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
248248 0xfff70004, 0xfff0000f, %[ff_pw_4])
249249
250250 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
251− %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
252− %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
251+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
253252
254253 MMI_SDC1(%[ftmp15], %[dst], 0x00)
255254 MMI_SDC1(%[ftmp16], %[dst], 0x10)
@@ -257,8 +256,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 1 unmodified line
257256 MMI_SDC1(%[ftmp18], %[dst], 0x30)
258257
259258 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
260− %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
261− %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
259+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
262260
263261 MMI_SDC1(%[ftmp19], %[dst], 0x08)
264262 MMI_SDC1(%[ftmp20], %[dst], 0x18)
@@ -301,8 +299,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 36 unmodified lines
301299 0xfff70004, 0xfff0000f, %[ff_pw_4])
302300
303301 TRANSPOSE_4H(%[ftmp15], %[ftmp16], %[ftmp17], %[ftmp18],
304− %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
305− %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
302+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
306303
307304 MMI_SDC1(%[ftmp15], %[dst], 0x40)
308305 MMI_SDC1(%[ftmp16], %[dst], 0x50)
@@ -310,8 +307,7 @@ void ff_vc1_inv_trans_8x8_mmi(int16_t block[64]) · 1 unmodified line
310307 MMI_SDC1(%[ftmp18], %[dst], 0x70)
311308
312309 TRANSPOSE_4H(%[ftmp19], %[ftmp20], %[ftmp21], %[ftmp22],
313− %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
314− %[ftmp5], %[tmp0], %[ftmp6], %[ftmp7])
310+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
315311
316312 MMI_SDC1(%[ftmp19], %[dst], 0x48)
317313 MMI_SDC1(%[ftmp20], %[dst], 0x58)
libavcodec/mips/vp8dsp_mmi.c+8−64
@@ -44,58 +44,6 @@ · 43 unmodified lines
4444 "punpcklbh "#dst_r", "#src", %[db_2] \n\t" \
4545 "punpckhbh "#dst_l", "#src", %[db_2] \n\t"
4646
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−
9947 #define MMI_VP8_LOOP_FILTER \
10048 /* Calculation of hev */ \
10149 "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
952900 "gsldlc1 %[q3], 0x03(%[tmp0]) \n\t"
953901 "gsldrc1 %[q3], -0x04(%[tmp0]) \n\t"
954902 /* Matrix transpose */
955− MMI_TRANSPOSE8x8_UB_UB(%[p3], %[p2], %[p1], %[p0],
956− %[q0], %[q1], %[q2], %[q3],
957− %[p3], %[p2], %[p1], %[p0],
958− %[q0], %[q1], %[q2], %[q3])
903+ TRANSPOSE_8B(%[p3], %[p2], %[p1], %[p0],
904+ %[q0], %[q1], %[q2], %[q3],
905+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
959906 MMI_VP8_LOOP_FILTER
960907 /* Matrix transpose */
961− MMI_TRANSPOSE8x8_UB_UB(%[p3], %[p2], %[p1], %[p0],
962− %[q0], %[q1], %[q2], %[q3],
963− %[p3], %[p2], %[p1], %[p0],
964− %[q0], %[q1], %[q2], %[q3])
908+ TRANSPOSE_8B(%[p3], %[p2], %[p1], %[p0],
909+ %[q0], %[q1], %[q2], %[q3],
910+ %[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4])
965911 /* Move to dst */
966912 "gssdlc1 %[p3], 0x03(%[dst]) \n\t"
967913 "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
12331179 MMI_SDC1(%[ftmp0], %[block], 0x18)
12341180
12351181 TRANSPOSE_4H(%[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
1236− %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8],
1237− %[ftmp9], %[tmp0], %[ftmp0], %[ftmp10])
1182+ %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8])
12381183
12391184 // t[0 4 8 12]
12401185 "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
12691214 "psrah %[ftmp4], %[ftmp4], %[ftmp11] \n\t"
12701215
12711216 TRANSPOSE_4H(%[ftmp1], %[ftmp2], %[ftmp3], %[ftmp4],
1272− %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8],
1273− %[ftmp9], %[tmp0], %[ftmp0], %[ftmp10])
1217+ %[ftmp5], %[ftmp6], %[ftmp7], %[ftmp8])
12741218
12751219 MMI_LWC1(%[ftmp5], %[dst0], 0x00)
12761220 MMI_LWC1(%[ftmp6], %[dst1], 0x00)
libavutil/mips/mmiutils.h+53−31
@@ -250,30 +250,53 @@ · 249 unmodified lines
250250 : "memory" \
251251 );
252252
253−#define TRANSPOSE_4H(m1, m2, m3, m4, t1, t2, t3, t4, t5, r1, zero, shift) \
254− "li "#r1", 0x93 \n\t" \
255− "xor "#zero","#zero","#zero" \n\t" \
256− "mtc1 "#r1", "#shift" \n\t" \
257− "punpcklhw "#t1", "#m1", "#zero" \n\t" \
258− "punpcklhw "#t5", "#m2", "#zero" \n\t" \
259− "pshufh "#t5", "#t5", "#shift" \n\t" \
260− "or "#t1", "#t1", "#t5" \n\t" \
261− "punpckhhw "#t2", "#m1", "#zero" \n\t" \
262− "punpckhhw "#t5", "#m2", "#zero" \n\t" \
263− "pshufh "#t5", "#t5", "#shift" \n\t" \
264− "or "#t2", "#t2", "#t5" \n\t" \
265− "punpcklhw "#t3", "#m3", "#zero" \n\t" \
266− "punpcklhw "#t5", "#m4", "#zero" \n\t" \
267− "pshufh "#t5", "#t5", "#shift" \n\t" \
268− "or "#t3", "#t3", "#t5" \n\t" \
269− "punpckhhw "#t4", "#m3", "#zero" \n\t" \
270− "punpckhhw "#t5", "#m4", "#zero" \n\t" \
271− "pshufh "#t5", "#t5", "#shift" \n\t" \
272− "or "#t4", "#t4", "#t5" \n\t" \
273− "punpcklwd "#m1", "#t1", "#t3" \n\t" \
274− "punpckhwd "#m2", "#t1", "#t3" \n\t" \
275− "punpcklwd "#m3", "#t2", "#t4" \n\t" \
276− "punpckhwd "#m4", "#t2", "#t4" \n\t"
253+/**
254+ * brief: Transpose 4X4 half word packaged data.
255+ * fr_i0, fr_i1, fr_i2, fr_i3: src & dst
256+ * fr_t0, fr_t1, fr_t2, fr_t3: temporary register
257+ */
258+#define TRANSPOSE_4H(fr_i0, fr_i1, fr_i2, fr_i3, \
259+ fr_t0, fr_t1, fr_t2, fr_t3) \
260+ "punpcklhw "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
261+ "punpckhhw "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
262+ "punpcklhw "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
263+ "punpckhhw "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
264+ "punpcklwd "#fr_i0", "#fr_t0", "#fr_t2" \n\t" \
265+ "punpckhwd "#fr_i1", "#fr_t0", "#fr_t2" \n\t" \
266+ "punpcklwd "#fr_i2", "#fr_t1", "#fr_t3" \n\t" \
267+ "punpckhwd "#fr_i3", "#fr_t1", "#fr_t3" \n\t"
268+
269+/**
270+ * brief: Transpose 8x8 byte packaged data.
271+ * fr_i0~i7: src & dst
272+ * fr_t0~t3: temporary register
273+ */
274+#define TRANSPOSE_8B(fr_i0, fr_i1, fr_i2, fr_i3, fr_i4, fr_i5, \
275+ fr_i6, fr_i7, fr_t0, fr_t1, fr_t2, fr_t3) \
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"
277300
278301 /**
279302 * brief: Parallel SRA for 8 byte packaged data.
@@ -303,15 +326,14 @@ · 23 unmodified lines
303326 "psrlh "#fr_t1", "#fr_t1", "#fr_i1" \n\t" \
304327 "packsshb "#fr_d0", "#fr_t0", "#fr_t1" \n\t"
305328
306−
307−#define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
308− "psrah "#fp1", "#fp1", "#shift" \n\t" \
309− "psrah "#fp2", "#fp2", "#shift" \n\t" \
310− "psrah "#fp3", "#fp3", "#shift" \n\t" \
329+#define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
330+ "psrah "#fp1", "#fp1", "#shift" \n\t" \
331+ "psrah "#fp2", "#fp2", "#shift" \n\t" \
332+ "psrah "#fp3", "#fp3", "#shift" \n\t" \
311333 "psrah "#fp4", "#fp4", "#shift" \n\t"
312334
313−#define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \
314− PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
335+#define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \
336+ PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
315337 PSRAH_4_MMI(fp5, fp6, fp7, fp8, shift)
316338
317339

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