[FFmpeg-user] Questions about libavfilter/vf_mpdecimate
范正源
francisowo at 163.com
Sat Jul 24 20:23:13 EEST 2021
Hi,
I'm reading the source code of libavfilter/vf_mpdecimate.c, and I have some questions about function diff_planes().
In the picture below, the questions are labeled beside the code.
# Question 1:
My first question is about the start value of variable ‘x’ in the loop.
In function diff_planes(), there's a loop which computes difference for blocks of 8x8 bytes.
Why does 'x' start at 8 in the loop? // for (x=8; x < w-7; x+=4)
If 'x' starts at 8, the loop won't compare the left 8 cols of two planes, so why doesn't 'x' start at 0?
# Question 2:
Another question is about the parameter 'frac'.
In the document, it describes: "A frame is a candidate for dropping if no 8x8 blocks differ by more than a threshold of hi, and if no more than frac blocks (1 meaning the whole image) differ by more than a threshold of lo."
From the code, we can see that the block size is 8x8 and the step is 4. // y+=4, x+=4
Therefore, the loop has to compute (w/4-1)*(h/4-1) SADs (if 'x' starts at 0, not 8).
If SAD > lo, then c++. If c > t, then return 1.
However, t = (w/16)*(h/16)*frac. It indicates that the block number here is (w/16)*(h/16), not (w/4-1)*(h/4-1).
Why is the divisor 16? I'm really confused.
Can someone help me with these questions?
Thanks in advance.
Francis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Questions.png
Type: image/png
Size: 167248 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210725/4b18fb01/attachment.png>
More information about the ffmpeg-user
mailing list