[x265] [PATCH] arm: Implement calc_Residual ARM NEON

radhakrishnan at multicorewareinc.com radhakrishnan at multicorewareinc.com
Mon Feb 22 10:22:46 CET 2016


# HG changeset patch
# User Radhakrishnan VR <radhakrishnan at multicorewareinc.com>
# Date 1455865980 -19800
#      Fri Feb 19 12:43:00 2016 +0530
# Node ID 8d2be4dec4a41dd50754edab2bddc7975127649a
# Parent  0530326e8e07c0aa8607ba45dfe1c418509a5caa
arm: Implement calc_Residual ARM NEON

diff -r 0530326e8e07 -r 8d2be4dec4a4 source/common/arm/asm-primitives.cpp
--- a/source/common/arm/asm-primitives.cpp	Thu Feb 18 16:47:22 2016 +0530
+++ b/source/common/arm/asm-primitives.cpp	Fri Feb 19 12:43:00 2016 +0530
@@ -42,6 +42,12 @@
 {
     if (cpuMask & X265_CPU_NEON)
     {
+        // calc_Residual
+        p.cu[BLOCK_4x4].calcresidual   = PFX(getResidual4_neon);
+        p.cu[BLOCK_8x8].calcresidual   = PFX(getResidual8_neon);
+        p.cu[BLOCK_16x16].calcresidual = PFX(getResidual16_neon);
+        p.cu[BLOCK_32x32].calcresidual = PFX(getResidual32_neon);
+
         // sse_pp
         p.cu[BLOCK_4x4].sse_pp   = PFX(pixel_sse_pp_4x4_neon);
         p.cu[BLOCK_8x8].sse_pp   = PFX(pixel_sse_pp_8x8_neon);
diff -r 0530326e8e07 -r 8d2be4dec4a4 source/common/arm/pixel-util.S
--- a/source/common/arm/pixel-util.S	Thu Feb 18 16:47:22 2016 +0530
+++ b/source/common/arm/pixel-util.S	Fri Feb 19 12:43:00 2016 +0530
@@ -2,6 +2,7 @@
  * Copyright (C) 2016 x265 project
  *
  * Authors: Dnyaneshwar G <dnyaneshwar at multicorewareinc.com>
+ *          Radhakrishnan VR <radhakrishnan at multicorewareinc.com>
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -241,3 +242,77 @@
     vmov            r0, r1, d0
     bx              lr
 endfunc
+
+/* void getResidual4_neon(const pixel* fenc, const pixel* pred, int16_t* residual, intptr_t stride);
+ * r0   - fenc
+ * r1   - pred
+ * r2   - residual
+ * r3   - Stride */
+function x265_getResidual4_neon
+    lsl             r12, r3, #1
+.rept 2
+    vld1.u8         {d0}, [r0], r3
+    vld1.u8         {d1}, [r1], r3
+    vld1.u8         {d2}, [r0], r3
+    vld1.u8         {d3}, [r1], r3
+    vsubl.u8        q2, d0, d1
+    vsubl.u8        q3, d2, d3
+    vst1.s16        {d4}, [r2], r12
+    vst1.s16        {d6}, [r2], r12
+.endr
+    bx              lr
+endfunc
+
+function x265_getResidual8_neon
+    lsl             r12, r3, #1
+.rept 4
+    vld1.u8         {d0}, [r0], r3
+    vld1.u8         {d1}, [r1], r3
+    vld1.u8         {d2}, [r0], r3
+    vld1.u8         {d3}, [r1], r3
+    vsubl.u8        q2, d0, d1
+    vsubl.u8        q3, d2, d3
+    vst1.s16        {q2}, [r2], r12
+    vst1.s16        {q3}, [r2], r12
+.endr
+    bx              lr
+endfunc
+
+function x265_getResidual16_neon
+    lsl             r12, r3, #1
+.rept 8
+    vld1.u8         {d0, d1}, [r0], r3
+    vld1.u8         {d2, d3}, [r1], r3
+    vld1.u8         {d4, d5}, [r0], r3
+    vld1.u8         {d6, d7}, [r1], r3
+    vsubl.u8        q8, d0, d2
+    vsubl.u8        q9, d1, d3
+    vsubl.u8        q10, d4, d6
+    vsubl.u8        q11, d5, d7
+    vst1.s16        {q8, q9}, [r2], r12
+    vst1.s16        {q10, q11}, [r2], r12
+.endr
+    bx              lr
+endfunc
+
+function x265_getResidual32_neon
+    push            {r4}
+    lsl             r12, r3, #1
+    sub             r12, #32
+    mov             r4, #4
+loop_res32:
+    subs            r4, r4, #1
+.rept 8
+    vld1.u8         {q0, q1}, [r0], r3
+    vld1.u8         {q2, q3}, [r1], r3
+    vsubl.u8        q8, d0, d4
+    vsubl.u8        q9, d1, d5
+    vsubl.u8        q10, d2, d6
+    vsubl.u8        q11, d3, d7
+    vst1.s16        {q8, q9}, [r2]!
+    vst1.s16        {q10, q11}, [r2], r12
+.endr
+    bne             loop_res32
+    pop             {r4}
+    bx              lr
+endfunc
diff -r 0530326e8e07 -r 8d2be4dec4a4 source/common/arm/pixel-util.h
--- a/source/common/arm/pixel-util.h	Thu Feb 18 16:47:22 2016 +0530
+++ b/source/common/arm/pixel-util.h	Fri Feb 19 12:43:00 2016 +0530
@@ -30,4 +30,8 @@
 uint64_t x265_pixel_var_32x32_neon(const pixel* pix, intptr_t stride);
 uint64_t x265_pixel_var_64x64_neon(const pixel* pix, intptr_t stride);
 
+void x265_getResidual4_neon(const pixel* fenc, const pixel* pred, int16_t* residual, intptr_t stride);
+void x265_getResidual8_neon(const pixel* fenc, const pixel* pred, int16_t* residual, intptr_t stride);
+void x265_getResidual16_neon(const pixel* fenc, const pixel* pred, int16_t* residual, intptr_t stride);
+void x265_getResidual32_neon(const pixel* fenc, const pixel* pred, int16_t* residual, intptr_t stride);
 #endif // ifndef X265_PIXEL_UTIL_ARM_H


More information about the x265-devel mailing list