From 08c5859f17ed6c16d7e59ea63c63d85cc0d9427f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 14 Jun 2014 18:55:27 +0200 Subject: [PATCH] avcodec: add simpleauto idct This will pick the "best" simple idct compatible idct Signed-off-by: Michael Niedermayer --- doc/codecs.texi | 3 +++ libavcodec/arm/dsputil_init_armv5te.c | 1 + libavcodec/arm/dsputil_init_neon.c | 1 + libavcodec/avcodec.h | 1 + libavcodec/options_table.h | 1 + libavcodec/x86/dsputil_init.c | 1 + 6 files changed, 8 insertions(+) diff --git a/doc/codecs.texi b/doc/codecs.texi index b5255cbdc4..e1a244d6ad 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -394,6 +394,9 @@ Possible values: @item simplemmx +@item simpleauto +Automatically pick a IDCT compatible with the simple one + @item arm @item altivec diff --git a/libavcodec/arm/dsputil_init_armv5te.c b/libavcodec/arm/dsputil_init_armv5te.c index 883f6e40ad..0ba4f453ee 100644 --- a/libavcodec/arm/dsputil_init_armv5te.c +++ b/libavcodec/arm/dsputil_init_armv5te.c @@ -34,6 +34,7 @@ av_cold void ff_dsputil_init_armv5te(DSPContext *c, AVCodecContext *avctx, { if (!avctx->lowres && !high_bit_depth && (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEAUTO || avctx->idct_algo == FF_IDCT_SIMPLEARMV5TE)) { c->idct_put = ff_simple_idct_put_armv5te; c->idct_add = ff_simple_idct_add_armv5te; diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c index 2d30d40117..797983c76c 100644 --- a/libavcodec/arm/dsputil_init_neon.c +++ b/libavcodec/arm/dsputil_init_neon.c @@ -46,6 +46,7 @@ av_cold void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx, { if (!avctx->lowres && !high_bit_depth) { if (avctx->idct_algo == FF_IDCT_AUTO || + avctx->idct_algo == FF_IDCT_SIMPLEAUTO || avctx->idct_algo == FF_IDCT_SIMPLENEON) { c->idct_put = ff_simple_idct_put_neon; c->idct_add = ff_simple_idct_add_neon; diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7cf53b4848..2579ccc971 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2667,6 +2667,7 @@ typedef struct AVCodecContext { #if FF_API_ARCH_ALPHA #define FF_IDCT_SIMPLEALPHA 23 #endif +#define FF_IDCT_SIMPLEAUTO 128 /** * bits per sample/pixel from the demuxer (needed for huffyuv). diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index 9bfd750517..6185e67937 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -219,6 +219,7 @@ static const AVOption avcodec_options[] = { {"ipp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"xvidmmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"faani", "floating point AAN IDCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"}, +{"simpleauto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEAUTO }, INT_MIN, INT_MAX, V|E|D, "idct"}, {"slice_count", NULL, OFFSET(slice_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, {"ec", "set error concealment strategy", OFFSET(error_concealment), AV_OPT_TYPE_FLAGS, {.i64 = 3 }, INT_MIN, INT_MAX, V|D, "ec"}, {"guess_mvs", "iterative motion vector (MV) search (slow)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_GUESS_MVS }, INT_MIN, INT_MAX, V|D, "ec"}, diff --git a/libavcodec/x86/dsputil_init.c b/libavcodec/x86/dsputil_init.c index 1ab1a0ae59..5c12364c23 100644 --- a/libavcodec/x86/dsputil_init.c +++ b/libavcodec/x86/dsputil_init.c @@ -60,6 +60,7 @@ static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, if (avctx->lowres == 0 && !high_bit_depth) { switch (avctx->idct_algo) { case FF_IDCT_AUTO: + case FF_IDCT_SIMPLEAUTO: case FF_IDCT_SIMPLEMMX: c->idct_put = ff_simple_idct_put_mmx; c->idct_add = ff_simple_idct_add_mmx;