comparison i386/vp3dsp_sse2.c @ 7883:6f77eda89813 libavcodec

Make a separate macro for writing an entire block from registers to memory
author conrad
date Thu, 18 Sep 2008 03:08:13 +0000
parents 1a684e0e6420
children 4077df298ba2
comparison
equal deleted inserted replaced
7882:1a684e0e6420 7883:6f77eda89813
119 SHIFT(%%xmm2) /* xmm2 = op2 */ \ 119 SHIFT(%%xmm2) /* xmm2 = op2 */ \
120 "psubsw %%xmm7, %%xmm4 \n\t" /* xmm4 = E - G = E. */ \ 120 "psubsw %%xmm7, %%xmm4 \n\t" /* xmm4 = E - G = E. */ \
121 SHIFT(%%xmm1) /* xmm1 = op1 */ \ 121 SHIFT(%%xmm1) /* xmm1 = op1 */ \
122 "movdqa "I(2)", %%xmm3 \n\t" /* Load D. from I(2) */ \ 122 "movdqa "I(2)", %%xmm3 \n\t" /* Load D. from I(2) */ \
123 "paddsw %%xmm7, %%xmm7 \n\t" /* xmm7 = G + G */ \ 123 "paddsw %%xmm7, %%xmm7 \n\t" /* xmm7 = G + G */ \
124 "movdqa %%xmm2, "O(2)" \n\t" /* Write out op2 */ \
125 "paddsw %%xmm4, %%xmm7 \n\t" /* xmm7 = E + G = G. */ \ 124 "paddsw %%xmm4, %%xmm7 \n\t" /* xmm7 = E + G = G. */ \
126 "movdqa %%xmm1, "O(1)" \n\t" /* Write out op1 */ \
127 "psubsw %%xmm3, %%xmm4 \n\t" /* xmm4 = E. - D. = R4 */ \ 125 "psubsw %%xmm3, %%xmm4 \n\t" /* xmm4 = E. - D. = R4 */ \
128 ADD(%%xmm4) /* Adjust R4 and R3 before shifting */ \ 126 ADD(%%xmm4) /* Adjust R4 and R3 before shifting */ \
129 "paddsw %%xmm3, %%xmm3 \n\t" /* xmm3 = D. + D. */ \ 127 "paddsw %%xmm3, %%xmm3 \n\t" /* xmm3 = D. + D. */ \
130 "paddsw %%xmm4, %%xmm3 \n\t" /* xmm3 = E. + D. = R3 */ \ 128 "paddsw %%xmm4, %%xmm3 \n\t" /* xmm3 = E. + D. = R3 */ \
131 SHIFT(%%xmm4) /* xmm4 = op4 */ \ 129 SHIFT(%%xmm4) /* xmm4 = op4 */ \
133 SHIFT(%%xmm3) /* xmm3 = op3 */ \ 131 SHIFT(%%xmm3) /* xmm3 = op3 */ \
134 ADD(%%xmm6) /* Adjust R6 and R5 before shifting */ \ 132 ADD(%%xmm6) /* Adjust R6 and R5 before shifting */ \
135 "paddsw %%xmm5, %%xmm5 \n\t" /* xmm5 = B.. + B.. */ \ 133 "paddsw %%xmm5, %%xmm5 \n\t" /* xmm5 = B.. + B.. */ \
136 "paddsw %%xmm6, %%xmm5 \n\t" /* xmm5 = F. + B.. = R5 */ \ 134 "paddsw %%xmm6, %%xmm5 \n\t" /* xmm5 = F. + B.. = R5 */ \
137 SHIFT(%%xmm6) /* xmm6 = op6 */ \ 135 SHIFT(%%xmm6) /* xmm6 = op6 */ \
138 "movdqa %%xmm4, "O(4)" \n\t" /* Write out op4 */ \
139 SHIFT(%%xmm5) /* xmm5 = op5 */ \ 136 SHIFT(%%xmm5) /* xmm5 = op5 */ \
140 "movdqa %%xmm3, "O(3)" \n\t" /* Write out op3 */ \
141 "psubsw %%xmm0, %%xmm7 \n\t" /* xmm7 = G. - C. = R7 */ \ 137 "psubsw %%xmm0, %%xmm7 \n\t" /* xmm7 = G. - C. = R7 */ \
142 ADD(%%xmm7) /* Adjust R7 and R0 before shifting */ \ 138 ADD(%%xmm7) /* Adjust R7 and R0 before shifting */ \
143 "paddsw %%xmm0, %%xmm0 \n\t" /* xmm0 = C. + C. */ \ 139 "paddsw %%xmm0, %%xmm0 \n\t" /* xmm0 = C. + C. */ \
144 "paddsw %%xmm7, %%xmm0 \n\t" /* xmm0 = G. + C. */ \ 140 "paddsw %%xmm7, %%xmm0 \n\t" /* xmm0 = G. + C. */ \
145 SHIFT(%%xmm7) /* xmm7 = op7 */ \ 141 SHIFT(%%xmm7) /* xmm7 = op7 */ \
146 "movdqa %%xmm6, "O(6)" \n\t" /* Write out op6 */ \ 142 SHIFT(%%xmm0) /* xmm0 = op0 */
147 SHIFT(%%xmm0) /* xmm0 = op0 */ \ 143
148 "movdqa %%xmm5, "O(5)" \n\t" /* Write out op5 */ \ 144 #define PUT_BLOCK(r0, r1, r2, r3, r4, r5, r6, r7) \
149 "movdqa %%xmm7, "O(7)" \n\t" /* Write out op7 */ \ 145 "movdqa " #r0 ", " O(0) "\n\t" \
150 "movdqa %%xmm0, "O(0)" \n\t" /* Write out op0 */ 146 "movdqa " #r1 ", " O(1) "\n\t" \
151 147 "movdqa " #r2 ", " O(2) "\n\t" \
148 "movdqa " #r3 ", " O(3) "\n\t" \
149 "movdqa " #r4 ", " O(4) "\n\t" \
150 "movdqa " #r5 ", " O(5) "\n\t" \
151 "movdqa " #r6 ", " O(6) "\n\t" \
152 "movdqa " #r7 ", " O(7) "\n\t"
152 153
153 #define SSE2_Transpose() \ 154 #define SSE2_Transpose() \
154 "movdqa "I(4)", %%xmm4 \n\t" /* xmm4=e7e6e5e4e3e2e1e0 */ \ 155 "movdqa "I(4)", %%xmm4 \n\t" /* xmm4=e7e6e5e4e3e2e1e0 */ \
155 "movdqa "I(5)", %%xmm0 \n\t" /* xmm4=f7f6f5f4f3f2f1f0 */ \ 156 "movdqa "I(5)", %%xmm0 \n\t" /* xmm4=f7f6f5f4f3f2f1f0 */ \
156 "movdqa %%xmm4, %%xmm5 \n\t" /* make a copy */ \ 157 "movdqa %%xmm4, %%xmm5 \n\t" /* make a copy */ \
216 #define O(x) I(x) 217 #define O(x) I(x)
217 #define C(x) AV_STRINGIFY(16*(x-1))"(%1)" 218 #define C(x) AV_STRINGIFY(16*(x-1))"(%1)"
218 219
219 asm volatile ( 220 asm volatile (
220 VP3_1D_IDCT_SSE2(NOP, NOP) 221 VP3_1D_IDCT_SSE2(NOP, NOP)
222 PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
221 223
222 SSE2_Transpose() 224 SSE2_Transpose()
223 225
224 VP3_1D_IDCT_SSE2(ADD8, SHIFT4) 226 VP3_1D_IDCT_SSE2(ADD8, SHIFT4)
227 PUT_BLOCK(%%xmm0, %%xmm1, %%xmm2, %%xmm3, %%xmm4, %%xmm5, %%xmm6, %%xmm7)
225 :: "r"(input_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8) 228 :: "r"(input_data), "r"(ff_vp3_idct_data), "m"(ff_pw_8)
226 ); 229 );
227 } 230 }
228 231
229 void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block) 232 void ff_vp3_idct_put_sse2(uint8_t *dest, int line_size, DCTELEM *block)