From: Zhao Zhili <quinkblack-at-foxmail.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 1/2] aarch64/hevcdsp_idct_neon: Optimize idct dc Date: Tue, 4 Mar 2025 17:05:29 +0800 Message-ID: <tencent_F54D270CB89A1651CD4FA039CDE7CFE05507@qq.com> (raw) In-Reply-To: <40368528-9f44-ce93-4b4b-fefebe984bae@martin.st> > On Mar 2, 2025, at 05:39, Martin Storsjö <martin@martin.st> wrote: > > On Thu, 20 Feb 2025, Zhao Zhili wrote: > >> From: Zhao Zhili <zhilizhao@tencent.com> >> >> clang does better than the assembly code before the patch, especially >> for small size: >> >> hevc_idct_4x4_dc_8_c: 11.2 ( 1.00x) >> hevc_idct_4x4_dc_8_neon: 15.5 ( 0.73x) >> hevc_idct_4x4_dc_10_c: 12.0 ( 1.00x) >> hevc_idct_4x4_dc_10_neon: 15.2 ( 0.79x) >> hevc_idct_8x8_dc_8_c: 13.2 ( 1.00x) >> hevc_idct_8x8_dc_8_neon: 18.2 ( 0.73x) >> hevc_idct_8x8_dc_10_c: 13.5 ( 1.00x) >> hevc_idct_8x8_dc_10_neon: 17.2 ( 0.78x) >> hevc_idct_16x16_dc_8_c: 41.8 ( 1.00x) >> hevc_idct_16x16_dc_8_neon: 37.8 ( 1.11x) >> hevc_idct_16x16_dc_10_c: 41.8 ( 1.00x) >> hevc_idct_16x16_dc_10_neon: 37.8 ( 1.11x) >> hevc_idct_32x32_dc_8_c: 130.2 ( 1.00x) >> hevc_idct_32x32_dc_8_neon: 132.2 ( 0.98x) >> hevc_idct_32x32_dc_10_c: 130.2 ( 1.00x) >> hevc_idct_32x32_dc_10_neon: 132.2 ( 0.98x) >> >> This patch basically clone what the compiler does, so the performance >> is the same. >> --- >> libavcodec/aarch64/hevcdsp_idct_neon.S | 59 ++++++++++++++------------ >> 1 file changed, 33 insertions(+), 26 deletions(-) >> >> diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S >> index 3cac6e6db9..4543ab6b07 100644 >> --- a/libavcodec/aarch64/hevcdsp_idct_neon.S >> +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S >> @@ -888,38 +888,45 @@ function ff_hevc_transform_luma_4x4_neon_8, export=1 >> ret >> endfunc >> >> +.macro idct_8x8_dc_store offset >> +.irp i, 0x0, 0x20, 0x40, 0x60 >> + stp q0, q0, [x0, #(\offset + \i)] >> +.endr >> +.endm >> + >> +.macro idct_16x16_dc_store >> +.irp index, 0x0, 0x80, 0x100, 0x180 >> + idct_8x8_dc_store offset=\index >> +.endr >> +.endm >> + >> // void ff_hevc_idct_NxN_dc_DEPTH_neon(int16_t *coeffs) >> .macro idct_dc size, bitdepth >> function ff_hevc_idct_\size\()x\size\()_dc_\bitdepth\()_neon, export=1 >> - ld1r {v4.8h}, [x0] >> - srshr v4.8h, v4.8h, #1 >> - srshr v0.8h, v4.8h, #(14 - \bitdepth) >> - srshr v1.8h, v4.8h, #(14 - \bitdepth) >> -.if \size > 4 >> - srshr v2.8h, v4.8h, #(14 - \bitdepth) >> - srshr v3.8h, v4.8h, #(14 - \bitdepth) >> -.if \size > 16 /* dc 32x32 */ >> - mov x2, #4 >> + ldrsh w1, [x0] >> + add w1, w1, #1 >> + asr w1, w1, #1 >> + add w1, w1, #(1 << (13 - \bitdepth)) >> + asr w1, w1, #(14 - \bitdepth) >> + dup v0.8h, w1 >> + >> +.if \size < 8 >> + stp q0, q0, [x0] >> +.else >> +.if \size < 16 > > You can use .elseif instead of .else and a nested .if. Modified locally and pushed, thanks for the review. > > Other than that, this patch looks good to me, thanks! > > // Martin > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2025-03-04 9:05 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-02-19 16:50 Zhao Zhili 2025-03-01 21:39 ` Martin Storsjö 2025-03-04 9:05 ` Zhao Zhili [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=tencent_F54D270CB89A1651CD4FA039CDE7CFE05507@qq.com \ --to=quinkblack-at-foxmail.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git