| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (c) 2001 Fabrice Bellard | 2 * (c) 2001 Fabrice Bellard |
| 3 * 2007 Marc Hoffman <marc.hoffman@analog.com> | 3 * 2007 Marc Hoffman <marc.hoffman@analog.com> |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * Started from sample code by Juan J. Sierralta P. | 25 * Started from sample code by Juan J. Sierralta P. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 #include <stdio.h> | 29 #include <stdio.h> |
| 30 #include <string.h> | 30 #include <string.h> |
| 31 #include <sys/time.h> | 31 #include <sys/time.h> |
| 32 #include <unistd.h> | 32 #include <unistd.h> |
| 33 #include <math.h> | 33 #include <math.h> |
| 34 | 34 |
| 35 #include "libavutil/cpu.h" |
| 35 #include "libavutil/common.h" | 36 #include "libavutil/common.h" |
| 36 #include "libavutil/lfg.h" | 37 #include "libavutil/lfg.h" |
| 37 | 38 |
| 38 #include "simple_idct.h" | 39 #include "simple_idct.h" |
| 39 #include "aandcttab.h" | 40 #include "aandcttab.h" |
| 40 #include "faandct.h" | 41 #include "faandct.h" |
| 41 #include "faanidct.h" | 42 #include "faanidct.h" |
| 42 #include "x86/idct_xvid.h" | 43 #include "x86/idct_xvid.h" |
| 43 #include "dctref.h" | 44 #include "dctref.h" |
| 44 | 45 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 {"REF-DBL", 0, ff_ref_fdct, ff_ref_fdct, NO_PERM}, | 88 {"REF-DBL", 0, ff_ref_fdct, ff_ref_fdct, NO_PERM}, |
| 88 {"FAAN", 0, ff_faandct, ff_ref_fdct, FAAN_SCALE}, | 89 {"FAAN", 0, ff_faandct, ff_ref_fdct, FAAN_SCALE}, |
| 89 {"FAANI", 1, ff_faanidct, ff_ref_idct, NO_PERM}, | 90 {"FAANI", 1, ff_faanidct, ff_ref_idct, NO_PERM}, |
| 90 {"IJG-AAN-INT", 0, fdct_ifast, ff_ref_fdct, SCALE_PERM}, | 91 {"IJG-AAN-INT", 0, fdct_ifast, ff_ref_fdct, SCALE_PERM}, |
| 91 {"IJG-LLM-INT", 0, ff_jpeg_fdct_islow, ff_ref_fdct, NO_PERM}, | 92 {"IJG-LLM-INT", 0, ff_jpeg_fdct_islow, ff_ref_fdct, NO_PERM}, |
| 92 {"REF-DBL", 1, ff_ref_idct, ff_ref_idct, NO_PERM}, | 93 {"REF-DBL", 1, ff_ref_idct, ff_ref_idct, NO_PERM}, |
| 93 {"INT", 1, j_rev_dct, ff_ref_idct, MMX_PERM}, | 94 {"INT", 1, j_rev_dct, ff_ref_idct, MMX_PERM}, |
| 94 {"SIMPLE-C", 1, ff_simple_idct, ff_ref_idct, NO_PERM}, | 95 {"SIMPLE-C", 1, ff_simple_idct, ff_ref_idct, NO_PERM}, |
| 95 | 96 |
| 96 #if HAVE_MMX | 97 #if HAVE_MMX |
| 97 {"MMX", 0, ff_fdct_mmx, ff_ref_fdct, NO_PERM, FF_MM_MMX}, | 98 {"MMX", 0, ff_fdct_mmx, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_M
MX}, |
| 98 #if HAVE_MMX2 | 99 #if HAVE_MMX2 |
| 99 {"MMX2", 0, ff_fdct_mmx2, ff_ref_fdct, NO_PERM, FF_MM_MMX2}, | 100 {"MMX2", 0, ff_fdct_mmx2, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_M
MX2}, |
| 100 {"SSE2", 0, ff_fdct_sse2, ff_ref_fdct, NO_PERM, FF_MM_SSE2}, | 101 {"SSE2", 0, ff_fdct_sse2, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_S
SE2}, |
| 101 #endif | 102 #endif |
| 102 | 103 |
| 103 #if CONFIG_GPL | 104 #if CONFIG_GPL |
| 104 {"LIBMPEG2-MMX", 1, ff_mmx_idct, ff_ref_idct, MMX_PERM, FF_MM_MMX}, | 105 {"LIBMPEG2-MMX", 1, ff_mmx_idct, ff_ref_idct, MMX_PERM, AV_CPU_FLAG_
MMX}, |
| 105 {"LIBMPEG2-MMX2", 1, ff_mmxext_idct, ff_ref_idct, MMX_PERM, FF_MM_MMX2}, | 106 {"LIBMPEG2-MMX2", 1, ff_mmxext_idct, ff_ref_idct, MMX_PERM, AV_CPU_FLAG_
MMX2}, |
| 106 #endif | 107 #endif |
| 107 {"SIMPLE-MMX", 1, ff_simple_idct_mmx, ff_ref_idct, MMX_SIMPLE_PERM, FF_MM
_MMX}, | 108 {"SIMPLE-MMX", 1, ff_simple_idct_mmx, ff_ref_idct, MMX_SIMPLE_PERM, AV_CP
U_FLAG_MMX}, |
| 108 {"XVID-MMX", 1, ff_idct_xvid_mmx, ff_ref_idct, NO_PERM, FF_MM_MMX}, | 109 {"XVID-MMX", 1, ff_idct_xvid_mmx, ff_ref_idct, NO_PERM, AV_CPU_FLAG_M
MX}, |
| 109 {"XVID-MMX2", 1, ff_idct_xvid_mmx2, ff_ref_idct, NO_PERM, FF_MM_MMX2}, | 110 {"XVID-MMX2", 1, ff_idct_xvid_mmx2, ff_ref_idct, NO_PERM, AV_CPU_FLAG_M
MX2}, |
| 110 {"XVID-SSE2", 1, ff_idct_xvid_sse2, ff_ref_idct, SSE2_PERM, FF_MM_SSE2}
, | 111 {"XVID-SSE2", 1, ff_idct_xvid_sse2, ff_ref_idct, SSE2_PERM, AV_CPU_FLAG
_SSE2}, |
| 111 #endif | 112 #endif |
| 112 | 113 |
| 113 #if HAVE_ALTIVEC | 114 #if HAVE_ALTIVEC |
| 114 {"altivecfdct", 0, fdct_altivec, ff_ref_fdct, NO_PERM, FF_MM_ALTIVEC
}, | 115 {"altivecfdct", 0, fdct_altivec, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_A
LTIVEC}, |
| 115 #endif | 116 #endif |
| 116 | 117 |
| 117 #if ARCH_BFIN | 118 #if ARCH_BFIN |
| 118 {"BFINfdct", 0, ff_bfin_fdct, ff_ref_fdct, NO_PERM}, | 119 {"BFINfdct", 0, ff_bfin_fdct, ff_ref_fdct, NO_PERM}, |
| 119 {"BFINidct", 1, ff_bfin_idct, ff_ref_idct, NO_PERM}, | 120 {"BFINidct", 1, ff_bfin_idct, ff_ref_idct, NO_PERM}, |
| 120 #endif | 121 #endif |
| 121 | 122 |
| 122 #if ARCH_ARM | 123 #if ARCH_ARM |
| 123 {"SIMPLE-ARM", 1, ff_simple_idct_arm, ff_ref_idct, NO_PERM }, | 124 {"SIMPLE-ARM", 1, ff_simple_idct_arm, ff_ref_idct, NO_PERM }, |
| 124 {"INT-ARM", 1, ff_j_rev_dct_arm, ff_ref_idct, MMX_PERM }, | 125 {"INT-ARM", 1, ff_j_rev_dct_arm, ff_ref_idct, MMX_PERM }, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 181 } |
| 181 } | 182 } |
| 182 | 183 |
| 183 DECLARE_ALIGNED(16, static DCTELEM, block)[64]; | 184 DECLARE_ALIGNED(16, static DCTELEM, block)[64]; |
| 184 DECLARE_ALIGNED(8, static DCTELEM, block1)[64]; | 185 DECLARE_ALIGNED(8, static DCTELEM, block1)[64]; |
| 185 DECLARE_ALIGNED(8, static DCTELEM, block_org)[64]; | 186 DECLARE_ALIGNED(8, static DCTELEM, block_org)[64]; |
| 186 | 187 |
| 187 static inline void mmx_emms(void) | 188 static inline void mmx_emms(void) |
| 188 { | 189 { |
| 189 #if HAVE_MMX | 190 #if HAVE_MMX |
| 190 if (cpu_flags & FF_MM_MMX) | 191 if (cpu_flags & AV_CPU_FLAG_MMX) |
| 191 __asm__ volatile ("emms\n\t"); | 192 __asm__ volatile ("emms\n\t"); |
| 192 #endif | 193 #endif |
| 193 } | 194 } |
| 194 | 195 |
| 195 static void dct_error(const char *name, int is_idct, | 196 static void dct_error(const char *name, int is_idct, |
| 196 void (*fdct_func)(DCTELEM *block), | 197 void (*fdct_func)(DCTELEM *block), |
| 197 void (*fdct_ref)(DCTELEM *block), int form, int test) | 198 void (*fdct_ref)(DCTELEM *block), int form, int test) |
| 198 { | 199 { |
| 199 int it, i, scale; | 200 int it, i, scale; |
| 200 int err_inf, v; | 201 int err_inf, v; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 " 2 -> do 3. test from mpeg4 std\n" | 548 " 2 -> do 3. test from mpeg4 std\n" |
| 548 "-i test IDCT implementations\n" | 549 "-i test IDCT implementations\n" |
| 549 "-4 test IDCT248 implementations\n"); | 550 "-4 test IDCT248 implementations\n"); |
| 550 } | 551 } |
| 551 | 552 |
| 552 int main(int argc, char **argv) | 553 int main(int argc, char **argv) |
| 553 { | 554 { |
| 554 int test_idct = 0, test_248_dct = 0; | 555 int test_idct = 0, test_248_dct = 0; |
| 555 int c,i; | 556 int c,i; |
| 556 int test=1; | 557 int test=1; |
| 557 cpu_flags = mm_support(); | 558 cpu_flags = av_get_cpu_flags(); |
| 558 | 559 |
| 559 ff_ref_dct_init(); | 560 ff_ref_dct_init(); |
| 560 idct_mmx_init(); | 561 idct_mmx_init(); |
| 561 | 562 |
| 562 for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i; | 563 for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i; |
| 563 for(i=0;i<MAX_NEG_CROP;i++) { | 564 for(i=0;i<MAX_NEG_CROP;i++) { |
| 564 cropTbl[i] = 0; | 565 cropTbl[i] = 0; |
| 565 cropTbl[i + MAX_NEG_CROP + 256] = 255; | 566 cropTbl[i + MAX_NEG_CROP + 256] = 255; |
| 566 } | 567 } |
| 567 | 568 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 590 if (test_248_dct) { | 591 if (test_248_dct) { |
| 591 idct248_error("SIMPLE-C", ff_simple_idct248_put); | 592 idct248_error("SIMPLE-C", ff_simple_idct248_put); |
| 592 } else { | 593 } else { |
| 593 for (i=0;algos[i].name;i++) | 594 for (i=0;algos[i].name;i++) |
| 594 if (algos[i].is_idct == test_idct && !(~cpu_flags & algos[i].mm_support)
) { | 595 if (algos[i].is_idct == test_idct && !(~cpu_flags & algos[i].mm_support)
) { |
| 595 dct_error (algos[i].name, algos[i].is_idct, algos[i].func, algos[i].re
f, algos[i].format, test); | 596 dct_error (algos[i].name, algos[i].is_idct, algos[i].func, algos[i].re
f, algos[i].format, test); |
| 596 } | 597 } |
| 597 } | 598 } |
| 598 return 0; | 599 return 0; |
| 599 } | 600 } |
| OLD | NEW |