Changeset 51f898a0eb6029c1922b2b4311f074245c99e963

Show
Ignore:
Timestamp:
06/26/08 09:34:52 (2 months ago)
Author:
Ilkka Ollakka <ileoo@videolan.org>
git-committer:
Ilkka Ollakka <ileoo@videolan.org> 1214465692 +0300
git-parent:

[4f541d3b05be7729e48a28e5daf8497102598bb8]

git-author:
Ilkka Ollakka <ileoo@videolan.org> 1214465572 +0300
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/codec/avcodec/avcodec.c

    rf7d5f3e r51f898a  
    154154    add_bool( ENC_CFG_PREFIX "pre-me", 0, NULL, ENC_PRE_ME_TEXT, 
    155155              ENC_PRE_ME_LONGTEXT, true ); 
    156     add_bool( ENC_CFG_PREFIX "strict-rc", 0, NULL, ENC_RC_STRICT_TEXT, 
    157               ENC_RC_STRICT_LONGTEXT, true ); 
    158156    add_integer( ENC_CFG_PREFIX "rc-buffer-size", 224*1024*8, NULL, 
    159157                 ENC_RC_BUF_TEXT, ENC_RC_BUF_LONGTEXT, true ); 
  • modules/codec/avcodec/avcodec.h

    rf7d5f3e r51f898a  
    142142  "estimation algorithm.") 
    143143 
    144 #define ENC_RC_STRICT_TEXT N_( "Strict rate control" ) 
    145 #define ENC_RC_STRICT_LONGTEXT N_( "Enable the strict rate " \ 
    146   "control algorithm." ) 
    147  
    148144#define ENC_RC_BUF_TEXT N_( "Rate control buffer size" ) 
    149145#define ENC_RC_BUF_LONGTEXT N_( "Rate control " \ 
  • modules/codec/avcodec/encoder.c

    r37a2578 r51f898a  
    132132    int        i_qmax; 
    133133    int        i_hq; 
    134     bool       b_strict_rc; 
    135134    int        i_rc_buffer_size; 
    136135    float      f_rc_buffer_aggressivity; 
     
    154153 
    155154static const char *const ppsz_enc_options[] = { 
    156     "keyint", "bframes", "vt", "qmin", "qmax", "hq", "strict-rc", 
     155    "keyint", "bframes", "vt", "qmin", "qmax", "hq",  
    157156    "rc-buffer-size", "rc-buffer-aggressivity", "pre-me", "hurry-up", 
    158157    "interlace", "i-quant-factor", "noise-reduction", "mpeg4-matrix", 
     
    319318    } 
    320319 
    321     var_Get( p_enc, ENC_CFG_PREFIX "strict-rc", &val ); 
    322     p_sys->b_strict_rc = val.b_bool; 
    323320    var_Get( p_enc, ENC_CFG_PREFIX "rc-buffer-size", &val ); 
    324321    p_sys->i_rc_buffer_size = val.i_int; 
     
    476473        } 
    477474 
    478         if ( p_sys->b_strict_rc ) 
     475 
     476        if ( p_sys->f_i_quant_factor != 0.0 ) 
     477            p_context->i_quant_factor = p_sys->f_i_quant_factor; 
     478 
     479        p_context->noise_reduction = p_sys->i_noise_reduction; 
     480 
     481        if ( p_sys->b_mpeg4_matrix ) 
     482        { 
     483            p_context->intra_matrix = mpeg4_default_intra_matrix; 
     484            p_context->inter_matrix = mpeg4_default_non_intra_matrix; 
     485        } 
     486 
     487        if ( p_sys->b_pre_me ) 
     488        { 
     489            p_context->pre_me = 1; 
     490            p_context->me_pre_cmp = FF_CMP_CHROMA; 
     491        } 
     492 
     493        if ( p_sys->b_interlace ) 
     494        { 
     495            if ( p_context->height <= 280 ) 
     496            { 
     497                if ( p_context->height != 16 || p_context->width != 16 ) 
     498                    msg_Warn( p_enc, 
     499                        "disabling interlaced video because height=%d <= 280", 
     500                        p_context->height ); 
     501            } 
     502            else 
     503            { 
     504                p_context->flags |= CODEC_FLAG_INTERLACED_DCT; 
     505                if ( p_sys->b_interlace_me ) 
     506                    p_context->flags |= CODEC_FLAG_INTERLACED_ME; 
     507            } 
     508        } 
     509 
     510        if ( p_sys->b_trellis ) 
     511            p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; 
     512 
     513        if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) 
     514            p_context->flags |= CODEC_FLAG_QSCALE; 
     515 
     516        if ( p_enc->i_threads >= 1 ) 
     517            p_context->thread_count = p_enc->i_threads; 
     518 
     519        if( p_sys->i_vtolerance > 0 ) 
     520            p_context->bit_rate_tolerance = p_sys->i_vtolerance; 
     521 
     522        /* usually if someone sets bitrate, he likes more to get that bitrate 
     523         * over quality should help 'normal' user to get asked bitrate 
     524         */ 
     525        if( p_enc->fmt_out.i_bitrate > 0 && p_sys->i_qmax == 0 && p_sys->i_qmin == 0 ) 
     526        { 
     527            p_sys->i_qmax = 51; 
     528            p_sys->i_qmin = 3; 
     529        } 
     530 
     531        if( p_sys->i_qmin > 0 ) 
     532        { 
     533            p_context->mb_qmin = p_context->qmin = p_sys->i_qmin; 
     534            p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA; 
     535        } 
     536        if( p_sys->i_qmax > 0 ) 
     537        { 
     538            p_context->mb_qmax = p_context->qmax = p_sys->i_qmax; 
     539            p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA; 
     540        } 
     541        p_context->max_qdiff = 3; 
     542 
     543        p_context->mb_decision = p_sys->i_hq; 
     544 
     545        if( p_sys->i_quality ) 
     546        { 
     547            p_context->flags |= CODEC_FLAG_QSCALE; 
     548            p_context->global_quality = p_sys->i_quality; 
     549        }  
     550        else  
    479551        { 
    480552            p_context->rc_qsquish = 1.0; 
     
    487559            p_context->rc_buffer_aggressivity = p_sys->f_rc_buffer_aggressivity; 
    488560        } 
    489  
    490         if ( p_sys->f_i_quant_factor != 0.0 ) 
    491             p_context->i_quant_factor = p_sys->f_i_quant_factor; 
    492  
    493         p_context->noise_reduction = p_sys->i_noise_reduction; 
    494  
    495         if ( p_sys->b_mpeg4_matrix ) 
    496         { 
    497             p_context->intra_matrix = mpeg4_default_intra_matrix; 
    498             p_context->inter_matrix = mpeg4_default_non_intra_matrix; 
    499         } 
    500  
    501         if ( p_sys->b_pre_me ) 
    502         { 
    503             p_context->pre_me = 1; 
    504             p_context->me_pre_cmp = FF_CMP_CHROMA; 
    505         } 
    506  
    507         if ( p_sys->b_interlace ) 
    508         { 
    509             if ( p_context->height <= 280 ) 
    510             { 
    511                 if ( p_context->height != 16 || p_context->width != 16 ) 
    512                     msg_Warn( p_enc, 
    513                         "disabling interlaced video because height=%d <= 280", 
    514                         p_context->height ); 
    515             } 
    516             else 
    517             { 
    518                 p_context->flags |= CODEC_FLAG_INTERLACED_DCT; 
    519                 if ( p_sys->b_interlace_me ) 
    520                     p_context->flags |= CODEC_FLAG_INTERLACED_ME; 
    521             } 
    522         } 
    523  
    524         if ( p_sys->b_trellis ) 
    525             p_context->flags |= CODEC_FLAG_TRELLIS_QUANT; 
    526  
    527         if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) 
    528             p_context->flags |= CODEC_FLAG_QSCALE; 
    529  
    530         if ( p_enc->i_threads >= 1 ) 
    531             p_context->thread_count = p_enc->i_threads; 
    532  
    533         if( p_sys->i_vtolerance > 0 ) 
    534             p_context->bit_rate_tolerance = p_sys->i_vtolerance; 
    535  
    536         /* usually if someone sets bitrate, he likes more to get that bitrate 
    537          * over quality should help 'normal' user to get asked bitrate 
    538          */ 
    539         if( p_enc->fmt_out.i_bitrate > 0 && p_sys->i_qmax == 0 && p_sys->i_qmin == 0 ) 
    540         { 
    541             p_sys->i_qmax = 51; 
    542             p_sys->i_qmin = 3; 
    543         } 
    544  
    545         if( p_sys->i_qmin > 0 ) 
    546         { 
    547             p_context->mb_qmin = p_context->qmin = p_sys->i_qmin; 
    548             p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA; 
    549         } 
    550         if( p_sys->i_qmax > 0 ) 
    551         { 
    552             p_context->mb_qmax = p_context->qmax = p_sys->i_qmax; 
    553             p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA; 
    554         } 
    555         p_context->max_qdiff = 3; 
    556  
    557         p_context->mb_decision = p_sys->i_hq; 
    558  
    559         if( p_sys->i_quality ) 
    560         { 
    561             p_context->flags |= CODEC_FLAG_QSCALE; 
    562             p_context->global_quality = p_sys->i_quality; 
    563         } 
    564561    } 
    565562    else if( p_enc->fmt_in.i_cat == AUDIO_ES ) 
     
    576573        { 
    577574            /* XXX: FAAC does resample only when setting the INPUT samplerate 
    578              * to the desired value (-R option of the faac frontend) */ 
    579             p_enc->fmt_in.audio.i_rate = p_context->sample_rate; 
     575             * to the desired value (-R option of the faac frontend)  
     576            p_enc->fmt_in.audio.i_rate = p_context->sample_rate;*/ 
    580577#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4) 
    581578        /* Ignore FF_PROFILE_UNKNOWN */