diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2002-10-31 00:48:05 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2002-10-31 00:48:05 +0000 |
commit | af27aea9226bea67f2730fd334c09cd7724d151b (patch) | |
tree | 66c97ab70d32910c2315ad8bc81c940711fb90bb /libavcodec | |
parent | 4707cb07e1ceb0d1a518eda08fbf0d4035ea7745 (diff) | |
download | ffmpeg-af27aea9226bea67f2730fd334c09cd7724d151b.tar.gz |
fixing another assert q>0.0 issue caused by variance < 0, this fix allso changes the inter/intra decission very slightly -> all regression checksums need to be updated
Originally committed as revision 1122 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/motion_est.c | 5 | ||||
-rw-r--r-- | libavcodec/mpegvideo.c | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 547c619526..e94657dcaa 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1135,14 +1135,13 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, sum = pix_sum(pix, s->linesize); - sum= (sum+8)>>4; - varc = (pix_norm1(pix, s->linesize) - sum*sum + 500 + 128)>>8; + varc = (pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8; vard = (pix_norm(pix, ppix, s->linesize)+128)>>8; //printf("%d %d %d %X %X %X\n", s->mb_width, mb_x, mb_y,(int)s, (int)s->mb_var, (int)s->mc_mb_var); fflush(stdout); s->mb_var [s->mb_width * mb_y + mb_x] = varc; s->mc_mb_var[s->mb_width * mb_y + mb_x] = vard; - s->mb_mean [s->mb_width * mb_y + mb_x] = (sum+7)>>4; + s->mb_mean [s->mb_width * mb_y + mb_x] = (sum+128)>>8; s->mb_var_sum += varc; s->mc_mb_var_sum += vard; //printf("E%d %d %d %X %X %X\n", s->mb_width, mb_x, mb_y,(int)s, (int)s->mb_var, (int)s->mc_mb_var); fflush(stdout); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4503e3e1e7..1e68e03e11 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -2590,11 +2590,10 @@ static void encode_picture(MpegEncContext *s, int picture_number) int varc; int sum = pix_sum(pix, s->linesize); - sum= (sum+8)>>4; - varc = (pix_norm1(pix, s->linesize) - sum*sum + 500 + 128)>>8; + varc = (pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8; s->mb_var [s->mb_width * mb_y + mb_x] = varc; - s->mb_mean[s->mb_width * mb_y + mb_x] = (sum+7)>>4; + s->mb_mean[s->mb_width * mb_y + mb_x] = (sum+128)>>8; s->mb_var_sum += varc; } } |