1. Homepage
  2. Programming
  3. CSCI 576 Multimedia Systems Design - Assignment 1: Quantization and Subsampling

CSCI 576 Multimedia Systems Design - Assignment 1: Quantization and Subsampling

Engage in a Conversation
CSCI 576USCMultimedia Systems DesignUniversity of Southern CaliforniaC++JavaYUVQuantizationSubsampling

  CourseNana.COM

CS 576 – Assignment 1 CourseNana.COM

Instructor: Parag Havaldar CourseNana.COM

  CourseNana.COM

Assigned on 01/25/16, CourseNana.COM

Solutions due on 02/12/16 by midday 12 pm noon CourseNana.COM

Late Policy: None, unless prior arrangement has been made CourseNana.COM

  CourseNana.COM

Written Part: (20 points) CourseNana.COM

Each question has marks displayed CourseNana.COM

  CourseNana.COM

Q.1 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 CourseNana.COM

·      What is the bit-rate produced by the camera? (2 points) CourseNana.COM

·      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 (3 points) CourseNana.COM

  CourseNana.COM

Q.2  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). CourseNana.COM

·     Write down the quantized sequence. (4 points) CourseNana.COM

·     How many bits do you need to transmit it? (1 points) CourseNana.COM

  CourseNana.COM

Q.3 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.  Assume there is a car moving at 36 km/h and you record the car using a film, which traditionally record at 24 frames per second. The tires have a diameter of 0.4244 meters. Each tire has a white mark to gauge the speed of rotation. CourseNana.COM

  • If you are watching this projected movie in a theatre, what do you perceive the rate of tire rotation to be in rotations/sec? (5 points)
  • If you use your camcorder to record the movie in the theater and your camcorder is recording at one third film rate (i.e. 8 fps), at what rate (rotations/sec) does the tire rotate in your video  recording (5 points)


Programming Part: (80 points) CourseNana.COM

This assignment will help you gain a practical understanding of Quantization and Subsampling to analyze how it affects visual media types like images and video. CourseNana.COM

We have provided you with a Microsoft Visual C++ project and a java class to display two images side by side (left – original and right – output of your program). Currently both left and right correspond to the same input image. You are free to use this display program as a start, or write your own in a language of your choice. CourseNana.COM

  CourseNana.COM

Input to your program will be five parameters where CourseNana.COM

  • The first parameter is the name of the image, which will be provided in an 8 bit per channel RGB format (Total 24 bits per pixel). You may assume that all images will be of the same size for this assignment, more information on the image format will be placed on the class website
  • The next three parameters control the subsampling of your Y U and V spaces respectively. For sake of simplicity, we will follow the convention that subsampling occurs only along the width dimension and not the height. Each of these parameters can take on values from 1 to n for some n, 1 suggesting no sub sampling and n suggesting a sub sampling by n
  • The last parameter Q controls quantization of your R, G and B values. It is a number that specifies how many different values each channel can have

  CourseNana.COM

  CourseNana.COM

To invoke your program we will compile it and run it at the command line as CourseNana.COM

  CourseNana.COM

YourProgram.exe C:/myDir/myImage.rgb Y U V Q CourseNana.COM

  CourseNana.COM

where Y U V Q are the parameters as described above. Example inputs are shown below and this should give you a fair idea about what your input parameters do and how your program will be tested. CourseNana.COM

  CourseNana.COM

1.     YourProgram,exe image1.rgb 1 1 1 256

There are 256 values (8 bits) per R G and B, and no subsampling in the Y, U or V -> which implies that the output is the same as the input CourseNana.COM

  CourseNana.COM

2.     YourProgram,exe image1.rgb 1 1 1 64

There are 64 values (6 bits) per R G and B and no subsampling in Y, U or V. CourseNana.COM

  CourseNana.COM

3.     YourProgram,exe image1.rgb 1 2 2 256

There are 256 values (8bits) per R, G and B (no additional color quantization), but the U and V channels are subsampled by 2. No subsampling in the Y channels. CourseNana.COM

  CourseNana.COM

