CVS: main/libmpcodecs ve_lavc.c,1.58,1.59 vd_ffmpeg.c,1.84,1.85
Update of /cvsroot/mplayer/main/libmpcodecs In directory mail:/var/tmp.root/cvs-serv741/libmpcodecs Modified Files: ve_lavc.c vd_ffmpeg.c Log Message: Adaptive quantization support for "-lavcopts psnr" and "-lavdopts vstats". Index: ve_lavc.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_lavc.c,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- ve_lavc.c 22 Mar 2003 12:46:22 -0000 1.58 +++ ve_lavc.c 6 Apr 2003 23:37:56 -0000 1.59 @@ -528,6 +528,7 @@ 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 @@ /*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), Index: vd_ffmpeg.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_ffmpeg.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -r1.84 -r1.85 --- vd_ffmpeg.c 8 Mar 2003 02:05:14 -0000 1.84 +++ vd_ffmpeg.c 6 Apr 2003 23:37:56 -0000 1.85 @@ -550,6 +550,7 @@ static int frame_number=0; static double all_frametime=0.0; AVFrame *pic= avctx->coded_frame; + double quality=0.0; if(!fvstats) { time_t today2; @@ -567,10 +568,24 @@ } } + // average MB quantizer + { + int x, y; + int w = (avctx->width+15) >> 4; + int h = (avctx->height+15) >> 4; + int8_t *q = pic->qscale_table; + for( y = 0; y < h; y++ ) { + for( x = 0; x < w; x++ ) + quality += (double)*(q+x); + q += pic->qstride; + } + quality /= w * h; + } + all_len+=len; all_frametime+=sh->frametime; fprintf(fvstats, "frame= %5d q= %2.2f f_size= %6d s_size= %8.0fkB ", - ++frame_number, pic->quality, len, (double)all_len/1024); + ++frame_number, quality, len, (double)all_len/1024); fprintf(fvstats, "time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", all_frametime, (double)(len*8)/sh->frametime/1000.0, (double)(all_len*8)/all_frametime/1000.0); @@ -587,11 +602,14 @@ case FF_B_TYPE: fprintf(fvstats, "type= B\n"); break; + default: + fprintf(fvstats, "type= ? (%d)\n", pic->pict_type); + break; } - ctx->qp_stat[(int)(pic->quality+0.5)]++; - ctx->qp_sum += pic->quality; - ctx->inv_qp_sum += 1.0/pic->quality; + ctx->qp_stat[(int)(quality+0.5)]++; + ctx->qp_sum += quality; + ctx->inv_qp_sum += 1.0/(double)quality; break; }
participants (1)
-
R�mi Guyomarch CVS