[FFmpeg-devel] [PATCH 3/5] lavc/aarch64: new optimization for 8-bit hevc_epel_uni_w_v

Martin Storsjö martin at martin.st
Sun Jul 2 00:21:51 EEST 2023


On Sun, 18 Jun 2023, Logan.Lyu wrote:

> Hi, Martin,
>
> I modified it according to your comments. Please review again.

> From 45508b099dc99d30e711b9e1f253068f7804e3ed Mon Sep 17 00:00:00 2001
> From: Logan Lyu <Logan.Lyu at myais.com.cn>
> Date: Sat, 27 May 2023 09:42:07 +0800
> Subject: [PATCH 3/5] lavc/aarch64: new optimization for 8-bit
>  hevc_epel_uni_w_v
> 
> Signed-off-by: Logan Lyu <Logan.Lyu at myais.com.cn>
> ---
>  libavcodec/aarch64/hevcdsp_epel_neon.S    | 503 ++++++++++++++++++++++
>  libavcodec/aarch64/hevcdsp_init_aarch64.c |   6 +
>  2 files changed, 509 insertions(+)
> 
> diff --git a/libavcodec/aarch64/hevcdsp_epel_neon.S b/libavcodec/aarch64/hevcdsp_epel_neon.S
> index 0411de9864..ca37ce1786 100644
> --- a/libavcodec/aarch64/hevcdsp_epel_neon.S
> +++ b/libavcodec/aarch64/hevcdsp_epel_neon.S

> +function ff_hevc_put_hevc_epel_uni_w_v12_8_neon, export=1
> +        EPEL_UNI_W_V_HEADER
> +
> +        ldr             q4, [x2]
> +        ldr             q5, [x2, x3]
> +        add             x2, x2, x3, lsl #1
> +        ldr             q6, [x2]
> +        sub             x1, x1, #8
> +1:
> +        ldr             q7, [x2, x3]
> +        subs            w4, w4, #1
> +        add             x2, x2, x3, lsl #1
> +        EPEL_UNI_W_V12_CALC v16, v17 v4, v5, v6, v7, v24, v25, v26, v27

This is missing a comma between "v17" and "v4" (here and in one other 
place). This breaks compilation for macOS targets, where the assembler 
(for historical reasons) has a separate way of handling macro arguments.

The same also goes for "v20 v24" in two places.

> +function ff_hevc_put_hevc_epel_uni_w_v48_8_neon, export=1
> +        EPEL_UNI_W_V_HEADER
> +        stp             q8, q9, [sp, #-64]!
> +        stp             q10, q11, [sp, #32]

As mentioned in another follow-up reply, you don't need to back up and
restore all of q8-q15, only the lower half. This means that it's enough
to back up and restore d8-d15, which only takes half as much space.

I.e. here you'd have

+        stp             d8,  d9,  [sp, #-32]!
+        stp             d10, d11, [sp, #16]

instead, and for the full d8-d15 you'd have

+        stp             d8,  d9,  [sp, #-64]!
+        stp             d10, d11, [sp, #16]
+        stp             d12, d13, [sp, #32]
+        stp             d14, d15, [sp, #48]

The same goes for both of these places in this patch, and for a
number of places in patch 5/5.

// Martin



More information about the ffmpeg-devel mailing list