Graphics Reference
In-Depth Information
Exercise 17.2:
Suppose you needed to store images that contained many large
regions of constant color. Think of a lossless way to compress such images for
more compact storage.
Exercise 17.3:
Implement the checkerboard-selection lossy compression
scheme described in this chapter; try it on several images and describe the arti-
facts that you notice in the redisplayed images.
Exercise 17.4:
Our description of MIP maps was informal. Suppose that
M
is
a MIP map of some image,
I
. It's easy to label subparts of
M
:Welet
I
pq
be the
subimage that is
I
, shrunk by 2
p
in rows and by 2
q
in columns. Thus, the upper-left
corner of
M
, which is a copy of the original image, is
I
00
; the half-as-wide image
to its right is
I
01
; the half-as-tall image below
I
00
is
I
10
, etc. If you consider the
subimage of
I
consisting of all parts
I
pq
where
p
1, it's evidently a MIP map
for
I
10
; a similar statement holds for the set of parts where
q
≥
1: It's the MIP
map for
I
01
. Use this idea to formulate a recursive definition of the MIP map of an
image
I
. You may assume that
I
has a width and height that are powers of two.
Exercise 17.5:
MIP mapping is often performed as a preprocess on an image,
with the MIP map itself being used many times. The preprocessing cost is there-
fore relatively unimportant. Nonetheless, for large images, especially those so
large that they cannot fit in memory, it can be worth being efficient. Assume that
the source image
I
and the MIP map
M
are both too large to fit in memory, and that
they are stored in row-major order (i.e., that
I
[
0, 0
]
,
I
[
0, 1
]
,
I
[
0, 2
]
,
≥
are adjacent
in memory), and that each time you access a new row it incurs a substantial cost,
while accessing elements in a single row is relatively inexpensive. How would you
generate a MIP map efficiently under these conditions?
...