diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-09-23 15:16:09 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-09-23 15:16:09 +0000 |
commit | 693b0e1d66e08aec96669cb596acb545643992ea (patch) | |
tree | 9d6b67777006a35c8d667b005264d881bf8416f3 /libavcodec | |
parent | c5d309f2d5f6b04ff68e121302a9913b70dac9c1 (diff) | |
download | ffmpeg-693b0e1d66e08aec96669cb596acb545643992ea.tar.gz |
fixing variance scaling for b frames (messed adaptive quants up)
cliping too long MVs in b frames instead of setting them to 0
Originally committed as revision 965 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/motion_est.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index d4ee88bf6f..c59e06b48a 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1546,7 +1546,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s, score=fbmin; type= MB_TYPE_BIDIR; } - score= (score*score)>>8; + score= (score*score + 128*256)>>16; s->mc_mb_var_sum += score; s->mc_mb_var[mb_y*s->mb_width + mb_x] = score; //FIXME use SSD } @@ -1698,18 +1698,15 @@ void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, i int xy= (y+1)* (s->mb_width+2)+1; int i= y*s->mb_width; for(x=0; x<s->mb_width; x++){ - if(s->mb_type[i]&type){ - if( fcode_tab[mv_table[xy][0] + MAX_MV] > f_code - || fcode_tab[mv_table[xy][0] + MAX_MV] == 0 - || fcode_tab[mv_table[xy][1] + MAX_MV] > f_code - || fcode_tab[mv_table[xy][1] + MAX_MV] == 0 ){ - if(s->mb_type[i]&(~type)) s->mb_type[i] &= ~type; - else{ - mv_table[xy][0] = 0; - mv_table[xy][1] = 0; - //this is certainly bad FIXME - } - } + if( fcode_tab[mv_table[xy][0] + MAX_MV] > f_code + || fcode_tab[mv_table[xy][0] + MAX_MV] == 0){ + if(mv_table[xy][0]>0) mv_table[xy][0]= (16<<f_code)-1; + else mv_table[xy][0]= -(16<<f_code); + } + if( fcode_tab[mv_table[xy][1] + MAX_MV] > f_code + || fcode_tab[mv_table[xy][1] + MAX_MV] == 0){ + if(mv_table[xy][1]>0) mv_table[xy][1]= (16<<f_code)-1; + else mv_table[xy][1]= -(16<<f_code); } xy++; i++; |