aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-10-07 11:32:40 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-10-07 11:32:40 +0000
commit158c7f059c3906b0116ae73a7669a3bb7bc570bb (patch)
tree1dbb85c2164bec440148a818aeafd6c6197b80c6 /ffmpeg.c
parent72385798357e53f64ba5ac405fb1b227ddcffc6c (diff)
downloadffmpeg-158c7f059c3906b0116ae73a7669a3bb7bc570bb.tar.gz
use lagrange multipler instead of qp for ratecontrol, this may break some things, tell me ASAP if u notice anything broken
quality which was 1..31 float is now a 1..FF_LAMBDA_MAX int, and FF_QP2LAMBDA * qp can be used to convert to the new range Originally committed as revision 2348 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 945476e378..cf2f7b974b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -79,7 +79,7 @@ static int frame_rate = 25;
static int frame_rate_base = 1;
static int video_bit_rate = 200*1000;
static int video_bit_rate_tolerance = 4000*1000;
-static int video_qscale = 0;
+static float video_qscale = 0;
static int video_qmin = 2;
static int video_qmax = 31;
static int video_mb_qmin = 2;
@@ -680,7 +680,7 @@ static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
total_size += frame_size;
if (enc->codec_type == CODEC_TYPE_VIDEO) {
frame_number = ost->frame_number;
- fprintf(fvstats, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality);
+ fprintf(fvstats, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
if (enc->flags&CODEC_FLAG_PSNR)
fprintf(fvstats, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
@@ -738,12 +738,12 @@ static void print_report(AVFormatContext **output_files,
enc = &ost->st->codec;
if (vid && enc->codec_type == CODEC_TYPE_VIDEO) {
sprintf(buf + strlen(buf), "q=%2.1f ",
- enc->coded_frame->quality);
+ enc->coded_frame->quality/(float)FF_QP2LAMBDA);
}
if (!vid && enc->codec_type == CODEC_TYPE_VIDEO) {
frame_number = ost->frame_number;
sprintf(buf + strlen(buf), "frame=%5d q=%2.1f ",
- frame_number, enc->coded_frame ? enc->coded_frame->quality : 0);
+ frame_number, enc->coded_frame ? enc->coded_frame->quality/(float)FF_QP2LAMBDA : 0);
if (enc->flags&CODEC_FLAG_PSNR)
sprintf(buf + strlen(buf), "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
vid = 1;
@@ -1774,10 +1774,10 @@ static void opt_mb_decision(const char *arg)
static void opt_qscale(const char *arg)
{
- video_qscale = atoi(arg);
- if (video_qscale < 0 ||
- video_qscale > 31) {
- fprintf(stderr, "qscale must be >= 1 and <= 31\n");
+ video_qscale = atof(arg);
+ if (video_qscale < 0.01 ||
+ video_qscale > 255) {
+ fprintf(stderr, "qscale must be >= 0.01 and <= 255\n");
exit(1);
}
}
@@ -2245,7 +2245,7 @@ static void opt_output_file(const char *filename)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
- st->quality = video_qscale;
+ st->quality = FF_QP2LAMBDA * video_qscale;
}
if(bitexact)