diff mbox

[FFmpeg-devel] avcodec/mips: Remove generic func use in hevc non-uni copy mc msa functions

Message ID 70293ACCC3BA6A4E81FFCA024C7A86E1E05922FE@PUMAIL01.pu.imgtec.org
State New
Headers show

Commit Message

Manojkumar Bhosale Sept. 21, 2017, 11:57 a.m. UTC
LGTM

-----Original Message-----
From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf Of kaustubh.raste@imgtec.com

Sent: Thursday, September 21, 2017 12:45 PM
To: ffmpeg-devel@ffmpeg.org
Cc: Kaustubh Raste
Subject: [FFmpeg-devel] [PATCH] avcodec/mips: Remove generic func use in hevc non-uni copy mc msa functions

From: Kaustubh Raste <kaustubh.raste@imgtec.com>


Signed-off-by: Kaustubh Raste <kaustubh.raste@imgtec.com>

---
 libavcodec/mips/hevcdsp_msa.c |  168 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 160 insertions(+), 8 deletions(-)

ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Comments

Michael Niedermayer Sept. 22, 2017, 10:16 a.m. UTC | #1
On Thu, Sep 21, 2017 at 11:57:16AM +0000, Manojkumar Bhosale wrote:
> LGTM

applied

[....]
diff mbox

Patch

diff --git a/libavcodec/mips/hevcdsp_msa.c b/libavcodec/mips/hevcdsp_msa.c index f2bc748..1a854b2 100644
--- a/libavcodec/mips/hevcdsp_msa.c
+++ b/libavcodec/mips/hevcdsp_msa.c
@@ -1,5 +1,5 @@ 
 /*
- * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
+ * Copyright (c) 2015 - 2017 Manojkumar Bhosale 
+ (Manojkumar.Bhosale@imgtec.com)
  *
  * This file is part of FFmpeg.
  *
@@ -302,8 +302,34 @@  static void hevc_copy_16w_msa(uint8_t *src, int32_t src_stride,
         ST_SH4(in0_r, in1_r, in2_r, in3_r, dst, dst_stride);
         ST_SH4(in0_l, in1_l, in2_l, in3_l, (dst + 8), dst_stride);
     } else if (0 == (height % 8)) {
-        hevc_copy_16multx8mult_msa(src, src_stride, dst, dst_stride,
-                                   height, 16);
+        uint32_t loop_cnt;
+        v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
+        v8i16 in0_r, in1_r, in2_r, in3_r, in0_l, in1_l, in2_l, in3_l;
+
+        for (loop_cnt = (height >> 3); loop_cnt--;) {
+            LD_SB8(src, src_stride, src0, src1, src2, src3, src4, src5, src6,
+                   src7);
+            src += (8 * src_stride);
+            ILVR_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3, in0_r,
+                       in1_r, in2_r, in3_r);
+            ILVL_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3, in0_l,
+                       in1_l, in2_l, in3_l);
+            SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+            SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+            ST_SH4(in0_r, in1_r, in2_r, in3_r, dst, dst_stride);
+            ST_SH4(in0_l, in1_l, in2_l, in3_l, (dst + 8), dst_stride);
+            dst += (4 * dst_stride);
+
+            ILVR_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7, in0_r,
+                       in1_r, in2_r, in3_r);
+            ILVL_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7, in0_l,
+                       in1_l, in2_l, in3_l);
+            SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+            SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+            ST_SH4(in0_r, in1_r, in2_r, in3_r, dst, dst_stride);
+            ST_SH4(in0_l, in1_l, in2_l, in3_l, (dst + 8), dst_stride);
+            dst += (4 * dst_stride);
+        }
     }
 }
 
@@ -311,29 +337,155 @@  static void hevc_copy_24w_msa(uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)  {
-    hevc_copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 16);
-    hevc_copy_8w_msa(src + 16, src_stride, dst + 16, dst_stride, height);
+    uint32_t loop_cnt;
+    v16i8 zero = { 0 };
+    v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
+    v8i16 in0_r, in1_r, in2_r, in3_r, in0_l, in1_l, in2_l, in3_l;
+
+    for (loop_cnt = (height >> 2); loop_cnt--;) {
+        LD_SB4(src, src_stride, src0, src1, src2, src3);
+        LD_SB4((src + 16), src_stride, src4, src5, src6, src7);
+        src += (4 * src_stride);
+        ILVR_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3, in0_r, in1_r,
+                   in2_r, in3_r);
+        ILVL_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3, in0_l, in1_l,
+                   in2_l, in3_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        ST_SH4(in0_r, in1_r, in2_r, in3_r, dst, dst_stride);
+        ST_SH4(in0_l, in1_l, in2_l, in3_l, (dst + 8), dst_stride);
+        ILVR_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7, in0_r, in1_r,
+                   in2_r, in3_r);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        ST_SH4(in0_r, in1_r, in2_r, in3_r, (dst + 16), dst_stride);
+        dst += (4 * dst_stride);
+    }
 }
 
 static void hevc_copy_32w_msa(uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)  {
-    hevc_copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 32);
+    uint32_t loop_cnt;
+    v16i8 zero = { 0 };
+    v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
+    v8i16 in0_r, in1_r, in2_r, in3_r, in0_l, in1_l, in2_l, in3_l;
+
+    for (loop_cnt = (height >> 2); loop_cnt--;) {
+        LD_SB4(src, src_stride, src0, src2, src4, src6);
+        LD_SB4((src + 16), src_stride, src1, src3, src5, src7);
+        src += (4 * src_stride);
+
+        ILVR_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3, in0_r, in1_r,
+                   in2_r, in3_r);
+        ILVL_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3, in0_l, in1_l,
+                   in2_l, in3_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        ST_SH4(in0_r, in0_l, in1_r, in1_l, dst, 8);
+        dst += dst_stride;
+        ST_SH4(in2_r, in2_l, in3_r, in3_l, dst, 8);
+        dst += dst_stride;
+
+        ILVR_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7, in0_r, in1_r,
+                   in2_r, in3_r);
+        ILVL_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7, in0_l, in1_l,
+                   in2_l, in3_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        ST_SH4(in0_r, in0_l, in1_r, in1_l, dst, 8);
+        dst += dst_stride;
+        ST_SH4(in2_r, in2_l, in3_r, in3_l, dst, 8);
+        dst += dst_stride;
+    }
 }
 
 static void hevc_copy_48w_msa(uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)  {
-    hevc_copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 48);
+    uint32_t loop_cnt;
+    v16i8 zero = { 0 };
+    v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
+    v16i8 src8, src9, src10, src11;
+    v8i16 in0_r, in1_r, in2_r, in3_r, in4_r, in5_r;
+    v8i16 in0_l, in1_l, in2_l, in3_l, in4_l, in5_l;
+
+    for (loop_cnt = (height >> 2); loop_cnt--;) {
+        LD_SB3(src, 16, src0, src1, src2);
+        src += src_stride;
+        LD_SB3(src, 16, src3, src4, src5);
+        src += src_stride;
+        LD_SB3(src, 16, src6, src7, src8);
+        src += src_stride;
+        LD_SB3(src, 16, src9, src10, src11);
+        src += src_stride;
+
+        ILVR_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3,
+                   in0_r, in1_r, in2_r, in3_r);
+        ILVL_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3,
+                   in0_l, in1_l, in2_l, in3_l);
+        ILVR_B2_SH(zero, src4, zero, src5, in4_r, in5_r);
+        ILVL_B2_SH(zero, src4, zero, src5, in4_l, in5_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        SLLI_4V(in4_r, in5_r, in4_l, in5_l, 6);
+        ST_SH6(in0_r, in0_l, in1_r, in1_l, in2_r, in2_l, dst, 8);
+        dst += dst_stride;
+        ST_SH6(in3_r, in3_l, in4_r, in4_l, in5_r, in5_l, dst, 8);
+        dst += dst_stride;
+
+        ILVR_B4_SH(zero, src6, zero, src7, zero, src8, zero, src9,
+                   in0_r, in1_r, in2_r, in3_r);
+        ILVL_B4_SH(zero, src6, zero, src7, zero, src8, zero, src9,
+                   in0_l, in1_l, in2_l, in3_l);
+        ILVR_B2_SH(zero, src10, zero, src11, in4_r, in5_r);
+        ILVL_B2_SH(zero, src10, zero, src11, in4_l, in5_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        SLLI_4V(in4_r, in5_r, in4_l, in5_l, 6);
+        ST_SH6(in0_r, in0_l, in1_r, in1_l, in2_r, in2_l, dst, 8);
+        dst += dst_stride;
+        ST_SH6(in3_r, in3_l, in4_r, in4_l, in5_r, in5_l, dst, 8);
+        dst += dst_stride;
+    }
 }
 
 static void hevc_copy_64w_msa(uint8_t *src, int32_t src_stride,
                               int16_t *dst, int32_t dst_stride,
                               int32_t height)  {
-    hevc_copy_16multx8mult_msa(src, src_stride, dst, dst_stride, height, 64);
+    uint32_t loop_cnt;
+    v16i8 zero = { 0 };
+    v16i8 src0, src1, src2, src3, src4, src5, src6, src7;
+    v8i16 in0_r, in1_r, in2_r, in3_r, in0_l, in1_l, in2_l, in3_l;
+
+    for (loop_cnt = (height >> 1); loop_cnt--;) {
+        LD_SB4(src, 16, src0, src1, src2, src3);
+        src += src_stride;
+        LD_SB4(src, 16, src4, src5, src6, src7);
+        src += src_stride;
+
+        ILVR_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3,
+                   in0_r, in1_r, in2_r, in3_r);
+        ILVL_B4_SH(zero, src0, zero, src1, zero, src2, zero, src3,
+                   in0_l, in1_l, in2_l, in3_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        ST_SH4(in0_r, in0_l, in1_r, in1_l, dst, 8);
+        ST_SH4(in2_r, in2_l, in3_r, in3_l, (dst + 32), 8);
+        dst += dst_stride;
+
+        ILVR_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7,
+                   in0_r, in1_r, in2_r, in3_r);
+        ILVL_B4_SH(zero, src4, zero, src5, zero, src6, zero, src7,
+                   in0_l, in1_l, in2_l, in3_l);
+        SLLI_4V(in0_r, in1_r, in2_r, in3_r, 6);
+        SLLI_4V(in0_l, in1_l, in2_l, in3_l, 6);
+        ST_SH4(in0_r, in0_l, in1_r, in1_l, dst, 8);
+        ST_SH4(in2_r, in2_l, in3_r, in3_l, (dst + 32), 8);
+        dst += dst_stride;
+    }
 }
 
 static void hevc_hz_8t_4w_msa(uint8_t *src, int32_t src_stride,
--
1.7.9.5

_______________________________________________
ffmpeg-devel mailing list