Full file at

1Exercises

  1. [R03] Say you have an 8-bit A/D converter which has a full-scale input range of -2V to +4V. When a particular voltage is applied, the computer records the hex number A2. Assuming a perfect calibration,
  • What output voltage does this value correspond to,
  • What is the digitization (quantization) error in the voltage?
  • By how much percent would this error change if it 12 bits were used to approximate the output instead of 8 bits.

Output reading is A2 = 162. This corresponds to a voltage of 162x6/256 = 3.796875 V

The maximum quantization error can be half of the quantization interval = 3/256 = 0.01171875 V.

With 12 bits the max error = 3/4096 = 0.000732421875

Perentage change in error = (000732421875 - 0.01171875) / 0.01171875 = -0.93 percent

  1. [R03] The bandwidth of a speech signal is from 50 Hz through to 10 kHz and that of a music signal is from 15Hz through to 20Khz. You want to digitize these signals using the Nyquist criterion.
  • What is the bit rate produced for the speech signal if 12 bits are used per sample?
  • Perform the same for the music signal when 16 bits per sample are used.
  • How many mega bytes of storage do you need for 10 minutes of stereophonic music?

Speech signal must be sampled at 20 kHz. Therefore its bit rate = 12 * 20 = 240 Kbps

Music signal must be sampled at 40 kHz. Therefore its bit rate = 16 * 40 = 640 Kbps

10 minute of mono music requires 10*60*640K = 384 Mbits = 48 Mbytes

For stereophonic music, space required = 48*2 = 96 Mbytes

  1. [R03] Say you scan a 5 inch x 7 inch photograph in at 120 ppi (points per inch or pixels per inch) 24-bit color representation. For all the following, compute your answers in

bytes.

  • How big is the file?
  • If you quantize the full color mode to use 256 indexed colors, how big is the file?
  • If you quantize the color mode to black and white, how big is the file?

Number of pixels = 5x120 x 7 x 120 = 504000 pixels.

Each pixel = 24 bits, hence file size = 12.096 Megabits = 1.512 Megbytes

Each index is 8 bits (256 colors), Hence file size = 50400x8 bits = 0.504 Megabytes

Black, White and Gray has 8 bits per pixel. So file size is = 50400x8 bits = 0.504 Megabytes.

  1. [R03] A movie on a video server occupies 4GB. You wish to download it on your local machine.
  • What should the link speed be if you want to download it in 30 minutes? Assume that the local and remote computers are fast enough to have negligible read/write time.
  • If you were to get the same movie via a slower 56Kpbs modem connection of today, how long will it take you?
  • If you had a DSL connection at 780 Kbs, how long would it take you?

Rate of download or link speed = 4 GB/ 30 x 60 = 2.2222 Mbps.

On a 56Kpbs, time required = 4GB/56 = 71428.5 seconds

On a 780 Kbps, it would take 4GB/780Kb = 5128 seconds = 85.47 mins

  1. [R04] The high-frequency limit of human hearing extends to approximately 20 kHz, but studies have shown that intelligible speech requires frequencies only up to 4kHz.
  • Justify why the sampling rate for an audio Compact Disc (CD) is 44.1 kHz. What is the Nyquist rate for reliable speech communications?
  • Why do you think people sound different on the phone from in person?
  • Suppose intelligible speech requires 7 bits per sample. If the phone system is designed to precisely meet the requirements for speech (which is the case), what is the maximum bit rate allowable over telephone lines?
  • CDs use 16 bits per sample. What is the bit rate of music coming off a CD? Is a modem connection fast enough to support streamed CD quality audio?

The ear is the ultimate receptor of the rendered digital audio. Since it can hear frequencies no more than 20KHz, the original signal must be sampled at at least 40 KHz to capture all the 20KHz frequencies. With some additional room for higher ranges, the CD audio is sampled at 44.1 KHz

Though the human larynx can produce frequencies only upto 4 KHz, different people have different frequencies for the same set of sounds depending on structure of mouth, tongue movement, etc. – same reason why a 256 Hz frequency sounds different on a guitar than on a piano.

Max bit rate over telephone lines = 2x4x7 = 56Kbps.

Bit rate of CD sound = 44.1x16 = 705.6 Kbps for mono, or 1.411 Mbps for stereo.

