Commit c673f426 authored by fbarchard@google.com's avatar fbarchard@google.com

ARGBToI444 for Neon

BUG=none
TEST=libyuvTest.ARGBToI444_Opt
Review URL: https://webrtc-codereview.appspot.com/932013

git-svn-id: http://libyuv.googlecode.com/svn/trunk@475 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent c1f17f18
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 474
Version: 475
License: BSD
License File: LICENSE
......
......@@ -193,6 +193,7 @@ extern "C" {
#define HAS_I444TOARGBROW_NEON
#define HAS_I411TOARGBROW_NEON
#define HAS_ARGBTOYROW_NEON
#define HAS_ARGBTOUV444ROW_NEON
#define HAS_BGRATOYROW_NEON
#define HAS_ABGRTOYROW_NEON
#define HAS_RGBATOYROW_NEON
......@@ -342,6 +343,8 @@ void RGBAToYRow_Unaligned_SSSE3(const uint8* src_rgba, uint8* dst_y, int pix);
void RGB24ToYRow_Unaligned_SSSE3(const uint8* src_rgb24, uint8* dst_y, int pix);
void RAWToYRow_Unaligned_SSSE3(const uint8* src_raw, uint8* dst_y, int pix);
void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int pix);
void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
int pix);
void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int pix);
void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int pix);
void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int pix);
......
......@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 474
#define LIBYUV_VERSION 475
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
......@@ -38,6 +38,8 @@ int ARGBToI444(const uint8* src_argb, int src_stride_argb,
}
void (*ARGBToYRow)(const uint8* src_argb, uint8* dst_y, int pix) =
ARGBToYRow_C;
void (*ARGBToUV444Row)(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
int pix) = ARGBToUV444Row_C;
#if defined(HAS_ARGBTOYROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3) && width >= 16) {
ARGBToYRow = ARGBToYRow_Any_SSSE3;
......@@ -54,12 +56,13 @@ int ARGBToI444(const uint8* src_argb, int src_stride_argb,
ARGBToYRow = ARGBToYRow_Any_NEON;
if (IS_ALIGNED(width, 8)) {
ARGBToYRow = ARGBToYRow_NEON;
ARGBToUV444Row = ARGBToUV444Row_NEON;
}
}
#endif
for (int y = 0; y < height; ++y) {
ARGBToUV444Row_C(src_argb, dst_u, dst_v, width);
ARGBToUV444Row(src_argb, dst_u, dst_v, width);
ARGBToYRow(src_argb, dst_y, width);
src_argb += src_stride_argb;
dst_y += dst_stride_y;
......
......@@ -1572,6 +1572,46 @@ void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int pix) {
}
#endif // HAS_ARGBTOYROW_NEON
#ifdef HAS_ARGBTOYROW_NEON
void ARGBToUV444Row_NEON(const uint8* src_argb, uint8* dst_u, uint8* dst_v,
int pix) {
asm volatile (
"vmov.u8 d24, #112 / 2 \n" // UB / VR coefficient
"vmov.u8 d25, #74 / 2 \n" // UG -coefficient
"vmov.u8 d26, #38 / 2 \n" // UR -coefficient
"vmov.u8 d27, #18 / 2 \n" // VB -coefficient
"vmov.u8 d28, #94 / 2 \n" // VG -coefficient
"vmov.u16 q15, #0x8080 / 2 \n" // 128
".p2align 2 \n"
"1: \n"
"vld4.8 {d0, d1, d2, d3}, [%0]! \n" // load 8 ARGB pixels.
"subs %3, %3, #8 \n" // 8 processed per loop.
"vmull.u8 q2, d0, d24 \n" // B
"vmlsl.u8 q2, d1, d25 \n" // G
"vmlsl.u8 q2, d2, d26 \n" // R
"vadd.u16 q2, q2, q15 \n" // +128 -> unsigned
"vmull.u8 q3, d2, d24 \n" // R
"vmlsl.u8 q3, d1, d28 \n" // G
"vmlsl.u8 q3, d0, d27 \n" // B
"vadd.u16 q3, q3, q15 \n" // +128 -> unsigned
"vqshrn.u16 d0, q2, #7 \n" // 16 bit to 8 bit U
"vqshrn.u16 d1, q3, #7 \n" // 16 bit to 8 bit V
"vst1.8 {d0}, [%1]! \n" // store 8 pixels U.
"vst1.8 {d1}, [%2]! \n" // store 8 pixels U.
"bgt 1b \n"
: "+r"(src_argb), // %0
"+r"(dst_u), // %1
"+r"(dst_v), // %2
"+r"(pix) // %3
:
: "memory", "cc", "q0", "q1", "q2", "q3", "q4"
);
}
#endif // HAS_ARGBTOYROW_NEON
#ifdef HAS_RGB565TOYROW_NEON
void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int pix) {
asm volatile (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment