1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

lavc/aarch64: new optimization for 8-bit hevc_epel_uni_hv

checkasm bench:
put_hevc_epel_uni_hv4_8_c: 204.7
put_hevc_epel_uni_hv4_8_i8mm: 70.2
put_hevc_epel_uni_hv6_8_c: 378.2
put_hevc_epel_uni_hv6_8_i8mm: 131.9
put_hevc_epel_uni_hv8_8_c: 637.7
put_hevc_epel_uni_hv8_8_i8mm: 137.9
put_hevc_epel_uni_hv12_8_c: 1301.9
put_hevc_epel_uni_hv12_8_i8mm: 314.2
put_hevc_epel_uni_hv16_8_c: 2203.4
put_hevc_epel_uni_hv16_8_i8mm: 454.7
put_hevc_epel_uni_hv24_8_c: 4848.2
put_hevc_epel_uni_hv24_8_i8mm: 1065.2
put_hevc_epel_uni_hv32_8_c: 8517.4
put_hevc_epel_uni_hv32_8_i8mm: 1898.4
put_hevc_epel_uni_hv48_8_c: 19591.7
put_hevc_epel_uni_hv48_8_i8mm: 4107.2
put_hevc_epel_uni_hv64_8_c: 33880.2
put_hevc_epel_uni_hv64_8_i8mm: 6568.7

Co-Authored-By: J. Dekker <jdek@itanimul.li>
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Logan Lyu 2023-09-23 10:38:36 +08:00 committed by Martin Storsjö
parent c0374f77f4
commit b7a3150bc5
2 changed files with 299 additions and 0 deletions

View File

