[FFmpeg-devel] [PATCH 8/9] dct-test: add 12 bit tests

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


---
 libavcodec/dct-test.c     | 22 +++++++++++++++++++++-
 libavcodec/x86/dct-test.c | 22 +++++++++++++++++++++-
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 18d1ba7..24b23e2 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -71,6 +71,10 @@ static const struct algo fdct_tab10[] = {
     { 0 }
 };
 
+static const struct algo fdct_tab12[] = {
+    { 0 }
+};
+
 static void ff_prores_idct_wrap(int16_t *dst){
     LOCAL_ALIGNED(16, int16_t, qmat, [64]);
     int i;
@@ -113,6 +117,13 @@ static const struct algo idct_tab10[] = {
     { 0 }
 };
 
+SIC_WRAP(12)
+
+static const struct algo idct_tab12[] = {
+    { "SIMPLE12-C",  simple_idct12_put_wrap,    FF_IDCT_PERM_NONE },
+    { 0 }
+};
+
 #if ARCH_ARM
 #include "arm/dct-test.c"
 #elif ARCH_PPC
@@ -124,6 +135,8 @@ 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 } };
+static const struct algo fdct_tab_arch12[] = { { 0 } };
+static const struct algo idct_tab_arch12[] = { { 0 } };
 #endif
 
 #define AANSCALE_BITS 12
@@ -232,9 +245,12 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
         if (!strcmp(dct->name, "PR-SSE2"))
             for (i = 0; i < 64; i++)
                 block1[i] = av_clip(block1[i], 4-512, 1019-512);
-        else if (strcmp(dct->name, "SIMPLE10-") > 0)
+        else if (strcmp(dct->name, "SIMPLE10") > 0 && bits == 10) {
             for (i = 0; i < 64; i++)
                 block1[i] = av_clip(block1[i], -512, 511);
+        } else if (strcmp(dct->name, "SIMPLE12") > 0 && bits == 12)
+            for (i = 0; i < 64; i++)
+                block1[i] = av_clip(block1[i], -2048, 2047);
 
         blockSumErr = 0;
         for (i = 0; i < 64; i++) {
@@ -531,6 +547,10 @@ int main(int argc, char **argv)
             idct_tab = idct_tab10; fdct_tab = fdct_tab10;
             idct_tab_arch = idct_tab_arch10; fdct_tab_arch = fdct_tab_arch10;
             break;
+        case 12:
+            idct_tab = idct_tab12; fdct_tab = fdct_tab12;
+            idct_tab_arch = idct_tab_arch12; fdct_tab_arch = fdct_tab_arch12;
+            break;
         default: fprintf(stderr, "No tests for %i bits\n", bits); return 1;
         }
         if (test_idct) {
diff --git a/libavcodec/x86/dct-test.c b/libavcodec/x86/dct-test.c
index 348585c..78dc32f 100644
--- a/libavcodec/x86/dct-test.c
+++ b/libavcodec/x86/dct-test.c
@@ -120,7 +120,27 @@ static const struct algo idct_tab_arch10[] = {
     { 0 }
 };
 static const struct algo fdct_tab_arch12[] = { { 0 } };
-static const struct algo idct_tab_arch12[] = { { 0 } };
+
+#if HAVE_YASM
+#if HAVE_SSE2_EXTERNAL
+SI_WRAP(12, sse2)
+#endif
+#if HAVE_AVX_EXTERNAL
+SI_WRAP(12, avx)
+#endif
+#endif
+
+static const struct algo idct_tab_arch12[] = {
+#if HAVE_YASM
+#if HAVE_SSE2_EXTERNAL
+    { "SIMPLE12-SSE2",  simple_idct12_put_sse2_wrap, FF_IDCT_PERM_TRANSPOSE, AV_CPU_FLAG_SSE2, 1 },
+#endif
+#if HAVE_AVX_EXTERNAL
+    { "SIMPLE12-AVX",   simple_idct12_put_avx_wrap,  FF_IDCT_PERM_TRANSPOSE, AV_CPU_FLAG_AVX,  1 },
+#endif
+#endif
+    { 0 }
+};
 
 static const uint8_t idct_simple_mmx_perm[64] = {
     0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
-- 
2.6.0



More information about the ffmpeg-devel mailing list