[FFmpeg-devel] ZMBV Improved Motion Estimation

Måns Rullgård mans
Mon May 12 00:41:56 CEST 2008


Michael Niedermayer <michaelni at gmx.at> writes:

> On Sun, May 11, 2008 at 05:21:57AM -0700, Jason Garrett-Glaser wrote:
>> >
>> > I call and raise.
>> >
>> > 16765242 May 11 05:03 ffmpeg2.CAPCOM.FLC.avi
>> > 792548 May 11 05:03 ffmpeg2.CRUSHER.FLC.avi
>> > 2285332 May 11 05:03 ffmpeg2.FLOAT.FLC.avi
>> 
>> Wow, this is what I get from coding at 4 in the morning.  I just
>> looked back at the code I wrote and realized that under your original
>> code, "histogram[0]" already tracks the zero count, making almost all
>> of my patch except the last line completely unnecessary.
>> 
>> It should work with something like this:
>> 
>> return sum + 256*bw*bh - histogram[0]*256;
>> 
>> But it doesn't.  I suspect I'm missing the obvious due to lack of
>> sleep.  I'll look back on this in the morning.
>
> probably its that histogram is uint8_t and thus 256==0

That's not the problem, or at least not all of it.  All operands are
promoted to at least int before any arithmetic is performed, so the
calculation above is done in 32 bits.  It could of course be truncated
if the return type is narrower, which I didn't bother checking.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list