mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-09 17:39:08 +00:00
avcodec/x86/vc1dsp_inv_trans: Port to SSE2
No change in performance here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -66,14 +66,14 @@ void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
|
||||
ptrdiff_t stride, int h, int x, int y);
|
||||
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, const uint8_t *src,
|
||||
ptrdiff_t stride, int h, int x, int y);
|
||||
void ff_vc1_inv_trans_4x4_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_4x8_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_8x4_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_8x8_dc_mmxext(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_4x4_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_4x8_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_8x4_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
void ff_vc1_inv_trans_8x8_dc_sse2(uint8_t *dest, ptrdiff_t linesize,
|
||||
int16_t *block);
|
||||
|
||||
#define MSPEL_FUNC(OP, X, Y, SIZE, XMM) \
|
||||
void ff_vc1_ ## OP ## _mspel_mc ## X ## Y ## _ ## SIZE ##_ ## XMM \
|
||||
@@ -110,13 +110,12 @@ av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
|
||||
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
|
||||
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
|
||||
|
||||
if (EXTERNAL_MMXEXT(cpu_flags)) {
|
||||
dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_mmxext;
|
||||
dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_mmxext;
|
||||
dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_mmxext;
|
||||
dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_mmxext;
|
||||
}
|
||||
if (EXTERNAL_SSE2(cpu_flags)) {
|
||||
dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_sse2;
|
||||
dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_sse2;
|
||||
dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_sse2;
|
||||
dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_sse2;
|
||||
|
||||
ASSIGN_LF816(sse2);
|
||||
|
||||
MSPEL_FUNCS(0, 0, sse2);
|
||||
|
||||
@@ -23,9 +23,13 @@
|
||||
|
||||
SECTION .text
|
||||
|
||||
%macro INV_TRANS_INIT 0
|
||||
%macro INV_TRANS_INIT 1 ; width
|
||||
movd m0, blockd
|
||||
%if %1 == 4
|
||||
pshuflw m0, m0, 0
|
||||
%else
|
||||
SPLATW m0, m0
|
||||
%endif
|
||||
pxor m1, m1
|
||||
psubw m1, m0
|
||||
packuswb m0, m0
|
||||
@@ -54,9 +58,9 @@ SECTION .text
|
||||
mov%1 [linesize3q +destq], m5
|
||||
%endmacro
|
||||
|
||||
; ff_vc1_inv_trans_?x?_dc_mmxext(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
|
||||
INIT_MMX mmxext
|
||||
cglobal vc1_inv_trans_4x4_dc, 3,4,0, dest, linesize, block
|
||||
INIT_XMM sse2
|
||||
; ff_vc1_inv_trans_?x?_dc_sse2(uint8_t *dest, ptrdiff_t linesize, int16_t *block)
|
||||
cglobal vc1_inv_trans_4x4_dc, 3,4,6, dest, linesize, block
|
||||
movsx r3d, WORD [blockq]
|
||||
mov blockd, r3d ; dc
|
||||
shl blockd, 4 ; 16 * dc
|
||||
@@ -67,13 +71,12 @@ cglobal vc1_inv_trans_4x4_dc, 3,4,0, dest, linesize, block
|
||||
lea blockd, [blockq+r3+64] ; 17 * dc + 64
|
||||
sar blockd, 7 ; >> 7
|
||||
|
||||
INV_TRANS_INIT
|
||||
INV_TRANS_INIT 4
|
||||
|
||||
INV_TRANS_PROCESS h
|
||||
INV_TRANS_PROCESS d
|
||||
RET
|
||||
|
||||
INIT_MMX mmxext
|
||||
cglobal vc1_inv_trans_4x8_dc, 3,4,0, dest, linesize, block
|
||||
cglobal vc1_inv_trans_4x8_dc, 3,4,6, dest, linesize, block
|
||||
movsx r3d, WORD [blockq]
|
||||
mov blockd, r3d ; dc
|
||||
shl blockd, 4 ; 16 * dc
|
||||
@@ -83,15 +86,14 @@ cglobal vc1_inv_trans_4x8_dc, 3,4,0, dest, linesize, block
|
||||
lea blockd, [blockq*3+64] ; 12 * dc + 64
|
||||
sar blockd, 7 ; >> 7
|
||||
|
||||
INV_TRANS_INIT
|
||||
INV_TRANS_INIT 4
|
||||
|
||||
INV_TRANS_PROCESS h
|
||||
INV_TRANS_PROCESS d
|
||||
lea destq, [destq+linesizeq*4]
|
||||
INV_TRANS_PROCESS h
|
||||
INV_TRANS_PROCESS d
|
||||
RET
|
||||
|
||||
INIT_MMX mmxext
|
||||
cglobal vc1_inv_trans_8x4_dc, 3,4,0, dest, linesize, block
|
||||
cglobal vc1_inv_trans_8x4_dc, 3,4,6, dest, linesize, block
|
||||
movsx blockd, WORD [blockq] ; dc
|
||||
lea blockd, [blockq*3+1] ; 3 * dc + 1
|
||||
sar blockd, 1 ; >> 1
|
||||
@@ -100,22 +102,21 @@ cglobal vc1_inv_trans_8x4_dc, 3,4,0, dest, linesize, block
|
||||
lea blockd, [blockq+r3+64] ; 17 * dc + 64
|
||||
sar blockd, 7 ; >> 7
|
||||
|
||||
INV_TRANS_INIT
|
||||
INV_TRANS_INIT 8
|
||||
|
||||
INV_TRANS_PROCESS a
|
||||
INV_TRANS_PROCESS q
|
||||
RET
|
||||
|
||||
INIT_MMX mmxext
|
||||
cglobal vc1_inv_trans_8x8_dc, 3,3,0, dest, linesize, block
|
||||
cglobal vc1_inv_trans_8x8_dc, 3,3,6, dest, linesize, block
|
||||
movsx blockd, WORD [blockq] ; dc
|
||||
lea blockd, [blockq*3+1] ; 3 * dc + 1
|
||||
sar blockd, 1 ; >> 1
|
||||
lea blockd, [blockq*3+16] ; 3 * dc + 16
|
||||
sar blockd, 5 ; >> 5
|
||||
|
||||
INV_TRANS_INIT
|
||||
INV_TRANS_INIT 8
|
||||
|
||||
INV_TRANS_PROCESS a
|
||||
INV_TRANS_PROCESS q
|
||||
lea destq, [destq+linesizeq*4]
|
||||
INV_TRANS_PROCESS a
|
||||
INV_TRANS_PROCESS q
|
||||
RET
|
||||
|
||||
@@ -310,7 +310,7 @@ static void check_inv_trans_adding(void)
|
||||
void (*func)(uint8_t *, ptrdiff_t, int16_t *) = *(void **)((intptr_t) &h + tests[k].offset);
|
||||
if (check_func(func, "vc1dsp.%s", tests[k].name)) {
|
||||
matrix *coeffs;
|
||||
declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, ptrdiff_t, int16_t *);
|
||||
declare_func(void, uint8_t *, ptrdiff_t, int16_t *);
|
||||
RANDOMIZE_BUFFER16(inv_trans_in, 8 * 8);
|
||||
RANDOMIZE_BUFFER8(inv_trans_out, 10 * 24);
|
||||
coeffs = generate_inverse_quantized_transform_coefficients(tests[k].width, tests[k].height);
|
||||
|
||||
Reference in New Issue
Block a user