@ -682,6 +682,300 @@ function ff_hevc_put_hevc_epel_h64_8_neon_i8mm, export=1
ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv4_8_neon_i8mm, export=1
add w10, w4, #3
lsl x10, x10, #7
sub sp, sp, x10 // tmp_array
str x30, [sp, #-48]!
stp x4, x6, [sp, #16]
stp x0, x1, [sp, #32]
add x0, sp, #48
sub x1, x2, x3
mov x2, x3
add w3, w4, #3
mov x4, x5
bl X(ff_hevc_put_hevc_epel_h4_8_neon_i8mm)
ldp x4, x6, [sp, #16]
ldp x0, x1, [sp, #32]
ldr x30, [sp], #48
load_epel_filterh x6, x5
mov x10, #(MAX_PB_SIZE * 2)
ld1 {v16.4h}, [sp], x10
ld1 {v17.4h}, [sp], x10
ld1 {v18.4h}, [sp], x10
.macro calc src0, src1, src2, src3
ld1 {\src3\().4h}, [sp], x10
calc_epelh v4, \src0, \src1, \src2, \src3
sqrshrun v4.8b, v4.8h, #6
subs w4, w4, #1
st1 {v4.s}[0], [x0], x1
.endm
1: calc_all4
.purgem calc
2: ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv6_8_neon_i8mm, export=1
add w10, w4, #3
lsl x10, x10, #7
sub sp, sp, x10 // tmp_array
str x30, [sp, #-48]!
stp x4, x6, [sp, #16]
stp x0, x1, [sp, #32]
add x0, sp, #48
sub x1, x2, x3
mov x2, x3
add w3, w4, #3
mov x4, x5
bl X(ff_hevc_put_hevc_epel_h6_8_neon_i8mm)
ldp x4, x6, [sp, #16]
ldp x0, x1, [sp, #32]
ldr x30, [sp], #48
load_epel_filterh x6, x5
sub x1, x1, #4
mov x10, #(MAX_PB_SIZE * 2)
ld1 {v16.8h}, [sp], x10
ld1 {v17.8h}, [sp], x10
ld1 {v18.8h}, [sp], x10
.macro calc src0, src1, src2, src3
ld1 {\src3\().8h}, [sp], x10
calc_epelh v4, \src0, \src1, \src2, \src3
calc_epelh2 v4, v5, \src0, \src1, \src2, \src3
sqrshrun v4.8b, v4.8h, #6
st1 {v4.s}[0], [x0], #4
subs w4, w4, #1
st1 {v4.h}[2], [x0], x1
.endm
1: calc_all4
.purgem calc
2: ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv8_8_neon_i8mm, export=1
add w10, w4, #3
lsl x10, x10, #7
sub sp, sp, x10 // tmp_array
str x30, [sp, #-48]!
stp x4, x6, [sp, #16]
stp x0, x1, [sp, #32]
add x0, sp, #48
sub x1, x2, x3
mov x2, x3
add w3, w4, #3
mov x4, x5
bl X(ff_hevc_put_hevc_epel_h8_8_neon_i8mm)
ldp x4, x6, [sp, #16]
ldp x0, x1, [sp, #32]
ldr x30, [sp], #48
load_epel_filterh x6, x5
mov x10, #(MAX_PB_SIZE * 2)
ld1 {v16.8h}, [sp], x10
ld1 {v17.8h}, [sp], x10
ld1 {v18.8h}, [sp], x10
.macro calc src0, src1, src2, src3
ld1 {\src3\().8h}, [sp], x10
calc_epelh v4, \src0, \src1, \src2, \src3
calc_epelh2 v4, v5, \src0, \src1, \src2, \src3
sqrshrun v4.8b, v4.8h, #6
subs w4, w4, #1
st1 {v4.8b}, [x0], x1
.endm
1: calc_all4
.purgem calc
2: ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv12_8_neon_i8mm, export=1
add w10, w4, #3
lsl x10, x10, #7
sub sp, sp, x10 // tmp_array
str x30, [sp, #-48]!
stp x4, x6, [sp, #16]
stp x0, x1, [sp, #32]
add x0, sp, #48
sub x1, x2, x3
mov x2, x3
add w3, w4, #3
mov x4, x5
bl X(ff_hevc_put_hevc_epel_h12_8_neon_i8mm)
ldp x4, x6, [sp, #16]
ldp x0, x1, [sp, #32]
ldr x30, [sp], #48
load_epel_filterh x6, x5
sub x1, x1, #8
mov x10, #(MAX_PB_SIZE * 2)
ld1 {v16.8h, v17.8h}, [sp], x10
ld1 {v18.8h, v19.8h}, [sp], x10
ld1 {v20.8h, v21.8h}, [sp], x10
.macro calc src0, src1, src2, src3, src4, src5, src6, src7
ld1 {\src6\().8h, \src7\().8h}, [sp], x10
calc_epelh v4, \src0, \src2, \src4, \src6
calc_epelh2 v4, v5, \src0, \src2, \src4, \src6
calc_epelh v5, \src1, \src3, \src5, \src7
sqrshrun v4.8b, v4.8h, #6
sqrshrun2 v4.16b, v5.8h, #6
st1 {v4.8b}, [x0], #8
st1 {v4.s}[2], [x0], x1
subs w4, w4, #1
.endm
1: calc_all8
.purgem calc
2: ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm, export=1
add w10, w4, #3
lsl x10, x10, #7
sub sp, sp, x10 // tmp_array
str x30, [sp, #-48]!
stp x4, x6, [sp, #16]
stp x0, x1, [sp, #32]
add x0, sp, #48
sub x1, x2, x3
mov x2, x3
add w3, w4, #3
mov x4, x5
bl X(ff_hevc_put_hevc_epel_h16_8_neon_i8mm)
ldp x4, x6, [sp, #16]
ldp x0, x1, [sp, #32]
ldr x30, [sp], #48
load_epel_filterh x6, x5
mov x10, #(MAX_PB_SIZE * 2)
ld1 {v16.8h, v17.8h}, [sp], x10
ld1 {v18.8h, v19.8h}, [sp], x10
ld1 {v20.8h, v21.8h}, [sp], x10
.macro calc src0, src1, src2, src3, src4, src5, src6, src7
ld1 {\src6\().8h, \src7\().8h}, [sp], x10
calc_epelh v4, \src0, \src2, \src4, \src6
calc_epelh2 v4, v5, \src0, \src2, \src4, \src6
calc_epelh v5, \src1, \src3, \src5, \src7
calc_epelh2 v5, v6, \src1, \src3, \src5, \src7
sqrshrun v4.8b, v4.8h, #6
sqrshrun2 v4.16b, v5.8h, #6
subs w4, w4, #1
st1 {v4.16b}, [x0], x1
.endm
1: calc_all8
.purgem calc
2: ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv24_8_neon_i8mm, export=1
add w10, w4, #3
lsl x10, x10, #7
sub sp, sp, x10 // tmp_array
str x30, [sp, #-48]!
stp x4, x6, [sp, #16]
stp x0, x1, [sp, #32]
add x0, sp, #48
sub x1, x2, x3
mov x2, x3
add w3, w4, #3
mov x4, x5
bl X(ff_hevc_put_hevc_epel_h24_8_neon_i8mm)
ldp x4, x6, [sp, #16]
ldp x0, x1, [sp, #32]
ldr x30, [sp], #48
load_epel_filterh x6, x5
mov x10, #(MAX_PB_SIZE * 2)
ld1 {v16.8h, v17.8h, v18.8h}, [sp], x10
ld1 {v19.8h, v20.8h, v21.8h}, [sp], x10
ld1 {v22.8h, v23.8h, v24.8h}, [sp], x10
.macro calc src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10, src11
ld1 {\src9\().8h, \src10\().8h, \src11\().8h}, [sp], x10
calc_epelh v4, \src0, \src3, \src6, \src9
calc_epelh2 v4, v5, \src0, \src3, \src6, \src9
calc_epelh v5, \src1, \src4, \src7, \src10
calc_epelh2 v5, v6, \src1, \src4, \src7, \src10
calc_epelh v6, \src2, \src5, \src8, \src11
calc_epelh2 v6, v7, \src2, \src5, \src8, \src11
sqrshrun v4.8b, v4.8h, #6
sqrshrun v5.8b, v5.8h, #6
sqrshrun v6.8b, v6.8h, #6
subs w4, w4, #1
st1 {v4.8b, v5.8b, v6.8b}, [x0], x1
.endm
1: calc_all12
.purgem calc
2: ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv32_8_neon_i8mm, export=1
stp x5, x6, [sp, #-64]!
stp x3, x4, [sp, #16]
stp x1, x2, [sp, #32]
stp x0, x30, [sp, #48]
mov x7, #16
bl X(ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm)
ldp x5, x6, [sp]
ldp x3, x4, [sp, #16]
ldp x1, x2, [sp, #32]
ldr x0, [sp, #48]
add x0, x0, #16
add x2, x2, #16
mov x7, #16
bl X(ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm)
ldr x30, [sp, #56]
add sp, sp, #64
ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv48_8_neon_i8mm, export=1
stp x5, x6, [sp, #-64]!
stp x3, x4, [sp, #16]
stp x1, x2, [sp, #32]
stp x0, x30, [sp, #48]
mov x7, #24
bl X(ff_hevc_put_hevc_epel_uni_hv24_8_neon_i8mm)
ldp x5, x6, [sp]
ldp x3, x4, [sp, #16]
ldp x1, x2, [sp, #32]
ldr x0, [sp, #48]
add x0, x0, #24
add x2, x2, #24
mov x7, #24
bl X(ff_hevc_put_hevc_epel_uni_hv24_8_neon_i8mm)
ldr x30, [sp, #56]
add sp, sp, #64
ret
endfunc
function ff_hevc_put_hevc_epel_uni_hv64_8_neon_i8mm, export=1
stp x5, x6, [sp, #-64]!
stp x3, x4, [sp, #16]
stp x1, x2, [sp, #32]
stp x0, x30, [sp, #48]
mov x7, #16
bl X(ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm)
ldp x5, x6, [sp]
ldp x3, x4, [sp, #16]
ldp x1, x2, [sp, #32]
ldr x0, [sp, #48]
add x0, x0, #16
add x2, x2, #16
mov x7, #16
bl X(ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm)
ldp x5, x6, [sp]
ldp x3, x4, [sp, #16]
ldp x1, x2, [sp, #32]
ldr x0, [sp, #48]
add x0, x0, #32
add x2, x2, #32
mov x7, #16
bl X(ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm)
ldp x5, x6, [sp]
ldp x3, x4, [sp, #16]
ldp x1, x2, [sp, #32]
ldr x0, [sp, #48]
add x0, x0, #48
add x2, x2, #48
mov x7, #16
bl X(ff_hevc_put_hevc_epel_uni_hv16_8_neon_i8mm)
ldr x30, [sp, #56]
add sp, sp, #64
ret
endfunc
.macro EPEL_UNI_W_H_HEADER
ldr x12, [sp]
sub x2, x2, #1

View File

@ -165,6 +165,10 @@ NEON8_FNPROTO(epel_uni_v, (uint8_t *dst, ptrdiff_t dststride,
const uint8_t *src, ptrdiff_t srcstride,
int height, intptr_t mx, intptr_t my, int width),);
NEON8_FNPROTO(epel_uni_hv, (uint8_t *dst, ptrdiff_t _dststride,
const uint8_t *src, ptrdiff_t srcstride,
int height, intptr_t mx, intptr_t my, int width), _i8mm);
NEON8_FNPROTO(epel_uni_w_v, (uint8_t *_dst, ptrdiff_t _dststride,
const uint8_t *_src, ptrdiff_t _srcstride,
int height, int denom, int wx, int ox,
@ -298,6 +302,7 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth)
if (have_i8mm(cpu_flags)) {
NEON8_FNASSIGN(c->put_hevc_epel, 0, 1, epel_h, _i8mm);
NEON8_FNASSIGN(c->put_hevc_epel_uni, 1, 1, epel_uni_hv, _i8mm);
NEON8_FNASSIGN(c->put_hevc_epel_uni_w, 0, 1, epel_uni_w_h ,_i8mm);
NEON8_FNASSIGN(c->put_hevc_qpel, 0, 1, qpel_h, _i8mm);
NEON8_FNASSIGN(c->put_hevc_qpel_uni_w, 0, 1, qpel_uni_w_h, _i8mm);