Broad band to most homes is getting to a point where this can be supported, but still for practical efficiency, the CD audio streams are compressed using a psychoacoustic audio compression scheme, such as mp3 or AAC.

  1. [R05] The following sequence of real numbers has been obtained sampling an audio signal: 1.8, 2.2, 2.2, 3.2, 3.3, 3.3, 2.5, 2.8, 2.8, 2.8, 1.5, 1.0, 1.2, 1.2, 1.8, 2.2, 2.2, 2.2, 1.9, 2.3, 1.2, 0.2, -1.2, -1.2, -1.7, -1.1, -2.2, -1.5, -1.5, -0.7, 0.1, 0.9 Quantize this sequence by dividing the interval [-4, 4] into 32 uniformly distributed levels (place the level 0 at -3.75, the level 1 at -3.5, and so on. This should simplify your calculations).
  • Write down the quantized sequence.
  • How many bits do you need to transmit it?
  • While storing similar signals, you notice that you need to reduce the number of bits by 50%. Propose what you can do to achieve this?
  • Does your result signal have more error than the original case? Can you think of ways to reduce the error maintaining the bit rate to a 50% level.

There are 32 levels (with values from 0 to 31) with 0 corresponding to (0,-3.75], and 31 corresponding to (3.75, 4] . If the input values is x, then the quantized value should be

Round (((x – (-3.75)) / 8) * 32 ) which is round(((x+3.75)/8)*32).

The intervals thus correspond to

22, 24, 24, 28, 28, 28, 25, 26, 26, 26, 21, 19, 20, 20, 22, 24, 24, 24, 23, 24, 20, 16, 10, 10, 8, 11, 6, 9, 9, 12, 15, 19

32 intervals, therefore each value needs 5 bits. Total bits = 32 x5 = 160 bits

Using DPCM we have

22, 2, 0, 4, 0, 0, -3, 1, 0, 0, -5, -2, 1, 0, 2, 2, 0, 0, -1, 1, -4, -4 -6, 0, -2, 3, -5, 3, 0, 3, 3, 4.

To encode the sequence: 102 bits

5) 102/160 = 0.6375

  1. [R05] Normally quantization intervals are equi-spaced which results in uniformly quantized signals. This is the case with most signals used. However, now you decide to venture out and design a non – uniform quantizer which results in unequal quantization intervals.
  2. Explain the benefit of such a design giving an example application where it would be of advantage.
  3. Can you think of a mathematically defined non-uniform quantization function?

Since the quantization intervals are distributed non uniformly – so is the error. The error is proportional to the quantization interval, so smaller the interval, small is the error. All signals have a certain dynamic range (min value – max value), however, if the signal has a statistical behavior of falling within a fixed sub range of this larger dynamic range, then you could define quantization intervals non uniformly such that the intervals in more commonly occurring area are smaller than the other less commonly occurring areas. This reduces the overall error.

An example where this is used is in the quantization of human speech signals. Though human larynx are capable of producing larger decibel ranges, most conversations (over the telephone) occur in lower decibel ranges. Hence standards such as u-law or A-law make use of non-uniform quantization. This is also called companding.

Log(x) where x is the variable describing the input range.

ax , for some constant a is also a good non uniformquantizer.

  1. [R07] Temporal aliasing can be observed when you attempt to record a rotating wheel with a video camera. In this problem, you will analyze such effects. Let’s say we have a car moving, and the wheels of the car appear to be rotating at a speed different from the speed of the car (or even in a direction different from the motion of the car). Suppose a car traveling at 36 km/hr is being captured by a video camera. The tires have a diameter of 0.4244 meters. Each tire has a white mark to gauge the speed of rotation.
  • Determine the Nyquist sampling rate (film frame rate) for the tire rotation.
  • If the film is being shot at 24 frames per second (fps), at what speed (in rotations per second) will the tires appear to be rotating?
  • How about at 12 fps? 7.5 fps? 6 fps?
  • 24 fps is fairly standard for digital video. What should be the frequency for the tire rotation at this sampling rate to not have aliasing? How fast can the car be traveling (in km/hr) before aliasing occurs?

Speed of Car = 10m/s. Diameter of tyres = 0.4244m

One rotation covers 3.14*0.4244 =1.3326m and hence One Rotation takes = 0.13326 sec

Hence, speed of rotation = 1/0.13326 = 7.5 rot/s (approx)

Hence, Nyquist sampling Frequency of rotation = 2F =15 rot/sec (Hz)

24 fps > 15 fps (Nyquist freq), and therefore no aliasing seen.

Hence the wheel appears to turn in clockwise(forward) direction at same speed.

Speed of rotation shall be = 7.5 rot/sec

At 12 Fps, - The film covers 7.5*360 degree rotation in 12 frames,

Therefore the degree of turn per frame = 7.5*30 = 225(360>225>180)

Hence the wheel appears to turn in anti-clockwise (backward) direction,

At a speed covering (360-225) = 135 degree turn per frame.

Hence a total turn of 135*12 degrees per second = 135*12/360 rot/sec

Speed of rotation shall be = 4.5 rot/sec (in opposite direction than direction of ACTUAL travel)

At 7.5 Fps, - The film covers 7.5*360 degree rotation in 7.5 frames,

Therefore the degree of turn per frame = 7.5*360/7.5 = 360

