[FFmpeg-devel] [PATCH] avcodec: add simpleauto idct

Michael Niedermayer michaelni at gmx.at
Sat Jun 14 18:56:00 CEST 2014


This will pick the "best" simple idct compatible idct

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 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 b5255cb..e1a244d 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -394,6 +394,9 @@ Possible values:
 
 @item simplemmx
 
+ at 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 883f6e4..0ba4f45 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 c7b393a..b1e1869 100644
--- a/libavcodec/arm/dsputil_init_neon.c
+++ b/libavcodec/arm/dsputil_init_neon.c
@@ -49,6 +49,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 68b1f26..aadc64d 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2666,6 +2666,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 ed83621..d01f059 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 40da2d3..42d4dbb 100644
--- a/libavcodec/x86/dsputil_init.c
+++ b/libavcodec/x86/dsputil_init.c
@@ -62,6 +62,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;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list