1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ It'd be useful if you included a link to the paper, as well as an example of what you expected to get, and what you actually got. $\endgroup$ – MBaz Jun 4 '16 at 16:06
  • $\begingroup$ @MBaz I have added the links. $\endgroup$ – Safi Mustafa Jun 4 '16 at 16:51
  • $\begingroup$ Unfortunately my results are a bit different from his results that means I am doing something wrong not necessarily. Sometimes papers are wrong, sometimes you both can be right. But usually, yes, especially when I'm relatively new to a topic, I'd assume that I'm the one who did the mistake. $\endgroup$ – Marcus Müller Jun 4 '16 at 17:13
  • $\begingroup$ @MarcusMüller Yes I am a beginner in this field. I don't know how to achieve this "Each frame is divided into small blocks (i.e. 8 × 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)." $\endgroup$ – Safi Mustafa Jun 4 '16 at 17:33
1
$\begingroup$

I think there are multiple things to consider here:

1) Where are you dividing the image into 8x8 blocks? If you don't divide like this, then normalization by 64 is meaningless, and you are just computing SAD over all pixels. Maybe I'm seeing something wrong? You should do the normalized SAD in those small windows and then sum and normalize. And since 3600 is not a normalized value, I don't think that he normalizes.

2) Have you considered that your function for loading the video or the codec you use is actually giving you slightly different values than the one he uses? If your input is different, you will obviously get different results.

$\endgroup$
  • $\begingroup$ Also, the OP is not saving nextFrame to be currentFrame at the next iteration, do the code is just comparing frames pair wise. $\endgroup$ – Peter K. Jun 4 '16 at 23:28
  • $\begingroup$ @PeterK. In the next iteration t+1 becomes t, so the next frame is becoming current frame. $\endgroup$ – Safi Mustafa Jun 5 '16 at 5:06
  • $\begingroup$ @Tolga Bridal. Yes I was getting slightly different values so I divided the videos into frame. The author has not given any implementation of his procedure that I can match my code. Actually I don't know how to compare blocks once they are divided. $\endgroup$ – Safi Mustafa Jun 5 '16 at 5:08
  • $\begingroup$ @Tolga Bridal it's 3.600 not 3600 $\endgroup$ – Safi Mustafa Jun 5 '16 at 5:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.