]> git.videolan.org Git - x264.git/commitdiff
allow fractional values of crf
authorLoren Merritt <pengvado@videolan.org>
Fri, 13 Oct 2006 20:04:58 +0000 (20:04 +0000)
committerLoren Merritt <pengvado@videolan.org>
Fri, 13 Oct 2006 20:04:58 +0000 (20:04 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@591 df754926-b1dd-0310-bc7b-ec298dee348c

common/common.c
encoder/encoder.c
encoder/ratecontrol.c
x264.c
x264.h

index f813b639e1bc65162d4bc0b9b8380b7ac6b56ff1..6b16e0bcd4eae94db5ba4562baf82e086e989bdc 100644 (file)
@@ -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 );
index 940162a907429ec1ff0e1e8f9df95c0fdb9c2640..396f5bb3dfb70ac0de6abca456f02670fd799cbf 100644 (file)
@@ -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 )
     {
index 510ff0ede9e09b5e415e95f9c1d02f2c41e0feb4..7d37cc9340b783b514c4dff1b67200c5339fc297 100644 (file)
@@ -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 94d6ccfc8567bac7021e703270b75f84d316f566..6168a3e52fbe615f1171c58274a3c3969ba1b7f2 100644 (file)
--- 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 d9059cfe64831d06f536c9a6dd3cc2cc2a8249eb..491393f9a6570ac35f1b9ba23c4944d2085b51bf 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -35,7 +35,7 @@
 
 #include <stdarg.h>
 
-#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;