Assignment 3: Spring 2020

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

ELEC S334

Signal Processing and Multimedia Technology

Assignment 3
Cut-off date: 20 November 2020

Spring 2020

Solution
Not all steps given. For reference only.

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 1


ELEC S334 Assignment 3 (2020) Cut-off date: 20 November 2020

The distribution of marks for this assignment is shown in the following table:
Question 1 2 3 4 Total
Percentage 25% 25% 25% 25% 100%

Question 1 [ 25 marks ]
+x

+y p3(x3, y3) p4(x4, y4)

p1(6, 9) p2(x2, y2)


9

(a) Refer to the coordinate system of the above image for spatial transformation. What are the
directions of positive x and positive y? [ 2 marks ]
Answer: Positive x points to right and positive y points downward.

(b) Determine the coordinates of p2, p3, and p4. [ 3 marks ]


Answer: p2(15, 9), p3(6, 5), p4(15, 5)

(c) The rectangle is translated to the position as shown in the dashed rectangle below.
[ 7 marks ]

+x

+y p3(x3, y3) p4(x4, y4)

p1(6, 9) p2(x2, y2)


9
p3’ (2, 12)

p1’ (x1’, y1’)

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 2


(i) Determine the equation pair of the translation.
Answer: x’ = x – 4 y’ = y + 7

(ii) Based on the translation equation, determine the coordinates of p1’.


Answer: p1’ is (2, 16)

(d) Now, the rectangle is rotated by 30° anti-clockwise about p3’ as shown in the figure below.
Determine the coordinates of the four corners of the rectangle after the rotation. Show your
work. [ 8 marks ]

+x

+y p3(x3, y3) p4(x4, y4)

p1(6, 9) p2(x2, y2)


9

p3’ (2, 12)


30°
P4’ (x4’, y4’)

p1’ (x1’, y1’) p2’ (x2’, y2’)


Answer:
Corner After translation
x’ y’
p1’ 4.000 15.464
p2’ 11.794 10.964
p3’ 2.000 12.000
p4’ 9.794 7.500

(e) What is aliasing in image processing? What is an effective way to reduce the effect of this
type of aliasing? [ 5 marks ]

Answer:
• Aliasing appear when there is insufficient source image pixel samples (i.e. under-sampling)
• For example, when scale image by a factor > 1, the number of destination pixel is more than
the number of source samples (mapping a pixel in original image to multiple pixels)
• Result in blocky effect (poor quality)
• Use interpolation to reduce aliasing effect

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 3


Question 2 [ 25 marks ]
(a) Describe the steps in MP3 encoding and explain how frequency masking is applied in MP3
encoding. [ 5 marks ]

Answer: The MP3 encoding processes are as follows:


• Use filters to divide the PCM audio signal into frequency bands that approximate 32
critical bands
• Determine the amount of frequency masking for each band caused by nearby masking
bands, and derive the corresponding masking curves
• If the power in a band is below the masking threshold, ignore the band (no value is saved)
• Otherwise, determine the number of bits needed to represent the coefficient such that
noise introduced by quantization is below the masking effect and cannot be perceived

(b) What are the frequency masking bands for the following two (2) cases? Show your work.
[ 5 marks ]
(i) A loud tone at 1.3 kHz
Answer: 1289.49 Hz to 1310.51 Hz
(ii) A loud tone at 220Hz
Answer: 217.8 Hz to 222.2 Hz

(c) A signal, which has amplitudes ranging from 0 to 7, is quantized according to the µ-law.
What are the results for companding the values 0, 1, 2, 3, 4, 5 and 6 for µ = 40, and
µ = 180. Present you answers in a table. Plot graphs to illustrate the µ-law equation outputs
versus inputs for µ = 40 and µ = 180 on a single graph. Show your work.
x V u1 u2 y1 y2
0 7 40 180 0.000 0.000
1 7 40 180 3.589 4.424
2 7 40 180 4.750 5.332
3 7 40 180 5.463 5.869
4 7 40 180 5.979 6.252
5 7 40 180 6.384 6.550
6 7 40 180 6.717 6.794
[ 10 marks ]

8.000
6.000
4.000
2.000
0.000
0 2 4 6 8

y1 y2
x

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 4


(d) Why is the µ-law instead of the linear quantizer is used for audio signal quantization?
[ 5 marks ]
Answer:
• The Quantization step sizes vary logarithmically
• Smaller step sizes for quieter audio signals
• Results in larger effective quantization SNR

Question 3 [ 25 marks ]

