Section 20.1 Digital images
We live in a sea of digital images—phones, laptops, watches, televisions, cameras, games, automobile dashboards, advertising... how many more can you think of? They vary widely in size (height, width), resolution (number of pixels, number of colors, number of frames per second), and technologies (LCD, LED, and OLED are among the abbreviations you may have encountered while shopping for a new device). In this chapter we will focus on one particular type of video display, called
Video Graphics Array, or
VGA. Since its introduction by IBM in 1987 for its PS/2 line of personal computers, it has undergone many modifications and extensions. We shall be concerned with the particular implementation supported on the Digilent Basys 3 board. You can read more about the VGA standard, including the original IBM specifications, beginning with the Wikipedia article
[18]. We shall also refer to the Basys 3 reference manual
[3]. Another interesting source is the "Project F" website
[7].
A two-dimensional digital image is a rectangular array of picture elements, or pixels. Image size is conventionally expressed as "width \(\times\) height", e.g., a VGA image, which has 640 columns and 480 rows, is expressed "\(640 \times 480\)". This is opposite the way arrays are sized in mathematics—a matrix with 640 columns and 480 rows is said to be "\(480 \times 640\)". However, both the elements of a matrix and the pixels of a VGA image are indexed in the same way, by (row, column), from coordinates \((0,0)\) at the upper left corner to \((479, 639)\) at the lower right corner.
Each pixel is represented by a \(B\)-bit number encoding its color. For simple black and white, one bit is sufficient. Eight bits will encode 256 gray levels. Four bits, in the original VGA specification, encoded 16 colors. The Basys 3 supports up to 12 bits (4096 colors) per pixel: 4 bits of red, 4 bits of green, and 4 bits of blue.
Checkpoint 20.1.1.
How many bits of memory are required to store a 12-bit VGA image? How many bits of block RAM does the Artix 7 FPGA on the Basys 3 board contain
[3]?
Answer.
\(640 \times 480 \times 12 = 3,686,400\) bits. And according to the reference manual, the FPGA contains 1,800 Kbits. Evidently, there isn’t enough memory to store this image. Something will have to be done!
A video image is a time sequence of single images, or frames. The speed at which individual still frames are displayed is called the frame rate, expressed in frames per second (fps). The frame rate must be high enough to create the illusion of smooth, flicker-free motion in the mind of the viewer. Typical frame rates are 24 fps for movies, 30 fps for television, and 60 fps for VGA graphics.
Checkpoint 20.1.2.
Why do you think a computer screen has a higher frame rate than a movie or television program?
Hint.
It may have something to do with the eye’s sensitivity to flicker in stationary vs moving images. Read up on it!
Checkpoint 20.1.3.
How many pixels per second are sent to a VGA display operating at 60 fps? How does this compare with the clock speed of the Basys 3 board
[3]?
Answer.
\(640 \times 480 \times 60 = 18,432,000\) pixels per second. This is a less than than the 100 MHz Basys 3 clock speed.