Fall 2019: Week 3 Exercise Questions

Total Page:16

File Type:pdf, Size:1020Kb

Fall 2019: Week 3 Exercise Questions ECE326 – Fall 2019: Week 3 Exercise Questions 1. True or False [1 mark each] Circle T is true, otherwise circle F for false. 1. Overloading virtual functions in C++ is an example of multiple dispatch. T F Function overloading in C++ is done statically (static dispatch), at compile time. 2. You can declare an opaque data type on the stack. T F No. You must know the size of a data type to be able to declare it on the stack, but an opaque data type is not defined, making it impossible to calculate its size. 3. Pure virtual functions are not necessarily pure functions. T F Pure virtual functions can still have side effects such as modifying global variables, which makes it not always a pure function. 4. A virtual function overloading an operator is an example of dynamic dispatch. T F Yes, for example, virtual int operator+(int val) const; 5. Dynamically-typed interpreted language cannot implement early binding. T F Only compiled languages can legitimately implement early binding (name to address translation) 2. Short Answers 1. Override the eat method in Animal so that the eat method in Dog will, in addition to what Animal.eat already does, print “Wags its tail” at the very end. Show the entire class definition for Dog. [3 marks] class Animal: … # may change this function in the future def eat(self, food): # a mistake was fixed (self added) print(str(food) + “ is delicious”) class Dog(Animal): def eat(self, food): super().eat(food) # or Animal.eat(self, food) print("Wags its tail") 2. Write an expression with equivalent result as the following list comprehension, using only the map and filter function for control flow. [2 marks] [ str(v) for v in range(10, 100) if not (v//10+v%10)%7 ] def cond(v): return not (v//10+v%10)%7 b = list(map(str, filter(cond, range(10, 100)))) 3. Prototype-based Programming [10 marks] In Prototype-based programming, all objects have the type Object. The base object initially has no attribute. We wish to program with this paradigm in Python. Create a Person object out of the base object, followed by inheriting from the Person object to create a Student object. Finally, make an instance of Student. A Person object should have the data attributes: name, age, and gender, with a method called birthday() that increments age. A Student object should have the data attributes: id, gpa, and year. Create an instance of Student named “me” with your credential (can be fake). Choose suitable defaults for the prototypes. class Object: pass base = Object() import copy student.id = 0 person = copy.deepycopy(base) student.gpa = 0 person.name = “” student.year = 1900 person.age = 26 me = copy.deepcopy(student) person.gender = “unknown” me.name = “jack” def bday(self): me.gender = “male” self.age += 1 me.id = 123456789 Object.birthday = bday me.gpa = 3 student = me.year = 2015 copy.deepycopy(person) 4. Virtual Tables [10 marks] a. For the following inheritance hierarchy, draw a virtual table for each class and draw an arrow from each entry in the virtual table to their definition in the C++ classes. [7 marks] A::vtable struct A { virtual void foo() { cout << “A.foo”; } A::foo virtual void bar() { cout << “A.bar”; } void baz() { cout << “A.baz”; } A::bar }; B::vtable struct B : public A { A::foo virtual void bar() { cout << “B.bar”; } B::bar }; C::vtable struct C : public B { C::foo virtual void foo() { cout << “C.foo”; } B::bar void baz() { cout << “C.baz”; } }; D::vtable struct D : public A { D::foo virtual void foo() { cout << “D.foo”; } A::bar void baz() { cout << “D.baz”; } }; b. What is the output of the following program? [3 marks] D d = D(); C c = C(); A * ad = &d; A * ac = &c; ac->baz(); ad->foo(); ac->bar(); A.baz D.foo B.bar ECE326 – Fall 2019: Week 4 Exercise Questions 1. True or False [1 mark each] Circle T is true, otherwise circle F for false. 1. With C3 Linearization, Python completely solves the diamond problem. T F 2. 0x8888FEDC is a 4-byte aligned address. T F 3. Suppose class A is inherited by class B, and C, monotonicity guarantees that A will behave the same for both B and C. T F 4. Adding a new pure virtual function to a base class with many existing derived classes is an example of a fragile base class problem. T F 5. The main difference between delegation and type embedding is that with type embedding, you can no longer reference the embedded member by name. T F 2. Multiple Answers [2 marks each] Pick all answer(s) that are correct. You will lose 1 mark per wrong choice, down to 0 marks. 1. Which of the following are true about mixins? (a) It requires subclass to complete its implementation. Not Necessarily. (b) It can contain both member variables and functions. (c) It is used as a super type to the derived class. (d) Using it requires method forwarding. Only composition requires forwarding. (e) The order in which mixins are composed may change behaviour of the subclass. 2. Java only supports single inheritance with runtime polymorphism. Which of the following is true? (a) Java does not support mixins. Mixin requires multiple inheritance. (b) Java does not need virtual tables. Still required to implement dynamic dispatch. (c) Casting pointers (internally, Java does not expose pointers to programmers) in Java will never require point offsetting. (d) Java does not need to deal with inheritance-related ambiguity. (e) Java does not have method resolution order. Only late binding languages require MRO. 3. Virtual Base Class in C++ [10 marks] Draw the data layout of class X (include padding assuming 8-byte alignment, and write down the size of each sub-structure) and all the virtual tables generated for class X and its ancestors. struct B { int b1; int b2; virtual void foo() { cout << “A.foo”; } virtual ~A() {} }; struct P : virtual public B { long p1; virtual void foo() override { cout << “P.foo”; } }; struct Q : public P { int q1; }; struct N : virtual public B { char n1[30]; }; struct X : public N, public Q { int x1; virtual void foo() override { cout << “X.foo”; } }; struct X B::b2 : int B::b1 : int 16 bytes B::__vptr X::x1 : int 4 bytes Q::q1 : int 4 bytes P::p1 : long 16 bytes P::__vptr padding: 2 bytes 40 bytes N::n1 : char[30] N::__vptr X::N::vtable virtual base offset: 64 offset to “bottom”: 0 typeinfo = typeinfo(X) X::foo X::~X() X::B::vtable X::P::vtable virtual base offset: 0 virtual base offset: 24 offset to “bottom”: 64 offset to “bottom”: 40 typeinfo = typeinfo(X) typeinfo = typeinfo(X) X::foo X::foo X::~X() X::~X() 4. Method Resolution Order [10 marks] a. For the following inheritance hierarchy in Python, draw a diagram of the hierarchy. [2 marks] class A: pass class B: pass class C: pass class D: pass class E: pass class P(A, B, C): pass class Q(D, B, E): pass class R(D, A): pass class X(P, R, Q): pass b. What is the C3 Linearization of X? [8 marks] L[A] = (A, o) L[B] = (B, o) L[C] = (C, o) L[D] = (D, o) L[E] = (E, o) L[P] = (P, A, B, C, o) L[Q] = (Q, D, B, E, o) L[R] = (R, D, A, o) L[X] = (X, merge((P, A, B, C, o), (R, D, A, o), (Q, D, B, E, o), (P, R, Q))) = (X, P, merge((A, B, C, o), (R, D, A, o), (Q, D, B, E, o), (R, Q))) = (X, P, R, merge((A, B, C, o), (D, A, o), (Q, D, B, E, o), (Q))) = (X, P, R, Q, merge((A, B, C, o), (D, A, o), (D, B, E, o))) # A bad head, in tail of 2nd list = (X, P, R, Q, D, merge((A, B, C, o), (A, o), (B, E, o))) = (X, P, R, Q, D, A, merge((B, C, o), (o), (B, E, o))) = (X, P, R, Q, D, A, B, merge((C, o), (o), (E, o))) = (X, P, R, Q, D, A, B, C, E, o) ECE326 – Fall 2019: Week 5 Exercise Questions 1. True or False [1 mark each] Circle T is true, otherwise circle F for false. 1. Generic programming is a subset of metaprogramming. T F Neither is a subset of each other, but they do have overlaps. 2. If no deep copy is required (e.g. class has no pointer), move semantics performs no better than copy semantics. T F 3. If template specialization is not used (i.e. not instantiated), its code is not generated for the final executable. T F 4. For template T foo(), you can write int a = foo() to instantiate the function template foo with an int parameter . T F Have to write foo<int>() because C++ does not do type inference based on return type. 5. The new operator in C++ couples heap allocation and constructor invocation. T F 2. Short Answers 1. Use container_of to return a pointer to the parent object of member field base. [2 marks] struct base { int x, y, z; }; struct derived { int a; struct base b; char c[10]; }; struct derived * get_derived(struct base * ptr) { return container_of(ptr, struct derived, b); } 2. Implement binary search algorithm using a function template, assume the array is sorted and return -1 upon not found. [5 marks] template<typename T> /* find index of val in array of size n */ int binary_search(const T & val, T * array, int n) { int top = n-1; int bot = 0; while (bot <= top) { int mid = (top + bot)/2; if (array[mid] == val) return mid; else if (array[mid] < val) bot = mid+1; else top = mid-1; } return -1; } 3.
Recommended publications
  • JHDF5 (HDF5 for Java) 19.04
    JHDF5 (HDF5 for Java) 19.04 Introduction HDF5 is an efficient, well-documented, non-proprietary binary data format and library developed and maintained by the HDF Group. The library provided by the HDF Group is written in C and available under a liberal BSD-style Open Source software license. It has over 600 API calls and is very powerful and configurable, but it is not trivial to use. SIS (formerly CISD) has developed an easy-to-use high-level API for HDF5 written in Java and available under the Apache License 2.0 called JHDF5. The API works on top of the low-level API provided by the HDF Group and the files created with the SIS API are fully compatible with HDF5 1.6/1.8/1.10 (as you choose). Table of Content Introduction ................................................................................................................................ 1 Table of Content ...................................................................................................................... 1 Simple Use Case .......................................................................................................................... 2 Overview of the library ............................................................................................................... 2 Numeric Data Types .................................................................................................................... 3 Compound Data Types ................................................................................................................ 4 System
    [Show full text]
  • Cyclone: a Type-Safe Dialect of C∗
    Cyclone: A Type-Safe Dialect of C∗ Dan Grossman Michael Hicks Trevor Jim Greg Morrisett If any bug has achieved celebrity status, it is the • In C, an array of structs will be laid out contigu- buffer overflow. It made front-page news as early ously in memory, which is good for cache locality. as 1987, as the enabler of the Morris worm, the first In Java, the decision of how to lay out an array worm to spread through the Internet. In recent years, of objects is made by the compiler, and probably attacks exploiting buffer overflows have become more has indirections. frequent, and more virulent. This year, for exam- ple, the Witty worm was released to the wild less • C has data types that match hardware data than 48 hours after a buffer overflow vulnerability types and operations. Java abstracts from the was publicly announced; in 45 minutes, it infected hardware (“write once, run anywhere”). the entire world-wide population of 12,000 machines running the vulnerable programs. • C has manual memory management, whereas Notably, buffer overflows are a problem only for the Java has garbage collection. Garbage collec- C and C++ languages—Java and other “safe” lan- tion is safe and convenient, but places little con- guages have built-in protection against them. More- trol over performance in the hands of the pro- over, buffer overflows appear in C programs written grammer, and indeed encourages an allocation- by expert programmers who are security concious— intensive style. programs such as OpenSSH, Kerberos, and the com- In short, C programmers can see the costs of their mercial intrusion detection programs that were the programs simply by looking at them, and they can target of Witty.
    [Show full text]
  • REFPERSYS High-Level Goals and Design Ideas*
    REFPERSYS high-level goals and design ideas* Basile STARYNKEVITCH† Abhishek CHAKRAVARTI‡ Nimesh NEEMA§ refpersys.org October 2019 - May 2021 Abstract REFPERSYS is a REFlexive and orthogonally PERsistent SYStem (as a GPLv3+ licensed free software1) running on Linux; it is a hobby2 but serious research project for many years, mostly aimed to experiment open science ideas close to Artificial General Intelligence3 dreams, and we don’t expect use- ful or interesting results before several years of hard work. audience : LINUX free software developers4 and computer scientists interested in an experimental open science approach to reflexive systems, orthogonal persistence, symbolic artificial intelligence, knowledge engines, etc.... Nota Bene: this report contains many hyperlinks to relevant sources so its PDF should rather be read on a computer screen, e.g. with evince. Since it describes a circular design (with many cycles [Hofstadter:1979:GEB]), we recommend to read it twice (skipping footnotes and references on the first read). This entire document is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. *This document has git commit fb17387fbbb7e200, was Lua-LATEX generated on 2021-May-17 18:55 MEST, see gitlab.com/bstarynk/refpersys/ and its doc/design-ideas subdirectory. Its draft is downloadable, as a PDF file, from starynkevitch.net/Basile/refpersys-design.pdf ... †See starynkevitch.net/Basile/ and contact [email protected], 92340 Bourg La Reine (near Paris), France. ‡[email protected], FL 3C, 62B PGH Shah Road, Kolkata 700032, India.
    [Show full text]
  • Spindle Documentation Release 2.0.0
    spindle Documentation Release 2.0.0 Jorge Ortiz, Jason Liszka June 08, 2016 Contents 1 Thrift 3 1.1 Data model................................................3 1.2 Interface definition language (IDL)...................................4 1.3 Serialization formats...........................................4 2 Records 5 2.1 Creating a record.............................................5 2.2 Reading/writing records.........................................6 2.3 Record interface methods........................................6 2.4 Other methods..............................................7 2.5 Mutable trait...............................................7 2.6 Raw class.................................................7 2.7 Priming..................................................7 2.8 Proxies..................................................8 2.9 Reflection.................................................8 2.10 Field descriptors.............................................8 3 Custom types 9 3.1 Enhanced types..............................................9 3.2 Bitfields..................................................9 3.3 Type-safe IDs............................................... 10 4 Enums 13 4.1 Enum value methods........................................... 13 4.2 Companion object methods....................................... 13 4.3 Matching and unknown values...................................... 14 4.4 Serializing to string............................................ 14 4.5 Examples................................................. 14 5 Working
    [Show full text]
  • Union Types for Semistructured Data
    Edinburgh Research Explorer Union Types for Semistructured Data Citation for published version: Buneman, P & Pierce, B 1999, Union Types for Semistructured Data. in Union Types for Semistructured Data: 7th International Workshop on Database Programming Languages, DBPL’99 Kinloch Rannoch, UK, September 1–3,1999 Revised Papers. Lecture Notes in Computer Science, vol. 1949, Springer-Verlag GmbH, pp. 184-207. https://doi.org/10.1007/3-540-44543-9_12 Digital Object Identifier (DOI): 10.1007/3-540-44543-9_12 Link: Link to publication record in Edinburgh Research Explorer Document Version: Peer reviewed version Published In: Union Types for Semistructured Data General rights Copyright for the publications made accessible via the Edinburgh Research Explorer is retained by the author(s) and / or other copyright owners and it is a condition of accessing these publications that users recognise and abide by the legal requirements associated with these rights. Take down policy The University of Edinburgh has made every reasonable effort to ensure that Edinburgh Research Explorer content complies with UK legislation. If you believe that the public display of this file breaches copyright please contact [email protected] providing details, and we will remove access to the work immediately and investigate your claim. Download date: 27. Sep. 2021 Union Typ es for Semistructured Data Peter Buneman Benjamin Pierce University of Pennsylvania Dept of Computer Information Science South rd Street Philadelphia PA USA fpeterbcpiercegcisupenn edu Technical
    [Show full text]
  • A Proposal for a Standard Systemverilog Synthesis Subset
    A Proposal for a Standard Synthesizable Subset for SystemVerilog-2005: What the IEEE Failed to Define Stuart Sutherland Sutherland HDL, Inc., Portland, Oregon [email protected] Abstract frustrating disparity in commercial synthesis compilers. Each commercial synthesis product—HDL Compiler, SystemVerilog adds hundreds of extensions to the Encounter RTL Compiler, Precision, Blast and Synplify, to Verilog language. Some of these extensions are intended to name just a few—supports a different subset of represent hardware behavior, and are synthesizable. Other SystemVerilog. Design engineers must experiment and extensions are intended for testbench programming or determine for themselves what SystemVerilog constructs abstract system level modeling, and are not synthesizable. can safely be used for a specific design project and a The IEEE 1800-2005 SystemVerilog standard[1] defines specific mix of EDA tools. Valuable engineering time is the syntax and simulation semantics of these extensions, lost because of the lack of a standard synthesizable subset but does not define which constructs are synthesizable, or definition for SystemVerilog. the synthesis rules and semantics. This paper proposes a standard synthesis subset for SystemVerilog. The paper This paper proposes a subset of the SystemVerilog design reflects discussions with several EDA companies, in order extensions that should be considered synthesizable using to accurately define a common synthesis subset that is current RTL synthesis compiler technology. At Sutherland portable across today’s commercial synthesis compilers. HDL, we use this SystemVerilog synthesis subset in the training and consulting services we provide. We have 1. Introduction worked closely with several EDA companies to ensure that this subset is portable across a variety of synthesis SystemVerilog extensions to the Verilog HDL address two compilers.
    [Show full text]
  • Sun 64-Bit Binary Alignment Proposal
    1 KMIP 64-bit Binary Alignment Proposal 2 3 To: OASIS KMIP Technical Committee 4 From: Matt Ball, Sun Microsystems, Inc. 5 Date: May 1, 2009 6 Version: 1 7 Purpose: To propose a change to the binary encoding such that each part is aligned to an 8-byte 8 boundary 9 10 Revision History 11 Version 1, 2009-05-01: Initial version 12 Introduction 13 The binary encoding as defined in the 1.0 version of the KMIP draft does not maintain alignment to 8-byte 14 boundaries within the message structure. This causes problems on hard-aligned processors, such as the 15 ARM, that are not able to easily access memory on addresses that are not aligned to 4 bytes. 16 Additionally, it reduces performance on modern 64-bit processors. For hard-aligned processors, when 17 unaligned memory contents are requested, either the compiler has to add extra instructions to perform 18 two aligned memory accesses and reassemble the data, or the processor has to take a „trap‟ (i.e., an 19 interrupt generated on unaligned memory accesses) to correctly assemble the memory contents. Either 20 of these options results in reduced performance. On soft-aligned processors, the hardware has to make 21 two memory accesses instead of one when the contents are not properly aligned. 22 This proposal suggests ways to improve the performance on hard-aligned processors by aligning all data 23 structures to 8-byte boundaries. 24 Summary of Proposed Changes 25 This proposal includes the following changes to the KMIP 0.98 draft submission to the OASIS KMIP TC: 26 Change the alignment of the KMIP binary encoding such that each part is aligned to an 8-byte 27 boundary.
    [Show full text]
  • Presentation on Ocaml Internals
    OCaml Internals Implementation of an ML descendant Theophile Ranquet Ecole Pour l’Informatique et les Techniques Avancées SRS 2014 [email protected] November 14, 2013 2 of 113 Table of Contents Variants and subtyping System F Variants Type oddities worth noting Polymorphic variants Cyclic types Subtyping Weak types Implementation details α ! β Compilers Functional programming Values Why functional programming ? Allocation and garbage Combinatory logic : SKI collection The Curry-Howard Compiling correspondence Type inference OCaml and recursion 3 of 113 Variants A tagged union (also called variant, disjoint union, sum type, or algebraic data type) holds a value which may be one of several types, but only one at a time. This is very similar to the logical disjunction, in intuitionistic logic (by the Curry-Howard correspondance). 4 of 113 Variants are very convenient to represent data structures, and implement algorithms on these : 1 d a t a t y p e tree= Leaf 2 | Node of(int ∗ t r e e ∗ t r e e) 3 4 Node(5, Node(1,Leaf,Leaf), Node(3, Leaf, Node(4, Leaf, Leaf))) 5 1 3 4 1 fun countNodes(Leaf)=0 2 | countNodes(Node(int,left,right)) = 3 1 + countNodes(left)+ countNodes(right) 5 of 113 1 t y p e basic_color= 2 | Black| Red| Green| Yellow 3 | Blue| Magenta| Cyan| White 4 t y p e weight= Regular| Bold 5 t y p e color= 6 | Basic of basic_color ∗ w e i g h t 7 | RGB of int ∗ i n t ∗ i n t 8 | Gray of int 9 1 l e t color_to_int= function 2 | Basic(basic_color,weight) −> 3 l e t base= match weight with Bold −> 8 | Regular −> 0 in 4 base+ basic_color_to_int basic_color 5 | RGB(r,g,b) −> 16 +b+g ∗ 6 +r ∗ 36 6 | Grayi −> 232 +i 7 6 of 113 The limit of variants Say we want to handle a color representation with an alpha channel, but just for color_to_int (this implies we do not want to redefine our color type, this would be a hassle elsewhere).
    [Show full text]
  • Making Classes Provable Through Contracts, Models and Frames
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by CiteSeerX DISS. ETH NO. 17610 Making classes provable through contracts, models and frames A dissertation submitted to the SWISS FEDERAL INSTITUTE OF TECHNOLOGY ZURICH (ETH Zurich)¨ for the degree of Doctor of Sciences presented by Bernd Schoeller Diplom-Informatiker, TU Berlin born April 5th, 1974 citizen of Federal Republic of Germany accepted on the recommendation of Prof. Dr. Bertrand Meyer, examiner Prof. Dr. Martin Odersky, co-examiner Prof. Dr. Jonathan S. Ostroff, co-examiner 2007 ABSTRACT Software correctness is a relation between code and a specification of the expected behavior of the software component. Without proper specifica- tions, correct software cannot be defined. The Design by Contract methodology is a way to tightly integrate spec- ifications into software development. It has proved to be a light-weight and at the same time powerful description technique that is accepted by software developers. In its more than 20 years of existence, it has demon- strated many uses: documentation, understanding object-oriented inheri- tance, runtime assertion checking, or fully automated testing. This thesis approaches the formal verification of contracted code. It conducts an analysis of Eiffel and how contracts are expressed in the lan- guage as it is now. It formalizes the programming language providing an operational semantics and a formal list of correctness conditions in terms of this operational semantics. It introduces the concept of axiomatic classes and provides a full library of axiomatic classes, called the mathematical model library to overcome prob- lems of contracts on unbounded data structures.
    [Show full text]
  • Multithreaded Programming Guide
    Multithreaded Programming Guide Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 816–5137–10 January 2005 Copyright 2005 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, and Solaris are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements.
    [Show full text]
  • IBM Informix Glossary
    IBM Informix Version 11.70 IBM Informix Glossary SC27-3531-00 IBM Informix Version 11.70 IBM Informix Glossary SC27-3531-00 Note Before using this information and the product it supports, read the information in “Notices” on page B-1. This document contains proprietary information of IBM. It is provided under a license agreement and is protected by copyright law. The information contained in this publication does not include any product warranties, and any statements provided in this manual should not be interpreted as such. When you send information to IBM, you grant IBM a nonexclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. © Copyright IBM Corporation 1996, 2010. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Glossary ..................................1-1 Numerics ....................................1-1 A......................................1-1 B ......................................1-3 C......................................1-4 D......................................1-8 E......................................1-13 F......................................1-15 G......................................1-16 H......................................1-17 I......................................1-17 J......................................1-19 K......................................1-19 L......................................1-19 M......................................1-21 N......................................1-22
    [Show full text]
  • High Dynamic Range Video
    High Dynamic Range Video Karol Myszkowski, Rafał Mantiuk, Grzegorz Krawczyk Contents 1 Introduction 5 1.1 Low vs. High Dynamic Range Imaging . 5 1.2 Device- and Scene-referred Image Representations . ...... 7 1.3 HDRRevolution ............................ 9 1.4 OrganizationoftheBook . 10 1.4.1 WhyHDRVideo? ....................... 11 1.4.2 ChapterOverview ....................... 12 2 Representation of an HDR Image 13 2.1 Light................................... 13 2.2 Color .................................. 15 2.3 DynamicRange............................. 18 3 HDR Image and Video Acquisition 21 3.1 Capture Techniques Capable of HDR . 21 3.1.1 Temporal Exposure Change . 22 3.1.2 Spatial Exposure Change . 23 3.1.3 MultipleSensorswithBeamSplitters . 24 3.1.4 SolidStateSensors . 24 3.2 Photometric Calibration of HDR Cameras . 25 3.2.1 Camera Response to Light . 25 3.2.2 Mathematical Framework for Response Estimation . 26 3.2.3 Procedure for Photometric Calibration . 29 3.2.4 Example Calibration of HDR Video Cameras . 30 3.2.5 Quality of Luminance Measurement . 33 3.2.6 Alternative Response Estimation Methods . 33 3.2.7 Discussion ........................... 34 4 HDR Image Quality 39 4.1 VisualMetricClassification. 39 4.2 A Visual Difference Predictor for HDR Images . 41 4.2.1 Implementation......................... 43 5 HDR Image, Video and Texture Compression 45 1 2 CONTENTS 5.1 HDR Pixel Formats and Color Spaces . 46 5.1.1 Minifloat: 16-bit Floating Point Numbers . 47 5.1.2 RGBE: Common Exponent . 47 5.1.3 LogLuv: Logarithmic encoding . 48 5.1.4 RGB Scale: low-complexity RGBE coding . 49 5.1.5 LogYuv: low-complexity LogLuv . 50 5.1.6 JND steps: Perceptually uniform encoding .
    [Show full text]