;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
-%include "x86inc.asm"
-%include "x86util.asm"
+%include "libavutil/x86/x86util.asm"
%define W1sh2 22725 ; W1 = 90901 = 22725<<2 + 1
%define W2sh2 21407 ; W2 = 85627 = 21407<<2 - 1
%define W6sh2 8867 ; W6 = 35468 = 8867<<2
%define W7sh2 4520 ; W7 = 18081 = 4520<<2 + 1
-%ifdef ARCH_X86_64
+%if ARCH_X86_64
SECTION_RODATA
; %1 = row or col (for rounding variable)
; %2 = number of bits to shift at the end
-; %3 = optimization
-%macro IDCT_1D 3
+%macro IDCT_1D 2
; a0 = (W4 * row[0]) + (1 << (15 - 1));
; a1 = a0;
; a2 = a0;
%endmacro
; void prores_idct_put_10_<opt>(uint8_t *pixels, int stride,
-; DCTELEM *block, const int16_t *qmat);
-%macro idct_put_fn 2
-cglobal prores_idct_put_10_%1, 4, 4, %2
+; int16_t *block, const int16_t *qmat);
+%macro idct_put_fn 1
+cglobal prores_idct_put_10, 4, 4, %1
movsxd r1, r1d
pxor m15, m15 ; zero
pmullw m13,[r3+64]
pmullw m12,[r3+96]
- IDCT_1D row, 17, %1
+ IDCT_1D row, 17
; transpose for second part of IDCT
TRANSPOSE8x8W 8, 0, 1, 2, 4, 11, 9, 10, 3
; for (i = 0; i < 8; i++)
; idctSparseColAdd(dest + i, line_size, block + i);
- IDCT_1D col, 20, %1
+ IDCT_1D col, 20
; clip/store
mova m6, [pw_512]
RET
%endmacro
-%macro signextend_sse2 3 ; dstlow, dsthigh, tmp
+%macro SIGNEXTEND 2-3
+%if cpuflag(sse4) ; dstlow, dsthigh
+ movhlps %2, %1
+ pmovsxwd %1, %1
+ pmovsxwd %2, %2
+%elif cpuflag(sse2) ; dstlow, dsthigh, tmp
pxor %3, %3
pcmpgtw %3, %1
mova %2, %1
punpcklwd %1, %3
punpckhwd %2, %3
+%endif
%endmacro
-%macro signextend_sse4 2-3 ; dstlow, dsthigh
- movhlps %2, %1
- pmovsxwd %1, %1
- pmovsxwd %2, %2
-%endmacro
-
-INIT_XMM
-%define SIGNEXTEND signextend_sse2
-idct_put_fn sse2, 16
-INIT_XMM
-%define SIGNEXTEND signextend_sse4
-idct_put_fn sse4, 16
-INIT_AVX
-idct_put_fn avx, 16
+INIT_XMM sse2
+idct_put_fn 16
+INIT_XMM sse4
+idct_put_fn 16
+INIT_XMM avx
+idct_put_fn 16
%endif