<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="margin:0;"><span style="color: rgb(51, 51, 51); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;">Hi,</span></div><div style="margin:0;">I'm reading the source code of <b>libavfilter/vf_mpdecimate.c</b>, and I have some questions about function <b>diff_planes</b>().</div><div style="margin:0;"><div style="margin: 0px;">In the picture below (in the attachment), the questions are labeled beside the code.</div><div style="margin: 0px;"><img src="cid:22c24c2b$1$17ab99e9cfa$Coremail$francisowo$163.com" orgwidth="875" orgheight="729" data-image="1" style="width: 619px; height: 515px; border: none;"></div></div><div style="margin:0;"><b><br></b></div><div style="margin:0;"><b># Question 1:</b></div><div style="margin:0;">My first question is about the <b>start value of variable ¡®x¡¯</b> in the loop.</div><div style="margin:0;">In function <b>diff_planes</b>(), there's a loop which computes difference for blocks of 8x8 bytes.</div><div style="margin:0;">Why does 'x' <b>start at 8</b> in the loop? <u>// for (</u><b><u>x=8</u></b><u>; x < w-7; x+=4)</u></div><div style="margin:0;">If 'x' starts at 8, the loop won't compare the left 8 cols of two planes, so why doesn't 'x' <b>start at 0</b>?</div><div style="margin:0;"><b><br></b></div><div style="margin:0;"><b># Question 2:</b></div><div style="margin:0;">Another question is about the parameter <b>'frac'</b>.</div><div style="margin:0;">In the document, it describes: <u><i>"A frame is a candidate for dropping if no 8x8 blocks differ by more than a threshold of </i></u><b><u><i>hi</i></u></b><u><i>, and if no more than </i></u><b><u><i>frac</i></u></b><u><i> blocks (1 meaning the whole image) differ by more than a threshold of </i></u><b><u><i>lo</i></u></b><u><i>."</i></u></div><div style="margin:0;">From the code, we can see that the <b>block size is 8x8</b> and the <b>step is 4</b>. <u>// y+=4, x+=4</u></div><div style="margin:0;">Therefore, the loop has to compute <u><b>(w/4-1)*(h/4-1)</b></u> SADs (if 'x' starts at 0, not 8).</div><div style="margin:0;">If SAD > lo, then c++. If c > t, then return 1.</div><div style="margin:0;">However, t = <u style="font-weight: bold;">(w/16)*(h/16)*frac</u>. It indicates that the block number here is <u style="font-weight: bold;">(w/16)*(h/16)</u>, not <u><b>(w/4-1)*(h/4-1)</b></u>.</div><div style="margin:0;">Why is the divisor <b>16</b>? I'm really confused.</div><div style="margin:0;"><br></div><div style="margin:0;">Can someone help me with these questions?</div><div style="margin:0;">Thanks!</div><div style="margin:0;">Francis</div><div style="margin:0;"><br></div></div></div></div><br><br><span title="neteasefooter"><p> </p></span>