libx264: add 'direct-pred' private option

Deprecate AVCodecContext.directpred
pull/2/head
Anton Khirnov 14 years ago
parent 0635a8aa21
commit 9c684feadc
  1. 4
      libavcodec/avcodec.h
  2. 12
      libavcodec/libx264.c
  3. 2
      libavcodec/options.c
  4. 1
      libavformat/ffmdec.c
  5. 1
      libavformat/ffmenc.c
  6. 2
      tests/ref/lavf/ffm

@ -2484,14 +2484,14 @@ typedef struct AVCodecContext {
#define X264_PART_P8X8 0x010 /* Analyze p16x8, p8x16 and p8x8 */
#define X264_PART_P4X4 0x020 /* Analyze p8x4, p4x8, p4x4 */
#define X264_PART_B8X8 0x100 /* Analyze b16x8, b8x16 and b8x8 */
#endif
/**
* direct MV prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)
* - encoding: Set by user.
* - decoding: unused
*/
int directpred;
attribute_deprecated int directpred;
#endif
/**
* Audio cutoff bandwidth (0 means "automatic")

@ -63,6 +63,7 @@ typedef struct X264Context {
char *deblock;
float cplxblur;
char *partitions;
int direct_pred;
} X264Context;
static void X264_log(void *p, int level, const char *fmt, va_list args)
@ -208,8 +209,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.b_deblocking_filter = avctx->flags & CODEC_FLAG_LOOP_FILTER;
x4->params.analyse.i_direct_mv_pred = avctx->directpred;
if (avctx->me_method == ME_EPZS)
x4->params.analyse.i_me_method = X264_ME_DIA;
else if (avctx->me_method == ME_HEX)
@ -307,6 +306,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.i_deblocking_filter_beta = avctx->deblockbeta;
if (avctx->complexityblur >= 0)
x4->params.rc.f_complexity_blur = avctx->complexityblur;
if (avctx->directpred >= 0)
x4->params.analyse.i_direct_mv_pred = avctx->directpred;
if (avctx->partitions) {
if (avctx->partitions & X264_PART_I4X4)
x4->params.analyse.inter |= X264_ANALYSE_I4x4;
@ -386,6 +387,8 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.b_aud = x4->aud;
if (x4->mbtree >= 0)
x4->params.rc.b_mb_tree = x4->mbtree;
if (x4->direct_pred >= 0)
x4->params.analyse.i_direct_mv_pred = x4->direct_pred;
if (x4->fastfirstpass)
x264_param_apply_fastfirstpass(&x4->params);
@ -488,6 +491,11 @@ static const AVOption options[] = {
{ "cplxblur", "Reduce fluctuations in QP (before curve compression)", OFFSET(cplxblur), FF_OPT_TYPE_FLOAT, {-1 }, -1, FLT_MAX, VE},
{ "partitions", "A comma-separated list of partitions to consider. "
"Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all", OFFSET(partitions), FF_OPT_TYPE_STRING, { 0 }, 0, 0, VE},
{ "direct-pred", "Direct MV prediction mode", OFFSET(direct_pred), FF_OPT_TYPE_INT, {-1 }, -1, INT_MAX, VE, "direct-pred" },
{ "none", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_NONE }, 0, 0, VE, "direct-pred" },
{ "spatial", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_SPATIAL }, 0, 0, VE, "direct-pred" },
{ "temporal", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_TEMPORAL }, 0, 0, VE, "direct-pred" },
{ "auto", NULL, 0, FF_OPT_TYPE_CONST, { X264_DIRECT_PRED_AUTO }, 0, 0, VE, "direct-pred" },
{ NULL },
};

@ -402,8 +402,8 @@ static const AVOption options[]={
{"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
#endif
{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, {.dbl = 2 }, INT_MIN, INT_MAX, V|E},
#if FF_API_X264_GLOBAL_OPTS
{"directpred", "direct mv prediction mode - 0 (none), 1 (spatial), 2 (temporal), 3 (auto)", OFFSET(directpred), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E},
{"bpyramid", "allows B-frames to be used as references for predicting", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BPYRAMID }, INT_MIN, INT_MAX, V|E, "flags2"},
{"wpred", "weighted biprediction for b-frames (H.264)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_WPRED }, INT_MIN, INT_MAX, V|E, "flags2"},
{"mixed_refs", "one reference per partition, as opposed to one reference per macroblock", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MIXED_REFS }, INT_MIN, INT_MAX, V|E, "flags2"},

@ -353,7 +353,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->qblur = av_int2dbl(avio_rb64(pb));
codec->max_qdiff = avio_rb32(pb);
codec->refs = avio_rb32(pb);
codec->directpred = avio_rb32(pb);
break;
case AVMEDIA_TYPE_AUDIO:
codec->sample_rate = avio_rb32(pb);

@ -165,7 +165,6 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb64(pb, av_dbl2int(codec->qblur));
avio_wb32(pb, codec->max_qdiff);
avio_wb32(pb, codec->refs);
avio_wb32(pb, codec->directpred);
break;
case AVMEDIA_TYPE_AUDIO:
avio_wb32(pb, codec->sample_rate);

@ -1,3 +1,3 @@
6d6db9474c5c10621bff51f20984797b *./tests/data/lavf/lavf.ffm
bf46c0b53fc318d0a60fa9bf446b2e4f *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm
./tests/data/lavf/lavf.ffm CRC=0xf361ed74

Loading…
Cancel
Save