History

avutil/mips: [loongson] simplify macro TRANSPOSE_4H and TRANSPOSE_8B

Simplify macro TRANSPOSE_4H in mmiutils.h and add TRANSPOSE_8B as a common macro.

Shiyou Yin committed 8 years ago

Commit 5161f7b1 parent 090647d3 files · +65 −103Browse files

Unified · Split

3 files
  1. libavcodec/mips/vc1dsp_mmi.c +4 −8
  2. libavcodec/mips/vp8dsp_mmi.c +8 −64
  3. libavutil/mips/mmiutils.h +53 −31
libavcodec/mips/vc1dsp_mmi.c+4−8
@@ -248,8 +248,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 247 unmodified lines
248 0xfff70004, 0xfff0000f, %[ff_pw_4])248 0xfff70004, 0xfff0000f, %[ff_pw_4])
249 249
250 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],250 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
251 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],251 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
252 %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
253 252
254 MMI_SDC1(%[ftmp15], %[dst], 0x00)253 MMI_SDC1(%[ftmp15], %[dst], 0x00)
255 MMI_SDC1(%[ftmp16], %[dst], 0x10)254 MMI_SDC1(%[ftmp16], %[dst], 0x10)
@@ -257,8 +256,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 1 unmodified line
257 MMI_SDC1(%[ftmp18], %[dst], 0x30)256 MMI_SDC1(%[ftmp18], %[dst], 0x30)
258 257
259 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],258 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
260 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],259 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
261 %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
262 260
263 MMI_SDC1(%[ftmp19], %[dst], 0x08)261 MMI_SDC1(%[ftmp19], %[dst], 0x08)
264 MMI_SDC1(%[ftmp20], %[dst], 0x18)262 MMI_SDC1(%[ftmp20], %[dst], 0x18)
@@ -301,8 +299,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 36 unmodified lines
301 0xfff70004, 0xfff0000f, %[ff_pw_4])299 0xfff70004, 0xfff0000f, %[ff_pw_4])
302 300
303 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],301 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
304 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],302 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
305 %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
306 303
307 MMI_SDC1(%[ftmp15], %[dst], 0x40)304 MMI_SDC1(%[ftmp15], %[dst], 0x40)
308 MMI_SDC1(%[ftmp16], %[dst], 0x50)305 MMI_SDC1(%[ftmp16], %[dst], 0x50)
@@ -310,8 +307,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 1 unmodified line
310 MMI_SDC1(%[ftmp18], %[dst], 0x70)307 MMI_SDC1(%[ftmp18], %[dst], 0x70)
311 308
312 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],309 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
313 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],310 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
314 %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
315 311
316 MMI_SDC1(%[ftmp19], %[dst], 0x48)312 MMI_SDC1(%[ftmp19], %[dst], 0x48)
317 MMI_SDC1(%[ftmp20], %[dst], 0x58)313 MMI_SDC1(%[ftmp20], %[dst], 0x58)
libavcodec/mips/vp8dsp_mmi.c+8−64
@@ -44,58 +44,6 @@ · 43 unmodified lines
44 "punpcklbh "#dst_r", "#src", %[db_2] \n\t" \44 "punpcklbh "#dst_r", "#src", %[db_2] \n\t" \
45 "punpckhbh "#dst_l", "#src", %[db_2] \n\t"45 "punpckhbh "#dst_l", "#src", %[db_2] \n\t"
46 46
47#define MMI_TRANSPOSE8x8_UB_UB(src_0, src_1, src_2, src_3, \
48 src_4, src_5, src_6, src_7, \
49 dst_0, dst_1, dst_2, dst_3, \
50 dst_4, dst_5, dst_6, dst_7) \
51 "li %[it_1], 0xe4 \n\t" \
52 "dmtc1 %[it_1], %[db_1] \n\t" \
53 "pshufh %[db_2], "#src_0", %[db_1] \n\t" \
54 "punpcklbh "#dst_0", "#src_0", "#src_1" \n\t" \
55 "punpckhbh "#dst_1", %[db_2], "#src_1" \n\t" \
56 "pshufh %[db_2], "#src_2", %[db_1] \n\t" \
57 "punpcklbh "#dst_2", "#src_2", "#src_3" \n\t" \
58 "punpckhbh "#dst_3", %[db_2], "#src_3" \n\t" \
59 "pshufh %[db_2], "#src_4", %[db_1] \n\t" \
60 "punpcklbh "#dst_4", "#src_4", "#src_5" \n\t" \
61 "punpckhbh "#dst_5", %[db_2], "#src_5" \n\t" \
62 "pshufh %[db_2], "#src_6", %[db_1] \n\t" \
63 "punpcklbh "#dst_6", "#src_6", "#src_7" \n\t" \
64 "punpckhbh "#dst_7", %[db_2], "#src_7" \n\t" \
65 \
66 "pshufh %[db_2], "#dst_0", %[db_1] \n\t" \
67 "punpcklhw "#dst_0", "#dst_0", "#dst_2" \n\t" \
68 "punpckhhw "#dst_2", %[db_2], "#dst_2" \n\t" \
69 "pshufh %[db_2], "#dst_1", %[db_1] \n\t" \
70 "punpcklhw "#dst_1", "#dst_1", "#dst_3" \n\t" \
71 "punpckhhw "#dst_3", %[db_2], "#dst_3" \n\t" \
72 "pshufh %[db_2], "#dst_4", %[db_1] \n\t" \
73 "punpcklhw "#dst_4", "#dst_4", "#dst_6" \n\t" \
74 "punpckhhw "#dst_6", %[db_2], "#dst_6" \n\t" \
75 "pshufh %[db_2], "#dst_5", %[db_1] \n\t" \
76 "punpcklhw "#dst_5", "#dst_5", "#dst_7" \n\t" \
77 "punpckhhw "#dst_7", %[db_2], "#dst_7" \n\t" \
78 \
79 "pshufh %[db_2], "#dst_0", %[db_1] \n\t" \
80 "punpcklwd "#dst_0", "#dst_0", "#dst_4" \n\t" \
81 "punpckhwd "#dst_4", %[db_2], "#dst_4" \n\t" \
82 "pshufh %[db_2], "#dst_1", %[db_1] \n\t" \
83 "punpcklwd "#dst_1", "#dst_1", "#dst_5" \n\t" \
84 "punpckhwd "#dst_5", %[db_2], "#dst_5" \n\t" \
85 "pshufh %[db_2], "#dst_2", %[db_1] \n\t" \
86 "punpcklwd "#dst_2", "#dst_2", "#dst_6" \n\t" \
87 "punpckhwd "#dst_6", %[db_2], "#dst_6" \n\t" \
88 "pshufh %[db_2], "#dst_3", %[db_1] \n\t" \
89 "punpcklwd "#dst_3", "#dst_3", "#dst_7" \n\t" \
90 "punpckhwd "#dst_7", %[db_2], "#dst_7" \n\t" \
91 \
92 "pshufh %[db_2], "#dst_1", %[db_1] \n\t" \
93 "pshufh "#dst_1", "#dst_4", %[db_1] \n\t" \
94 "pshufh "#dst_4", %[db_2], %[db_1] \n\t" \
95 "pshufh %[db_2], "#dst_3", %[db_1] \n\t" \
96 "pshufh "#dst_3", "#dst_6", %[db_1] \n\t" \
97 "pshufh "#dst_6", %[db_2], %[db_1] \n\t"
98
99#define MMI_VP8_LOOP_FILTER \47#define MMI_VP8_LOOP_FILTER \
100 /* Calculation of hev */ \48 /* Calculation of hev */ \
101 "dmtc1 %[thresh], %[ftmp3] \n\t" \49 "dmtc1 %[thresh], %[ftmp3] \n\t" \
@@ -952,16 +900,14 @@ static av_always_inline void vp8_h_loop_filter8_mmi(uint8_t *dst, · 850 unmodified lines
952 "gsldlc1 %[q3], 0x03(%[tmp0]) \n\t"900 "gsldlc1 %[q3], 0x03(%[tmp0]) \n\t"
953 "gsldrc1 %[q3], -0x04(%[tmp0]) \n\t"901 "gsldrc1 %[q3], -0x04(%[tmp0]) \n\t"
954 /* Matrix transpose */902 /* Matrix transpose */
955 MMI_TRANSPOSE8x8_UB_UB(%[p3], %[p2], %[p1], %[p0],903 TRANSPOSE_8B(%[p3], %[p2], %[p1], %[p0],
956 %[q0], %[q1], %[q2], %[q3],904 %[q0], %[q1], %[q2], %[q3],
957 %[p3], %[p2], %[p1], %[p0],905 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
958 %[q0], %[q1], %[q2], %[q3])
959 MMI_VP8_LOOP_FILTER906 MMI_VP8_LOOP_FILTER
960 /* Matrix transpose */907 /* Matrix transpose */
961 MMI_TRANSPOSE8x8_UB_UB(%[p3], %[p2], %[p1], %[p0],908 TRANSPOSE_8B(%[p3], %[p2], %[p1], %[p0],
962 %[q0], %[q1], %[q2], %[q3],909 %[q0], %[q1], %[q2], %[q3],
963 %[p3], %[p2], %[p1], %[p0],910 %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
964 %[q0], %[q1], %[q2], %[q3])
965 /* Move to dst */911 /* Move to dst */
966 "gssdlc1 %[p3], 0x03(%[dst]) \n\t"912 "gssdlc1 %[p3], 0x03(%[dst]) \n\t"
967 "gssdrc1 %[p3], -0x04(%[dst]) \n\t"913 "gssdrc1 %[p3], -0x04(%[dst]) \n\t"
@@ -1233,8 +1179,7 @@ void ff_vp8_idct_add_mmi(uint8_t *dst, int16_t block[16], ptrdiff_t stride) · 265 unmodified lines
1233 MMI_SDC1(%[ftmp0], %[block], 0x18)1179 MMI_SDC1(%[ftmp0], %[block], 0x18)
1234 1180
1235 TRANSPOSE_4H(%[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],1181 TRANSPOSE_4H(%[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
1236 %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8],1182 %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8])
1237 %[ftmp9], %[tmp0], %[ftmp0], %[ftmp10])
1238 1183
1239 // t[0 4 8 12]1184 // t[0 4 8 12]
1240 "paddh %[ftmp5], %[ftmp1], %[ftmp3] \n\t"1185 "paddh %[ftmp5], %[ftmp1], %[ftmp3] \n\t"
@@ -1269,8 +1214,7 @@ void ff_vp8_idct_add_mmi(uint8_t *dst, int16_t block[16], ptrdiff_t stride) · 28 unmodified lines
1269 "psrah %[ftmp4], %[ftmp4], %[ftmp11] \n\t"1214 "psrah %[ftmp4], %[ftmp4], %[ftmp11] \n\t"
1270 1215
1271 TRANSPOSE_4H(%[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],1216 TRANSPOSE_4H(%[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
1272 %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8],1217 %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8])
1273 %[ftmp9], %[tmp0], %[ftmp0], %[ftmp10])
1274 1218
1275 MMI_LWC1(%[ftmp5], %[dst0], 0x00)1219 MMI_LWC1(%[ftmp5], %[dst0], 0x00)
1276 MMI_LWC1(%[ftmp6], %[dst1], 0x00)1220 MMI_LWC1(%[ftmp6], %[dst1], 0x00)
libavutil/mips/mmiutils.h+53−31
@@ -250,30 +250,53 @@ · 249 unmodified lines
250 : "memory" \250 : "memory" \
251 );251 );
252 252
253#define TRANSPOSE_4H(m1, m2, m3, m4, t1, t2, t3, t4, t5, r1, zero, shift) \253/**
254 "li "#r1", 0x93 \n\t" \254 * brief: Transpose 4X4 half word packaged data.
255 "xor "#zero","#zero","#zero" \n\t" \255 * fr_i0, fr_i1, fr_i2, fr_i3: src & dst
256 "mtc1 "#r1", "#shift" \n\t" \256 * fr_t0, fr_t1, fr_t2, fr_t3: temporary register
257 "punpcklhw "#t1", "#m1", "#zero" \n\t" \257 */
258 "punpcklhw "#t5", "#m2", "#zero" \n\t" \258#define TRANSPOSE_4H(fr_i0, fr_i1, fr_i2, fr_i3, \
259 "pshufh "#t5", "#t5", "#shift" \n\t" \259 fr_t0, fr_t1, fr_t2, fr_t3) \
260 "or "#t1", "#t1", "#t5" \n\t" \260 "punpcklhw "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
261 "punpckhhw "#t2", "#m1", "#zero" \n\t" \261 "punpckhhw "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
262 "punpckhhw "#t5", "#m2", "#zero" \n\t" \262 "punpcklhw "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
263 "pshufh "#t5", "#t5", "#shift" \n\t" \263 "punpckhhw "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
264 "or "#t2", "#t2", "#t5" \n\t" \264 "punpcklwd "#fr_i0", "#fr_t0", "#fr_t2" \n\t" \
265 "punpcklhw "#t3", "#m3", "#zero" \n\t" \265 "punpckhwd "#fr_i1", "#fr_t0", "#fr_t2" \n\t" \
266 "punpcklhw "#t5", "#m4", "#zero" \n\t" \266 "punpcklwd "#fr_i2", "#fr_t1", "#fr_t3" \n\t" \
267 "pshufh "#t5", "#t5", "#shift" \n\t" \267 "punpckhwd "#fr_i3", "#fr_t1", "#fr_t3" \n\t"
268 "or "#t3", "#t3", "#t5" \n\t" \268
269 "punpckhhw "#t4", "#m3", "#zero" \n\t" \269/**
270 "punpckhhw "#t5", "#m4", "#zero" \n\t" \270 * brief: Transpose 8x8 byte packaged data.
271 "pshufh "#t5", "#t5", "#shift" \n\t" \271 * fr_i0~i7: src & dst
272 "or "#t4", "#t4", "#t5" \n\t" \272 * fr_t0~t3: temporary register
273 "punpcklwd "#m1", "#t1", "#t3" \n\t" \273 */
274 "punpckhwd "#m2", "#t1", "#t3" \n\t" \274#define TRANSPOSE_8B(fr_i0, fr_i1, fr_i2, fr_i3, fr_i4, fr_i5, \
275 "punpcklwd "#m3", "#t2", "#t4" \n\t" \275 fr_i6, fr_i7, fr_t0, fr_t1, fr_t2, fr_t3) \
276 "punpckhwd "#m4", "#t2", "#t4" \n\t"276 "punpcklbh "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
277 "punpckhbh "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
278 "punpcklbh "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
279 "punpckhbh "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
280 "punpcklbh "#fr_i0", "#fr_i4", "#fr_i5" \n\t" \
281 "punpckhbh "#fr_i1", "#fr_i4", "#fr_i5" \n\t" \
282 "punpcklbh "#fr_i2", "#fr_i6", "#fr_i7" \n\t" \
283 "punpckhbh "#fr_i3", "#fr_i6", "#fr_i7" \n\t" \
284 "punpcklhw "#fr_i4", "#fr_t0", "#fr_t2" \n\t" \
285 "punpckhhw "#fr_i5", "#fr_t0", "#fr_t2" \n\t" \
286 "punpcklhw "#fr_i6", "#fr_t1", "#fr_t3" \n\t" \
287 "punpckhhw "#fr_i7", "#fr_t1", "#fr_t3" \n\t" \
288 "punpcklhw "#fr_t0", "#fr_i0", "#fr_i2" \n\t" \
289 "punpckhhw "#fr_t1", "#fr_i0", "#fr_i2" \n\t" \
290 "punpcklhw "#fr_t2", "#fr_i1", "#fr_i3" \n\t" \
291 "punpckhhw "#fr_t3", "#fr_i1", "#fr_i3" \n\t" \
292 "punpcklwd "#fr_i0", "#fr_i4", "#fr_t0" \n\t" \
293 "punpckhwd "#fr_i1", "#fr_i4", "#fr_t0" \n\t" \
294 "punpcklwd "#fr_i2", "#fr_i5", "#fr_t1" \n\t" \
295 "punpckhwd "#fr_i3", "#fr_i5", "#fr_t1" \n\t" \
296 "punpcklwd "#fr_i4", "#fr_i6", "#fr_t2" \n\t" \
297 "punpckhwd "#fr_i5", "#fr_i6", "#fr_t2" \n\t" \
298 "punpcklwd "#fr_i6", "#fr_i7", "#fr_t3" \n\t" \
299 "punpckhwd "#fr_i7", "#fr_i7", "#fr_t3" \n\t"
277 300
278/**301/**
279 * brief: Parallel SRA for 8 byte packaged data.302 * brief: Parallel SRA for 8 byte packaged data.
@@ -303,15 +326,14 @@ · 23 unmodified lines
303 "psrlh "#fr_t1", "#fr_t1", "#fr_i1" \n\t" \326 "psrlh "#fr_t1", "#fr_t1", "#fr_i1" \n\t" \
304 "packsshb "#fr_d0", "#fr_t0", "#fr_t1" \n\t"327 "packsshb "#fr_d0", "#fr_t0", "#fr_t1" \n\t"
305 328
306 329#define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
307#define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \330 "psrah "#fp1", "#fp1", "#shift" \n\t" \
308 "psrah "#fp1", "#fp1", "#shift" \n\t" \331 "psrah "#fp2", "#fp2", "#shift" \n\t" \
309 "psrah "#fp2", "#fp2", "#shift" \n\t" \332 "psrah "#fp3", "#fp3", "#shift" \n\t" \
310 "psrah "#fp3", "#fp3", "#shift" \n\t" \
311 "psrah "#fp4", "#fp4", "#shift" \n\t"333 "psrah "#fp4", "#fp4", "#shift" \n\t"
312 334
313#define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \335#define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \
314 PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \336 PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
315 PSRAH_4_MMI(fp5, fp6, fp7, fp8, shift)337 PSRAH_4_MMI(fp5, fp6, fp7, fp8, shift)
316 338
317 339

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