comparison dct-test.c @ 6602:e0a87be356e3 libavcodec

Test idct_xvid_sse2() in dct-test.
author astrange
date Wed, 16 Apr 2008 01:54:16 +0000
parents 0ec61ed36c29
children 65e7e714c770
comparison
equal deleted inserted replaced
6601:f76581c16848 6602:e0a87be356e3
70 struct algo { 70 struct algo {
71 char *name; 71 char *name;
72 enum { FDCT, IDCT } is_idct; 72 enum { FDCT, IDCT } is_idct;
73 void (* func) (DCTELEM *block); 73 void (* func) (DCTELEM *block);
74 void (* ref) (DCTELEM *block); 74 void (* ref) (DCTELEM *block);
75 enum formattag { NO_PERM,MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM } format; 75 enum formattag { NO_PERM,MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM, SSE2_PERM } format;
76 int mm_support; 76 int mm_support;
77 }; 77 };
78 78
79 #ifndef FAAN_POSTSCALE 79 #ifndef FAAN_POSTSCALE
80 #define FAAN_SCALE SCALE_PERM 80 #define FAAN_SCALE SCALE_PERM
103 {"LIBMPEG2-MMXEXT", 1, ff_mmxext_idct, idct, MMX_PERM, MM_MMXEXT}, 103 {"LIBMPEG2-MMXEXT", 1, ff_mmxext_idct, idct, MMX_PERM, MM_MMXEXT},
104 #endif 104 #endif
105 {"SIMPLE-MMX", 1, ff_simple_idct_mmx, idct, MMX_SIMPLE_PERM, MM_MMX}, 105 {"SIMPLE-MMX", 1, ff_simple_idct_mmx, idct, MMX_SIMPLE_PERM, MM_MMX},
106 {"XVID-MMX", 1, ff_idct_xvid_mmx, idct, NO_PERM, MM_MMX}, 106 {"XVID-MMX", 1, ff_idct_xvid_mmx, idct, NO_PERM, MM_MMX},
107 {"XVID-MMX2", 1, ff_idct_xvid_mmx2, idct, NO_PERM, MM_MMXEXT}, 107 {"XVID-MMX2", 1, ff_idct_xvid_mmx2, idct, NO_PERM, MM_MMXEXT},
108 {"XVID-SSE2", 1, ff_idct_xvid_sse2, idct, SSE2_PERM, MM_SSE2},
108 #endif 109 #endif
109 110
110 #ifdef HAVE_ALTIVEC 111 #ifdef HAVE_ALTIVEC
111 {"altivecfdct", 0, fdct_altivec, fdct, NO_PERM, MM_ALTIVEC}, 112 {"altivecfdct", 0, fdct_altivec, fdct, NO_PERM, MM_ALTIVEC},
112 #endif 113 #endif
155 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, 156 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
156 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, 157 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
157 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, 158 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
158 }; 159 };
159 160
161 static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7};
162
160 void idct_mmx_init(void) 163 void idct_mmx_init(void)
161 { 164 {
162 int i; 165 int i;
163 166
164 /* the mmx/mmxext idct uses a reordered input, so we patch scan tables */ 167 /* the mmx/mmxext idct uses a reordered input, so we patch scan tables */
230 block[idct_mmx_perm[i]] = block1[i]; 233 block[idct_mmx_perm[i]] = block1[i];
231 } else if (form == MMX_SIMPLE_PERM) { 234 } else if (form == MMX_SIMPLE_PERM) {
232 for(i=0;i<64;i++) 235 for(i=0;i<64;i++)
233 block[idct_simple_mmx_perm[i]] = block1[i]; 236 block[idct_simple_mmx_perm[i]] = block1[i];
234 237
238 } else if (form == SSE2_PERM) {
239 for(i=0; i<64; i++)
240 block[(i&0x38) | idct_sse2_row_perm[i&7]] = block1[i];
235 } else { 241 } else {
236 for(i=0; i<64; i++) 242 for(i=0; i<64; i++)
237 block[i]= block1[i]; 243 block[i]= block1[i];
238 } 244 }
239 #if 0 // simulate mismatch control for tested IDCT but not the ref 245 #if 0 // simulate mismatch control for tested IDCT but not the ref