[FFmpeg-devel] ZMBV Improved Motion Estimation
Jason Garrett-Glaser
darkshikari
Sun May 11 14:07:01 CEST 2008
2008/5/8 Michael Niedermayer <michaelni at gmx.at>:
> 16774286 2008-05-08 23:20 capcom-h1-i256.avi
> 793356 2008-05-08 23:01 crusher-h1-i256.avi
> 2288290 2008-05-08 23:24 float-h1-i256.avi
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
Index: libavcodec/zmbvenc.c
===================================================================
--- libavcodec/zmbvenc.c (revision 13112)
+++ libavcodec/zmbvenc.c (working copy)
@@ -62,13 +62,16 @@
*/
static inline int block_cmp(uint8_t *src, int stride, uint8_t *src2,
int stride2, int bw, int bh)
{
- int sum = 0;
+ int sum = 0, zerocount = 0;
int i, j;
uint8_t histogram[256]={0};
for(j = 0; j < bh; j++){
- for(i = 0; i < bw; i++)
- histogram[src[i] ^ src2[i]]++;
+ for(i = 0; i < bw; i++){
+ int n = src[i] ^ src2[i];
+ histogram[n]++;
+ zerocount+=!n;
+ }
src += stride;
src2 += stride2;
}
@@ -76,7 +79,7 @@
for(i=1; i<256; i++)
sum+= score_tab[histogram[i]];
- return sum;
+ return sum + 256*bw*bh - zerocount*256;
}
/** Motion estimation function
Dark Shikari
More information about the ffmpeg-devel
mailing list