From: Loren Merritt Date: Fri, 13 Oct 2006 20:04:58 +0000 (+0000) Subject: allow fractional values of crf X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=93b54ce1fbbbb191e69d8c6e33897037ba5bbfd1;p=x264.git allow fractional values of crf git-svn-id: svn://svn.videolan.org/x264/trunk@591 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/common/common.c b/common/common.c index f813b639..6b16e0bc 100644 --- a/common/common.c +++ b/common/common.c @@ -87,7 +87,7 @@ void x264_param_default( x264_param_t *param ) param->rc.i_vbv_buffer_size = 0; param->rc.f_vbv_buffer_init = 0.9; param->rc.i_qp_constant = 26; - param->rc.i_rf_constant = 0; + param->rc.f_rf_constant = 0; param->rc.i_qp_min = 10; param->rc.i_qp_max = 51; param->rc.i_qp_step = 4; @@ -465,7 +465,7 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value ) } OPT("crf") { - p->rc.i_rf_constant = atoi(value); + p->rc.f_rf_constant = atof(value); p->rc.i_rc_method = X264_RC_CRF; } OPT2("qpmin", "qp-min") @@ -900,7 +900,7 @@ char *x264_param2string( x264_param_t *p, int b_res ) if( p->rc.i_rc_method == X264_RC_ABR || p->rc.i_rc_method == X264_RC_CRF ) { if( p->rc.i_rc_method == X264_RC_CRF ) - s += sprintf( s, " crf=%d", p->rc.i_rf_constant ); + s += sprintf( s, " crf=%.1f", p->rc.f_rf_constant ); else s += sprintf( s, " bitrate=%d ratetol=%.1f", p->rc.i_bitrate, p->rc.f_rate_tolerance ); diff --git a/encoder/encoder.c b/encoder/encoder.c index 940162a9..396f5bb3 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -377,10 +377,10 @@ static int x264_validate_parameters( x264_t *h ) x264_log( h, X264_LOG_ERROR, "invalid RC method\n" ); return -1; } - h->param.rc.i_rf_constant = x264_clip3( h->param.rc.i_rf_constant, 0, 51 ); + h->param.rc.f_rf_constant = x264_clip3f( h->param.rc.f_rf_constant, 0, 51 ); h->param.rc.i_qp_constant = x264_clip3( h->param.rc.i_qp_constant, 0, 51 ); if( h->param.rc.i_rc_method == X264_RC_CRF ) - h->param.rc.i_qp_constant = h->param.rc.i_rf_constant; + h->param.rc.i_qp_constant = h->param.rc.f_rf_constant; if( (h->param.rc.i_rc_method == X264_RC_CQP || h->param.rc.i_rc_method == X264_RC_CRF) && h->param.rc.i_qp_constant == 0 ) { diff --git a/encoder/ratecontrol.c b/encoder/ratecontrol.c index 510ff0ed..7d37cc93 100644 --- a/encoder/ratecontrol.c +++ b/encoder/ratecontrol.c @@ -252,7 +252,7 @@ int x264_ratecontrol_new( x264_t *h ) if( rc->b_abr ) { /* FIXME ABR_INIT_QP is actually used only in CRF */ -#define ABR_INIT_QP ( h->param.rc.i_rc_method == X264_RC_CRF ? h->param.rc.i_rf_constant : 24 ) +#define ABR_INIT_QP ( h->param.rc.i_rc_method == X264_RC_CRF ? h->param.rc.f_rf_constant : 24 ) rc->accum_p_norm = .01; rc->accum_p_qp = ABR_INIT_QP * rc->accum_p_norm; /* estimated ratio that produces a reasonable QP for the first I-frame */ @@ -266,7 +266,7 @@ int x264_ratecontrol_new( x264_t *h ) /* arbitrary rescaling to make CRF somewhat similar to QP */ double base_cplx = h->mb.i_mb_count * (h->param.i_bframe ? 120 : 80); rc->rate_factor_constant = pow( base_cplx, 1 - h->param.rc.f_qcompress ) - / qp2qscale( h->param.rc.i_rf_constant ); + / qp2qscale( h->param.rc.f_rf_constant ); } rc->ip_offset = 6.0 * log(h->param.rc.f_ip_factor) / log(2.0); diff --git a/x264.c b/x264.c index 94d6ccfc..6168a3e5 100644 --- a/x264.c +++ b/x264.c @@ -362,7 +362,7 @@ static int Parse( int argc, char **argv, { "keyint", required_argument, NULL, 'I' }, { "scenecut",required_argument, NULL, 0 }, { "nf", no_argument, NULL, 0 }, - { "nodeblock", no_argument, NULL, 0 }, + { "no-deblock", no_argument, NULL, 0 }, { "filter", required_argument, NULL, 0 }, { "deblock", required_argument, NULL, 'f' }, { "interlaced", no_argument, NULL, 0 }, diff --git a/x264.h b/x264.h index d9059cfe..491393f9 100644 --- a/x264.h +++ b/x264.h @@ -35,7 +35,7 @@ #include -#define X264_BUILD 53 +#define X264_BUILD 54 /* x264_t: * opaque handler for encoder */ @@ -238,7 +238,7 @@ typedef struct int i_qp_step; /* max QP step between frames */ int i_bitrate; - int i_rf_constant; /* 1pass VBR, nominal QP */ + float f_rf_constant; /* 1pass VBR, nominal QP */ float f_rate_tolerance; int i_vbv_max_bitrate; int i_vbv_buffer_size;