diff options
author | rguyom <rguyom@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-04-06 23:37:56 +0000 |
---|---|---|
committer | rguyom <rguyom@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-04-06 23:37:56 +0000 |
commit | a19559f911411665afe3fb106486cf4dfbecb360 (patch) | |
tree | 94af7b5fffced02aa3329e58772b2ed1f1b68719 /libmpcodecs/ve_lavc.c | |
parent | dae951d466af113a15cc7da1100a101b96e5058e (diff) | |
download | mpv-a19559f911411665afe3fb106486cf4dfbecb360.tar.bz2 mpv-a19559f911411665afe3fb106486cf4dfbecb360.tar.xz |
Adaptive quantization support for "-lavcopts psnr" and "-lavdopts vstats".
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9866 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/ve_lavc.c')
-rw-r--r-- | libmpcodecs/ve_lavc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index b7e79a4ed4..8149dbf257 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -528,6 +528,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ static double all_frametime=0.0; AVFrame *pic= lavc_venc_context->coded_frame; double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0; + double quality=0.0; if(!fvstats) { time_t today2; @@ -543,10 +544,24 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ /*exit(1);*/ } } + + // average MB quantizer + { + int x, y; + int w = (lavc_venc_context->width+15) >> 4; + int h = (lavc_venc_context->height+15) >> 4; + int8_t *q = lavc_venc_context->coded_frame->qscale_table; + for( y = 0; y < h; y++ ) { + for( x = 0; x < w; x++ ) + quality += (double)*(q+x); + q += lavc_venc_context->coded_frame->qstride; + } + quality /= w * h; + } fprintf(fvstats, "%6d, %2.2f, %6d, %2.2f, %2.2f, %2.2f, %2.2f %c\n", lavc_venc_context->coded_frame->coded_picture_number, - lavc_venc_context->coded_frame->quality, + quality, out_size, psnr(lavc_venc_context->coded_frame->error[0]/f), psnr(lavc_venc_context->coded_frame->error[1]*4/f), |