On Mon, 1 May 2017, Alexandra Hájková wrote:

---
libavcodec/arm/hevc_idct.S        | 90 +++++++++++++++++++++++++++++++++++++++
libavcodec/arm/hevcdsp_init_arm.c | 13 ++++++
2 files changed, 103 insertions(+)

diff --git a/libavcodec/arm/hevc_idct.S b/libavcodec/arm/hevc_idct.S
index b3ce00b..5d400c2 100644
--- a/libavcodec/arm/hevc_idct.S
+++ b/libavcodec/arm/hevc_idct.S
@@ -30,6 +30,13 @@ const trans, align=4
        .short 57, 43, 25, 9
endconst

+.macro clip10 in1, in2, c1, c2
+        vmax.s16        \in1, \in1, \c1
+        vmax.s16        \in2, \in2, \c1
+        vmin.s16        \in1, \in1, \c2
+        vmin.s16        \in2, \in2, \c2
+.endm
+
function ff_hevc_add_residual_4x4_8_neon, export=1
        vld1.16         {q0-q1}, [r1, :128]
        vld1.32         d4[0], [r0, :32], r2
@@ -50,6 +57,25 @@ function ff_hevc_add_residual_4x4_8_neon, export=1
        bx              lr
endfunc

+function ff_hevc_add_residual_4x4_10_neon, export=1
+        mov             r12, r0
+        vld1.16         {q0-q1}, [r1, :128]
+        vld1.16         d4, [r12, :64], r2
+        vld1.16         d5, [r12, :64], r2
+        vld1.16         d6, [r12, :64], r2
+        vqadd.s16       q0, q2
+        vld1.16         d7, [r12, :64], r2
+        vmov.s16        q12, #0
+        vqadd.s16       q1, q3
+        vmov.s16        q13, #0x3FF

clang doesn't support this. When assembling this with gas, it actually produces "vmvn #0xFC00" instead. Clang doesn't do that automatically, so you need to manually write the vmvn instruction instead.

+        clip10          q0, q1, q12, q13
+        vst1.16         d0, [r0, :64], r2
+        vst1.16         d1, [r0, :64], r2
+        vst1.16         d2, [r0, :64], r2
+        vst1.16         d3, [r0, :64], r2
+        bx              lr
+endfunc
+
function ff_hevc_add_residual_8x8_8_neon, export=1
        add             r12, r0, r2
        add             r2,  r2, r2
@@ -70,6 +96,25 @@ function ff_hevc_add_residual_8x8_8_neon, export=1
        bx              lr
endfunc

+function ff_hevc_add_residual_8x8_10_neon, export=1
+        add             r12, r0, r2
+        add             r2,  r2, r2
+        mov             r3,  #8
+        vmov.s16        q12, #0
+        vmov.s16        q13, #0x3FF
+1:      subs            r3,  #2
+        vld1.16         {q0-q1}, [r1, :128]!
+        vld1.16         {q8},    [r0, :128]
+        vqadd.s16       q0, q8
+        vld1.16         {q9},    [r12, :128]
+        vqadd.s16       q1, q9
+        clip10          q0, q1, q12, q13
+        vst1.16         {q0}, [r0, :128], r2
+        vst1.16         {q1}, [r12, :128], r2
+        bne             1b
+        bx              lr
+endfunc
+
function ff_hevc_add_residual_16x16_8_neon, export=1
        mov             r3,  #16
        add             r12, r0, r2
@@ -97,6 +142,29 @@ function ff_hevc_add_residual_16x16_8_neon, export=1
        bx              lr
endfunc

+function ff_hevc_add_residual_16x16_10_neon, export=1
+        mov             r3,  #16
+        vmov.s16        q12, #0
+        vmov.s16        q13, #0x3FF
+        add             r12, r0, r2
+        add             r2,  r2, r2
+1:      subs            r3,  #2
+        vld1.16         {q8-q9},   [r0, :128]
+        vld1.16         {q0, q1},  [r1, :128]!
+        vqadd.s16       q0, q8
+        vld1.16         {q10-q11}, [r12, :128]
+        vqadd.s16       q1, q9
+        vld1.16         {q2, q3},  [r1, :128]!
+        vqadd.s16       q2, q10
+        vqadd.s16       q3, q11
+        clip10          q0, q1, q12, q13
+        clip10          q2, q3, q12, q13
+        vst1.16         {q0-q1},   [r0, :128], r2
+        vst1.16         {q2-q3},   [r12, :128], r2
+        bne             1b
+        bx              lr
+endfunc
+
function ff_hevc_add_residual_32x32_8_neon, export=1
        vpush           {q4-q7}
        add             r12, r0, r2
@@ -137,6 +205,28 @@ function ff_hevc_add_residual_32x32_8_neon, export=1
        bx              lr
endfunc

+function ff_hevc_add_residual_32x32_10_neon, export=1
+        mov             r3,  #32
+        vmov.s16        q12, #0
+        vmov.s16        q13, #0x3FF
+1:      subs            r3,  #1
+        vldm            r1!, {q0-q3}
+        vld1.16         {q8, q9},   [r0, :128]
+        add             r12, r0, #32
+        vld1.16         {q10, q11}, [r12, :128]

This would be more straightforward if you'd do the "add r12, r0, #32" before the loop (before the 1:).

+        vqadd.s16       q0, q8
+        vqadd.s16       q1, q9
+        vqadd.s16       q2, q10
+        vqadd.s16       q3, q11
+        clip10          q0, q1, q12, q13
+        clip10          q2, q3, q12, q13
+        vst1.16         {q0-q1},   [r0, :128]
+        vst1.16         {q2-q3},   [r12, :128]
+        add             r0, r2

Instead of the explicit add here, add r2 as post-increment to both vst1 instructions.

The 4x4, 8x8 and 16x16 seem good enough on a quick read-through.

Since there wasn't any bigger rework needed, I did the necessary fixups and pushed.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to