comparison i386/idct_mmx.c @ 8015:ad3949b075ba libavcodec

Add a bunch of const qualifiers to function arguments. Taken from the upstream libmpeg2 version of the file.
author diego
date Tue, 07 Oct 2008 21:41:25 +0000
parents 35187c18580f
children
comparison
equal deleted inserted replaced
8014:07d8986fbea7 8015:ad3949b075ba
83 c4, -c6, c4, -c6, \ 83 c4, -c6, c4, -c6, \
84 -c4, c2, c4, -c2, \ 84 -c4, c2, c4, -c2, \
85 c5, -c1, c3, -c1, \ 85 c5, -c1, c3, -c1, \
86 c7, c3, c7, -c5 } 86 c7, c3, c7, -c5 }
87 87
88 static inline void mmxext_row_head (int16_t * row, int offset, const int16_t * table) 88 static inline void mmxext_row_head (int16_t * const row, const int offset,
89 const int16_t * const table)
89 { 90 {
90 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ 91 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
91 92
92 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */ 93 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
93 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */ 94 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
99 pmaddwd_r2r (mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */ 100 pmaddwd_r2r (mm0, mm3); /* mm3 = -C4*x4-C2*x6 C4*x0+C2*x2 */
100 101
101 pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */ 102 pshufw_r2r (mm2, mm2, 0x4e); /* mm2 = x2 x0 x6 x4 */
102 } 103 }
103 104
104 static inline void mmxext_row (const int16_t * table, const int32_t * rounder) 105 static inline void mmxext_row (const int16_t * const table,
106 const int32_t * const rounder)
105 { 107 {
106 movq_m2r (*(table+8), mm1); /* mm1 = -C5 -C1 C3 C1 */ 108 movq_m2r (*(table+8), mm1); /* mm1 = -C5 -C1 C3 C1 */
107 pmaddwd_r2r (mm2, mm4); /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */ 109 pmaddwd_r2r (mm2, mm4); /* mm4 = C4*x0+C6*x2 C4*x4+C6*x6 */
108 110
109 pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */ 111 pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x4-C6*x6 C4*x0-C6*x2 */
138 140
139 paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */ 141 paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
140 psubd_r2r (mm5, mm4); /* mm4 = a3-b3 a2-b2 + rounder */ 142 psubd_r2r (mm5, mm4); /* mm4 = a3-b3 a2-b2 + rounder */
141 } 143 }
142 144
143 static inline void mmxext_row_tail (int16_t * row, int store) 145 static inline void mmxext_row_tail (int16_t * const row, const int store)
144 { 146 {
145 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */ 147 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
146 148
147 psrad_i2r (ROW_SHIFT, mm4); /* mm4 = y4 y5 */ 149 psrad_i2r (ROW_SHIFT, mm4); /* mm4 = y4 y5 */
148 150
156 /* slot */ 158 /* slot */
157 159
158 movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */ 160 movq_r2m (mm4, *(row+store+4)); /* save y7 y6 y5 y4 */
159 } 161 }
160 162
161 static inline void mmxext_row_mid (int16_t * row, int store, 163 static inline void mmxext_row_mid (int16_t * const row, const int store,
162 int offset, const int16_t * table) 164 const int offset,
165 const int16_t * const table)
163 { 166 {
164 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ 167 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
165 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */ 168 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
166 169
167 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */ 170 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
195 c4, -c6, c4, -c2, \ 198 c4, -c6, c4, -c2, \
196 -c4, c2, c4, -c6, \ 199 -c4, c2, c4, -c6, \
197 c5, -c1, c7, -c5, \ 200 c5, -c1, c7, -c5, \
198 c7, c3, c3, -c1 } 201 c7, c3, c3, -c1 }
199 202
200 static inline void mmx_row_head (int16_t * row, int offset, const int16_t * table) 203 static inline void mmx_row_head (int16_t * const row, const int offset,
204 const int16_t * const table)
201 { 205 {
202 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ 206 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
203 207
204 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */ 208 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
205 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */ 209 movq_r2r (mm2, mm0); /* mm0 = x6 x4 x2 x0 */
214 218
215 movq_m2r (*(table+8), mm1); /* mm1 = -C7 C3 C3 C1 */ 219 movq_m2r (*(table+8), mm1); /* mm1 = -C7 C3 C3 C1 */
216 punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */ 220 punpckhdq_r2r (mm2, mm2); /* mm2 = x6 x4 x6 x4 */
217 } 221 }
218 222
219 static inline void mmx_row (const int16_t * table, const int32_t * rounder) 223 static inline void mmx_row (const int16_t * const table,
224 const int32_t * const rounder)
220 { 225 {
221 pmaddwd_r2r (mm2, mm4); /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */ 226 pmaddwd_r2r (mm2, mm4); /* mm4 = -C4*x4-C2*x6 C4*x4+C6*x6 */
222 punpckldq_r2r (mm5, mm5); /* mm5 = x3 x1 x3 x1 */ 227 punpckldq_r2r (mm5, mm5); /* mm5 = x3 x1 x3 x1 */
223 228
224 pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */ 229 pmaddwd_m2r (*(table+16), mm0); /* mm0 = C4*x0-C2*x2 C4*x0-C6*x2 */
253 258
254 paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */ 259 paddd_r2r (mm5, mm0); /* mm0 = a3+b3 a2+b2 + rounder */
255 psubd_r2r (mm5, mm7); /* mm7 = a3-b3 a2-b2 + rounder */ 260 psubd_r2r (mm5, mm7); /* mm7 = a3-b3 a2-b2 + rounder */
256 } 261 }
257 262
258 static inline void mmx_row_tail (int16_t * row, int store) 263 static inline void mmx_row_tail (int16_t * const row, const int store)
259 { 264 {
260 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */ 265 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
261 266
262 psrad_i2r (ROW_SHIFT, mm7); /* mm7 = y4 y5 */ 267 psrad_i2r (ROW_SHIFT, mm7); /* mm7 = y4 y5 */
263 268
277 /* slot */ 282 /* slot */
278 283
279 movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */ 284 movq_r2m (mm7, *(row+store+4)); /* save y7 y6 y5 y4 */
280 } 285 }
281 286
282 static inline void mmx_row_mid (int16_t * row, int store, 287 static inline void mmx_row_mid (int16_t * const row, const int store,
283 int offset, const int16_t * table) 288 const int offset, const int16_t * const table)
284 { 289 {
285 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */ 290 movq_m2r (*(row+offset), mm2); /* mm2 = x6 x4 x2 x0 */
286 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */ 291 psrad_i2r (ROW_SHIFT, mm0); /* mm0 = y3 y2 */
287 292
288 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */ 293 movq_m2r (*(row+offset+4), mm5); /* mm5 = x7 x5 x3 x1 */
385 } 390 }
386 #endif 391 #endif
387 392
388 393
389 /* MMX column IDCT */ 394 /* MMX column IDCT */
390 static inline void idct_col (int16_t * col, int offset) 395 static inline void idct_col (int16_t * const col, const int offset)
391 { 396 {
392 #define T1 13036 397 #define T1 13036
393 #define T2 27146 398 #define T2 27146
394 #define T3 43790 399 #define T3 43790
395 #define C4 23170 400 #define C4 23170
554 559
555 #undef COL_SHIFT 560 #undef COL_SHIFT
556 #undef ROW_SHIFT 561 #undef ROW_SHIFT
557 562
558 #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \ 563 #define declare_idct(idct,table,idct_row_head,idct_row,idct_row_tail,idct_row_mid) \
559 void idct (int16_t * block) \ 564 void idct (int16_t * const block) \
560 { \ 565 { \
561 static const int16_t table04[] ATTR_ALIGN(16) = \ 566 static const int16_t table04[] ATTR_ALIGN(16) = \
562 table (22725, 21407, 19266, 16384, 12873, 8867, 4520); \ 567 table (22725, 21407, 19266, 16384, 12873, 8867, 4520); \
563 static const int16_t table17[] ATTR_ALIGN(16) = \ 568 static const int16_t table17[] ATTR_ALIGN(16) = \
564 table (31521, 29692, 26722, 22725, 17855, 12299, 6270); \ 569 table (31521, 29692, 26722, 22725, 17855, 12299, 6270); \