Solution to Homework #2: MIDI, Video Processing, and DCT
Part 1:
-
Create a 10 second midi file using tool such as ablemidi. Save the midi file as <login>TheComposer.mid in your cs525 web page directory. Let us vote next wednesday on whose midi is the best. The winner gets some bonus point.
- Here is the list of midi files created by our composers:
Part2:
-
In year 2009, ATSC decides to start developing the next generation of HDTV standards with four times the resolution of today's HDTV system. Assume one simple solution is to increase the scanning lines from 1125 to 2250, other paramters (BW, CH, AR, FR, CV, Kf) not changed. What will be the RH and Rv numbers? What will be number of equivalent pixels in one frame? See pages 12 and 13 of video.pdf for the related formula.
Ans: RH=2*CH*Bw/(AR*NL*FR); Rv=Cv*Kf*NL; Np=RH*AR*Rv=2*CH*Cv*Kf*Bw/FR=2*C*Kf*Bw/FR
where RH*AR is the horizontal resolution with the picture width.
|
NTSC |
PAL |
HDTV |
hw2p2HTV |
| BW |
4.20 |
5.00 |
20.00 |
20.00 |
| NL |
525.00 |
625.00 |
1125.00 |
2250.00 |
| CH |
0.85 |
0.80 |
0.83 |
0.83 |
| AR |
1.33 |
1.33 |
1.78 |
1.78 |
| FR |
29.97 |
25.00 |
30.00 |
30.00 |
| RH |
340.34 |
384.00 |
553.33 |
276.67 |
|
|
|
|
|
| Cv |
0.92 |
0.92 |
0.96 |
0.96 |
| NL |
525 |
625 |
1125 |
2250 |
| Kf |
0.7 |
0.7 |
0.7 |
0.7 |
| Rv |
338.1 |
402.5 |
756 |
1512 |
|
|
|
|
|
| Np |
153425.4 |
206080 |
743680 |
743680 |
- What is the main difference between a composite TV system and a component TV system? (See Page 25 of video.pdf.)
Ans: The composite TV system merges the video signal into one channel to be transmitted. The component TV system use 3 separate channels to transmit the video signal and resulting in better quality.
- The video standards converts RGB signal to YIQ signal format. how can we take advantage of the YIQ format, in terms of video compression utilizing the human perception system? (See Page 26 of video.pdf).
Ans: When allocating bandwidth to these three video signal components, we can give more bandwidth to the luminance signal component (Y), less bandwidth to color components (IQ). Between I and Q compoments we can give more bandwidth to I.
Part3:
-
Login to a machine in EN136 Lab (with Maple software). Follow the instructions in http://cs.uccs.edu/~cs525/dct/dctmws.htm to generate the FDCT results their plots.
-
Create a 8x8 pixel data matrix of your choice using the fuction similar to
bwstrip:=proc(f)
local i,j;
for i from 1 to 8 do
for j from 1 to 8 do
if (i mod 4 > 1) then f[i,j]:=0;
else f[i,j]:=100;
fi;
od;
od;
end;
bwstrip(f);
-
It can be an area with gradient value changes from left to right, such as
gradient:=proc(f)
local i,j;
for i from 1 to 8 do
for j from 1 to 8 do
f[i,j]:=10*j;
fi;
od;
od;
end;
gradient(f);
-
execute getdctf(F); to obtain the 2D-DCT coefficients in F matrix.
-
Use print(F); to print the matrix and matrixplot(f, axes=BOXED); to plot the resulting matrix.
-
Submit the F matrix, the corresponding zig-zag sequence, and the Intermediate sequence for the above zig-zag sequence (values encoded using the VLI encoding), the compression ratio for this particular data set.
-
Ans:
Blocking: The following
are the 8x8 block data for a block in a Q plane. It has a vertical
line pattern.

- Fast DCT: For the above block,
what are the corresponding 8x8 transformed coefficients? Express
them in matrix format.
- Threshold and Quantization Step:
Round the coefficients to the nearest integer numbers.
- Zig-zag sequence: Describe the
order of coefficients after arranging them in the zig-zag sequence.
Ans: 400,
43, 4 zeros, 51, 8 zeros, 76, 12 zeros, 217, EOB
- Run length and VLI Coding: Encode
the intermediate sequence in (size, magnitude), (runlength, size, magnitude)+
symbol using runlength and VLI coding. Describe each data pattern of these
fields in its equivalent decimal value.

Ans: (9,
400), (0, 6, 43), (4, 6, 51), (8, 7, 76), (12, 8, 217), (0, 0)
4
+ 9 + 4+4+6 + 4+4+6 + 4+4+7
+ 4+ 4+ 8 + 4+4=80 bits
- Assume each of original source
8x8 block data is 8 bit, the runlength and size field are 4bits without
using VLC Huffman coding, magnitude fields are encoded with VLI code.
What is the compression ratio between the original data size and the encoded
intermediate encoded sequence?
Ans: 64*8:80=512:80=6.4
- If all elements of a JPEG block
have the same non-zero value. How many zeros will appear in the transformed
coefficients?
Ans: 63
zeros.
For gradient example,
gradient := proc(f)
local i, j;
for i to 8 do for j to 8 do f[i, j] := 10*j end do end do
end proc
> gradient(f); print(f); matrixplot(f, axes=BOXED);


> getdctf(F); print(F); matrixplot(F, axes=BOXED);

- Threshold and Quantization Step:
Round the coefficients to the nearest integer numbers.
- Zig-zag sequence: Describe the
order of coefficients after arranging them in the zig-zag sequence
Ans: 360, -182, 4 zeros, -19, 8 zeros, -6, 12 zeros, -1, EOB.
- Run length and VLI Coding: Encode
the intermediate sequence in (size, magnitude), (runlength, size, magnitude)+
symbol using runlength and VLI coding. Describe each data pattern of these
fields in its equivalent decimal value.
Ans: (9,360), (0, 8, 73), (4, 5, 12), (8, 3, 1), (12,1,0), (0,0).
The number of bits encoded:
4+9+ 4+4+8+ 4+4+5+ 4+4+3+ 4+4+1+4+4=70.
- Assume each of original source
8x8 block data is 8 bit, the runlength and size field are 4bits without
using VLC Huffman coding, magnitude fields are encoded with VLI code.
What is the compression ratio between the original data size and the encoded
intermediate encoded sequence?
Ans: 64*8:70=512:70=7.31