History

avcodec/x86/mpegvideoenc_template: Remove remnants of MMX

Forgotten in 7284ab789d5fe271b9d6a1666ab5ea6be8724cca.

Andreas Rheinhardt committed 1 year ago

Commit 1422f001 parent 8c7b00b2 files · +53 −92Browse files

Unified · Split

2 files
  1. libavcodec/x86/mpegvideoenc.c +0 −10
  2. libavcodec/x86/mpegvideoenc_template.c +53 −82
libavcodec/x86/mpegvideoenc.c+0−10
@@ -43,26 +43,16 @@ DECLARE_ALIGNED(16, static const uint16_t, inv_zigzag_direct16)[64] = { · 42 unmodified lines
4343 #if HAVE_6REGS
4444
4545 #if HAVE_SSE2_INLINE
46−#undef COMPILE_TEMPLATE_SSE2
47−#undef COMPILE_TEMPLATE_SSSE3
48−#define COMPILE_TEMPLATE_SSE2 1
4946 #define COMPILE_TEMPLATE_SSSE3 0
50−#undef RENAME
51−#undef RENAME_FDCT
5247 #define RENAME(a) a ## _sse2
53−#define RENAME_FDCT(a) a ## _sse2
5448 #include "mpegvideoenc_template.c"
5549 #endif /* HAVE_SSE2_INLINE */
5650
5751 #if HAVE_SSSE3_INLINE
58−#undef COMPILE_TEMPLATE_SSE2
5952 #undef COMPILE_TEMPLATE_SSSE3
60−#define COMPILE_TEMPLATE_SSE2 1
6153 #define COMPILE_TEMPLATE_SSSE3 1
6254 #undef RENAME
63−#undef RENAME_FDCT
6455 #define RENAME(a) a ## _ssse3
65−#define RENAME_FDCT(a) a ## _sse2
6656 #include "mpegvideoenc_template.c"
6757 #endif /* HAVE_SSSE3_INLINE */
6858
libavcodec/x86/mpegvideoenc_template.c+53−82
@@ -29,49 +29,22 @@ · 28 unmodified lines
2929 #include "libavcodec/mpegvideoenc.h"
3030 #include "fdct.h"
3131
32−#undef MMREG_WIDTH
33−#undef MM
34−#undef MOVQ
3532 #undef SPREADW
3633 #undef PMAXW
3734 #undef PMAX
3835 #undef SAVE_SIGN
3936 #undef RESTORE_SIGN
4037
41−#if COMPILE_TEMPLATE_SSE2
42−#define MMREG_WIDTH "16"
43−#define MM "%%xmm"
44−#define MOVQ "movdqa"
4538 #define SPREADW(a) \
4639 "pshuflw $0, "a", "a" \n\t"\
4740 "punpcklwd "a", "a" \n\t"
48−#define PMAXW(a,b) "pmaxsw "a", "b" \n\t"
4941 #define PMAX(a,b) \
5042 "movhlps "a", "b" \n\t"\
51− PMAXW(b, a)\
43+ "pmaxsw "b", "a" \n\t"\
5244 "pshuflw $0x0E, "a", "b" \n\t"\
53− PMAXW(b, a)\
45+ "pmaxsw "b", "a" \n\t"\
5446 "pshuflw $0x01, "a", "b" \n\t"\
55− PMAXW(b, a)
56−#else
57−#define MMREG_WIDTH "8"
58−#define MM "%%mm"
59−#define MOVQ "movq"
60−#define SPREADW(a) \
61− "punpcklwd "a", "a" \n\t"\
62− "punpcklwd "a", "a" \n\t"
63−#define PMAXW(a,b) \
64− "psubusw "a", "b" \n\t"\
65− "paddw "a", "b" \n\t"
66−#define PMAX(a,b) \
67− "movq "a", "b" \n\t"\
68− "psrlq $32, "a" \n\t"\
69− PMAXW(b, a)\
70− "movq "a", "b" \n\t"\
71− "psrlq $16, "a" \n\t"\
72− PMAXW(b, a)
73−
74−#endif
47+ "pmaxsw "b", "a" \n\t"
7548
7649 #if COMPILE_TEMPLATE_SSSE3
7750 #define SAVE_SIGN(a,b) \
@@ -100,7 +73,7 @@ static int RENAME(dct_quantize)(MPVEncContext *const s, · 22 unmodified lines
10073 LOCAL_ALIGNED_16(int16_t, temp_block, [64]);
10174
10275 //s->fdct (block);
103− RENAME_FDCT(ff_fdct)(block); // cannot be anything else ...
76+ ff_fdct_sse2(block); // cannot be anything else ...
10477
10578 if(s->dct_error_sum)
10679 s->denoise_dct(s, block);
@@ -138,32 +111,32 @@ static int RENAME(dct_quantize)(MPVEncContext *const s, · 31 unmodified lines
138111
139112 if ((s->c.out_format == FMT_H263 || s->c.out_format == FMT_H261) && !s->c.mpeg_quant) {
140113 __asm__ volatile(
141− "movd %%"FF_REG_a", "MM"3 \n\t" // last_non_zero_p1
142− SPREADW(MM"3")
143− "pxor "MM"7, "MM"7 \n\t" // 0
144− "pxor "MM"4, "MM"4 \n\t" // 0
145− MOVQ" (%2), "MM"5 \n\t" // qmat[0]
146− "pxor "MM"6, "MM"6 \n\t"
147− "psubw (%3), "MM"6 \n\t" // -bias[0]
114+ "movd %%"FF_REG_a", %%xmm3 \n\t" // last_non_zero_p1
115+ SPREADW("%%xmm3")
116+ "pxor %%xmm7, %%xmm7 \n\t" // 0
117+ "pxor %%xmm4, %%xmm4 \n\t" // 0
118+ "movdqa (%2), %%xmm5 \n\t" // qmat[0]
119+ "pxor %%xmm6, %%xmm6 \n\t"
120+ "psubw (%3), %%xmm6 \n\t" // -bias[0]
148121 "mov $-128, %%"FF_REG_a" \n\t"
149122 ".p2align 4 \n\t"
150123 "1: \n\t"
151− MOVQ" (%1, %%"FF_REG_a"), "MM"0 \n\t" // block[i]
152− SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
153− "psubusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
154− "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
155− "por "MM"0, "MM"4 \n\t"
156− RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
157− MOVQ" "MM"0, (%5, %%"FF_REG_a") \n\t"
158− "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
159− MOVQ" (%4, %%"FF_REG_a"), "MM"1 \n\t"
160− MOVQ" "MM"7, (%1, %%"FF_REG_a") \n\t" // 0
161− "pandn "MM"1, "MM"0 \n\t"
162− PMAXW(MM"0", MM"3")
163− "add $"MMREG_WIDTH", %%"FF_REG_a" \n\t"
124+ "movdqa (%1, %%"FF_REG_a"), %%xmm0 \n\t" // block[i]
125+ SAVE_SIGN("%%xmm1", "%%xmm0") // ABS(block[i])
126+ "psubusw %%xmm6, %%xmm0 \n\t" // ABS(block[i]) + bias[0]
127+ "pmulhw %%xmm5, %%xmm0 \n\t" // (ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16
128+ "por %%xmm0, %%xmm4 \n\t"
129+ RESTORE_SIGN("%%xmm1", "%%xmm0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
130+ "movdqa %%xmm0, (%5, %%"FF_REG_a") \n\t"
131+ "pcmpeqw %%xmm7, %%xmm0 \n\t" // out==0 ? 0xFF : 0x00
132+ "movdqa (%4, %%"FF_REG_a"), %%xmm1 \n\t"
133+ "movdqa %%xmm7, (%1, %%"FF_REG_a") \n\t" // 0
134+ "pandn %%xmm1, %%xmm0 \n\t"
135+ "pmaxsw %%xmm0, %%xmm3 \n\t"
136+ "add $16, %%"FF_REG_a" \n\t"
164137 " js 1b \n\t"
165− PMAX(MM"3", MM"0")
166− "movd "MM"3, %%"FF_REG_a" \n\t"
138+ PMAX("%%xmm3", "%%xmm0")
139+ "movd %%xmm3, %%"FF_REG_a" \n\t"
167140 "movzbl %%al, %%eax \n\t" // last_non_zero_p1
168141 : "+a" (last_non_zero_p1)
169142 : "r" (block+64), "r" (qmat), "r" (bias),
@@ -173,31 +146,31 @@ static int RENAME(dct_quantize)(MPVEncContext *const s, · 3 unmodified lines
173146 );
174147 }else{ // FMT_H263
175148 __asm__ volatile(
176− "movd %%"FF_REG_a", "MM"3 \n\t" // last_non_zero_p1
177− SPREADW(MM"3")
178− "pxor "MM"7, "MM"7 \n\t" // 0
179− "pxor "MM"4, "MM"4 \n\t" // 0
149+ "movd %%"FF_REG_a", %%xmm3 \n\t" // last_non_zero_p1
150+ SPREADW("%%xmm3")
151+ "pxor %%xmm7, %%xmm7 \n\t" // 0
152+ "pxor %%xmm4, %%xmm4 \n\t" // 0
180153 "mov $-128, %%"FF_REG_a" \n\t"
181154 ".p2align 4 \n\t"
182155 "1: \n\t"
183− MOVQ" (%1, %%"FF_REG_a"), "MM"0 \n\t" // block[i]
184− SAVE_SIGN(MM"1", MM"0") // ABS(block[i])
185− MOVQ" (%3, %%"FF_REG_a"), "MM"6 \n\t" // bias[0]
186− "paddusw "MM"6, "MM"0 \n\t" // ABS(block[i]) + bias[0]
187− MOVQ" (%2, %%"FF_REG_a"), "MM"5 \n\t" // qmat[i]
188− "pmulhw "MM"5, "MM"0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
189− "por "MM"0, "MM"4 \n\t"
190− RESTORE_SIGN(MM"1", MM"0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
191− MOVQ" "MM"0, (%5, %%"FF_REG_a") \n\t"
192− "pcmpeqw "MM"7, "MM"0 \n\t" // out==0 ? 0xFF : 0x00
193− MOVQ" (%4, %%"FF_REG_a"), "MM"1 \n\t"
194− MOVQ" "MM"7, (%1, %%"FF_REG_a") \n\t" // 0
195− "pandn "MM"1, "MM"0 \n\t"
196− PMAXW(MM"0", MM"3")
197− "add $"MMREG_WIDTH", %%"FF_REG_a" \n\t"
156+ "movdqa (%1, %%"FF_REG_a"), %%xmm0 \n\t" // block[i]
157+ SAVE_SIGN("%%xmm1", "%%xmm0") // ABS(block[i])
158+ "movdqa (%3, %%"FF_REG_a"), %%xmm6 \n\t" // bias[0]
159+ "paddusw %%xmm6, %%xmm0 \n\t" // ABS(block[i]) + bias[0]
160+ "movdqa (%2, %%"FF_REG_a"), %%xmm5 \n\t" // qmat[i]
161+ "pmulhw %%xmm5, %%xmm0 \n\t" // (ABS(block[i])*qmat[0] + bias[0]*qmat[0])>>16
162+ "por %%xmm0, %%xmm4 \n\t"
163+ RESTORE_SIGN("%%xmm1", "%%xmm0") // out=((ABS(block[i])*qmat[0] - bias[0]*qmat[0])>>16)*sign(block[i])
164+ "movdqa %%xmm0, (%5, %%"FF_REG_a") \n\t"
165+ "pcmpeqw %%xmm7, %%xmm0 \n\t" // out==0 ? 0xFF : 0x00
166+ "movdqa (%4, %%"FF_REG_a"), %%xmm1 \n\t"
167+ "movdqa %%xmm7, (%1, %%"FF_REG_a") \n\t" // 0
168+ "pandn %%xmm1, %%xmm0 \n\t"
169+ "pmaxsw %%xmm0, %%xmm3 \n\t"
170+ "add $16, %%"FF_REG_a" \n\t"
198171 " js 1b \n\t"
199− PMAX(MM"3", MM"0")
200− "movd "MM"3, %%"FF_REG_a" \n\t"
172+ PMAX("%%xmm3", "%%xmm0")
173+ "movd %%xmm3, %%"FF_REG_a" \n\t"
201174 "movzbl %%al, %%eax \n\t" // last_non_zero_p1
202175 : "+a" (last_non_zero_p1)
203176 : "r" (block+64), "r" (qmat+64), "r" (bias+64),
@@ -207,14 +180,12 @@ static int RENAME(dct_quantize)(MPVEncContext *const s, · 3 unmodified lines
207180 );
208181 }
209182 __asm__ volatile(
210− "movd %1, "MM"1 \n\t" // max_qcoeff
211− SPREADW(MM"1")
212− "psubusw "MM"1, "MM"4 \n\t"
213− "packuswb "MM"4, "MM"4 \n\t"
214−#if COMPILE_TEMPLATE_SSE2
215− "packsswb "MM"4, "MM"4 \n\t"
216−#endif
217− "movd "MM"4, %0 \n\t" // *overflow
183+ "movd %1, %%xmm1 \n\t" // max_qcoeff
184+ SPREADW("%%xmm1")
185+ "psubusw %%xmm1, %%xmm4 \n\t"
186+ "packuswb %%xmm4, %%xmm4 \n\t"
187+ "packsswb %%xmm4, %%xmm4 \n\t"
188+ "movd %%xmm4, %0 \n\t" // *overflow
218189 : "=g" (*overflow)
219190 : "g" (s->max_qcoeff)
220191 );

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t