[vlc-devel] commit: Set strict-rc functionality as default if user hasn't ( Ilkka Ollakka )

git version control git at videolan.org
Thu Jun 26 09:36:54 CEST 2008


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu Jun 26 10:32:52 2008 +0300| [51f898a0eb6029c1922b2b4311f074245c99e963]

Set strict-rc functionality as default if user hasn't
defined quality based encoding, and remove strict-rc option
because it's not needed ( thou maybe someone needs vbr-transcoding
with some hint of bitrate without quality-based encoding ? )

Should fix transcoding bitrate bug and close ticket #1463

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=51f898a0eb6029c1922b2b4311f074245c99e963
---

 modules/codec/avcodec/avcodec.c |    2 --
 modules/codec/avcodec/avcodec.h |    4 ----
 modules/codec/avcodec/encoder.c |   31 ++++++++++++++-----------------
 3 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 0e554da..3fa80a5 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -153,8 +153,6 @@ vlc_module_begin();
                  ENC_VT_LONGTEXT, true );
     add_bool( ENC_CFG_PREFIX "pre-me", 0, NULL, ENC_PRE_ME_TEXT,
               ENC_PRE_ME_LONGTEXT, true );
-    add_bool( ENC_CFG_PREFIX "strict-rc", 0, NULL, ENC_RC_STRICT_TEXT,
-              ENC_RC_STRICT_LONGTEXT, true );
     add_integer( ENC_CFG_PREFIX "rc-buffer-size", 224*1024*8, NULL,
                  ENC_RC_BUF_TEXT, ENC_RC_BUF_LONGTEXT, true );
     add_float( ENC_CFG_PREFIX "rc-buffer-aggressivity", 1.0, NULL,
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index c80aa87..591d125 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -141,10 +141,6 @@ void EndAudioDec( decoder_t *p_dec );
 #define ENC_PRE_ME_LONGTEXT N_( "Enable the pre-motion " \
   "estimation algorithm.")
 
-#define ENC_RC_STRICT_TEXT N_( "Strict rate control" )
-#define ENC_RC_STRICT_LONGTEXT N_( "Enable the strict rate " \
-  "control algorithm." )
-
 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
 #define ENC_RC_BUF_LONGTEXT N_( "Rate control " \
   "buffer size (in kbytes). A bigger buffer will allow for better rate " \
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 23c2674..49763f2 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -131,7 +131,6 @@ struct encoder_sys_t
     int        i_qmin;
     int        i_qmax;
     int        i_hq;
-    bool       b_strict_rc;
     int        i_rc_buffer_size;
     float      f_rc_buffer_aggressivity;
     bool       b_pre_me;
@@ -153,7 +152,7 @@ struct encoder_sys_t
 };
 
 static const char *const ppsz_enc_options[] = {
-    "keyint", "bframes", "vt", "qmin", "qmax", "hq", "strict-rc",
+    "keyint", "bframes", "vt", "qmin", "qmax", "hq", 
     "rc-buffer-size", "rc-buffer-aggressivity", "pre-me", "hurry-up",
     "interlace", "i-quant-factor", "noise-reduction", "mpeg4-matrix",
     "trellis", "qscale", "strict", "lumi-masking", "dark-masking",
@@ -318,8 +317,6 @@ int OpenEncoder( vlc_object_t *p_this )
         p_sys->i_noise_reduction = 1;
     }
 
-    var_Get( p_enc, ENC_CFG_PREFIX "strict-rc", &val );
-    p_sys->b_strict_rc = val.b_bool;
     var_Get( p_enc, ENC_CFG_PREFIX "rc-buffer-size", &val );
     p_sys->i_rc_buffer_size = val.i_int;
     var_Get( p_enc, ENC_CFG_PREFIX "rc-buffer-aggressivity", &val );
@@ -475,17 +472,6 @@ int OpenEncoder( vlc_object_t *p_this )
             p_enc->fmt_in.i_codec = GetVlcChroma( p_context->pix_fmt );
         }
 
-        if ( p_sys->b_strict_rc )
-        {
-            p_context->rc_qsquish = 1.0;
-            p_context->rc_max_rate = p_enc->fmt_out.i_bitrate;
-            p_context->rc_min_rate = p_enc->fmt_out.i_bitrate;
-            p_context->rc_buffer_size = p_sys->i_rc_buffer_size;
-            /* This is from ffmpeg's ffmpeg.c : */
-            p_context->rc_initial_buffer_occupancy
-                = p_sys->i_rc_buffer_size * 3/4;
-            p_context->rc_buffer_aggressivity = p_sys->f_rc_buffer_aggressivity;
-        }
 
         if ( p_sys->f_i_quant_factor != 0.0 )
             p_context->i_quant_factor = p_sys->f_i_quant_factor;
@@ -560,6 +546,17 @@ int OpenEncoder( vlc_object_t *p_this )
         {
             p_context->flags |= CODEC_FLAG_QSCALE;
             p_context->global_quality = p_sys->i_quality;
+        } 
+        else 
+        {
+            p_context->rc_qsquish = 1.0;
+            p_context->rc_max_rate = p_enc->fmt_out.i_bitrate;
+            p_context->rc_min_rate = p_enc->fmt_out.i_bitrate;
+            p_context->rc_buffer_size = p_sys->i_rc_buffer_size;
+            /* This is from ffmpeg's ffmpeg.c : */
+            p_context->rc_initial_buffer_occupancy
+                = p_sys->i_rc_buffer_size * 3/4;
+            p_context->rc_buffer_aggressivity = p_sys->f_rc_buffer_aggressivity;
         }
     }
     else if( p_enc->fmt_in.i_cat == AUDIO_ES )
@@ -575,8 +572,8 @@ int OpenEncoder( vlc_object_t *p_this )
         if ( p_enc->fmt_out.i_codec == VLC_FOURCC('m','p','4','a') )
         {
             /* XXX: FAAC does resample only when setting the INPUT samplerate
-             * to the desired value (-R option of the faac frontend) */
-            p_enc->fmt_in.audio.i_rate = p_context->sample_rate;
+             * to the desired value (-R option of the faac frontend) 
+            p_enc->fmt_in.audio.i_rate = p_context->sample_rate;*/
 #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
         /* Ignore FF_PROFILE_UNKNOWN */
         if( p_sys->i_aac_profile >= FF_PROFILE_AAC_MAIN )




More information about the vlc-devel mailing list