-#define HADAMARD8_DIFF_MMX(cpu) \
-static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\
- DECLARE_ALIGNED_8(uint64_t, temp[13]);\
- int sum;\
-\
- assert(h==8);\
-\
- DIFF_PIXELS_4x8(src1, src2, stride, temp[0]);\
-\
- __asm__ volatile(\
- HADAMARD48\
-\
- "movq %%mm7, 96(%1) \n\t"\
-\
- TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
- STORE4(8, 0(%1), %%mm0, %%mm3, %%mm7, %%mm2)\
-\
- "movq 96(%1), %%mm7 \n\t"\
- TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
- STORE4(8, 64(%1), %%mm4, %%mm7, %%mm0, %%mm6)\
-\
- : "=r" (sum)\
- : "r"(temp)\
- );\
-\
- DIFF_PIXELS_4x8(src1+4, src2+4, stride, temp[4]);\
-\
- __asm__ volatile(\
- HADAMARD48\
-\
- "movq %%mm7, 96(%1) \n\t"\
-\
- TRANSPOSE4(%%mm0, %%mm1, %%mm2, %%mm3, %%mm7)\
- STORE4(8, 32(%1), %%mm0, %%mm3, %%mm7, %%mm2)\
-\
- "movq 96(%1), %%mm7 \n\t"\
- TRANSPOSE4(%%mm4, %%mm5, %%mm6, %%mm7, %%mm0)\
- "movq %%mm7, %%mm5 \n\t"/*FIXME remove*/\
- "movq %%mm6, %%mm7 \n\t"\
- "movq %%mm0, %%mm6 \n\t"\
-\
- LOAD4(8, 64(%1), %%mm0, %%mm1, %%mm2, %%mm3)\
-\
- HADAMARD48\
- "movq %%mm7, 64(%1) \n\t"\
- MMABS(%%mm0, %%mm7)\
- MMABS(%%mm1, %%mm7)\
- MMABS_SUM(%%mm2, %%mm7, %%mm0)\
- MMABS_SUM(%%mm3, %%mm7, %%mm1)\
- MMABS_SUM(%%mm4, %%mm7, %%mm0)\
- MMABS_SUM(%%mm5, %%mm7, %%mm1)\
- MMABS_SUM(%%mm6, %%mm7, %%mm0)\
- "movq 64(%1), %%mm2 \n\t"\
- MMABS_SUM(%%mm2, %%mm7, %%mm1)\
- "paddusw %%mm1, %%mm0 \n\t"\
- "movq %%mm0, 64(%1) \n\t"\
-\
- LOAD4(8, 0(%1), %%mm0, %%mm1, %%mm2, %%mm3)\
- LOAD4(8, 32(%1), %%mm4, %%mm5, %%mm6, %%mm7)\
-\
- HADAMARD48\
- "movq %%mm7, (%1) \n\t"\
- MMABS(%%mm0, %%mm7)\
- MMABS(%%mm1, %%mm7)\
- MMABS_SUM(%%mm2, %%mm7, %%mm0)\
- MMABS_SUM(%%mm3, %%mm7, %%mm1)\
- MMABS_SUM(%%mm4, %%mm7, %%mm0)\
- MMABS_SUM(%%mm5, %%mm7, %%mm1)\
- MMABS_SUM(%%mm6, %%mm7, %%mm0)\
- "movq (%1), %%mm2 \n\t"\
- MMABS_SUM(%%mm2, %%mm7, %%mm1)\
- "paddusw 64(%1), %%mm0 \n\t"\
- "paddusw %%mm1, %%mm0 \n\t"\
-\
- HSUM(%%mm0, %%mm1, %0)\
-\
- : "=r" (sum)\
- : "r"(temp)\
- );\
- return sum&0xFFFF;\
-}\
-WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
-
-#define HADAMARD8_DIFF_SSE2(cpu) \
-static int hadamard8_diff_##cpu(void *s, uint8_t *src1, uint8_t *src2, int stride, int h){\
- DECLARE_ALIGNED_16(uint64_t, temp[4]);\
- int sum;\
-\
- assert(h==8);\
-\
- DIFF_PIXELS_8x8(src1, src2, stride, temp[0]);\
-\
- __asm__ volatile(\
- HADAMARD8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)\
- TRANSPOSE8(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7, (%1))\
- HADAMARD8(%%xmm0, %%xmm5, %%xmm7, %%xmm3, %%xmm6, %%xmm4, %%xmm2, %%xmm1)\
- MMABS_SUM_8x8\
- HSUM_SSE2(%%xmm0, %%xmm1, %0)\
- : "=r" (sum)\
- : "r"(temp)\
- );\
- return sum&0xFFFF;\
-}\
-WRAPPER8_16_SQ(hadamard8_diff_##cpu, hadamard8_diff16_##cpu)
-
-#define MMABS(a,z) MMABS_MMX(a,z)
-#define HSUM(a,t,dst) HSUM_MMX(a,t,dst)
-HADAMARD8_DIFF_MMX(mmx)
-#undef MMABS
-#undef HSUM