From 21e59552d6894917d3d16a3984268a171f4a1c98 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 5 Mar 2003 16:10:13 +0000 Subject: [PATCH] extended option for h263+ patch by (fixounet at free dot fr) with some minor modifications Originally committed as revision 1622 to svn://svn.ffmpeg.org/ffmpeg/trunk --- ffmpeg.c | 18 +++++++++++++++++- libavcodec/avcodec.h | 14 +++++++++++++- libavcodec/mpegvideo.c | 7 ++++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 9b45859daa..a8a5e74db2 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -123,6 +123,11 @@ static int same_quality = 0; static int b_frames = 0; static int use_hq = 0; static int use_4mv = 0; +/* Fx */ +static int use_aic = 0; +static int use_umv = 0; +/* /Fx */ +static int use_h263p_extra = 0; static int do_deinterlace = 0; static int workaround_bugs = FF_BUG_AUTODETECT; static int error_resilience = 2; @@ -2230,7 +2235,14 @@ static void opt_output_file(const char *filename) if (use_hq) { video_enc->flags |= CODEC_FLAG_HQ; } - + /* Fx */ + if (use_umv) { + video_enc->flags |= CODEC_FLAG_H263P_UMV; + } + if (use_aic) { + video_enc->flags |= CODEC_FLAG_H263P_AIC; + } + /* /Fx */ if (use_4mv) { video_enc->flags |= CODEC_FLAG_HQ; video_enc->flags |= CODEC_FLAG_4MV; @@ -2769,6 +2781,10 @@ const OptionDef options[] = { { "vstats", OPT_BOOL | OPT_EXPERT, {(void*)&do_vstats}, "dump video coding statistics to file" }, { "bitexact", OPT_EXPERT, {(void*)opt_bitexact}, "only use bit exact algorithms (for codec testing)" }, { "vhook", HAS_ARG | OPT_EXPERT, {(void*)add_frame_hooker}, "insert video processing module", "module name and parameters" }, + /* Fx */ + { "aic", OPT_BOOL | OPT_EXPERT, {(void*)&use_aic}, "enable Advanced intra coding (h263+)" }, + { "umv", OPT_BOOL | OPT_EXPERT, {(void*)&use_umv}, "enable Unlimited Motion Vector (h263+)" }, + /* /Fx */ { NULL, }, }; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 2990693bc4..e9ca0ea803 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -160,7 +160,19 @@ static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG, #define CODEC_FLAG_TRELLIS_QUANT 0x00200000 /* use trellis quantization */ #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 */ +#define CODEC_FLAG_H263P_AIC 0x01000000 /* Advanced intra coding */ +#define CODEC_FLAG_H263P_UMV 0x02000000 /* Unlimited motion vector */ +/* For advanced prediction mode, we reuse the 4MV flag */ +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Deblocking filter internal loop + * Slice structured + * Reference Picture Selection + * Independant Segment Decoding + * Alternative Inter * VLC + * Modified Quantization */ +/* /Fx */ /* codec capabilities */ #define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 /* decoder can use draw_horiz_band callback */ diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 7a2b10ecb6..8bfc0f049d 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -581,9 +581,10 @@ int MPV_encode_init(AVCodecContext *avctx) case CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; - s->unrestricted_mv = 1; - s->h263_aic = 1; - + /* Fx */ + s->unrestricted_mv=(avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0; + s->h263_aic= (avctx->flags & CODEC_FLAG_H263P_AIC) ? 1:0; + /* /Fx */ /* These are just to be sure */ s->umvplus = 1; avctx->delay=0;