This question requires you to use Octave. You may search for information on the corresponding
functions in Octave Help. Show all codes.

Download the file bird.jpg from the OLE under Assignment 3 in the “Assignment Files”
Section.

(a) Using Octave, read and display the file bird.jpg. Screen capture the display from Octave,
and submit it as the answer to this part. [ 3 marks ]

(b) Using Octave, determine the resolution of bird.jpg. Show your code. [ 3 marks ]

(c) Apply 51x51 filter with Octave to blur bird.jpg. Show your image result and the code.
[ 5 marks ]

(d) Use Octave to generate a 21´21 kernel matrix of LoG filter with sigma = 0.58824 and
multiplication factor =1.0. [ 6 marks ]

(e) Combine the LoG filter you generated in Part (d) with original image to create sharpening
filter. Apply the filter on bird.jpg with Octave. Describe what you observed. Capture the
resulting image and submit it as the answer to this part. [ 8 marks ]

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 5


Question 4 [ 25 marks ]

(a) With the aid of appropriate illustrations and in your own words, briefly describe any two
(2) common types of multiplier effect that are used in audio programming. [ 4 marks ]
Answer: Fade-in, fade-out, tremolo, or noise gating

(b) Explain, in terms of the amplitude histogram, how the error signal can lead to data
compression in predictive coding. Include diagram(s) to support your explanation.
[ 6 marks ]
Answer:

Amplitude histogram for the difference (error) signal is more concentrated (narrower) around
zero; whereas amplitude histogram for the original signal is less concentrated (wider). Since
lower amplitude values occur frequently in the difference signal, shorter code word can be
assigned to these values. Higher amplitudes, which rarely occur, are assigned longer code
words. As a result, less bits is needed for representing the error signal.

(c) A DPCM encoder is to be constructed using the following predictor:


1
𝑠̂! = [2𝑠̌!"# + 𝑠̌!"$ + 𝑠̌!"% ]
4
The quantizer gives a 3-bit output code according to the table below:

Error 𝒆𝒊 Quantized Error 𝒆,𝒊 Output Code


5 ≤ 𝑒! 6 011
3 ≤ 𝑒! <5 4 010
1 ≤ 𝑒! <3 2 001
-1 ≤ 𝑒! <1 0 000
-3 ≤ 𝑒! <-1 -2 111
-5 ≤ 𝑒! <-3 -4 110
-7 ≤ 𝑒! <-5 -6 101
𝑒! <-7 -8 100

Consider a sequence of samples [s1, s2, s3, s4, s5, s6] = [8.8, 10.2, 9.1, 12.5, 13.6, 14]. Given
the previous predictions (previous reconstructed values) were 𝑠̌!"$ = 𝑠̌!"# = 𝑠̌' = 10,
determine the list of output codes in tabulated form. [ 6 marks ]

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 6


Answer:
i si 𝒔0𝒊 𝒆𝒊 = 𝒔𝒊 + 𝒔0𝒊 𝒆,𝒊 𝒔,𝒊 = 𝒆,𝒊 + 𝒔0𝒊 Output Code
-2 10
-1 10
0 10
1 8.80 10.00 -1.20 -2 8.00 111
2 10.20 9.00 1.20 2 11.00 001
3 9.10 10.00 -0.90 0 10.00 000
4 12.50 9.75 2.75 2 11.75 001
5 13.60 11.13 2.48 2 13.13 001
6 14.00 12.00 2.00 2 14.00 001

(d) The previous reconstructed values were 𝑠̌!"$ = 𝑠̌!"# = 𝑠̌' = 10 , determine the list of
reconstructed values from the output code : 110101111010100111. Show your work in
tabulated form. [ 6 marks ]

Answer:
i Output Code 𝒔0𝒊 𝒆,𝒊 𝒔,𝒊 = 𝒆,𝒊 + 𝒔0𝒊
-2 10
-1 10
0 10
1 110 10.00 -4 6.00
2 101 8.00 -6 2.00
3 111 5.00 -2 3.00
4 010 3.50 4 7.50
5 100 5.00 -8 -3.00
6 111 1.13 -2 -0.88

(e) An audio CD contains 30 minutes 10 seconds of music. Assuming it is in stereo and every
sample is represented by two bytes, how many MB of audio data are stored in the CD?
Show your work. [ 3 marks ]

Answer: 304.5MB

[ End of Assignment 3 ]

Assignment 3 ELEC S334, Spr 2020 Pres. Solution 7

You might also like