diff options
author | Juanjo <pulento@users.sourceforge.net> | 2002-02-10 06:10:50 +0000 |
---|---|---|
committer | Juanjo <pulento@users.sourceforge.net> | 2002-02-10 06:10:50 +0000 |
commit | e03c341ef3d755c9779b39fe0851c58343c12906 (patch) | |
tree | 6d77b4e08554ec82eff0f4dd7c2595843e3268e2 /libavcodec/motion_est.c | |
parent | 37fbfd0a91fddc5e4fc1e94f74c0470adee8011d (diff) | |
download | ffmpeg-e03c341ef3d755c9779b39fe0851c58343c12906.tar.gz |
- More work on preliminary bit rate control, just to be able to get an
average variance for picture's MBs so we can adjust qscale on the MB layer.
Originally committed as revision 294 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r-- | libavcodec/motion_est.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 71a30dd260..8e215f9e9f 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -400,7 +400,7 @@ int estimate_motion(MpegEncContext * s, UINT8 *pix, *ppix; int sum, varc, vard, mx, my, range, dmin, xx, yy; int xmin, ymin, xmax, ymax; - + range = 8 * (1 << (s->f_code - 1)); /* XXX: temporary kludge to avoid overflow for msmpeg4 */ if (s->out_format == FMT_H263 && !s->h263_msmpeg4) @@ -458,9 +458,12 @@ int estimate_motion(MpegEncContext * s, vard = vard >> 8; sum = sum >> 8; varc = (varc >> 8) - (sum * sum); + + s->avg_mb_var += varc; + #if 0 - printf("varc=%d (sum=%d) vard=%d mx=%d my=%d\n", - varc, sum, vard, mx - xx, my - yy); + printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n", + varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); #endif if (vard <= 64 || vard < varc) { if (s->full_search != ME_ZERO) { |