From 51f898a0eb6029c1922b2b4311f074245c99e963 Mon Sep 17 00:00:00 2001 From: Ilkka Ollakka Date: Thu, 26 Jun 2008 10:32:52 +0300 Subject: [PATCH] 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 --- 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 0e554da2cb..3fa80a5bcb 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 c80aa87884..591d1258db 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 23c2674465..49763f21c0 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 ) -- 2.39.5