summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-03-30 21:33:14 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-03-30 21:33:14 +0000
commitff3dfbae1a74864841d0f9b8951ccf6b1013a7ae (patch)
treef9ab6a53859d8592c2c1b01113a9300c7438db04 /libavcodec/mpegvideo.c
parent14ae07d86cd96fab6127da222ce6ca76e12e1c9d (diff)
fixing 1/0
Originally committed as revision 370 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 55159c68c6..0887120b8f 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1995,7 +1995,7 @@ static int rate_estimate_qscale(MpegEncContext *s)
s->short_term_qcount++;
short_term_q= s->short_term_qsum/s->short_term_qcount;
- long_term_q= s->qsum/s->qcount*s->total_bits/wanted_bits;
+ long_term_q= s->qsum/s->qcount*(s->total_bits+1)/(wanted_bits+1); //+1 to avoid nan & 0
// q= (long_term_q - short_term_q)*s->qcompress + short_term_q;
q= 1/((1/long_term_q - 1/short_term_q)*s->qcompress + 1/short_term_q);
@@ -2016,8 +2016,8 @@ static int rate_estimate_qscale(MpegEncContext *s)
s->qcount++;
s->last_pict_type= s->pict_type;
-//printf("q:%d diff:%d comp:%f rate_q:%d st_q:%d fvar:%d last_size:%d\n", qscale, (int)diff, br_compensation,
-// rate_q, (int)short_term_q, s->mc_mb_var, s->frame_bits);
+//printf("q:%d diff:%d comp:%f rate_q:%d st_q:%f fvar:%d last_size:%d\n", qscale, (int)diff, br_compensation,
+// rate_q, short_term_q, s->mc_mb_var, s->frame_bits);
//printf("%d %d\n", s->bit_rate, (int)fps);
return qscale;
#else