aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-10-30 18:06:34 -0300
committerJames Almer <jamrial@gmail.com>2017-10-30 18:07:31 -0300
commit31a4112936196c5668c84c24acadf710244e8e72 (patch)
tree31b0b58b1fdd7222f8e50ad10055b02d1f3785dc /libavcodec
parent550e5d6602538d272ca4a7e117c6bd29eccb910f (diff)
parentedbf0fffb15dde7a1de70b05855529d5fc769f14 (diff)
downloadffmpeg-31a4112936196c5668c84c24acadf710244e8e72.tar.gz
Merge commit 'edbf0fffb15dde7a1de70b05855529d5fc769f14'
* commit 'edbf0fffb15dde7a1de70b05855529d5fc769f14': hevc: Add NEON add_residual for bitdepth 10 Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/arm/hevcdsp_idct_neon.S89
-rw-r--r--libavcodec/arm/hevcdsp_init_neon.c13
2 files changed, 102 insertions, 0 deletions
diff --git a/libavcodec/arm/hevcdsp_idct_neon.S b/libavcodec/arm/hevcdsp_idct_neon.S
index 64e9cca605..0b286fadbb 100644
--- a/libavcodec/arm/hevcdsp_idct_neon.S
+++ b/libavcodec/arm/hevcdsp_idct_neon.S
@@ -29,6 +29,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
@@ -49,6 +56,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
+ vmvn.s16 q13, #0xFC00 @ vmov.s16 #0x3FF
+ 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
@@ -69,6 +95,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
+ vmvn.s16 q13, #0xFC00 @ vmov.s16 #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
@@ -96,6 +141,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
+ vmvn.s16 q13, #0xFC00 @ vmov.s16 #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
@@ -136,6 +204,27 @@ 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
+ add r12, r0, #32
+ vmov.s16 q12, #0
+ vmvn.s16 q13, #0xFC00 @ vmov.s16 #0x3FF
+1: subs r3, #1
+ vldm r1!, {q0-q3}
+ vld1.16 {q8, q9}, [r0, :128]
+ vld1.16 {q10, q11}, [r12, :128]
+ 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], r2
+ vst1.16 {q2-q3}, [r12, :128], r2
+ bne 1b
+ bx lr
+endfunc
+
/* uses registers q2 - q9 for temp values */
/* TODO: reorder */
.macro tr4_luma_shift r0, r1, r2, r3, shift
diff --git a/libavcodec/arm/hevcdsp_init_neon.c b/libavcodec/arm/hevcdsp_init_neon.c
index 841030e9bb..3320baf6f1 100644
--- a/libavcodec/arm/hevcdsp_init_neon.c
+++ b/libavcodec/arm/hevcdsp_init_neon.c
@@ -29,12 +29,20 @@ void ff_hevc_v_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_t
void ff_hevc_h_loop_filter_chroma_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, int16_t *coeffs,
ptrdiff_t stride);
+void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, int16_t *coeffs,
+ ptrdiff_t stride);
void ff_hevc_add_residual_8x8_8_neon(uint8_t *_dst, int16_t *coeffs,
ptrdiff_t stride);
+void ff_hevc_add_residual_8x8_10_neon(uint8_t *_dst, int16_t *coeffs,
+ ptrdiff_t stride);
void ff_hevc_add_residual_16x16_8_neon(uint8_t *_dst, int16_t *coeffs,
ptrdiff_t stride);
+void ff_hevc_add_residual_16x16_10_neon(uint8_t *_dst, int16_t *coeffs,
+ ptrdiff_t stride);
void ff_hevc_add_residual_32x32_8_neon(uint8_t *_dst, int16_t *coeffs,
ptrdiff_t stride);
+void ff_hevc_add_residual_32x32_10_neon(uint8_t *_dst, int16_t *coeffs,
+ ptrdiff_t stride);
void ff_hevc_idct_4x4_dc_8_neon(int16_t *coeffs);
void ff_hevc_idct_8x8_dc_8_neon(int16_t *coeffs);
void ff_hevc_idct_16x16_dc_8_neon(int16_t *coeffs);
@@ -232,6 +240,11 @@ av_cold void ff_hevc_dsp_init_neon(HEVCDSPContext *c, const int bit_depth)
}
if (bit_depth == 10) {
+ c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon;
+ c->add_residual[1] = ff_hevc_add_residual_8x8_10_neon;
+ c->add_residual[2] = ff_hevc_add_residual_16x16_10_neon;
+ c->add_residual[3] = ff_hevc_add_residual_32x32_10_neon;
+
c->idct_dc[0] = ff_hevc_idct_4x4_dc_10_neon;
c->idct_dc[1] = ff_hevc_idct_8x8_dc_10_neon;
c->idct_dc[2] = ff_hevc_idct_16x16_dc_10_neon;