[x265] [PATCH] arm: Implement quant

chen chenm003 at 163.com
Mon Apr 25 19:11:05 CEST 2016


Most are fine, I put some comment in below


At 2016-04-25 20:03:59,"Ramya Sriraman" <ramya at multicorewareinc.com> wrote:

Ignore above patch. Modified one below.

# HG changeset patch
# User Ramya Sriraman<ramya at multicorewareinc.com>
# Date 1461158053 -19800
#      Wed Apr 20 18:44:13 2016 +0530
# Node ID c26f9a4dc9173b0cbfb609a984c57607d129f011
# Parent  4f83d465d11b3baa46e6089f73b0929266d4b722
arm: Implement quant

diff -r 4f83d465d11b -r c26f9a4dc917 source/common/arm/asm-primitives.cpp
--- a/source/common/arm/asm-primitives.cpp    Wed Mar 30 17:29:13 2016 +0530
+++ b/source/common/arm/asm-primitives.cpp    Wed Apr 20 18:44:13 2016 +0530
@@ -820,6 +820,8 @@
         p.chroma[X265_CSP_I444].pu[LUMA_24x32].filter_vsp = PFX(interp_4tap_vert_sp_24x32_neon);
         p.chroma[X265_CSP_I444].pu[LUMA_48x64].filter_vsp = PFX(interp_4tap_vert_sp_48x64_neon);
 
+        // quant
+        p.quant = PFX(quant_neon);
     }
     if (cpuMask & X265_CPU_ARMV6)
     {
diff -r 4f83d465d11b -r c26f9a4dc917 source/common/arm/pixel-util.S
--- a/source/common/arm/pixel-util.S    Wed Mar 30 17:29:13 2016 +0530
+++ b/source/common/arm/pixel-util.S    Wed Apr 20 18:44:13 2016 +0530
@@ -1962,3 +1962,60 @@
     bx              lr
 endfunc
 
+function x265_quant_neon
+    push            {r4-r6}
+    ldr             r4, [sp, #3* 4]         //qbits
+    vdup.s32        q8, r4
+    mov             r12, #8
+    sub             r12, r12, r4
+    vdup.s32        q10, r12                // -(qbits- 8) = 8- qbits
+    ldr             r4, [sp, #3* 4 + 4]     // add
+    vdup.s32        q9, r4
+    ldr             r4, [sp, #3* 4 + 8]     // numcoeff
+
+    lsr             r4, r4 ,#2
+    eor             r5, r5
+    eor             r6, r6
+
+.loop_quant:
+
+    vld1.s16        d0, [r0]!
+    vmovl.s16       q1, d0                  // coef[blockpos]
+
+    vclt.s32        q4, q1, #0
+
+    vabs.s32        q1, q1                  // q1=level=abs(coef[blockpos])
+    vld1.s32        {q0}, [r1]!             // quantCoeff[blockpos]
+    vmul.i32        q0, q0, q1              // q0=tmplevel = abs(level) * quantCoeff[blockpos];
+
+    vadd.s32        q1, q0, q9              // q1= tmplevel+add
+    vneg.s32        q12, q8
+    vshl.s32        q1, q1, q12             // q1= level =(tmplevel+add) >> qbits
+
+    vshl.s32        q3, q1, q8              // q3 = level << qBits
+    vsub.s32        q13, q0, q3             // q8= tmplevel - (level << qBits)
VSHL+VSUB may replace by VMLS

+    vshl.s32        q13, q13, q10           // q3= ((tmplevel - (level << qBits)) >> qBits8)
+    vst1.s32        {q13}, [r2]!            // store deltaU
+
+    // numsig
+    vclz.s32        q2, q1
VCLZ (Vector Count Leading Zeros) counts the number of consecutive zeros
Are you means VCLT?

+    vshr.u32        q2, #5
+    vadd.u32        d4, d5
+    vpadd.u32       d4, d4
+    vmov.32         r12, d4[0]
+    add             r5, r12
+    add             r6, #4
above code block may replace by  'vadd.s32 q2, q1' and sum after loop

+
+    veor.s32        q2, q1, q4
+    vsub.s32        q2, q2, q4
+    vqmovn.s32      d0, q2
+    vst1.s16        d0, [r3]!
+
+    subs            r4, #1
+    bne             .loop_quant
+
+    sub             r0, r6, r5
+    pop             {r4-r6}
+    bx              lr
+endfunc
+
diff -r 4f83d465d11b -r c26f9a4dc917 source/common/arm/pixel-util.h
--- a/source/common/arm/pixel-util.h    Wed Mar 30 17:29:13 2016 +0530
+++ b/source/common/arm/pixel-util.h    Wed Apr 20 18:44:13 2016 +0530
@@ -78,4 +78,6 @@
 int x265_pixel_sa8d_32x32_neon(const pixel* pix1, intptr_t i_pix1, const pixel* pix2, intptr_t i_pix2);
 int x265_pixel_sa8d_32x64_neon(const pixel* pix1, intptr_t i_pix1, const pixel* pix2, intptr_t i_pix2);
 int x265_pixel_sa8d_64x64_neon(const pixel* pix1, intptr_t i_pix1, const pixel* pix2, intptr_t i_pix2);
+
+uint32_t x265_quant_neon(const int16_t* coef, const int32_t* quantCoeff, int32_t* deltaU, int16_t* qCoef, int qBits, int add, int numCoeff);
 #endif // ifndef X265_PIXEL_UTIL_ARM_H



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160426/b9b90eba/attachment.html>


More information about the x265-devel mailing list