uniformize trellis quant option

Originally committed as revision 13722 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Baptiste Coudurier 2008-06-09 00:43:07 +00:00
parent 7080cbe2c8
commit febea2f2e1
4 changed files with 17 additions and 4 deletions

View File

@ -427,7 +427,9 @@ typedef struct RcOverride{
#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT.
#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay.
#define CODEC_FLAG_ALT_SCAN 0x00100000 ///< Use alternate scan.
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
#define CODEC_FLAG_TRELLIS_QUANT 0x00200000 ///< Use trellis quantization.
#endif
#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe.
#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT).
/* Fx : Flag for h263+ extra options */

View File

@ -99,7 +99,11 @@ av_cold int ff_xvid_encode_init(AVCodecContext *avctx) {
x->vop_flags = XVID_VOP_HALFPEL; /* Bare minimum quality */
if( xvid_flags & CODEC_FLAG_4MV )
x->vop_flags |= XVID_VOP_INTER4V; /* Level 3 */
if( xvid_flags & CODEC_FLAG_TRELLIS_QUANT)
if( avctx->trellis
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
|| xvid_flags & CODEC_FLAG_TRELLIS_QUANT
#endif
)
x->vop_flags |= XVID_VOP_TRELLISQUANT; /* Level 5 */
if( xvid_flags & CODEC_FLAG_AC_PRED )
x->vop_flags |= XVID_VOP_HQACPRED; /* Level 6 */

View File

@ -332,6 +332,11 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT);
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
if (s->flags & CODEC_FLAG_TRELLIS_QUANT)
avctx->trellis = 1;
#endif
if(avctx->rc_max_rate && !avctx->rc_buffer_size){
av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n");
return -1;
@ -414,7 +419,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
return -1;
}
if((s->flags & CODEC_FLAG_CBP_RD) && !(s->flags & CODEC_FLAG_TRELLIS_QUANT)){
if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){
av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
return -1;
}
@ -680,7 +685,7 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
if(!s->denoise_dct)
s->denoise_dct = denoise_dct_c;
s->fast_dct_quantize = s->dct_quantize;
if(s->flags & CODEC_FLAG_TRELLIS_QUANT)
if(avctx->trellis)
s->dct_quantize = dct_quantize_trellis_c;
if((ENABLE_H263P_ENCODER || ENABLE_RV20_ENCODER) && s->modified_quant)

View File

@ -400,8 +400,10 @@ static const AVOption options[]={
{"ildct", "use interlaced dct", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_INTERLACED_DCT, INT_MIN, INT_MAX, V|E, "flags"},
{"low_delay", "force low delay", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_LOW_DELAY, INT_MIN, INT_MAX, V|D|E, "flags"},
{"alt", "enable alternate scantable (mpeg2/mpeg4)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_ALT_SCAN, INT_MIN, INT_MAX, V|E, "flags"},
#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
{"trell", "use trellis quantization", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_TRELLIS_QUANT, INT_MIN, INT_MAX, V|E, "flags"},
{"global_header", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GLOBAL_HEADER, INT_MIN, INT_MAX, 0, "flags"},
#endif
{"global_header", "place global headers in extradata instead of every keyframe", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_GLOBAL_HEADER, INT_MIN, INT_MAX, A|V|E, "flags"},
{"bitexact", "use only bitexact stuff (except (i)dct)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_BITEXACT, INT_MIN, INT_MAX, A|V|S|D|E, "flags"},
{"aic", "h263 advanced intra coding / mpeg4 ac prediction", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_AC_PRED, INT_MIN, INT_MAX, V|E, "flags"},
{"umv", "use unlimited motion vectors", 0, FF_OPT_TYPE_CONST, CODEC_FLAG_H263P_UMV, INT_MIN, INT_MAX, V|E, "flags"},