[FFmpeg-devel] [PATCH 5/9] dct-test: add infrastructure for 10 bits

Christophe Gisquet christophe.gisquet at gmail.com
Thu Oct 8 08:22:52 CEST 2015


---
 libavcodec/arm/dct-test.c | 10 ++++++++--
 libavcodec/dct-test.c     | 41 +++++++++++++++++++++++++++++++++++------
 libavcodec/ppc/dct-test.c | 10 ++++++++--
 libavcodec/x86/dct-test.c |  9 +++++++--
 4 files changed, 58 insertions(+), 12 deletions(-)

diff --git a/libavcodec/arm/dct-test.c b/libavcodec/arm/dct-test.c
index f9076b3..fd86b9d 100644
--- a/libavcodec/arm/dct-test.c
+++ b/libavcodec/arm/dct-test.c
@@ -20,11 +20,11 @@
 
 #include "idct.h"
 
-static const struct algo fdct_tab_arch[] = {
+static const struct algo fdct_tab_arch8[] = {
     { 0 }
 };
 
-static const struct algo idct_tab_arch[] = {
+static const struct algo idct_tab_arch8[] = {
     { "SIMPLE-ARM",     ff_simple_idct_arm,     FF_IDCT_PERM_NONE },
     { "INT-ARM",        ff_j_rev_dct_arm,       FF_IDCT_PERM_LIBMPEG2 },
 #if HAVE_ARMV5TE
@@ -38,3 +38,9 @@ static const struct algo idct_tab_arch[] = {
 #endif
     { 0 }
 };
+
+static const struct algo fdct_tab_arch10[] = { { 0 } };
+static const struct algo idct_tab_arch10[] = { { 0 } };
+static const struct algo fdct_tab_arch12[] = { { 0 } };
+static const struct algo idct_tab_arch12[] = { { 0 } };
+
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 56e1a62..9a195ab 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -56,13 +56,19 @@ struct algo {
     int nonspec;
 };
 
-static const struct algo fdct_tab[] = {
+static const struct algo fdct_tab8[] = {
     { "REF-DBL",     ff_ref_fdct,          FF_IDCT_PERM_NONE },
     { "IJG-AAN-INT", ff_fdct_ifast,        FF_IDCT_PERM_NONE },
     { "IJG-LLM-INT", ff_jpeg_fdct_islow_8, FF_IDCT_PERM_NONE },
 #if CONFIG_FAANDCT
     { "FAAN",        ff_faandct,           FF_IDCT_PERM_NONE },
 #endif /* CONFIG_FAANDCT */
+    { 0 }
+};
+
+static const struct algo fdct_tab10[] = {
+    { "IJG-LLM-INT10", ff_jpeg_fdct_islow_10, FF_IDCT_PERM_NONE },
+    { 0 }
 };
 
 static void ff_prores_idct_wrap(int16_t *dst){
@@ -78,7 +84,7 @@ static void ff_prores_idct_wrap(int16_t *dst){
     }
 }
 
-static const struct algo idct_tab[] = {
+static const struct algo idct_tab8[] = {
     { "REF-DBL",     ff_ref_idct,          FF_IDCT_PERM_NONE },
     { "INT",         ff_j_rev_dct,         FF_IDCT_PERM_LIBMPEG2 },
     { "SIMPLE-C",    ff_simple_idct_8,     FF_IDCT_PERM_NONE },
@@ -89,6 +95,12 @@ static const struct algo idct_tab[] = {
 #if CONFIG_MPEG4_DECODER
     { "XVID",        ff_xvid_idct,         FF_IDCT_PERM_NONE, 0, 1 },
 #endif /* CONFIG_MPEG4_DECODER */
+    { 0 }
+};
+
+static const struct algo idct_tab10[] = {
+    { "SIMPLE10-C",  ff_simple_idct_10,    FF_IDCT_PERM_NONE },
+    { 0 }
 };
 
 #if ARCH_ARM
@@ -98,8 +110,10 @@ static const struct algo idct_tab[] = {
 #elif ARCH_X86
 #include "x86/dct-test.c"
 #else
-static const struct algo fdct_tab_arch[] = { { 0 } };
-static const struct algo idct_tab_arch[] = { { 0 } };
+static const struct algo fdct_tab_arch8[] = { { 0 } };
+static const struct algo idct_tab_arch8[] = { { 0 } };
+static const struct algo fdct_tab_arch10[] = { { 0 } };
+static const struct algo idct_tab_arch10[] = { { 0 } };
 #endif
 
 #define AANSCALE_BITS 12
@@ -451,6 +465,10 @@ static void help(void)
 
 int main(int argc, char **argv)
 {
+    const struct algo* idct_tab = NULL;
+    const struct algo* fdct_tab = NULL;
+    const struct algo* fdct_tab_arch = NULL;
+    const struct algo* idct_tab_arch = NULL;
     int test_idct = 0, test_248_dct = 0;
     int c, i;
     int test = 1;
@@ -491,8 +509,19 @@ int main(int argc, char **argv)
         idct248_error("SIMPLE-C", ff_simple_idct248_put, speed);
     } else {
         const int cpu_flags = av_get_cpu_flags();
+        switch(bits) {
+        case  8:
+            idct_tab =  idct_tab8; fdct_tab =  fdct_tab8;
+            idct_tab_arch = idct_tab_arch8; fdct_tab_arch = fdct_tab_arch8;
+            break;
+        case 10:
+            idct_tab = idct_tab10; fdct_tab = fdct_tab10;
+            idct_tab_arch = idct_tab_arch10; fdct_tab_arch = fdct_tab_arch10;
+            break;
+        default: fprintf(stderr, "No tests for %i bits\n", bits); return 1;
+        }
         if (test_idct) {
-            for (i = 0; i < FF_ARRAY_ELEMS(idct_tab); i++)
+            for (i = 0; idct_tab[i].name; i++)
                 err |= dct_error(&idct_tab[i], test, test_idct, speed, bits);
 
             for (i = 0; idct_tab_arch[i].name; i++)
@@ -501,7 +530,7 @@ int main(int argc, char **argv)
         }
 #if CONFIG_FDCTDSP
         else {
-            for (i = 0; i < FF_ARRAY_ELEMS(fdct_tab); i++)
+            for (i = 0; fdct_tab[i].name; i++)
                 err |= dct_error(&fdct_tab[i], test, test_idct, speed, bits);
 
             for (i = 0; fdct_tab_arch[i].name; i++)
diff --git a/libavcodec/ppc/dct-test.c b/libavcodec/ppc/dct-test.c
index 2328516..a646c2e 100644
--- a/libavcodec/ppc/dct-test.c
+++ b/libavcodec/ppc/dct-test.c
@@ -20,13 +20,19 @@
 
 #include "fdct.h"
 
-static const struct algo fdct_tab_arch[] = {
+static const struct algo fdct_tab_arch8[] = {
 #if HAVE_ALTIVEC
     { "altivecfdct", ff_fdct_altivec, FF_IDCT_PERM_NONE, AV_CPU_FLAG_ALTIVEC },
 #endif
     { 0 }
 };
 
-static const struct algo idct_tab_arch[] = {
+static const struct algo idct_tab_arch8[] = {
     { 0 }
 };
+
+static const struct algo fdct_tab_arch10[] = { { 0 } };
+static const struct algo idct_tab_arch10[] = { { 0 } };
+static const struct algo fdct_tab_arch12[] = { { 0 } };
+static const struct algo idct_tab_arch12[] = { { 0 } };
+
diff --git a/libavcodec/x86/dct-test.c b/libavcodec/x86/dct-test.c
index 0414381..692c23b 100644
--- a/libavcodec/x86/dct-test.c
+++ b/libavcodec/x86/dct-test.c
@@ -53,7 +53,7 @@ PR_WRAP(avx)
 
 #endif
 
-static const struct algo fdct_tab_arch[] = {
+static const struct algo fdct_tab_arch8[] = {
 #if HAVE_MMX_INLINE
     { "MMX",    ff_fdct_mmx,    FF_IDCT_PERM_NONE, AV_CPU_FLAG_MMX },
 #endif
@@ -66,7 +66,7 @@ static const struct algo fdct_tab_arch[] = {
     { 0 }
 };
 
-static const struct algo idct_tab_arch[] = {
+static const struct algo idct_tab_arch8[] = {
 #if HAVE_MMX_INLINE
     { "SIMPLE-MMX",  ff_simple_idct_mmx,  FF_IDCT_PERM_SIMPLE, AV_CPU_FLAG_MMX },
 #endif
@@ -88,6 +88,11 @@ static const struct algo idct_tab_arch[] = {
     { 0 }
 };
 
+static const struct algo fdct_tab_arch10[] = { { 0 } };
+static const struct algo idct_tab_arch10[] = { { 0 } };
+static const struct algo fdct_tab_arch12[] = { { 0 } };
+static const struct algo idct_tab_arch12[] = { { 0 } };
+
 static const uint8_t idct_simple_mmx_perm[64] = {
     0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
     0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
-- 
2.6.0



More information about the ffmpeg-devel mailing list