aboutsummaryrefslogtreecommitdiff
path: root/files/source/scale_mmi.cc
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2022-08-02 13:26:21 -0700
committerVignesh Venkatasubramanian <vigneshv@google.com>2022-08-25 13:27:22 -0700
commit51738d52b6c91d4573b75f6483dd045d0affc00b (patch)
treee8cf5f7cdc94a5abfe84a758a4245d7269b65f8f /files/source/scale_mmi.cc
parentfe33d276d689446c03db3f1f761797b01aa06e1f (diff)
downloadlibyuv-51738d52b6c91d4573b75f6483dd045d0affc00b.tar.gz
Update external/libyuv to r1837
Update external/libyuv to version r1837 (d53f1bee) from upstream. This brings in some new functions that will be used by libavif. Also update README.version with local modifications. The files/ subdirectory is a pristine copy of the upstream checkout except for the local modifications that are listed in README.version. Bug: b/241008246 Bug: b/228492909 Test: Builds. Media and Camera CTS tests pass. Merged-In: I1bd041e475666e13fafd8c3792d7142a022d435a Change-Id: I85df21181e582ff835aab1e9ef13ad3ac8421d30
Diffstat (limited to 'files/source/scale_mmi.cc')
-rw-r--r--files/source/scale_mmi.cc55
1 files changed, 55 insertions, 0 deletions
diff --git a/files/source/scale_mmi.cc b/files/source/scale_mmi.cc
index 990463c2..1226ef3e 100644
--- a/files/source/scale_mmi.cc
+++ b/files/source/scale_mmi.cc
@@ -1103,6 +1103,61 @@ void ScaleRowUp2_16_MMI(const uint16_t* src_ptr,
: "memory");
}
+void ScaleRowDown34_MMI(const uint8_t* src_ptr,
+ ptrdiff_t src_stride,
+ uint8_t* dst,
+ int dst_width) {
+ (void)src_stride;
+ assert((dst_width % 3 == 0) && (dst_width > 0));
+ uint64_t src[2];
+ uint64_t tmp[2];
+ __asm__ volatile (
+ "1: \n\t"
+ "gsldlc1 %[src0], 0x07(%[src_ptr]) \n\t"
+ "gsldrc1 %[src0], 0x00(%[src_ptr]) \n\t"
+ "gsldlc1 %[src1], 0x0f(%[src_ptr]) \n\t"
+ "gsldrc1 %[src1], 0x08(%[src_ptr]) \n\t"
+ "and %[tmp1], %[src0], %[mask1] \n\t"
+ "psrlw %[tmp0], %[src0], %[rmov] \n\t"
+ "psllw %[tmp0], %[tmp0], %[lmov1] \n\t"
+ "or %[src0], %[tmp0], %[tmp1] \n\t"
+ "punpckhwd %[tmp0], %[src0], %[src0] \n\t"
+ "psllw %[tmp1], %[tmp0], %[rmov] \n\t"
+ "or %[src0], %[src0], %[tmp1] \n\t"
+ "psrlw %[tmp0], %[tmp0], %[rmov8] \n\t"
+ "pextrh %[tmp0], %[tmp0], %[zero] \n\t"
+ "pinsrh_2 %[src0], %[src0], %[tmp0] \n\t"
+ "pextrh %[tmp0], %[src1], %[zero] \n\t"
+ "pinsrh_3 %[src0], %[src0], %[tmp0] \n\t"
+
+ "punpckhwd %[tmp0], %[src1], %[src1] \n\t"
+ "pextrh %[tmp1], %[tmp0], %[zero] \n\t"
+ "psrlw %[src1], %[src1], %[rmov] \n\t"
+ "psllw %[tmp1], %[tmp1], %[rmov8] \n\t"
+ "or %[src1], %[src1], %[tmp1] \n\t"
+ "and %[tmp0], %[tmp0], %[mask2] \n\t"
+ "or %[src1], %[src1], %[tmp0] \n\t"
+
+ "gssdlc1 %[src0], 0x07(%[dst_ptr]) \n\t"
+ "gssdrc1 %[src0], 0x00(%[dst_ptr]) \n\t"
+ "gsswlc1 %[src1], 0x0b(%[dst_ptr]) \n\t"
+ "gsswrc1 %[src1], 0x08(%[dst_ptr]) \n\t"
+
+ "daddiu %[src_ptr], %[src_ptr], 0x10 \n\t"
+ "daddi %[width], %[width], -0x0c \n\t"
+ "daddiu %[dst_ptr], %[dst_ptr], 0x0c \n\t"
+ "bnez %[width], 1b \n\t"
+
+ : [src0]"=&f"(src[0]), [src1]"=&f"(src[1]),
+ [tmp0]"=&f"(tmp[0]), [tmp1]"=&f"(tmp[1])
+ : [src_ptr]"r"(src_ptr), [dst_ptr]"r"(dst),
+ [lmov]"f"(0xc), [rmov]"f"(0x18),
+ [mask1]"f"(0xffff0000ffff), [rmov8]"f"(0x8),
+ [zero]"f"(0x0), [mask2]"f"(0xff000000),
+ [width]"r"(dst_width), [lmov1]"f"(0x10)
+ : "memory"
+ );
+}
// clang-format on
#endif // !defined(LIBYUV_DISABLE_MMI) && defined(_MIPS_ARCH_LOONGSON3A)