Since this is exactly one rotation, the wheel will appear to be stationary.

At 6 Fps - The film covers 7.5*360 degree rotation in 6 frames,

Therefore the degree of turn per frame = 7.5*60 = 450(540>450>360)

Hence the wheel appears to turn in clockwise(forward) direction,

At a speed covering (450-360) = 90 turn per frame

Hence a total turn of 90*6 degrees per second = 540/360 rot/sec

Speed of rotation shall be = 1.5 rot/sec (in same direction as actual travel)

\

Max frequency not to have aliasing is 24/2 = 12 rot/sec.

At this rate, distance covered per second is 12 * 1.3326 m. Therefore, 15.9912 m/sec = 57.57 km/hr

  1. [R05] You are asked to design anti-aliasing filters for i)FM Radio, ii) CD Recording and ii) Telephone System. The corresponding sampling rates are given in a table located in the text. What will be typical filter design requirements for these applications?
  1. [R04] Note – you may need some theory from the next chapter to answer this question. Suppose a camera has 450 lines per frame, 520 pixels per line, and 25 Hz frame rate. The color sub-sampling scheme is 4:2:0, and the pixel aspect ratio is 16:9. The camera uses interlaced scanning, and each sample of Y, Cr, Cb is quantized with 8 bits.
  • What is the bit-rate produced by the camera?
  • Suppose we want to store the video signal on a hard disk, and, in order to save space, re-quantize each chrominance (Cr, Cb) signals with only 6 bits per sample. What is the minimum size of the hard disk required to store 10 minutes of video?
  • Repeat the exercise (both questions) assuming color sub sampling scheme 4:2:2.
  1. 70.2 Mbps,
  2. 3.95 GBytes,
  3. 93.6 Mbps 5.265 GBytes

Programming Assignments

  1. [R05] Aliasing effects are observed for all kinds of media types. Here, we want to study aliasing effects in images similar to the some of the examples seen in the text. Write a simple program to create a radial pattern of circles. A pattern of circles is centered at the center of the image and has two parameters describing it – M and N where M is the thickness of each circle in pixels and N is the difference between their successive radii in pixels.

Here is two example image for M = 1, N = 5, and M = 4, N=10 respectively

Start with an original image is 512 x 512 with an initial white background. Here are the steps you need to perform.

  • Create a radial pattern of black circles with M and N as properties described above
  • Implement a subsampling routine to subsample the image by K. When you sub sample by K, your image size will be 512/K by 512/K. eg For K = 4, you image size will be 64x64.
  • You sub sampling procedure above will cause aliasing artifacts. Implement an anti aliasing routine that will minimize such artifacts (eg a low pass averaging filter with a kernel of 3x3).

Perform the above steps for

1)M = 1, N = 4, K=2 and K=4

2)M = 3, N = 10, K=2 and K= 4

3)M = 3, N = 5, K=2 and K= 4

Play around with the parameters and give a brief write up on how aliasing effects vary with M, N and K. Specifically include comments on when one is allowed to vary with the others remaining constant.

  1. [R06] In the previous programming assignment we studied about aliasing effects. Here you will adapt the same program to understand Moire patterns. The previous assignemt took two parameters as input M, and N, where M is the thickness of each circle in pixels and N is the difference between their successive radii in pixels. Modify this program to take another set of parameters DX and DY. The DX and DY specify the offsets relative to the center at which you will draw another set of concentric circles defined by M and N.
  • Modify the code to take DX, DY as input and show two sets of concentric circles superimposed. The center of the first set is the image center and the center of the second set is offset DX, DY relative to the first center.
  • Observe the patterns perceived by varying DX, DY, M and N. For a fixed M and N, if DX and DY are allowed to vary, how do the patterns change? You should add user interfacing to allow you change DX DY interactively, that is, you should be able to interactively superimpose the two sets of concentric circles for a given M,N and see the Moire pattern effects
  • Comment on your observations of how these patterns are formed by varying M,N, DX, DY
  • Write a anti aliasing filter to decrease the effect of the observed Moire patterns.
  1. [R06] In this assignment you will study about temporal sampling and aliasing effects in a sequence of images of a revolving whee. You will have to implement a program that will take two parameters as input - m and n where m is the rotation speed of the wheel (m revolutions per second) and n is the refresh rate for display (n frames a second). Here is a step-by-step description of what you are required to implement.
  • Write a program that displays at the refresh rate. This means you will have to draw an image, clear it and draw the next image every 1/n second.
  • Implement a way to draw a wheel (code given) rotated about its center according to its speed at every frame
  • What happens for a constant m as you vary n and vice versa?
  • Suppose that the value of m is 20 revolutions per second. What should be the value of n such that the wheel appears not to move?

Multimedia: Past, Present and FutureHavaldar & Medioni

1 - 1