summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-09-01 13:15:09 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-07 07:27:55 +0200
commit9c684feadc063473da3f9e341fa07e6c17b75154 (patch)
treeff9bf10a0243083a209197718658ff5c2a157d90 /libavcodec
parent0635a8aa21d0495575c24f1883c1e6832d882657 (diff)
libx264: add 'direct-pred' private option
Deprecate AVCodecContext.directpred
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h4
-rw-r--r--libavcodec/libx264.c12
-rw-r--r--libavcodec/options.c2
3 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 7eb4a01291..7fc0e545fc 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -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")
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 10cb32eda2..d915735a76 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -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 },
};
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 0d670056dc..098778aa23 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -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"},