[Ffmpeg-cvslog] CVS: ffmpeg ffmpeg.c,1.356,1.357
Michael Niedermayer CVS
michael
Sun Dec 18 21:01:05 CET 2005
Update of /cvsroot/ffmpeg/ffmpeg
In directory mail:/var2/tmp/cvs-serv29529
Modified Files:
ffmpeg.c
Log Message:
support printing compact qp histogram
Index: ffmpeg.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/ffmpeg.c,v
retrieving revision 1.356
retrieving revision 1.357
diff -u -d -r1.356 -r1.357
--- ffmpeg.c 17 Dec 2005 18:14:26 -0000 1.356
+++ ffmpeg.c 18 Dec 2005 20:01:02 -0000 1.357
@@ -162,6 +162,7 @@
extern int loop_input; /* currently a hack */
static int loop_output = AVFMT_NOOUTPUTLOOP;
static int genpts = 0;
+static int qp_hist = 0;
static int gop_size = 12;
static int intra_only = 0;
@@ -1054,6 +1055,7 @@
int frame_number, vid, i;
double bitrate, ti1, pts;
static int64_t last_time = -1;
+ static int qp_histogram[52];
if (!is_last_report) {
int64_t cur_time;
@@ -1086,10 +1088,18 @@
}
if (!vid && enc->codec_type == CODEC_TYPE_VIDEO) {
frame_number = ost->frame_number;
- snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d q=%2.1f ",
- frame_number, enc->coded_frame ? enc->coded_frame->quality/(float)FF_QP2LAMBDA : 0);
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d q=%3.1f ",
+ frame_number, enc->coded_frame ? enc->coded_frame->quality/(float)FF_QP2LAMBDA : -1);
if(is_last_report)
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L");
+ if(qp_hist && enc->coded_frame){
+ int j;
+ int qp= lrintf(enc->coded_frame->quality/(float)FF_QP2LAMBDA);
+ if(qp>=0 && qp<sizeof(qp_histogram)/sizeof(int))
+ qp_histogram[qp]++;
+ for(j=0; j<32; j++)
+ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log(qp_histogram[j]+1)/log(2)));
+ }
if (enc->flags&CODEC_FLAG_PSNR){
int j;
double error, error_sum=0;
@@ -4097,6 +4107,7 @@
{ "skip_exp", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&frame_skip_exp}, "frame skip exponent", "exponent" },
{ "newvideo", OPT_VIDEO, {(void*)opt_new_video_stream}, "add a new video stream to the current output stream" },
{ "genpts", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&genpts }, "generate pts" },
+ { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
/* audio options */
{ "ab", HAS_ARG | OPT_AUDIO, {(void*)opt_audio_bitrate}, "set audio bitrate (in kbit/s)", "bitrate", },
More information about the ffmpeg-cvslog
mailing list