You are on page 1of 19

Primer Chapter 1.

Background*
Revision 2004-08-19 (Reformat 2005-06-15)

Table of Contents
1.1 Introduction .......................................................................................................... 2 1.2 Analog vs. Digital Representations............................................................................ 2 1.2.1 Analog Information ........................................................................................ 2 1.2.2 Digital Data .................................................................................................. 3 1.3 Converting Analog to Digital .................................................................................... 7 1.3 Base-10 and Base-2 ............................................................................................... 9 1.4 File Sizes ............................................................................................................ 12 1.5 Compression ....................................................................................................... 13 1.5.1 Lossy and Lossless Compression .................................................................... 14 1.6 Summary............................................................................................................ 14 Terms...................................................................................................................... 16 A List of Multimedia Learning Aids For This Chapter ........................................................ 16 Review Questions ...................................................................................................... 18

Key Concepts
o o o o o o Analog information vs. digital data Converting analog to digital sampling and quantizing Bits and bytes Base-10 vs. base-2 File size calculation File compression

General Learning Objectives


At the o o o o o o o end of this chapter, you should be able to demonstrate that you: know the meaning of the common terms in computer fundamental and digital media know the application of digitization process to various media know the general strategies for reducing digital media file size comprehend the binary system comprehend the difference between analog information and digital data comprehend the basic steps of digitization: sampling and quantization comprehend the need for file compression and the types of file compression

* This material is based on work supported by the National Science Foundation under Grant No. DUE-0127280 and was written by Dr. Yue-Ling Wong (ylwong@wfu.edu), Department of Computer Science and Department of Art, Wake Forest University.

1.1 Introduction
If asked to define the term "digital media," most people would probably think of the creation of digital images, music, and videos. However, digital media is not only about production. Like nearly all disciplines, digital media has both conceptual and hands-on application components. The natural sciences have their theoretical and experimental components, while fine art has art history and studio art. Similary, the study of digital media entails both concepts and practice. While you may choose to concentrate on either component, both components are crucial to the study of digital media no matter what area you choose to concentrate on. The best realization of an idea with predictable results often originates from a solid understanding of the background concepts, not just knowing the how-to's. The practical aspects of the study of digital media require that digital media courses deal with hands-on work and application programs for example, Adobe Photoshop and JASC Paint Shop Pro for digital imaging, Adobe Premiere and Apple Final Cut for digital video, Adobe Audition and Sonic Foundry Sound Forge for digital audio. However, tying all your knowledge to specific programs is not the best way to study digital media. One program works differently from the next even when two programs are in the same category, like digital imaging. In addition, new application programs and new versions of old ones appear every few months. Therefore, whenever you learn a digital media program, you should try to generalize the toolsidentify the task you want to accomplish and then associate it with the basic concept behind the tool. In this way, when you have to switch to another program, you can always pick up on the new program easily by looking up the keywords associated with the tools in the program's online Help. From the experience you may already have with digital image, sound or video processing programs, you may think that you don't really need much background to use these tools. Nowadays, many application programs have default settings available for novices to create digital media products. With these application programs, you don't necessarily need to know computer fundamentals such as bits, bytes, and base-2 to use the default settings; you can create a product without any knowledge of digital media concepts. For example, it is possible to apply a special effect with a filter without considering what its many settings do. No error message will prevent you from saving the file. Unfortunately, this might give you the impression that you do not need to understand the defaults or fine-tune the settings in order to produce the best digital media product. But don't be fooled by how easy digital media programs can be to use "blindly"! Understanding the concepts makes a big difference in your making rational and educated decisions about how to use digital media tools to produce predictable and effective results.

1.2 Analog vs. Digital Representations


It is often said that we live in the digital age. However, the natural world we live in is an analog world. For example, the sounds and music we hear are "analog" signals of sound waves. But computers store and transmit information using digital data. To connect our analog world with computers, analog and digital information need to be converted from one form to the other and back again. One problem in the conversion process it that we may sacrifice the exactness of the original information. We will discuss the conversion process sampling and quantization in more detail later in this chapter. In order to understand the process, we first need to understand the nature of analog and digital representations of information. 1.2.1 Analog Information Most information that we perceive in the natural world is in analog form. To illustrate the point, let's try to measure the length of a pencil (Figure 1). The ruler shows that the pencil is between 7 and 7 inches in length, but it is a little shorter than half way between 7 and 7 inches. Would you round it up to 7.25? You cannot reproduce the exact length of this pencil with 7.25 inches. But, wait, the pencil tip is at about the middle between 7 and 7. So should we say it is 7-3/8 or 7.375? This makes the measurement a little closer to the

Primer, Chapter 1

::

2 of 19

