From: Shreesh Adiga <16567adigashreesh@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH] swscale/x86/rgb2rgb: add AVX512ICL versions of shuffle_bytes
Date: Sat, 25 Jan 2025 19:55:46 +0530
Message-ID: <20250125142546.1244665-1-16567adigashreesh@gmail.com> (raw)
Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
---
libswscale/x86/rgb2rgb.c | 21 +++++++++++++++++++++
libswscale/x86/rgb_2_rgb.asm | 28 ++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 6790551a38..4cbed54b35 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -2364,6 +2364,16 @@ void ff_shuffle_bytes_2013_avx2(const uint8_t *src, uint8_t *dst, int src_size);
void ff_shuffle_bytes_2130_avx2(const uint8_t *src, uint8_t *dst, int src_size);
void ff_shuffle_bytes_1203_avx2(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_2103_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_0321_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_1230_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_3012_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_3210_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_3102_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_2013_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_2130_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_1203_avx512icl(const uint8_t *src, uint8_t *dst, int src_size);
+
void ff_uyvytoyuv422_sse2(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
const uint8_t *src, int width, int height,
int lumStride, int chromStride, int srcStride);
@@ -2454,6 +2464,17 @@ av_cold void rgb2rgb_init_x86(void)
shuffle_bytes_2130 = ff_shuffle_bytes_2130_avx2;
shuffle_bytes_1203 = ff_shuffle_bytes_1203_avx2;
}
+ if (EXTERNAL_AVX512ICL(cpu_flags)) {
+ shuffle_bytes_0321 = ff_shuffle_bytes_0321_avx512icl;
+ shuffle_bytes_2103 = ff_shuffle_bytes_2103_avx512icl;
+ shuffle_bytes_1230 = ff_shuffle_bytes_1230_avx512icl;
+ shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx512icl;
+ shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx512icl;
+ shuffle_bytes_3102 = ff_shuffle_bytes_3102_avx512icl;
+ shuffle_bytes_2013 = ff_shuffle_bytes_2013_avx512icl;
+ shuffle_bytes_2130 = ff_shuffle_bytes_2130_avx512icl;
+ shuffle_bytes_1203 = ff_shuffle_bytes_1203_avx512icl;
+ }
if (EXTERNAL_AVX2_FAST(cpu_flags)) {
uyvytoyuv422 = ff_uyvytoyuv422_avx2;
#endif
diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm
index b468beb12d..64b0988c4a 100644
--- a/libswscale/x86/rgb_2_rgb.asm
+++ b/libswscale/x86/rgb_2_rgb.asm
@@ -64,6 +64,18 @@ cglobal shuffle_bytes_%1%2%3%4, 3, 5, 2, src, dst, w, tmp, x
add dstq, wq
neg wq
+%if mmsize == 64
+ and xq, mmsize-4
+ shr xq, 2
+ mov tmpd, -1
+ shlx tmpd, tmpd, xd
+ not tmpd
+ kmovw k7, tmpw
+ vmovdqu32 m1{k7}{z}, [srcq + wq]
+ pshufb m1, m0
+ vmovdqu32 [dstq + wq]{k7}, m1
+ lea wq, [wq + 4 * xq]
+%else
;calc scalar loop
and xq, mmsize-4
je .loop_simd
@@ -80,6 +92,7 @@ cglobal shuffle_bytes_%1%2%3%4, 3, 5, 2, src, dst, w, tmp, x
add wq, 4
sub xq, 4
jg .loop_scalar
+%endif
;check if src_size < mmsize
cmp wq, 0
@@ -122,6 +135,21 @@ SHUFFLE_BYTES 1, 2, 0, 3
%endif
%endif
+%if ARCH_X86_64
+%if HAVE_AVX512ICL_EXTERNAL
+INIT_ZMM avx512icl
+SHUFFLE_BYTES 2, 1, 0, 3
+SHUFFLE_BYTES 0, 3, 2, 1
+SHUFFLE_BYTES 1, 2, 3, 0
+SHUFFLE_BYTES 3, 0, 1, 2
+SHUFFLE_BYTES 3, 2, 1, 0
+SHUFFLE_BYTES 3, 1, 0, 2
+SHUFFLE_BYTES 2, 0, 1, 3
+SHUFFLE_BYTES 2, 1, 3, 0
+SHUFFLE_BYTES 1, 2, 0, 3
+%endif
+%endif
+
;-----------------------------------------------------------------------------------------------
; uyvytoyuv422(uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
; const uint8_t *src, int width, int height,
--
2.45.3
_______________________________________________
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 reply other threads:[~2025-01-25 14:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-25 14:25 Shreesh Adiga [this message]
2025-01-25 14:33 ` James Almer
2025-01-25 15:11 ` Shreesh Adiga
2025-01-25 15:39 ` James Almer
2025-01-25 15:50 ` Shreesh Adiga
2025-01-25 16:17 ` James Almer
2025-01-25 22:27 ` Ronald S. Bultje
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=20250125142546.1244665-1-16567adigashreesh@gmail.com \
--to=16567adigashreesh@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