Now for the details - In order the display an image on a display device, the normal choice is an RGB representation. This is what the format of the input image is. However, for YUV processing reasons, you will have to convert the image in YUV space, process your subsampling and reconvert it back to RGB space to show the output to display. Here is the dataflow pipeline that illustrates all the steps. CourseNana.COM

  CourseNana.COM

  CourseNana.COM


CourseNana.COM


Conversion of RGB to YUV

Given R, G and B values the conversion from RGB to YUV is given by CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Y                     0.299   0.587   0.114               R CourseNana.COM

U          =         0.596   -0.274   -0.322            G CourseNana.COM

V                     0.211   -0.523    0.312`           B CourseNana.COM

  CourseNana.COM

Remember that if RGB channels are represented by n bits each, then the YUV channels are also represented by the same number of bits. CourseNana.COM

RGB values are positive, but YUV can take negative values! CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Conversion of YUV to RGB

Given R, G and B values the conversion from RGB to YUV is given by CourseNana.COM

  CourseNana.COM

R                     1.000    0.956    0.621             Y CourseNana.COM

G          =         1.000   -0.272   -0.647            U CourseNana.COM

B                     1.000   -1.106    1.703             V CourseNana.COM

  CourseNana.COM

Remember that if YUV channels are represented by n bits each, then the RGB channels are also represented by the same number of bits. CourseNana.COM

YUV channel can have negative values, but RGB is always positive! CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Sub sampling of YUV & processing

Sub sampling, as you know will reduce the number of samples for a channel. CourseNana.COM

E.g. for the input parameters CourseNana.COM

  CourseNana.COM

            YourProgram.exe image1.rgb 1 2 2 256

  CourseNana.COM

In this example, the YUV image is not subsampled in Y, but by 2 in U and by 2 in V resulting in CourseNana.COM

   CourseNana.COM

When converting back to the RGB space, all the YUV channels have to be of the same size. However the sampling throws away samples, which have to be filled in appropriately by average the neighborhood values. For example, for the above case a local image area would look like CourseNana.COM

  CourseNana.COM

Y11U11V11     Y12                     Y13U13V13    Y14           . . . . .         CourseNana.COM

line 1 CourseNana.COM

Y21U21V21     Y22               Y23U23V23    Y24           . . . . . CourseNana.COM

line 2 CourseNana.COM

Y31U31V31     Y32                Y33U33V33    Y34          . . . . . CourseNana.COM

line 3 CourseNana.COM

Y41U41V41     Y42                Y43U43V43    Y44         . . . . . CourseNana.COM

line 4 CourseNana.COM

  CourseNana.COM

The missing values may be filled in as CourseNana.COM

  CourseNana.COM

U12 = (U11 + U13)/2                              V12 = (V11 + V13)/2 CourseNana.COM

U14 = (U13 + U15)/2                              V14 = (V13 + V15)/2 CourseNana.COM

…. And so on, to get CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Y11U11V11     Y12U12V12     Y13U13V13    Y14U14V14 . . . . .         CourseNana.COM

line 1 CourseNana.COM

Y21U21V21     Y22U22V22     Y23U23V23    Y24U24V24 . . . . . CourseNana.COM

line 2 CourseNana.COM

Y31U31V31     Y32U32V32     Y33U33V33    Y34U34V34 . . . . . CourseNana.COM

line 3 CourseNana.COM

Y41U41V41     Y42U42V42     Y43U43V43    Y44U44V44 . . . . . CourseNana.COM

line 4 CourseNana.COM

  CourseNana.COM

Note the samples that you take to fill in values will change depending on the subsampling parameters. The YUV components can now be converted to RGB space. CourseNana.COM

  CourseNana.COM

  CourseNana.COM

RGB Color Quantization. CourseNana.COM

Assume that the quantization levels are uniformly distributed. Initially we have 8 bits per pixel per channel to start with. So the Q input value to your program can take on values from the range 255 – 0. For instance CourseNana.COM

  • Q=256, implies 8 bits per channel or 256 possible values for each channel, so the output number of bits is same as input.
  • Q=8, implies 3 bits per channel or 8 possible values which may be 0, 31, 63, 95, 127, 159, 191, 223,
  • Q=64, implies 6 bits per channel or 64 possible values which may be 0, 3, 7, 11,  … 239, 243, 247, 251
  • Remember Q may not necessarily be a power of 2.

So design your quantization function accordingly. CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

What should you submit?

  • Your source code, and your project file or makefile, if any, using the submit program. Please do not submit any binaries. We will compile your program and execute our tests accordingly.
  • Along with the program, also submit an electronic document (word, pdf, pagemaker etc format) using the submit program that answers the fore-mentioned analysis questions. You may use any (or all) input images for this analysis.

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Analysis Question 1: CourseNana.COM

Subsampling obviously degrades the image quality. Here you are going to analyze this degradation. Can you formulate a way to quantify this degradation as an error number or error percentage? CourseNana.COM

Compute this value for output images where each input Y, U, V is individually varying while the other two remain constant.  (Assume Q is constant at 256). Plot your error metric values for each. CourseNana.COM

  • Keep U and V constant at 1, and vary Y to compute different image outputs. For each compute your error metric and finally plot all these values to get a distortion curve.
  • Repeat the above process to compute your distortion curve keeping Y and V constant at 1 and vary U.
  • Repeat the above process to compute your distortion curve keeping Y and U constant at 1 and vary V.

Do you see any patterns in the curves? CourseNana.COM

What conclusion(s) can you draw from your analysis? CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Analysis Question 2: CourseNana.COM

You will see that your analysis varies for different images. If you had to improve the quality of your results for each case above (Y varying but U, V constant) or (U varying but Y, V constant) or (V varying, but Y, U constant), what changes can you implement to your code and where can you implement them? CourseNana.COM

Can you make these changes and submit some output images with before and after the change? You may screen grab images and paste them into your document. Remember not to scale the images – that could introduce additional artifacts. CourseNana.COM

Note you do not want to submit the changed source code since we will not be able to test it. Your visual images along with explanations in your document should be fine. CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
CSCI 576代写,USC代写,Multimedia Systems Design代写,University of Southern California代写,C++代写,Java代写,YUV代写,Quantization代写,Subsampling代写,CSCI 576代编,USC代编,Multimedia Systems Design代编,University of Southern California代编,C++代编,Java代编,YUV代编,Quantization代编,Subsampling代编,CSCI 576代考,USC代考,Multimedia Systems Design代考,University of Southern California代考,C++代考,Java代考,YUV代考,Quantization代考,Subsampling代考,CSCI 576help,USChelp,Multimedia Systems Designhelp,University of Southern Californiahelp,C++help,Javahelp,YUVhelp,Quantizationhelp,Subsamplinghelp,CSCI 576作业代写,USC作业代写,Multimedia Systems Design作业代写,University of Southern California作业代写,C++作业代写,Java作业代写,YUV作业代写,Quantization作业代写,Subsampling作业代写,CSCI 576编程代写,USC编程代写,Multimedia Systems Design编程代写,University of Southern California编程代写,C++编程代写,Java编程代写,YUV编程代写,Quantization编程代写,Subsampling编程代写,CSCI 576programming help,USCprogramming help,Multimedia Systems Designprogramming help,University of Southern Californiaprogramming help,C++programming help,Javaprogramming help,YUVprogramming help,Quantizationprogramming help,Subsamplingprogramming help,CSCI 576assignment help,USCassignment help,Multimedia Systems Designassignment help,University of Southern Californiaassignment help,C++assignment help,Javaassignment help,YUVassignment help,Quantizationassignment help,Subsamplingassignment help,CSCI 576solution,USCsolution,Multimedia Systems Designsolution,University of Southern Californiasolution,C++solution,Javasolution,YUVsolution,Quantizationsolution,Subsamplingsolution,