aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mips
diff options
context:
space:
mode:
authorShiyou Yin <yinshiyou-hf@loongson.cn>2018-09-06 16:10:53 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2018-09-09 12:01:07 +0200
commit5161f7bcfd3c2d2e6cb92e782855b7fc00bdf877 (patch)
tree13a91834e04c47ccccd3ecc58012703b127cee59 /libavutil/mips
parent090647da84f975c7ffb163436040cc8aecf46a9c (diff)
downloadffmpeg-5161f7bcfd3c2d2e6cb92e782855b7fc00bdf877.tar.gz
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. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/mips')
-rw-r--r--libavutil/mips/mmiutils.h84
1 files changed, 53 insertions, 31 deletions
diff --git a/libavutil/mips/mmiutils.h b/libavutil/mips/mmiutils.h
index b16edc4ba1..76b1199ab9 100644
--- a/libavutil/mips/mmiutils.h
+++ b/libavutil/mips/mmiutils.h
@@ -250,30 +250,53 @@
: "memory" \
);
-#define TRANSPOSE_4H(m1, m2, m3, m4, t1, t2, t3, t4, t5, r1, zero, shift) \
- "li "#r1", 0x93 \n\t" \
- "xor "#zero","#zero","#zero" \n\t" \
- "mtc1 "#r1", "#shift" \n\t" \
- "punpcklhw "#t1", "#m1", "#zero" \n\t" \
- "punpcklhw "#t5", "#m2", "#zero" \n\t" \
- "pshufh "#t5", "#t5", "#shift" \n\t" \
- "or "#t1", "#t1", "#t5" \n\t" \
- "punpckhhw "#t2", "#m1", "#zero" \n\t" \
- "punpckhhw "#t5", "#m2", "#zero" \n\t" \
- "pshufh "#t5", "#t5", "#shift" \n\t" \
- "or "#t2", "#t2", "#t5" \n\t" \
- "punpcklhw "#t3", "#m3", "#zero" \n\t" \
- "punpcklhw "#t5", "#m4", "#zero" \n\t" \
- "pshufh "#t5", "#t5", "#shift" \n\t" \
- "or "#t3", "#t3", "#t5" \n\t" \
- "punpckhhw "#t4", "#m3", "#zero" \n\t" \
- "punpckhhw "#t5", "#m4", "#zero" \n\t" \
- "pshufh "#t5", "#t5", "#shift" \n\t" \
- "or "#t4", "#t4", "#t5" \n\t" \
- "punpcklwd "#m1", "#t1", "#t3" \n\t" \
- "punpckhwd "#m2", "#t1", "#t3" \n\t" \
- "punpcklwd "#m3", "#t2", "#t4" \n\t" \
- "punpckhwd "#m4", "#t2", "#t4" \n\t"
+/**
+ * brief: Transpose 4X4 half word packaged data.
+ * fr_i0, fr_i1, fr_i2, fr_i3: src & dst
+ * fr_t0, fr_t1, fr_t2, fr_t3: temporary register
+ */
+#define TRANSPOSE_4H(fr_i0, fr_i1, fr_i2, fr_i3, \
+ fr_t0, fr_t1, fr_t2, fr_t3) \
+ "punpcklhw "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
+ "punpckhhw "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
+ "punpcklhw "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
+ "punpckhhw "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
+ "punpcklwd "#fr_i0", "#fr_t0", "#fr_t2" \n\t" \
+ "punpckhwd "#fr_i1", "#fr_t0", "#fr_t2" \n\t" \
+ "punpcklwd "#fr_i2", "#fr_t1", "#fr_t3" \n\t" \
+ "punpckhwd "#fr_i3", "#fr_t1", "#fr_t3" \n\t"
+
+/**
+ * brief: Transpose 8x8 byte packaged data.
+ * fr_i0~i7: src & dst
+ * fr_t0~t3: temporary register
+ */
+#define TRANSPOSE_8B(fr_i0, fr_i1, fr_i2, fr_i3, fr_i4, fr_i5, \
+ fr_i6, fr_i7, fr_t0, fr_t1, fr_t2, fr_t3) \
+ "punpcklbh "#fr_t0", "#fr_i0", "#fr_i1" \n\t" \
+ "punpckhbh "#fr_t1", "#fr_i0", "#fr_i1" \n\t" \
+ "punpcklbh "#fr_t2", "#fr_i2", "#fr_i3" \n\t" \
+ "punpckhbh "#fr_t3", "#fr_i2", "#fr_i3" \n\t" \
+ "punpcklbh "#fr_i0", "#fr_i4", "#fr_i5" \n\t" \
+ "punpckhbh "#fr_i1", "#fr_i4", "#fr_i5" \n\t" \
+ "punpcklbh "#fr_i2", "#fr_i6", "#fr_i7" \n\t" \
+ "punpckhbh "#fr_i3", "#fr_i6", "#fr_i7" \n\t" \
+ "punpcklhw "#fr_i4", "#fr_t0", "#fr_t2" \n\t" \
+ "punpckhhw "#fr_i5", "#fr_t0", "#fr_t2" \n\t" \
+ "punpcklhw "#fr_i6", "#fr_t1", "#fr_t3" \n\t" \
+ "punpckhhw "#fr_i7", "#fr_t1", "#fr_t3" \n\t" \
+ "punpcklhw "#fr_t0", "#fr_i0", "#fr_i2" \n\t" \
+ "punpckhhw "#fr_t1", "#fr_i0", "#fr_i2" \n\t" \
+ "punpcklhw "#fr_t2", "#fr_i1", "#fr_i3" \n\t" \
+ "punpckhhw "#fr_t3", "#fr_i1", "#fr_i3" \n\t" \
+ "punpcklwd "#fr_i0", "#fr_i4", "#fr_t0" \n\t" \
+ "punpckhwd "#fr_i1", "#fr_i4", "#fr_t0" \n\t" \
+ "punpcklwd "#fr_i2", "#fr_i5", "#fr_t1" \n\t" \
+ "punpckhwd "#fr_i3", "#fr_i5", "#fr_t1" \n\t" \
+ "punpcklwd "#fr_i4", "#fr_i6", "#fr_t2" \n\t" \
+ "punpckhwd "#fr_i5", "#fr_i6", "#fr_t2" \n\t" \
+ "punpcklwd "#fr_i6", "#fr_i7", "#fr_t3" \n\t" \
+ "punpckhwd "#fr_i7", "#fr_i7", "#fr_t3" \n\t"
/**
* brief: Parallel SRA for 8 byte packaged data.
@@ -303,15 +326,14 @@
"psrlh "#fr_t1", "#fr_t1", "#fr_i1" \n\t" \
"packsshb "#fr_d0", "#fr_t0", "#fr_t1" \n\t"
-
-#define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
- "psrah "#fp1", "#fp1", "#shift" \n\t" \
- "psrah "#fp2", "#fp2", "#shift" \n\t" \
- "psrah "#fp3", "#fp3", "#shift" \n\t" \
+#define PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
+ "psrah "#fp1", "#fp1", "#shift" \n\t" \
+ "psrah "#fp2", "#fp2", "#shift" \n\t" \
+ "psrah "#fp3", "#fp3", "#shift" \n\t" \
"psrah "#fp4", "#fp4", "#shift" \n\t"
-#define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \
- PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
+#define PSRAH_8_MMI(fp1, fp2, fp3, fp4, fp5, fp6, fp7, fp8, shift) \
+ PSRAH_4_MMI(fp1, fp2, fp3, fp4, shift) \
PSRAH_4_MMI(fp5, fp6, fp7, fp8, shift)