Some more stuff.
[ipdf/documents.git] / LitReviewDavid.tex
1 \documentclass[a4paper,10pt]{article}
2 \usepackage[utf8]{inputenc}
3 \usepackage{hyperref}
4
5 %opening
6 \title{Literature Review}
7 \author{David Gow}
8
9 \begin{document}
10
11 \maketitle
12
13 \section{Introduction}
14
15 Since mankind first climbed down from the trees, it is our ability to communicate that has made us unique.
16 Once ideas could be passed from person to person, it made sense to have a permanent record of them; one which
17 could be passed on from person to person without them ever meeting.
18
19 And thus the document was born.
20
21 Traditionally, documents have been static: just marks on paper, but with the advent of computers many more possibilities open up.
22 Most existing document formats --- such as the venerable PostScript and PDF --- are, however, designed to imitate
23 existing paper documents, largely to allow for easy printing. In order to truly take advantage of the possibilities operating in the digital
24 domain opens up to us, we must look to new formats.
25
26 Formats such as \texttt{HTML} allow for a greater scope of interactivity and for a more data-driven model, allowing
27 the content of the document to be explored in ways that perhaps the author had not anticipated.\cite{hayes2012pixels}
28 However, these data-driven formats typically do not support fixed layouts, and the display differs from renderer to
29 renderer.
30
31 Existing document formats, due to being designed to model paper,
32 have limited precision (8 decimal digits for PostScript\cite{plrm}, 5 decimal digits for PDF\cite{pdfref17}).
33 This matches the limited resolution of printers and ink, but is limited when compared to what aught to be possible
34 with ``zoom'' functionality, which is prevent from working beyond a limited scale factor, lest artefacts appear due
35 to issues with numeric precision.
36
37 \section{Rendering}
38
39 Computer graphics comes in two forms: bit-mapped (or raster) graphics, which is defined by an array of pixel colours, 
40 and \emph{vector} graphics, defined by mathematical descriptions of objects. Bit-mapped graphics are well suited to photographs
41 and are match how cameras, printers and monitors work. However, bitmap devices do not handle zooming beyond their
42 ``native'' resolution --- the resolution where one document pixel maps to one display pixel ---, exhibiting an artefact
43 called pixelation where the pixel structure becomes evident. Attempts to use interpolation to hide this effect are
44 never entirely successful, and sharp edges, such as those found in text and diagrams, are particularly effected.
45
46 Vector graphics lack many of these problems: the representation is independent of the output resolution, and rather
47 an abstract description of what it is being rendered, typically as a combination of simple geometric shapes like lines,
48 arcs and ``B\'ezier curves''. 
49 As existing displays (and printers) are bit-mapped devices, vector documents must be \emph{rasterized} into a bitmap at
50 a given resolution. This bitmap is then displayed or printed. The resulting bitmap is then an approximation of the vector image
51 at that resolution.
52
53 This project will be based around vector graphics, as these properties make it more suited to experimenting with zoom
54 quality.
55
56
57 The rasterization process typically operates on an individual ``object'' or ``shape'' at a time: there are special algorithms
58 for rendering lines\cite{bresenham1965algorithm}, triangles\cite{giesen2013triangle}, polygons\cite{pineda1988parallel} and B\'ezier
59 Curves\cite{goldman_thefractal}. Typically, these are rasterized independently and composited in the bitmap domain using Porter-Duff
60 compositing\cite{porter1984compositing} into a single image. This allows complex images to be formed from many simple pieces, as well
61 as allowing for layered translucent objects, which would otherwise require the solution of some very complex constructive geometry problems.
62
63 \subsection{Compositing Digital Images\cite{porter1984compositing}}
64
65
66
67 Perter and Duff's classic paper "Compositing Digital Images" lays the
68 foundation for digital compositing today. By providing an "alpha channel,"
69 images of arbitrary shapes — and images with soft edges or sub-pixel coverage
70 information — can be overlayed digitally, allowing separate objects to be
71 rasterized separately without a loss in quality.
72
73 Pixels in digital images are usually represented as 3-tuples containing
74 (red component, green component, blue component). Nominally these values are in
75 the [0-1] range. In the Porter-Duff paper, pixels are stored as $(R,G,B,\alpha)$
76 4-tuples, where alpha is the fractional coverage of each pixel. If the image
77 only covers half of a given pixel, for example, its alpha value would be 0.5.
78
79 To improve compositing performance, albeit at a possible loss of precision in
80 some implementations, the red, green and blue channels are premultiplied by the
81 alpha channel. This also simplifies the resulting arithmetic by having the
82 colour channels and alpha channels use the same compositing equations.
83
84 Several binary compositing operations are defined:
85 \begin{itemize}
86 \item over
87 \item in
88 \item out
89 \item atop
90 \item xor
91 \item plus
92 \end{itemize}
93
94 The paper further provides some additional operations for implementing fades and
95 dissolves, as well as for changing the opacity of individual elements in a
96 scene.
97
98 The method outlined in this paper is still the standard system for compositing
99 and is implemented almost exactly by modern graphics APIs such as \texttt{OpenGL}. It is
100 all but guaranteed that this is the method we will be using for compositing
101 document elements in our project.
102
103 \subsection{Bresenham's Algorithm: Algorithm for computer control of a digital plotter\cite{bresenham1965algorithm}}
104 Bresenham's line drawing algorithm is a fast, high quality line rasterization
105 algorithm which is still the basis for most (aliased) line drawing today. The
106 paper, while originally written to describe how to control a particular plotter,
107 is uniquely suited to rasterizing lines for display on a pixel grid.
108
109 Lines drawn with Bresenham's algorithm must begin and end at integer pixel
110 coordinates, though one can round or truncate the fractional part. In order to
111 avoid multiplication or division in the algorithm's inner loop, 
112
113 The algorithm works by scanning along the long axis of the line, moving along
114 the short axis when the error along that axis exceeds 0.5px. Because error
115 accumulates linearly, this can be achieved by simply adding the per-pixel
116 error (equal to (short axis/long axis)) until it exceeds 0.5, then incrementing
117 the position along the short axis and subtracting 1 from the error accumulator.
118
119 As this requires nothing but addition, it is very fast, particularly on the
120 older CPUs used in Bresenham's time. Modern graphics systems will often use Wu's
121 line-drawing algorithm instead, as it produces antialiased lines, taking
122 sub-pixel coverage into account. Bresenham himself extended this algorithm to
123 produce Bresenham's circle algorithm. The principles behind the algorithm have
124 also been used to rasterize other shapes, including B\'{e}zier curves.
125
126 \emph{GPU Rendering}\cite{loop2005resolution}, OpenVG implementation on GLES: \cite{oh2007implementation},
127 \cite{robart2009openvg}
128
129 \emph{Existing implementations of document format rendering}
130
131 \subsection{Xr: Cross-device Rendering for Vector Graphics\cite{worth2003xr}}
132
133 Xr (now known as Cairo) is an implementation of the PDF v1.4 rendering model,
134 independent of the PDF or PostScript file formats, and is now widely used
135 as a rendering API. In this paper, Worth and Packard describe the PDF v1.4 rendering
136 model, and their PostScript-derived API for it.
137
138 The PDF v1.4 rendering model is based on the original PostScript model, based around
139 a set of \emph{paths} (and other objects, such as raster images) each made up of lines
140 and B\'{e}zier curves, which are transformed by the ``Current Transformation Matrix.''
141 Paths can be \emph{filled} in a number of ways, allowing for different handling of self-intersecting
142 paths, or can have their outlines \emph{stroked}.
143 Furthermore, paths can be painted with RGB colours and/or patterns derived from either
144 previously rendered objects or external raster images.
145 PDF v1.4 extends this to provide, amongst other features, support for layering paths and
146 objects using Porter-Duff compositing\cite{porter1984compositing}, giving each painted path
147 the option of having an $\alpha$ value and a choice of any of the Porter-Duff compositing
148 methods.
149
150 The Cairo library approximates the rendering of some objects (particularly curved objects
151 such as splines) with a set of polygons. An \texttt{XrSetTolerance} function allows the user
152 of the library to set an upper bound on the approximation error in fractions of device pixels,
153 providing a trade-off between rendering quality and performance. The library developers found
154 that setting the tolerance to greater than $0.1$ device pixels resulted in errors visible to the
155 user.
156
157 \subsection{Glitz: Hardware Accelerated Image Compositing using OpenGL\cite{nilsson2004glitz}}
158
159 This paper describes the implementation of an \texttt{OpenGL} based rendering backend for
160 the \texttt{Cairo} library. 
161
162 The paper describes how OpenGL's Porter-Duff compositing is easily suited to the Cairo/PDF v1.4
163 rendering model. Similarly, traditional OpenGL (pre-version 3.0 core) support a matrix stack
164 of the same form as Cairo.
165
166 The ``Glitz'' backend will emulate support for tiled, non-power-of-two patterns/textures if
167 the hardware does not support it.
168
169 Glitz can render both triangles and trapezoids (which are formed from pairs of triangles).
170 However, it cannot guarantee that the rasterization is pixel-precise, as OpenGL does not proveide
171 this consistently.
172
173 Glitz also supports multi-sample anti-aliasing, convolution filters for raster image reads (implemented
174 with shaders).
175
176 Performance was much improved over the software rasterization and over XRender accellerated rendering
177 on all except nVidia hardware. However, nVidia's XRender implementation did slow down significantly when
178 some transformations were applied.
179
180
181
182 \textbf{Also look at \texttt{NV\_path\_rendering}} \cite{kilgard2012gpu}
183
184 \section{Floating-Point Precision}
185
186 How floating-point works and what its behaviour is w/r/t range and precision
187 \cite{goldberg1991whatevery}
188 \cite{goldberg1992thedesign}
189
190 Arb. precision exists
191
192 Higher precision numeric types can be implemented or used on the GPU, but are
193 slow.
194 \cite{emmart2010high}
195
196
197
198 \section{Quadtrees}
199 The quadtree is a data structure which 
200 \cite{finkel1974quad}
201
202
203 \bibliographystyle{unsrt}
204 \bibliography{papers}
205
206 \end{document}

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