0d3abd5c1cc062b1fcf77ebd7ce421817848678c
[ipdf/documents.git] / LiteratureNotes.tex
1 \documentclass[8pt]{extarticle}
2 \usepackage{graphicx}
3 \usepackage{caption}
4 \usepackage{amsmath} % needed for math align
5 \usepackage{bm} % needed for maths bold face
6  \usepackage{graphicx}    % needed for including graphics e.g. EPS, PS
7 \usepackage{fancyhdr}   % needed for header
8
9 \usepackage{hyperref}
10
11  \topmargin -1.5cm        % read Lamport p.163
12  \oddsidemargin -0.04cm   % read Lamport p.163
13  \evensidemargin -0.04cm  % same as oddsidemargin but for left-hand pages
14  \textwidth 16.59cm
15  \textheight 21.94cm 
16  %\pagestyle{empty}       % Uncomment if don't want page numbers
17  \parskip 8.2pt           % sets spacing between paragraphs
18  %\renewcommand{\baselinestretch}{1.5}  % Uncomment for 1.5 spacing between lines
19  \parindent 0pt           % sets leading space for paragraphs
20 \linespread{0.8}
21
22
23 \newcommand{\vect}[1]{\boldsymbol{#1}} % Draw a vector
24 \newcommand{\divg}[1]{\nabla \cdot #1} % divergence
25 \newcommand{\curl}[1]{\nabla \times #1} % curl
26 \newcommand{\grad}[1]{\nabla #1} %gradient
27 \newcommand{\pd}[3][ ]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} %partial derivative
28 %\newcommand{\d}[3][ ]{\frac{d^{#1} #2}{d #3^{#1}}} %full derivative
29 \newcommand{\phasor}[1]{\tilde{#1}} % make a phasor
30 \newcommand{\laplacian}[1]{\nabla^2 {#1}} % The laplacian operator
31
32 \usepackage{color}
33 \usepackage{listings}
34
35 \definecolor{darkgray}{rgb}{0.95,0.95,0.95}
36 \definecolor{darkred}{rgb}{0.75,0,0}
37 \definecolor{darkblue}{rgb}{0,0,0.75}
38 \definecolor{pink}{rgb}{1,0.5,0.5}
39 \lstset{language=Java}
40 \lstset{backgroundcolor=\color{darkgray}}
41 \lstset{numbers=left, numberstyle=\tiny, stepnumber=1, numbersep=5pt}
42 \lstset{keywordstyle=\color{darkred}\bfseries}
43 \lstset{commentstyle=\color{darkblue}}
44 %\lstset{stringsyle=\color{red}}
45 \lstset{showstringspaces=false}
46 \lstset{basicstyle=\small}
47
48
49
50
51
52 \begin{document}
53
54
55 \pagestyle{fancy}
56 \fancyhead{}
57 \fancyfoot{}
58
59 \fancyhead[LO, L]{}
60 \fancyfoot[CO, C]{\thepage}
61
62 \begin{center}
63         B.Eng. Final Year Project \par
64         {\bf \Large Literature Notes} \par
65         Sam Moore, David Gow \\
66         Faculty of Engineering, Computing and Mathematics, University of Western Australia \\
67         March 2014
68 \end{center}
69
70 \tableofcontents
71
72 \section{Postscript Language Reference Manual\cite{plrm}}
73
74 Adobe's official reference manual for PostScript.
75
76 It is big.
77
78 \section{Portable Document Format Reference Manual\cite{pdfref17}}
79
80 Adobe's official reference for PDF.
81
82 It is also big.
83
84 \pagebreak
85
86 \section{Portable Document Format (PDF) --- Finally...\cite{cheng2002portable}}
87
88 This is not spectacularly useful, is basically an advertisement for Adobe software.
89
90 {\bf Intro}
91 \begin{itemize}
92         \item Visual communications has been revolutionised by computing
93         \item BUT there have always been problems in exchanging formats
94         \item Filetypes like text, rich text, IGES, DXF, TIFF, JPEG, GIFF solve problems for particular types of files only
95         \item PDF solves everything for everyone; can include text, images, animation, sound, etc
96 \end{itemize}
97 {\bf PDF Features}
98 \begin{itemize}
99         \item Raster Image Process (RIP) --- For printing (presumably also displaying on screen)
100         \item Originally needed to convert to PS then RIP, with PS 3 can now RIP directly.
101         \item Reduced filesize due to compression
102         \item Four major applications - Stoy 1999\cite{stoy1999}
103                 \begin{enumerate}
104                         \item Download files from internet
105                         \item Files on CDs
106                         \item Files for outputing to printers
107                         \item Conventional [commercial scale?] printing
108                 \end{enumerate}
109         \item List of various (Adobe) PDF related software
110         \begin{itemize}
111                 \item Includes software for PS that converts to/from PDF 
112                 \item So PS was obviously pretty popular before PDF
113         \end{itemize}
114         \item Can Optimize for screen/printer [not clear how]
115         \item Can compress for size
116 \end{itemize}
117
118 \pagebreak
119 \section{Pixels or Perish \cite{hayes2012pixels}}
120
121 ``The art of scientific illustration will have to adapt to the new age of online publishing''
122 And therefore, JavaScript libraries ($\text{D}^3$) are the future.
123
124 The point is that we need to change from thinking about documents as paper to thinking of them as pixels.
125 This kind of makes it related to our paper, because it is the same way we are justifying our project. It does mention precision, but doesn't say we need to get more of it.
126
127 I get the feeling from this that Web based documents are a whole bunch of completely different design philosophies hacked together
128 with JavaScript.
129
130 This paper uses Metaphors a lot. I never met a phor that didn't over extend itself.
131
132
133 {\bf Intro}
134 \begin{itemize}
135         \item Drawings/Pictures are ornaments in science but they are not just ornamental
136         \item Processes have changed a lot; eg: photographic plates $\to$ digital images
137         \item ``we are about to turn the page --- if not close the book --- on yet another chapter in publishing history.'' (HO HO HO)
138         \item It would be cool to have animated figures in documents (eg: Population pyramid; changes with time); not just as ``supplements''
139         \item In the beginning, there was PostScript, 1970s and 1980s, John Warnock and Charles Geschke, Adobe Systems
140         \item PS is a language for vector graphics; objects are constructed from geometric primitives rather than a discrete array of pixels
141         \item PS is a complete programming language; an image is also a program; can exploit this to control how images are created based on data (eg: Faces)
142         \item PDF is ``flattened'' PS. No longer programable. Aspires to be ``virtual paper''.
143         \item But why are we using such powerful computing machines just to emulate sheets paper? (the author asks)
144 \end{itemize}
145
146 {\bf Web based Documents}
147 \begin{itemize}
148         \item HTML, CSS, JavaScript - The Axis of Web Documents
149         \begin{itemize}
150                 \item HTML - Defines document structure
151                 \item CSS - Defines presentation of elements in document
152                 \item JavaScript - Encodes actions, allows dynamic content (change the HTML/CSS)
153         \end{itemize}
154         \item \texttt{<canvas>} will let you draw anything (So in principle don't even need all of HTML/CSS)
155         \begin{itemize}
156                 \item Not device independent
157                 \item ``Coordinates can be specified with precision finer than pixel resolution'' {\bf (TODO: Investigate this?)}
158                 \item JavaScript operators to draw things on canvas are very similar to the PostScript model
159         \end{itemize}
160         \item SVG --- Same structure (Document Object Model (DOM)) as HTML
161         \begin{itemize}
162                 \item ``Noun language''
163                 \item Nouns define lines/curves etc, rather than paragraphs/lists
164                 \item Also borrows things from PostScript (eg: line caps and joints)
165                 \item IS device independent, ``very high precision'' {\bf (TODO: Investigate)}
166                 \item JavaScript can be used to interact with SVG too
167         \end{itemize}
168         \item $\text{D}^{3}$ (Data Driven Documents) - A JavaScript library
169         \begin{itemize}
170                 \item Idea is to create or modify elements of a DOM document using supplied data
171                 \item \url{https://github.com/mbostock/d3/wiki}
172         \end{itemize}
173         \item We are in a new Golden Age of data visualisation
174         \item Why do we still use PDFs?
175         \begin{itemize}
176                 \item PDFs are ``owned'' by the author/reader; you download it, store it, you can print it, etc
177                 \item HTML documents are normally on websites. They are not self contained. They often rely on remote content from other websites (annoying to download the whole document).
178         \end{itemize}
179         \item {\bf Conclusion} Someone should open up PDF to accept things like $\text{D}^{3}$ and other graphics formats (links nicely with \cite{barnes2013embedding})
180         \item Also, Harry Potter reference
181
182 \end{itemize}
183
184 \section{Embedding and Publishing Interactive, 3D Figures in PDF Files\cite{barnes2013embedding}}
185
186 \begin{itemize}
187         \item Linkes well with \cite{hayes2012pixels}; I heard you liked figures so I put a figure in your PDF
188         \item Title pretty much summarises it; similar to \cite{hayes2012pixels} except these guys actually did something practical
189 \end{itemize}
190
191 \section{27 Bits are not enough for 8 digit accuracy\cite{goldberg1967twentyseven}}
192
193 Proves with maths, that rounding errors mean that you need at least $q$ bits for $p$ decimal digits. $10^p < 2^{q-1}$
194
195 \begin{itemize}
196         \item Eg: For 8 decimal digits, since $10^8 < 2^{27}$ would expect to be able to represent with 27 binary digits
197         \item But: Integer part requires digits bits (regardless of fixed or floating point represenetation)
198         \item Trade-off between precision and range
199         \begin{itemize}
200                 \item 9000000.0 $\to$ 9999999.9 needs 24 digits for the integer part $2^{23} = 83886008$
201         \end{itemize}
202         \item Floating point zero = smallest possible machine exponent
203         \item Floating point representation:
204         \begin{align*}
205                 y &= 0.y_1 y_2 \text{...} y_q \times 2^{n}
206         \end{align*}
207         \item Can eliminate a bit by considering whether $n = -e$ for $-e$ the smallest machine exponent (???)
208         \begin{itemize}
209                 \item Get very small numbers with the same precision    
210                 \item Get large numbers with the extra bit of precision
211         \end{itemize}
212 \end{itemize}
213
214 \section{What every computer scientist should know about floating-point arithmetic\cite{goldberg1991whatevery}}
215
216 \begin{itemize}
217         \item Book: \emph{Floating Point Computation} by Pat Sterbenz (out of print... in 1991)
218     \item IEEE floating point standard becoming popular (introduced in 1987, this is 1991)
219     \begin{itemize}
220                 \item As well as structure, defines the algorithms for addition, multiplication, division and square root
221                 \item Makes things portable because results of operations are the same on all machines (following the standard)
222                 \item Alternatives to floating point: Floating slasi and Signed Logarithm (TODO: Look at these, although they will probably not be useful)
223
224         \end{itemize}
225         \item Base $\beta$ and precision $p$ (number of digits to represent with) - powers of the base can be represented exactly.
226         \item Largest and smallest exponents $e_{min}$ and $e_{max}$
227         \item Need bits for exponent and fraction, plus one for sign
228         \item ``Floating point number'' is one that can be represented exactly.
229         \item Representations are not unique! $0.01 \times 10^1 = 1.00 \times 10^{-1}$ Leading digit of one $\implies$ ``normalised''
230         \item Requiring the representation to be normalised makes it unique, {\bf but means it is impossible to represent zero}.
231         \begin{itemize}
232                 \item Represent zero as $1 \times \beta^{e_{min}-1}$ - requires extra bit in the exponent
233         \end{itemize}
234         \item {\bf Rounding Error}
235         \begin{itemize}
236                 \item ``Units in the last place'' eg: 0.0314159 compared to 0.0314 has ulp error of 0.159
237                 \item If calculation is the nearest floating point number to the result, it will still be as much as 1/2 ulp in error
238                 \item Relative error corresponding to 1/2 ulp can vary by a factor of $\beta$ ``wobble''. Written in terms of $\epsilon$
239                 \item Maths $\implies$ {\bf Relative error is always bounded by $\epsilon = (\beta/2)\beta^{-p}$}
240                 \item Fixed relative error $\implies$ ulp can vary by a factor of $\beta$ . Vice versa
241                 \item Larger $\beta \implies$ larger errors
242         \end{itemize}
243         \item {\bf Guard Digits}
244         \begin{itemize}
245                 \item In subtraction: Could compute exact difference and then round; this is expensive
246                 \item Keep fixed number of digits but shift operand right; discard precision. Lead to relative error up to $\beta - 1$
247                 \item Guard digit: Add extra digits before truncating. Leads to relative error of less than $2\epsilon$. This also applies to addition
248         \end{itemize}
249         \item {\bf Catastrophic Cancellation} - Operands are subject to rounding errors - multiplication
250         \item {\bf Benign Cancellation} - Subtractions. Error $< 2\epsilon$
251         \item Rearrange formula to avoid catastrophic cancellation
252         \item Historical interest only - speculation on why IBM used $\beta = 16$ for the system/370 - increased range? Avoids shifting
253         \item Precision: IEEE defines extended precision (a lower bound only)
254         \item Discussion of the IEEE standard for operations (TODO: Go over in more detail)
255         \item NaN allow continuing with underflow and Infinity with overflow
256         \item ``Incidentally, some people think that the solution to such anomalies is never to compare floating-point numbers for equality but instead to consider them equal if they are within some error bound E. This is hardly a cure all, because it raises as many questions as it answers.'' - On equality of floating point numbers
257
258 \end{itemize}
259
260
261 %%%%
262 % David's Stuff
263 %%%%
264 \section{Compositing Digital Images\cite{porter1984compositing}}
265
266
267
268 Perter and Duff's classic paper "Compositing Digital Images" lays the
269 foundation for digital compositing today. By providing an "alpha channel,"
270 images of arbitrary shapes — and images with soft edges or sub-pixel coverage
271 information — can be overlayed digitally, allowing separate objects to be
272 rasterized separately without a loss in quality.
273
274 Pixels in digital images are usually represented as 3-tuples containing
275 (red component, green component, blue component). Nominally these values are in
276 the [0-1] range. In the Porter-Duff paper, pixels are stored as $(R,G,B,\alpha)$
277 4-tuples, where alpha is the fractional coverage of each pixel. If the image
278 only covers half of a given pixel, for example, its alpha value would be 0.5.
279
280 To improve compositing performance, albeit at a possible loss of precision in
281 some implementations, the red, green and blue channels are premultiplied by the
282 alpha channel. This also simplifies the resulting arithmetic by having the
283 colour channels and alpha channels use the same compositing equations.
284
285 Several binary compositing operations are defined:
286 \begin{itemize}
287 \item over
288 \item in
289 \item out
290 \item atop
291 \item xor
292 \item plus
293 \end{itemize}
294
295 The paper further provides some additional operations for implementing fades and
296 dissolves, as well as for changing the opacity of individual elements in a
297 scene.
298
299 The method outlined in this paper is still the standard system for compositing
300 and is implemented almost exactly by modern graphics APIs such as \texttt{OpenGL}. It is
301 all but guaranteed that this is the method we will be using for compositing
302 document elements in our project.
303
304 \section{Bresenham's Algorithm: Algorithm for computer control of a digital plotter\cite{bresenham1965algorithm}}
305 Bresenham's line drawing algorithm is a fast, high quality line rasterization
306 algorithm which is still the basis for most (aliased) line drawing today. The
307 paper, while originally written to describe how to control a particular plotter,
308 is uniquely suited to rasterizing lines for display on a pixel grid.
309
310 Lines drawn with Bresenham's algorithm must begin and end at integer pixel
311 coordinates, though one can round or truncate the fractional part. In order to
312 avoid multiplication or division in the algorithm's inner loop, 
313
314 The algorithm works by scanning along the long axis of the line, moving along
315 the short axis when the error along that axis exceeds 0.5px. Because error
316 accumulates linearly, this can be achieved by simply adding the per-pixel
317 error (equal to (short axis/long axis)) until it exceeds 0.5, then incrementing
318 the position along the short axis and subtracting 1 from the error accumulator.
319
320 As this requires nothing but addition, it is very fast, particularly on the
321 older CPUs used in Bresenham's time. Modern graphics systems will often use Wu's
322 line-drawing algorithm instead, as it produces antialiased lines, taking
323 sub-pixel coverage into account. Bresenham himself extended this algorithm to
324 produce Bresenham's circle algorithm. The principles behind the algorithm have
325 also been used to rasterize other shapes, including B\'{e}zier curves.
326
327 \section{Quad Trees: A Data Structure for Retrieval on Composite Keys\cite{finkel1974quad}}
328
329 This paper introduces the ``quadtree'' spatial data structure. The quadtree structure is
330 a search tree in which every node has four children representing the north-east, north-west,
331 south-east and south-west quadrants of its space.
332
333 \section{Xr: Cross-device Rendering for Vector Graphics\cite{worth2003xr}}
334
335 Xr (now known as Cairo) is an implementation of the PDF v1.4 rendering model,
336 independent of the PDF or PostScript file formats, and is now widely used
337 as a rendering API. In this paper, Worth and Packard describe the PDF v1.4 rendering
338 model, and their PostScript-derived API for it.
339
340 The PDF v1.4 rendering model is based on the original PostScript model, based around
341 a set of \emph{paths} (and other objects, such as raster images) each made up of lines
342 and B\'{e}zier curves, which are transformed by the ``Current Transformation Matrix.''
343 Paths can be \emph{filled} in a number of ways, allowing for different handling of self-intersecting
344 paths, or can have their outlines \emph{stroked}.
345 Furthermore, paths can be painted with RGB colours and/or patterns derived from either
346 previously rendered objects or external raster images.
347 PDF v1.4 extends this to provide, amongst other features, support for layering paths and
348 objects using Porter-Duff compositing\cite{porter1984compositing}, giving each painted path
349 the option of having an $\alpha$ value and a choice of any of the Porter-Duff compositing
350 methods.
351
352 The Cairo library approximates the rendering of some objects (particularly curved objects
353 such as splines) with a set of polygons. An \texttt{XrSetTolerance} function allows the user
354 of the library to set an upper bound on the approximation error in fractions of device pixels,
355 providing a trade-off between rendering quality and performance. The library developers found
356 that setting the tolerance to greater than $0.1$ device pixels resulted in errors visible to the
357 user.
358
359 \section{Glitz: Hardware Accelerated Image Compositing using OpenGL\cite{nilsson2004glitz}}
360
361 This paper describes the implementation of an \texttt{OpenGL} based rendering backend for
362 the \texttt{Cairo} library. 
363
364 The paper describes how OpenGL's Porter-Duff compositing is easily suited to the Cairo/PDF v1.4
365 rendering model. Similarly, traditional OpenGL (pre-version 3.0 core) support a matrix stack
366 of the same form as Cairo.
367
368 The ``Glitz'' backend will emulate support for tiled, non-power-of-two patterns/textures if
369 the hardware does not support it.
370
371 Glitz can render both triangles and trapezoids (which are formed from pairs of triangles).
372 However, it cannot guarantee that the rasterization is pixel-precise, as OpenGL does not proveide
373 this consistently.
374
375 Glitz also supports multi-sample anti-aliasing, convolution filters for raster image reads (implemented
376 with shaders).
377
378 Performance was much improved over the software rasterization and over XRender accellerated rendering
379 on all except nVidia hardware. However, nVidia's XRender implementation did slow down significantly when
380 some transformations were applied.
381
382 %% Sam again
383
384 \section{Boost Multiprecision Library\cite{boost_multiprecision}}
385
386 \begin{itemize}
387         \item ``The Multiprecision Library provides integer, rational and floating-point types in C++ that have more range and precision than C++'s ordinary built-in types.''
388         \item Specify number of digits for precision as a template argument.
389         \item Precision is fixed... {\bf possible approach to project:} Use \verb/boost::mpf_float<N>/ and increase \verb/N/ as more precision is required?
390 \end{itemize}
391
392
393 % Some hardware related sounding stuff...
394
395 \section{A CMOS Floating Point Unit\cite{kelley1997acmos}}
396
397 The paper describes the implentation of a FPU for PowerPC using a particular Hewlett Packard process (HP14B 0.5$\mu$m, 3M, 3.3V).
398 It implements a ``subset of the most commonly used double precision floating point instructions''. The unimplemented operations are compiled for the CPU.
399
400 The paper gives a description of the architecture and design methods.
401 This appears to be an entry to a student design competition.
402
403 Standard is IEEE 754, but the multiplier tree is a 64-bit tree instead of a 54 bit tree.
404 `` The primary reason for implementing a larger tree is for future additions of SIMD [Single Instruction Multiple Data (?)] instructions similar to Intel's MMX and Sun's VIS instructions''.
405
406 HSPICE simulations used to determine transistor sizing.
407
408 Paper has a block diagram that sort of vaguely makes sense to me.
409 The rest requires more background knowledge.
410
411 \section{Simply FPU\cite{filiatreault2003simply}}
412
413 This is a webpage at one degree of seperation from wikipedia.
414
415 It talks about FPU internals, but mostly focuses on the instruction sets.
416 It includes FPU assembly code examples (!)
417
418 It is probably not that useful, I don't think we'll end up writing FPU assembly?
419
420 FPU's typically have 80 bit registers so they can support REAL4, REAL8 and REAL10 (single, double, extended precision).
421
422
423 \section{Floating Point Package User's Guide\cite{bishop2008floating}}
424
425 This is a technical report describing floating point VHDL packages \url{http://www.vhdl.org/fphdl/vhdl.html}
426
427 In theory I know VHDL (cough) so I am interested in looking at this further to see how FPU hardware works.
428 It might be getting a bit sidetracked from the ``document formats'' scope though.
429
430 The report does talk briefly about the IEEE standard and normalised / denormalised numbers as well.
431
432 See also: Java Optimized Processor\cite{jop} (it has a VHDL implementation of a FPU).
433
434 \section{Low-Cost Microarchitectural Support for Improved Floating-Point Accuracy\cite{dieter2007lowcost}}
435
436 Mentions how GPUs offer very good floating point performance but only for single precision floats.
437
438 Has a diagram of a Floating Point adder.
439
440 Talks about some magical technique called "Native-pair Arithmetic" that somehow makes 32-bit floating point accuracy ``competitive'' with 64-bit floating point numbers.
441
442 \section{Accurate Floating Point Arithmetic through Hardware Error-Free Transformations\cite{kadric2013accurate}}
443
444 From the abstract: ``This paper presents a hardware approach to performing ac-
445 curate floating point addition and multiplication using the idea of error-
446 free transformations. Specialized iterative algorithms are implemented
447 for computing arbitrarily accurate sums and dot products.''
448
449 The references for this look useful.
450
451 It also mentions VHDL.
452
453 So whenever hardware papers come up, VHDL gets involved...
454 I guess it's time to try and work out how to use the Opensource VHDL implementations.
455
456 This is about reduction of error in hardware operations rather than the precision or range of floats.
457 But it is probably still relevant.
458
459 \section{Floating Point Unit from JOP\cite{jop}}
460
461 This is a 32 bit floating point unit developed for JOP in VHDL.
462 I have been able to successfully compile it and the test program using GHDL\cite{ghdl}. 
463
464 % Back to software
465 \section{Basic Issues in Floating Point Arithmetic and Error Analysis\cite{demmel1996basic}}
466
467 These are lecture notes from U.C Berkelye CS267 in 1996.
468
469
470 \pagebreak
471 \bibliographystyle{unsrt}
472 \bibliography{papers}
473
474 \end{document}
475

UCC git Repository :: git.ucc.asn.au