comparison libmpcodecs/ve_lavc.c @ 32860:77dd2bb3fd02

Make sure we don't store the same stats twice by nulling the first byte of the stats_out string once we have written it. I've verified that this is necessary, without it at normally at least the last stats line is duplicated, it could also happen when we call encode_video more often due to encoder delay as Reimar noted. Sample encode was with default -ovc lavc -lavcopts vpass=1: --- pass1stats.log 2011-02-21 15:44:42.314259000 +0100 +++ pass1stats.log.dedup_patch 2011-02-21 15:41:51.262778000 +0100 @@ -6421,4 +6421,3 @@ in:6420 out:6420 type:2 q:239 itex:0 ptex:15905 mv:441 misc:1911 fcode:1 bcode:1 mc-var:989 var:350603 icount:0 skipcount:373 hbits:55; in:6421 out:6421 type:2 q:247 itex:0 ptex:13020 mv:422 misc:1863 fcode:1 bcode:1 mc-var:953 var:352607 icount:0 skipcount:379 hbits:55; in:6422 out:6422 type:2 q:252 itex:0 ptex:3162 mv:258 misc:1293 fcode:1 bcode:1 mc-var:837 var:352872 icount:0 skipcount:449 hbits:55; -in:6422 out:6422 type:2 q:252 itex:0 ptex:3162 mv:258 misc:1293 fcode:1 bcode:1 mc-var:837 var:352872 icount:0 skipcount:449 hbits:55;
author ranma
date Mon, 21 Feb 2011 14:52:25 +0000
parents f698af71f514
children d1c2c8899ec1
comparison
equal deleted inserted replaced
32859:93610fbf278c 32860:77dd2bb3fd02
811 } 811 }
812 out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size, 812 out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size,
813 pic); 813 pic);
814 814
815 /* store stats if there are any */ 815 /* store stats if there are any */
816 if(lavc_venc_context->stats_out && stats_file) 816 if(lavc_venc_context->stats_out && stats_file) {
817 fprintf(stats_file, "%s", lavc_venc_context->stats_out); 817 fprintf(stats_file, "%s", lavc_venc_context->stats_out);
818 /* make sure we can't accidentally store the same stats twice */
819 lavc_venc_context->stats_out[0] = 0;
820 }
818 821
819 if(pts != MP_NOPTS_VALUE) 822 if(pts != MP_NOPTS_VALUE)
820 dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base); 823 dts= pts - lavc_venc_context->delay * av_q2d(lavc_venc_context->time_base);
821 else 824 else
822 dts= MP_NOPTS_VALUE; 825 dts= MP_NOPTS_VALUE;