pencil length than using 7.25. But the pencil is shorter than 7-3/8 inches. So, is it 7.374, 7.373, 7.3735, 7.37355,...? There is an infinite number of divisions between two points. How small should the divisions of a ruler be to allow us to make an exact measurement? Infinitely small, because there is always another value between two values!

(a)

(b)

Figure 1. (a) Measuring the length of a pencil with a ruler. (b) Close-up view of the pencil tip and the ruler.
Examples of continuous phenomena are time, weight, and temperature, lines, waves (such as sound waves), and a plane (such as a photograph). Analog clocks, analog thermometers (Figure 2a), and rotating knobs to change radio stations are examples of analog devices.

(a)

(b)

Figure 2. Thermometers. (a) Analog thermometer and its close-up view. (b) Digital thermometer.
1.2.2 Digital Data Computers are built from devices that have only two possible states because the electronic nature of these devices limits them to be stable at one of two voltages. Because of this, the computer system operates on a binary systemalso called base-2. Regardless of the actual voltages of these two states, we might denote the states as on and off, or true and false. In computer science, we denote this pair of states numerically as 0 and 1. Most people associate the binary system only with computers. It is true that computers use the binary system, dealing only with 0's and 1's, while in our daily lives we use many other numbers. For this reason, you might think it's difficult to understand the binary concept. However, the binary system is not difficult to understand. For example, imagine using eye signals to communicate with your friends. Each eye has closed and open positions (Figure 3), just like the computer's binary numbers0 and 1. When

Primer, Chapter 1

::

3 of 19

you give an eye signal to your friend, you "encode" the combination of the open and closed eyes into a message. Say that "blink left eye" once means "yes" and "blink both eyes" means "no." But waityou could say even more than this. How many different possible combinations of open and closed are there for two eyes? There are four combinations of open and closed if you consider that you have two eyes. Therefore, you can have four eye signals. If we assign a numeral to each of the open and closed eyessay open eye as 1 and closed eye as 0then the four combinations are 00, 01, 10, and 11.

Figure 3. The four combinations of open and closed for two eyes. If we assign each of the open and closed eyes with a numeralsay open eye as 1 and closed eye as 0then the four combinations are 00, 01, 10, and 11.
Let's look at another exampleyour hand signals. Let's say that each finger can be up or bent down. How many different combinations are there with five fingers? 25 = 32. How about with both hands, ten fingers? 210 = 1024. Wow! Of course, some combinations of the raised and bent fingers are quite challenging to make, if not impossible. In computer systems, data is stored in binary digits, called bits. A bit has two possible values, 0 or 1. In the eye signal example above, each eye can be considered as a bit, considering that each eye denotes two possible states, open or closed. Although the two possible values of a bit are denoted as 0 and 1 numerically, this does not mean that bits can only be used for arithmetic. Just one bit does not have much meaning. But a combination of bits forming larger sequences or strings can be used to encode content information such as text characters, color information of digital images, and audio amplitudes. As you see in the daily life examples above, a combination of bits can be used to represent information such as messages and signals. As you see in the eye signal and hand signal analogies, you can encode any messages you want, as long as your friends who are getting your signals know how to decode them. For example, if you have already told your friends that blinking only the left eye means "yes" and blinking both eyes means "no," they can match your signals with the actual messages. Isn't this also how it works when a baseball player uses hand signals to send messages to his or her team in a baseball game? In the analogy using the eye signals, each eye is analogous to a biteach has two states, open and closed, or 0 and 1. With the use of two eyes, we would call your eye signal system a 2-bit system. In the hand signals analogy, if you are using one hand, your hand signal system is 5-bit. As you see, the number of possible values equals to 2bit. From the explanation above, it seems that sequences of bits can be used to represent anything. However, computers have their limitations. Information of analog media is continuous. To represent the colors changing from one point to the next in a natural image would require an infinite number of points because there are always more points between any two points in the analog world. Furthermore, the computer can represent only a limited number of colors. With 2 bits, we can represent four possible values. Say, we want to use the values to represent grays. The more different shades of grays we want to represent, the more bits we need. In a computer, there has to be a limit in the number of bits that are allowed for each piece of data; a sequence of bits in a computer cannot be infinite. In this

Primer, Chapter 1

::

4 of 19

example of shades of grays, no matter what the bit limit, each possible value only represents one discrete shade of gray. The shades of grays in between the two consecutive gray values then cannot be captured in digital form. The discrete and finite language of computers restricts the precision with which the analog medianatural sights and soundscan be reproduced in digital form. Integers Integers are an example of a discrete number system. Each two consecutive integers have no other integer between them. Integers work well in computers because computers encode things using 0 and 1, which are themselves discrete values. However, while integers are inherently discrete, they are not inherently finite. The list of integers goes on forever. Computers can only deal with a finite number of things. Still, this is not a problem for computers. The set of integers is made finite within a computer by setting a limit on the number of bits used to represent things. Eight bits make a byte. With 8 bits, you can represent 256 possibilities (28 = 256), ranging from 0 (00000000) to 255 (11111111). (Note that the range goes from 0 to 255, not from 1 to 256.) When you start to deal with lots of bits and bytes, you get into using prefixes such as kilo (K), mega (M), and giga (G). The chart below lists the prefixes, abbreviations, and sizes. Notice that bytes are abbreviated using a capital "B" whereas bits are abbreviated using a small "b".
side-note: Why is a byte eight bits? This is something that was settled as a standard through the history of development of the computing system over the past 50 years.

