From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 4/5] x86/vvc_sad: reduce gpr usage in all loop functions Date: Thu, 23 May 2024 09:27:15 -0300 Message-ID: <20240523122716.2158-4-jamrial@gmail.com> (raw) In-Reply-To: <20240523122716.2158-1-jamrial@gmail.com> This way they can be assembled on x86_32 targets. Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/x86/vvc/vvc_sad.asm | 22 ++++++++++------------ libavcodec/x86/vvc/vvcdsp_init.c | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/libavcodec/x86/vvc/vvc_sad.asm b/libavcodec/x86/vvc/vvc_sad.asm index 26df25ec66..9881b1180d 100644 --- a/libavcodec/x86/vvc/vvc_sad.asm +++ b/libavcodec/x86/vvc/vvc_sad.asm @@ -49,7 +49,7 @@ SECTION .text %endmacro %macro VVC_SAD 1 -cglobal vvc_sad_%1, 4, 7, 5, src1, src2, dx, dy, off1, block_h, off2 +cglobal vvc_sad_%1, 4, 6, 5, src1, src2, dx, dy, off, block_h %if UNIX64 == 0 mov block_hd, dword r5m %endif @@ -59,12 +59,12 @@ cglobal vvc_sad_%1, 4, 7, 5, src1, src2, dx, dy, off1, block_h, off2 sub dxq, 2 sub dyq, 2 - mov off1q, 2 - mov off2q, 2 + mov offq, 2 - add off1q, dyq - sub off2q, dyq + sub offq, dyq + add dyq, 2 +DEFINE_ARGS src1, src2, dx, off1, off2, block_h shl off1q, 7 shl off2q, 7 @@ -100,19 +100,19 @@ cglobal vvc_sad_%1, 4, 7, 5, src1, src2, dx, dy, off1, block_h, off2 %endmacro %macro VVC_SAD_LOOP 1 -cglobal vvc_sad_%1, 6, 8, 5, src1, src2, dx, dy, block_w, block_h, off1, off2 +cglobal vvc_sad_%1, 6, 7, 5, src1, src2, dx, dy, block_w, block_h, off movsxdifnidn dxq, dxd movsxdifnidn dyq, dyd sub dxq, 2 sub dyq, 2 - mov off1q, 2 - mov off2q, 2 + mov offq, 2 - add off1q, dyq - sub off2q, dyq + sub offq, dyq + add dyq, 2 +DEFINE_ARGS src1, src2, dx, off1, block_w, block_h, off2 shl off1q, 7 shl off2q, 7 @@ -159,7 +159,6 @@ DEFINE_ARGS src1, src2, dx, dy, block_w, block_h, row_idx RET %endmacro -%if ARCH_X86_64 INIT_XMM sse4 VVC_SAD 8 VVC_SAD_LOOP 16 @@ -168,4 +167,3 @@ INIT_YMM avx2 VVC_SAD 16 VVC_SAD_LOOP 32 %endif -%endif diff --git a/libavcodec/x86/vvc/vvcdsp_init.c b/libavcodec/x86/vvc/vvcdsp_init.c index cdf0e36b62..c0bd145191 100644 --- a/libavcodec/x86/vvc/vvcdsp_init.c +++ b/libavcodec/x86/vvc/vvcdsp_init.c @@ -311,6 +311,7 @@ ALF_FUNCS(16, 12, avx2) c->alf.filter[CHROMA] = ff_vvc_alf_filter_chroma_##bd##_avx2; \ c->alf.classify = ff_vvc_alf_classify_##bd##_avx2; \ } while (0) +#endif #define SAD_PROTOTYPE(w, opt) \ int bf(ff_vvc_sad, w, opt)(const int16_t *src0, const int16_t *src1, \ @@ -320,17 +321,17 @@ SAD_PROTOTYPE(8, sse4); SAD_PROTOTYPE(16, sse4); SAD_PROTOTYPE(16, avx2); SAD_PROTOTYPE(32, avx2); -#endif void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) { -#if ARCH_X86_64 const int cpu_flags = av_get_cpu_flags(); switch (bd) { case 8: if (EXTERNAL_SSE4(cpu_flags)) { +#if ARCH_X86_64 MC_LINK_SSE4(8); +#endif c->inter.sad[0] = ff_vvc_sad_8_sse4; c->inter.sad[1] = c->inter.sad[2] = @@ -338,9 +339,11 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) c->inter.sad[4] = ff_vvc_sad_16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { +#if ARCH_X86_64 ALF_INIT(8); AVG_INIT(8, avx2); MC_LINKS_AVX2(8); +#endif c->inter.sad[1] = ff_vvc_sad_16_avx2; c->inter.sad[2] = c->inter.sad[3] = @@ -349,7 +352,9 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) break; case 10: if (EXTERNAL_SSE4(cpu_flags)) { +#if ARCH_X86_64 MC_LINK_SSE4(10); +#endif c->inter.sad[0] = ff_vvc_sad_8_sse4; c->inter.sad[1] = c->inter.sad[2] = @@ -357,10 +362,12 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) c->inter.sad[4] = ff_vvc_sad_16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { +#if ARCH_X86_64 ALF_INIT(10); AVG_INIT(10, avx2); MC_LINKS_AVX2(10); MC_LINKS_16BPC_AVX2(10); +#endif c->inter.sad[1] = ff_vvc_sad_16_avx2; c->inter.sad[2] = c->inter.sad[3] = @@ -369,7 +376,9 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) break; case 12: if (EXTERNAL_SSE4(cpu_flags)) { +#if ARCH_X86_64 MC_LINK_SSE4(12); +#endif c->inter.sad[0] = ff_vvc_sad_8_sse4; c->inter.sad[1] = c->inter.sad[2] = @@ -377,10 +386,12 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) c->inter.sad[4] = ff_vvc_sad_16_sse4; } if (EXTERNAL_AVX2_FAST(cpu_flags)) { +#if ARCH_X86_64 ALF_INIT(12); AVG_INIT(12, avx2); MC_LINKS_AVX2(12); MC_LINKS_16BPC_AVX2(12); +#endif c->inter.sad[1] = ff_vvc_sad_16_avx2; c->inter.sad[2] = c->inter.sad[3] = @@ -390,5 +401,4 @@ void ff_vvc_dsp_init_x86(VVCDSPContext *const c, const int bd) default: break; } -#endif } -- 2.45.1 _______________________________________________ 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".
next prev parent reply other threads:[~2024-05-23 12:28 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-23 12:27 [FFmpeg-devel] [PATCH 1/5] avcodec/vvc_mc: split the SAD dsp prototype into one function per blocksize width James Almer 2024-05-23 12:27 ` [FFmpeg-devel] [PATCH 2/5] x86/vvc_sad: optimize vvc_sad_16 James Almer 2024-05-23 12:27 ` [FFmpeg-devel] [PATCH 3/5] x86/vvc_sad: add sse4 versions of all functions James Almer 2024-05-23 12:27 ` James Almer [this message] 2024-05-23 12:27 ` [FFmpeg-devel] [PATCH 5/5] x86/vvc_sad: reindent after the previous changes James Almer 2024-05-23 12:35 ` [FFmpeg-devel] [PATCH 1/5] avcodec/vvc_mc: split the SAD dsp prototype into one function per blocksize width Andreas Rheinhardt
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=20240523122716.2158-4-jamrial@gmail.com \ --to=jamrial@gmail.com \ --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