I am trying to implement a research paper just to verify my results. I have shared the code (written by me) and the description of the process given in the research paper. Unfortunately my results are a bit different from his results that means I am doing something wrong. Kindly guide me in the right direction.
Here is the link to the paper: A parametric model for perceptual video quality estimation.
I have tried for mobile video sequence which can be downloaded from the following link: Yuv video sequences.
He gets 3.600 as SAD/pixel value while I am getting around 1.
Code:
fileName = 'mobile_cif.yuv';
width=352;
height=288;
numFrames=30;
SAD=0;
%for loop to traverse & process from frame '1' to 'last' frames
for t = 1 : numFrames
if t < numFrames %(Need to traverse to n-1 frames)
result=loadFileYuv(fileName,width,height,t);
currFrame = result.cdata; %reading Current frame
result=loadFileYuv(fileName,width,height,t+1);
nextFrame = result.cdata; %reading Next frame
% First, take the absolute value of the difference at each pixel
myAbsDiff = abs(double(currFrame) - double(nextFrame));
% Then, sum over all pixels
out = sum(myAbsDiff(:));
out=out/(width*height); %(Taking Average with respect to pixel)
out=out/64;%(Dividing By Block size to normalize)
disp(out);
SAD=SAD+out;
else
continue;
end
end
disp(SAD/numFrames); %(Taking Average with respect to Frames)
Process Description
Sum of absolute difference (SAD) is a simple video quality metric used for block comparison and for moving vectors calculations. Each frame is divided into small blocks (i.e. $8 \times 8$ pixels) and for every block in one frame the most similar (minimum SAD) block in next frame is find. This minimum sum of absolutes differences is assigned as the SAD for each block in each frame (up to the $n − 1$ frame). Then all the SAD values are averaged for each frame and for all the frames in the clip, and divided by the block area, for normalization.