Using the Binary System to Represent Text Characters In the binary system, each letters of the alphabet or other text character is represented by a different combination of bits. Each byte holds one character in a text document. In the ASCII character set, each binary representation of the first 128 values (from 0 to 127) corresponds to a specific character. (Table 1 shows the lower 128 ACSII codes.) The other upper128 values can be used to handle special characters such as the accented characters in foreign languages. Later in this chapter, in the File Size section, you will see the relationship between bytes and file size.

0 1 2 3 4 5 6 7 8 9 10 11 12 13

NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR

16 17 18 19 20 21 22 23 24 25 26 27 28 29

DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS

32 33 34 35 36 37 38 39 40 41 42 43 44 45

! " # $ % & ' ( ) * + , -

48 49 50 51 52 53 54 55 56 57 58 59 60 61

0 1 2 3 4 5 6 7 8 9 : ; < =

64 65 66 67 68 69 70 71 72 73 74 75 76 77

@ A B C D E F G H I J K L M

80 81 82 83 84 85 86 87 88 89 90 91 92 93

P Q R S T U V W X Y Z [ \ ]

96 97 98 99 100 101 102 103 104 105 106 107 108 109

` a b c d e f g h i j k l m

112 113 114 115 116 117 118 119 120 121 122 123 124 125

p q r s t u v w x y z { | }

Primer, Chapter 1

::

5 of 19

14 15

SO SI

30 31

RS US

46 47

. /

62 63

> ?

78 79

N O

94 95

^ _

110 111

n o

126 127

~ DEL

Table 1. The lower 128 ACSII codes.

Prefix Name Kilo Mega Giga Tera Peta Exa Zetta Yotta

Abbreviation K M G T P E Z Y

Size 210 = 220 = 230 = 240 = 250 = 260 = 270 = 280 =

1,024 1,048,576 1,073,741,824 1,099,511,627,776 1,125,899,906,842,624 1,152,921,504,606,846,976 1,180,591,620,717,411,303,424 1,208,925,819,614,629,174,706,176

Table 2. The relationship between sizes and prefix names under the base-2 definition.
Although one kilo equals 1000 (e.g., one kilogram equals 1000 grams), notice that a kilobyte (KB) is not exactly one thousand bytes, a megabyte (MB) is not exactly one million bytes, and so forth under this base-2 definition (Table 2). This has caused confusion among manufacturers of computer storage devices, telecommunication engineers, and the general public because not everyone knows that 1 kilobyte means 1,024 bytes. But most people know that 1 kilo equals exactly 1000, and other prefixes equals a number based on 10 to the power of an integer. To avoid such confusion, in December 1998, the International Electrotechnical Commission (IEC) approved the following prefixes for binary multiples for use in the fields of data processing and data transmission (Table 3). (http://physics.nist.gov/cuu/Units/binary.html) However, at the time of writing this chapter, these new standard names are not widely used by or known to the public. Original Kilo Mega Giga Tera Peta Exa Prefix Name Kibi Mebi Gibi Tebi Pebi Exbi Symbol Ki Mi Gi Ti Pi Ei Size 210 220 230 240 250 260 = = = = = = 1,024 1,048,576 1,073,741,824 1,099,511,627,776 1,125,899,906,842,624 1,152,921,504,606,846,976

Table 3. Prefixes for binary multiples for use in the fields of data processing and data transmission approved by the International Electrotechnical Commission (IEC).
With these new standard names and symbols, we have the following: 1 kilobyte = 1,000 bytes 1 kibibyte = 210 bytes = 1,024 bytes 1 megabit = 1,000,000 bits 1 mebibit = 220 bits = 1,048,576 bits Your Computer Hard Drive Space Look up the information of your hard drive space, both in bytes and gigabytes (GB). If you are using Windows, you can rightclick on the C: drive in My Computer, and select Properties. Under the General tab, look up the Used Space and Free Space in bytes and GB. Verify that the numbers match up with the conversion according to the chart above.

Primer, Chapter 1

::

6 of 19

For example, say that your computer lists 19,994,050,560 bytes for 18.6 GB. To convert 19,994,050,560 bytes into GB, you divide 19,994,050,560 by 230 or 1,073,741,824:
19,994,050,560 bytes = 18.6 GB 1,073,741,824 bytes/GB

1.3 Converting Analog to Digital


Sound and pictures are by nature continuous phenomena, which implies that they must be represented with infinite values. When we want to represent sound and pictures on a computer, we face two problems. First, we have only finite capacity in the computerwhich leads to the problem of sampling. In addition, we cannot represent numbers with infinite precision in a computer, so the precision with which we represent colors or sounds is limited which leads to the problem of quantization. The process of converting from analog to digital information is a 2-step process: sampling and quantizing. The simple example above illustrates a sampling and quantizing process. But in the previous example in illustrating analog information, we only sample once because there is only one pencil. In digital media, often you need to sample more than once because, for examples, an image involves color value changes over the 2-D plane, and a sound wave involves amplitude changes over time. In these cases, you need to sample multiple times to represent the whole media. Then, the rate you samplesampling ratebecomes an important factor. To illustrate the concepts of sampling and quantizing, let's look at an analogy where you monitor a puppy's first year of growth by measuring its weight. You will use an analog scale to sample the puppy's weight. You need to decide a discrete number to recordquantizing. You also need to decide how frequently you want to weigh the puppy within the first year periodthe sampling rate. Say that you are going to use an analog scalethe kind that uses a spring-loaded mechanism. The more the puppy weighs, the more compressed the spring will be. The spring responds to the extent of compression on the spring and pulls the pointer on the scale to rotate. Such a scale is an analog scale because the spring can be compressed continuously. The weight, correspondingly, is analog information. What would you record for the puppy's weight (Figure 4)? You may choose to round off the reading to the nearest hash mark, or estimate the reading between the hash marks. Either way, you may not be recording an exact weight. You sacrifice the accuracy of the measurement when you convert analog information into a discrete number, but the advantage is that you can report the puppy's weight as a clear distinct value. On the other hand, if you describe the weight, for example, as "somewhere between 5 and 10 pounds," it will not be as clear and concise. If you do report the weight to someone using the latter method, you probably will get a response asking you to round it off. Why? Because distinct and unambiguous discrete values can easily be processed mathematically, compared, or plotted on a chart. The process of assigning a discrete value to something is called quantizing. In the example of measuring the length of a pencil (Figure 1), you face the decision of number of decimal places to use in the measurement. The number of decimal places determines the precision of the measurement. Generally, increasing the number of decimal places increases the precision of the measurement. In this analogy of puppy weighing, recording the puppy's weight using more decimal places will need more paper to keep the records. In digitizing analog media, the precision of the data is determined by the number of possible discrete values that the data can be assigned to. Increasing the decimal places is one way to increase the possible discrete values. For example, allowing one decimal place gives you 10 discrete levels between two consecutive integerssay, between 2 and 3, there are 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, and 2.9. The choice of the number of possible values in digital media is called bit depth.

Primer, Chapter 1

::

7 of 19

Bit Depth Does Not Mean Number of Decimal Places The number of decimal places is used as a simple example in the weighing puppy situation above to illustrate the concept of bit depth. However, increasing the bit depth does not necessary mean increase of the number of decimal places. Increasing bit depth means more possible discrete levels that the captured data can be assigned to. Say, for 10 discrete levels, you can have the 10 allowable values as, for examples: (1) 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, and 2.9 (2) 0, 5, 10, 15, 20, 25, 30, 35, 40, 45 So, if you use the first 10-level scale above for recording the puppy's weight, you get a precision of one decimal place within 2 to 3 lbs. That means, if the puppy's weight is between 2 and 3 lbs., you can distinguish the difference to one decimal place. However, any weight lower than 2.0 has to be rounded to 2.0. And, any weight higher than 2.9 can only be recorded as 2.9. It is certainly not a very practical 10-level scale for this weighing puppy situation. However, if you use the second 10-level scale for recording the puppy's weight, a weight of 2 lbs will be rounded to 0 and a weight of 3 lbs will be rounded to 5. In the case of 2 and 3 lbs, the difference between these two data is altered after they are assigned to the allowable value on this 10-level scalethe difference becomes 5 lbs, not 1 lb. However, because this scale has a wider range, a weight of, say, 45 lbs can be distinguished from 5 lbs. This scale is more practical than the first one for this weighing puppy scenario. Increasing the number of allowable levels, i.e. increasing the bit depth in digital media, can: (1) increase the precision of the captured data (2) increase the range of the scale (3) increase the file size

Figure 4. Sampling a puppy's weight on an analog scale.


Now, say that you need to monitor the puppy's first year growth by weight. You will need to decide how frequently you want to weigh the puppythe sampling rate. Do you want to

Primer, Chapter 1

::

8 of 19

weigh the puppy annually, monthly, weekly, daily, or hourly, or...? What factors do you take into consideration when you make this decision? Based on how fast a puppy normally grows in the first year in this example, it is reasonable to weigh the puppy monthly or weekly. However, if you do not know how fast a puppy would normally grow, you probably feel a little lost when you are asked to choose how frequently to weigh the puppy. If you sample too infrequently, you will miss data that may show how the weight changes over time. Well, how much more frequently do you want to sampledaily, hourly? As mentioned earlier, when converting analog information to digital data, no matter how frequent the sampling rate is, you will sacrifice accuracy. If you sample too frequently, you will be busy weighing the puppy and will need more paper to keep the recordand thus you will need more shelf space to store the record. In addition, it costs you more time to read through the records later. This is analogous to the situation in choosing a sampling rate in digital media. If you increase the sampling rate, you increase the accuracy of your plot of the puppy's growth pattern. At the same time, the computer has to sample faster. The resulting file that holds all the samples will be larger, and thus it will take up more hard disk space and will require more time to process. Then, what is the sampling rate we should use? Well, there is no one strictly right or wrong sampling rate. It is a matter of deciding an optimal sampling rate for your purpose. It depends on the situation, such as the rate of change of the original analog source and limitations on the file size and processing time. For this example, either monthly or weekly seems to be a reasonable sampling rate. The data from monthly sampling may not represent the growth rate well during the first few months when the puppy has more rapid growth. The weekly data can represent the growth rate more accurately but may yield redundant information in later months. In a real life scenario, you probably will choose to sample the first month's weight more frequently than the other months if you anticipate that the first month has more dramatic changes. Therefore, you may have more than one sampling rate for a single task. However, in digital media, one sampling rate is usually set for a session. So, how is this analogy related to digital media such as images and sound? Generally, for digital images, the sampling rate is related to the image resolution (or amount of detail) and the quantization is related to the image's bit depth (which in turn affects the number of colors that can be used). For digital audio, quantization is also related to the bit depth (which determines how well differences in sound amplitude can be represented), and sampling rate relates how frequent the amplitude value of a sound wave is sampled. Detailed discussions of sampling and quantizing in digital images and audio are covered in the primer chapters devoted to these media.
Learning Aid: Converting Analog to DigitalSampling and Quantizing An interactive tutorial illustrating the process of sampling and quantizing by using an analogy of a task to monitor a puppy's first year growth in weight.

1.3 Base-10 and Base-2


The mathematics we commonly use in our daily lives is based on the decimal system, a base10 notation. However, computer systems use base-2 (also called the binary system), which relates to the computer storage's basic units, bits and bytes, which are units used to measure file sizes. By learning what base-2 is and how it works, you will understand how binary notation is used to represent decimal numbers.
Learning Aid: Base-10 and Base-2 An interactive tutorial explaining base-10 and base-2.

Primer, Chapter 1

::

9 of 19

In base 10, there are ten possible numerals available: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The position of the digits in a number has significance. For example, the decimal number

3872. can be interpreted as shown here.


units 100

As you see, the position of each digit represents a power of 10. We can rewrite the decimal number in terms of products of powers of 10. For example, 3 x 103 + 8 x 102 + 7 x 101 + 2 x 100 = 3000 + 800 + 70 + 2 = 3872 What is base-2 then? The binary system is a base-2 notation. This means that there are only two possible numerals available in base-2: 0 and 1. For any binary number, the position of each digit represents a power of 2. Binary notation can be converted to decimal notation and vice versa. The following example shows the conversion of binary to decimal. For example, the binary notation

thousands hundreds tens 103 101 102

23

1011
22 2
1

can be interpreted as shown here.

20

We can convert this binary notation to decimal notation by breaking it down in terms of products of power of 2: 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 = 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1 = 11 (in decimal notation) Decimal notation can be converted to binary, too. One method is to repeatedly divide the decimal number by 2 until the number becomes 0, noting the remainder of each division. The reverse order of the sequence of the remainders is the binary representation of the decimal number. For example, to convert 19 to binary: Division of Number 19/2 = 9 9/2 = 4 4/2 = 2 2/2 = 1 1/2 = 0 Remainder 1 1 0 0 1

The sequence of the remainders you get in the repeated divisions above is 11001. The reverse order of this sequence 10011 is the binary notation of the decimal number 19. Another method involves repeated subtraction of the next largest possible power of 2. Mark 1 when the subtraction is possible and 0 when it is not. An example below will help you understand this method. Using the example of 19: Step 1: First we need to determine the largest possible power of 2 for 19. To do so, we list the products of powers of 2 up to larger or equal to 19. Power of Two 20 = 1

Primer, Chapter 1

:: 10 of 19

21 = 2 22 = 4 23 = 8 24 = 16 25 = 32 The largest possible power of 2 for 19 is 24 = 16 because the next power of 2 (25 = 32) is larger than 19. Step 2: Now we can start the subtraction, starting from the largest possible power of 2, and then keep subtracting the next largest power of 2 from the remainder. If the subtraction does not result in a negative number, then mark 1. Otherwise, mark 0 and skip to the next largest power of 2. Power of 2 24 = 16 23 = 8 2 =4 2 =2 20 = 1
1 2

Subtraction 19 16 = 3 3-8 3-4 32=1 11=0

1 for Subtraction Possible 0 for Not Possible 1 0 0 1 0

Either method will give you the same binary representation.


Learning Aid: Decimal To Binary Guided Practice An interactive exercise guides you step-by-step to convert decimal to binary using either method discussed above. You can use practice with a decimal number of your choice or let the program randomly generate one for you.

A "Digital" Clock As you see, decimal numbers can be converted or encoded into binary notation. How fast can you tell time if the digits of the time are binary coded? A binary coded decimal (BCD) clock (Figure 5) is built with six columns of LEDs. The first two columns read the hours, the middle two columns the minutes, and the last two columns the seconds. The off/on of the LED represents 0 and 1, respectively. The bottom row of the LED represents 20 (= 1) the next row up 21 (= 2), then 22 (= 4), and then 23 (= 8).

Primer, Chapter 1

:: 11 of 19

Figure 5. A binary coded decimal (BCD) clock shows decimal time in base-2 notation. Activity/Exercise: 1. Explain the number of LEDs for each column. That is, why does the first column need only two LEDs, the second column needs four LEDs,...and so forth? 2. Verify that the hour shown in the clock is 12. 3. What time is it in Figure 5?

Learning Aid: Binary Coded Decimal (BCD) Clock See how fast you can tell time by converting the binary notation to decimal. This interactive BCD clock will help you learn decimal to binary conversion using an interesting approach. You can choose to display the time in decimal along with the BCD clock. You can also display the BCD clock with LED-like circles, 0 and 1 representation, and power-of-2 representation.

1.4 File Sizes


As discussed above in a text document each byte holds a character represented by its own specific ACSII code. Computers store text documents using these ACSII codes. In other words, each character stored on disk requires one byte of the file size.
Activity/Exercise: If you are using Windows 95, 98, 2000 or XP: Open a new text file in Notepad and type the sentence, "Eight bits make a byte." Save the file as filesize-exercise.txt. Then, look at its file size. (To check out the file size of a file, you can right-click on the file-size-exercise.txt file, and select Properties.) You should find that the file size is 23 bytes because there are 23 characters in this sentence1 byte for each character, including spaces, which are characters too. (What is the ACSII code of the space? Look up in the Table above to find it.) If you are using Mac OSX: Open a new text file in TextEdit, and type the sentence, "Eight bits make a byte." Select Format > Make Plain Text. Then, save the file as file-size-exercise.txt. In the Save dialog box, choose Western for the Plain Text Encoding. Questions: In the file file-size-exercise.txt you have created above, add a blank line at the end of the sentence by hitting the Enter key (with Windows) or Return key (with Mac) on your keyboard. Save the file. Then, look at its file size again. What is the file size now? By how many byte(s) has the file size increased? Creating a blank line in Notepad actually involves both a carriage return (CR) and a line feed (LF). Are they characters? Look them up the Table above. If you create a Microsoft Word document with the same sentence "Eight bits make a byte.", will the file size of the Word document be 23 bytes? Why not?

But is a byte useful only for storing a character in a text document? Of course not. A byte is 8 bits, which has 256 possible values. It can be used to store color information of an image. If you use a byte to store the color information of each pixel in an image, how many possible color can be used for each pixel? If each pixel requires a byte, then the larger the pixel dimension of an image, the more bytes are needed to store the image, i.e. the larger the file size.
side-note: Pixels and pixel dimensions will be discussed in more detail in the digital imaging chapters. side-note: You will learn more about bit depth of digital images in the chapter on digital imaging.

Primer, Chapter 1

:: 12 of 19

Multimedia filesimage, sound, and especially video filescan be very large. Such large file sizes can require tremendous amounts of storage space. Also, the larger the file, the longer the transmission time to send the file over the network and the longer the processing time. Longer processing time means that it may take longer for your audience to open or playback your files. It also means that it may slow down your productivity when you are editing the file. Generally, there are three ways to reduce the file size of a digital media file. Reduce the sampling rate Reduce the bit depth Apply file compression When you reduce the sampling rate and bit depth, your resulting digital image no longer looks as close to the original subject as it did before, and the degradation of your resulting digital sound becomes more noticeable. However, when working with digital media files, you often have to weigh the quality against the file size.

1.5 Compression
File compression lets you reduce the total number of bits and bytes in a file so it can be transmitted faster over the network, and it takes up less storage space on a disk. Nowadays, storage space is inexpensive and many people have access to a high-speed network, especially those at universities and colleges. Although the storage space and network connection speeds are not big factors for many of you, especially with regard to digital images and sound, you still need to consider the playback performance of video files. Uncompressed videos require a high data rate. The video playback will become jerky and frame skipping may occur if the computer cannot process the video data fast enough for playback.
side-note: You will learn more about different codecs (compression/decompression methods) and corresponding data rate in the digital video chapter.

Learning Aid: Video examples of different levels of compression: uncompressed, low compression, and high compression The video is a 60-frame computer animation, rendered frame-by-frame (720 x 480 pixels) as an image sequence, imported in Adobe Premiere, and exported as QuickTime and MPEG-2 movies. Each exported movie uses a different level of compression: QuickTime, uncompressed QuickTime, using Animation Codec QuickTime, using Cinepak Codec QuickTime, using Sorenson Codec MPEG-2 Note the following properties of each movie: (a) the image quality for different codecs (b) the file sizes (c) smoothness of playback Why are the image quality, file size, and playback different with different compression methods? Codec stands for compression/decompression. You will understand when you learn more about digital video compression in the later chapters on digital video.

In later chapters, you will also learn some of the most common data compression methods that are applied to multimedia files. Some compression methods are not specific to multimedia files. Others are available only for a certain category of media files. For example, Cinepak is available for creating QuickTime movies or AVI movies, but is not available in sound or image compression. In learning these techniques, you will understand the strengths and weakness of each technique, and thus you can make educated decisions when you need to choose compression

Primer, Chapter 1

:: 13 of 19

methods for your media files. In addition, some compression methods allow you to control certain parameters that you often see when saving a file in a multimedia application. Understanding what these parameters mean and how they affect your files will help you make decisions that are best for your multimedia work. 1.5.1 Lossy and Lossless Compression Compression methods are categorized as being either lossy or lossless. With lossy compression methods, some information of the original file will be lost and cannot be recovered. Because of this, you should not use this type of compression for any file that you want to reproduce the exact original or keep as the start file for further editing. The lossy compression that most people are familiar with is JPEG compression in digital imaging. Many video codecs are also lossy, although a few codecs use lossless algorithms.
side-note: For details on the compression algorithms, see the CS Module.

1.6 Summary
The study of digital media involves not only the production of digital pictures, sound, and video but also an understanding of the mathematical and scientific concepts behind digital media tools. Understanding the concepts helps you make rational and educated decisions in settings in applications to produce predictable and effective results. The information we perceive through our senses involves analog phenomena, which imply infinite values. However, computers store and transmit information using discrete, finite data. The main difference between analog and digital information is continuity. Continuity describes analog data, while discreteness describes digital data. To connect our analog world with computers, analog and digital information need to be converted from one form to another. Converting from analog to digital involves a two-step processsampling and quantizing. When we want to represent information such as sights and sounds on a computer, we face two problems. First, we have only finite capacity in the computera problem of sampling. In addition, we cannot represent numbers with infinite precision in a computer, so the precision with which we represent colors or sounds is limiteda problem of quantization. The discrete and finite language of computers restricts the precision with which the analog medianatural sights and soundscan be reproduced in digital form. In converting from analog to digital, we may sacrifice the exactness of the original information. Because of the current electronic technology that computer systems are built on, computer systems operate on the binary system. Binary is a base-2 notation. Therefore, there are only two possible numerals available in base-2: denoted as 0 and 1 in the language of computers. For any binary number, the position of each digit represents a power of 2 while in the decimal (base-10) system that is commonly used in our daily lives, the position of each digit represents a power of 10. Base-10 and base-2 notations can be converted between each other. Multimedia filesimage, sound, and especially video filescan be very large. Such large file sizes can require tremendous amounts of storage space. Also, the larger the file, the longer the transmission time to send the file over the network. Generally, there are three ways to reduce the file size of a digital media file. Reduce the sampling rate Reduce the bit depth Apply file compression Reducing the sampling rate or bit depth sacrifices the quality of your resulting digital media. However, when working with digital media files, you often have to weigh the quality against the file size.

Primer, Chapter 1

:: 14 of 19

Compression methods are categorized as being either lossy or lossless. With lossy compression methods, some information of the original file will be lost and cannot be recovered. Because of this, you should not use this type of compression for any file that you want to reproduce the exact original or keep as the start file for further editing.

Primer, Chapter 1

:: 15 of 19

Terms
analog digital continuous discrete bit byte base-10 base-2 decimal binary sampling quantizing sampling rate compression lossy compression lossless compression kilo mega giga tera peta

A List of Multimedia Learning Aids For This Chapter


Learning aids can be found at http://digitalmedia.wfu.edu/project/
Converting Analog to DigitalSampling and Quantizing An interactive tutorial illustrating the process of sampling and quantizing by using an analogy of a task to monitor a puppy's first year growth in weight.

Base-10 and Base-2 An interactive tutorial explaining base-10 and base-2. Decimal To Binary Guided Practice An interactive exercise guides you step-by-step to convert decimal to binary using either method discussed above. You can use practice with a decimal number of your choice or let the program randomly generate one for you. Binary Coded Decimal (BCD) Clock See how fast you can tell time by converting the binary notation to decimal. This interactive BCD clock will help you learn decimal to binary conversion using an interesting approach. You can choose to display the time in decimal along with the BCD clock. You can also display the BCD clock with LED-like circles, 0 and 1 representation, and power-of-2 representation. Video examples of different levels of compression: uncompressed, low compression, and high compression The video is a 60-frame computer animation, rendered frame-by-frame (720 x 480 pixels) as an image sequence, which was then imported in Adobe Premiere and exported as QuickTime and MPEG-2 movies. Each exported movie uses a different level of compression: QuickTime, uncompressed QuickTime, using Animation Codec

Primer, Chapter 1

:: 16 of 19

QuickTime, using Cinepak Codec QuickTime, using Sorenson Codec MPEG-2 Note the following properties of each movie: (a) the image quality for different codecs (b) the file sizes (c) smoothness of playback Why are the image quality, file size, and playback different with different compression methods?? Codec stands for compression/decompression. You will understand when you learn more about digital video compression in the later chapters on digital video.

Primer, Chapter 1

:: 17 of 19

Review Questions
1. 2. Our every-day decimal numbering system is base-_____. Computers use base-_____, which is also known as the __________ numbering system. The smallest unit in a binary system is a A. bit, B. byte, which refers to a binary digit (i.e. a _____ or a _____ .) (Enter a digit or number.) Fill in the blanks with "bit(s)" or "byte(s)": Eight __________ equals one __________. The word bit comes from the shortening of the words __________ __________. If you want to use hand signals to communicate with your friend only two possibilitiesyes or no, what is the minimum number of finger(s) you need to make the hand signal? _____ We can call this hand signal system as ___-bit. A pixel that can have only one of two possible color values requires _____ bit(s) to store the color information. If you use a byte to store the grayscale information of each pixel in a grayscale image, how many gray possible levels can be for each pixel? Match the storage size on the left with the removable media on the right below: Storage Size 4.7 GB 100 MB 250 MB 650 or 700 MB 1.44 MB 9. Removable Media Floppy diskette DVD-R CD-R Zip disk

3. 4. 5.

6. 7. 8.

Multiple-choice: Which of the following hard disks has the most storage space? A. 24 GB B. 24 MB C. 240 MB D. 2400 KB

10. Fill in the names and abbreviations for the followings: Name Abbr. Size in bytes Kilo-byte KB 210 = 1,024 20 2 = 1,048,576 230 = 1,073,741,824 240 = 1,099,511,627,776 11. How many bits is each of the following binary numbers? Also, convert each to a decimal number. (i) 00000000 (ii) 01101000 (iii) 0000 (iv) 11 (v) 111 (vi) 0000000000000010 12. Convert the following decimal numbers into binary. (i) 0

Primer, Chapter 1

:: 18 of 19

(ii) 1 (iii) 2 (iv) 3 (v) 12 (vi) 123 (vii) 1234 (viii) 11 (ix) 111 (x) 128 (xi) 255 13. Look up the information of your hard drive space, both in bytes and GB. If you are using Windows, you can right-click on the C: drive in My Computer, and select Properties. Under the General tab, look up the Used Space and Free Space in bytes and GB. Verify that the number match up with the conversion according to the chart above. 14. Multiple-choice: Which of the following measurement is NOT an example of analog phenomena? A. brightness B. population C. temperature D. time 15. Converting from analog to digital involves a two-step process: __________ and __________ . 16. Multiple-choice: When we want to convert analog information to digital data, we face two problems that sacrifice the exactness of the original information. There is one problem in sampling and one in quantizing. Which of the followings is relevant to the problem of sampling? A. Computer systems operate on the binary system. B. Computer systems has only finite capacity. C. Computer systems cannot represent numbers with infinite precision. 17. Multiple-choice: When we want to convert analog information to digital data, we face two problems--one in sampling and one in quantizing--that sacrifice the exactness of the original information. Which of the followings is relevant to the problem of quantizing? A. Computer systems operate on the binary system. B. Computer systems has only finite capacity. C. Computer systems cannot represent numbers with infinite precision. 18. (i) Name three general strategies to reduce the file size of a digital media file. (ii) Which of these strategies does not necessary sacrifice the quality of the media file? How? 19. You should not use lossy compression for any file that you want to reproduce the exact original or keep as the start file for further editing because _____________ _________________________________________________________________.

Primer, Chapter 1

:: 19 of 19

You might also like