summaryrefslogtreecommitdiff
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-07-07 01:20:43 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-07-27 15:24:56 +0100
commit4b6b1082a73907c7c3de2646c6398bc61320f2c6 (patch)
tree3a85c5b997a1a9fdadd923c921af433dc67f1ef4 /libavcodec/libx264.c
parent03eb55741427c6608f63972c105e565ca0ba4f15 (diff)
downloadffmpeg-4b6b1082a73907c7c3de2646c6398bc61320f2c6.tar.gz
lavc: Deprecate avctx.me_method
This option is extremely codec specific and only a few codecs employ it. Move it to codec private options instead: mpegenc family supports only 3 values, xavs and x264 use 5, and xvid has a different metric entirely. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 7d719d4e3a..531d8970d7 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -76,6 +76,7 @@ typedef struct X264Context {
int slice_max_size;
char *stats;
int nal_hrd;
+ int motion_est;
char *x264_params;
} X264Context;
@@ -394,17 +395,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.f_pb_factor = avctx->b_quant_factor;
x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
- if (avctx->me_method == ME_EPZS)
- x4->params.analyse.i_me_method = X264_ME_DIA;
- else if (avctx->me_method == ME_HEX)
- x4->params.analyse.i_me_method = X264_ME_HEX;
- else if (avctx->me_method == ME_UMH)
- x4->params.analyse.i_me_method = X264_ME_UMH;
- else if (avctx->me_method == ME_FULL)
- x4->params.analyse.i_me_method = X264_ME_ESA;
- else if (avctx->me_method == ME_TESA)
- x4->params.analyse.i_me_method = X264_ME_TESA;
-
if (avctx->gop_size >= 0)
x4->params.i_keyint_max = avctx->gop_size;
if (avctx->max_b_frames >= 0)
@@ -493,6 +483,25 @@ static av_cold int X264_init(AVCodecContext *avctx)
if (x4->nal_hrd >= 0)
x4->params.i_nal_hrd = x4->nal_hrd;
+ if (x4->motion_est >= 0) {
+ x4->params.analyse.i_me_method = x4->motion_est;
+#if FF_API_MOTION_EST
+FF_DISABLE_DEPRECATION_WARNINGS
+ } else {
+ if (avctx->me_method == ME_EPZS)
+ x4->params.analyse.i_me_method = X264_ME_DIA;
+ else if (avctx->me_method == ME_HEX)
+ x4->params.analyse.i_me_method = X264_ME_HEX;
+ else if (avctx->me_method == ME_UMH)
+ x4->params.analyse.i_me_method = X264_ME_UMH;
+ else if (avctx->me_method == ME_FULL)
+ x4->params.analyse.i_me_method = X264_ME_ESA;
+ else if (avctx->me_method == ME_TESA)
+ x4->params.analyse.i_me_method = X264_ME_TESA;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ }
+
if (x4->profile)
if (x264_param_apply_profile(&x4->params, x4->profile) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile);
@@ -675,6 +684,12 @@ static const AVOption options[] = {
{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_NONE}, INT_MIN, INT_MAX, VE, "nal-hrd" },
{ "vbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR}, INT_MIN, INT_MAX, VE, "nal-hrd" },
{ "cbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR}, INT_MIN, INT_MAX, VE, "nal-hrd" },
+ { "motion-est", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA, VE, "motion-est"},
+ { "dia", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_DIA }, INT_MIN, INT_MAX, VE, "motion-est" },
+ { "hex", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_HEX }, INT_MIN, INT_MAX, VE, "motion-est" },
+ { "umh", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_UMH }, INT_MIN, INT_MAX, VE, "motion-est" },
+ { "esa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_ESA }, INT_MIN, INT_MAX, VE, "motion-est" },
+ { "tesa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_TESA }, INT_MIN, INT_MAX, VE, "motion-est" },
{ "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE },
{ NULL },
};
@@ -694,7 +709,9 @@ static const AVCodecDefault x264_defaults[] = {
{ "trellis", "-1" },
{ "nr", "-1" },
{ "me_range", "-1" },
+#if FF_API_MOTION_EST
{ "me_method", "-1" },
+#endif
{ "subq", "-1" },
{ "b_strategy", "-1" },
{ "keyint_min", "-1" },