Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

EE4414 Multimedia Communication Systems II

Experiment Two
Motion Estimation for Video Coding
Yao Wang and Xiaofeng Xu

1. Introduction
As you have learnt in the lecture, motion compensated prediction is an important step in
modern video coding techniques. For this experiment, you are provided with MATLAB
programs for performing motion estimation and motion compensation using different
techniques: EBMA (with integer or half-pel accuracy) and HBMA. You should go
through the MATLAB codes and try to understand how each algorithm is implemented.
You are also asked to run these programs with different parameter settings and record the
resulting prediction results and computation time. From these experiments, you should
appreciate the trade-off between prediction accuracy and computation time with different
algorithms and parameter settings. Another program applies block DCT on an image,
quantizes the DCT coefficients, and counts the number of non-zero coefficients after
quantization. The number of non-zero coefficients is a good indicator of the required bit
rate to code a frame. By applying this program to both an original video frame and the
prediction error, and comparing the resulting numbers of non-zero coefficients, you can
also appreciate the bit-rate savings by motion estimation.

2. Experiment

(1) EBMA_main.m is the main program for performing motion estimation using EBMA.
You can call fuction EBMA_integer(..) or EBMA_half(…) from EBMA_main.m to
execute integer or half-pel accuracy EBMA. It also calls for plot_MV_function(…),
which plots the estimated motion field. Go through these programs to understand the
underlying operations. Note you can view the Matlab programs using
MATLABEditor. Either click on those files, or uses the “open” menu in MATLAB
command window. In EBMA_main.m, which variables should be changed if you
want to do motion estimation between the following two frames: ‘foreman66.Y’ and
‘foreman69.Y’? What if you want to change the horizontal and vertical search range?
(2) Run the program EBMA_main as is, which calls EBMA_integer() function, and uses
a preset block size (=16) and search range (=16). Capture all images and record the
running time and PSNR. Save the predicted image into “pimg1”. (this can be done
simply at the command window by entering >>pimg1=pimg;)
(3) Now, open EBMA_main.m, change the line that calls EBMA_integer(..) to call
EBMA_half(…) instead. Save the file, and run EBMA_main again. Capture all
images and record the running time and PSNR. Save the predicted image into
“pimg2”. Compared to the results obtained using EBMA_integer(), which method is
more accurate, which method takes more time? Explain why.
(4) Edit the EBMA_main.m program to change horizontal search range into “8”. Also
change the EBMA_half(…) back to EBMA_integer(…) to run integer accuracy
EBMA. Save the program and run it again. Capture all images and record the running
time and PSNR. Save the predicted image into “pimg3”. Compared to the results
obtained using EBMA_integer() with search range =16, which method is more
accurate, which method takes more time? Explain why.
(5) The function video_coding(..) is intended to show the required bit rate and
reconstructed image, when we apply DCT to the prediction error image and quantize
the DCT coefficients. Instead of applying run-length coding to the quantized DCT
coefficients, the program simply counts the number of non-zero coefficients after
quantization. This number is a good indicator of the required bit rate for coding an
image. It also shows you the original image, DCT image without quantization,
quantized DCT image, and the reconstructed image from the quantized DCT
coefficients. As a comparison, it also applies the same processing on the original
image. Go through this program and try to understand the underlying processing. This
program uses a MATLAB function “blkproc(…)”, which performs the same function
on every block of an image, where the function can be a built-in MATLAB function
or a user-defined function. You can type “help blkproc” on the MATLAB command
window to learn more about how this function works.
(6) Run this program with the predicted image from using half-pel motion estimation
(step 3) as the input of this program. Note that in this case, you should use ‘img2’ for
the first parameter “Anchor_Img”, and use ‘pimg2’ for the second parameter
“Predict_Img”. Hint: To run the program, on the MATLAB command window, type
“video_coding (img2,pimg2)”. Enter “8” for the quantization factor. Capture all
images and record the percentage of non-zero coefficients and PSNRs. What is
percentage of non-zero coefficients when DCT is applied to the original image? What
is percentage when DCT is applied to the error image? Which way (DCT on original
image or DCT on error image) will lead to lower bit rate? Which method gives you
better reconstructed image? (both visually and in terms of PSNR). Explain why.
(7) Now repeat the same program with a high quantization factor (e.g. 80 or higher).
Capture all images and record the percentage of non-zero coefficients and PSNRs.
Which quantization factor gives you better reconstructed image quality? Which factor
gives you the smaller percentage of non-zero coefficients (correspondingly bit rate)?
And why?

3. Report
Your report should start with a general description of what you did in this experiment,
followed by the results and observations you obtained. You should answer all the
questions (written in italics in the proceeding instructions), with the corresponding
figures next to your answers.

You might also like