diff mbox series

[FFmpeg-devel,2/4] libswscale/x86/rgb2rgb: add shuffle_bytes avx512

Message ID 20210928053404.30714-2-jianhua.wu@intel.com
State New
Headers show
Series [FFmpeg-devel,1/4] libswscale/x86/rgb2rgb: add shuffle_bytes avx2
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Wu Jianhua Sept. 28, 2021, 5:34 a.m. UTC
Performance data(Less is better):
    shuffle_bytes_avx2      0.94288
    shuffle_bytes_avx512    0.60049

Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
---
 libswscale/x86/rgb2rgb.c     | 13 +++++++++++++
 libswscale/x86/rgb_2_rgb.asm |  8 ++++++++
 2 files changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/libswscale/x86/rgb2rgb.c b/libswscale/x86/rgb2rgb.c
index 0ab139aca4..c9ff33ab77 100644
--- a/libswscale/x86/rgb2rgb.c
+++ b/libswscale/x86/rgb2rgb.c
@@ -152,6 +152,12 @@  void ff_shuffle_bytes_1230_avx2(const uint8_t *src, uint8_t *dst, int src_size);
 void ff_shuffle_bytes_3012_avx2(const uint8_t *src, uint8_t *dst, int src_size);
 void ff_shuffle_bytes_3210_avx2(const uint8_t *src, uint8_t *dst, int src_size);
 
+void ff_shuffle_bytes_2103_avx512(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_0321_avx512(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_1230_avx512(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_3012_avx512(const uint8_t *src, uint8_t *dst, int src_size);
+void ff_shuffle_bytes_3210_avx512(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);
@@ -200,6 +206,13 @@  av_cold void rgb2rgb_init_x86(void)
         shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx2;
         shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx2;
     }
+    if (EXTERNAL_AVX512(cpu_flags)) {
+        shuffle_bytes_0321 = ff_shuffle_bytes_0321_avx512;
+        shuffle_bytes_2103 = ff_shuffle_bytes_2103_avx512;
+        shuffle_bytes_1230 = ff_shuffle_bytes_1230_avx512;
+        shuffle_bytes_3012 = ff_shuffle_bytes_3012_avx512;
+        shuffle_bytes_3210 = ff_shuffle_bytes_3210_avx512;
+    }
     if (EXTERNAL_AVX(cpu_flags)) {
         uyvytoyuv422 = ff_uyvytoyuv422_avx;
     }
diff --git a/libswscale/x86/rgb_2_rgb.asm b/libswscale/x86/rgb_2_rgb.asm
index c695c61d5c..3380a1272c 100644
--- a/libswscale/x86/rgb_2_rgb.asm
+++ b/libswscale/x86/rgb_2_rgb.asm
@@ -168,6 +168,14 @@  SHUFFLE_BYTES 1, 2, 3, 0
 SHUFFLE_BYTES 3, 0, 1, 2
 SHUFFLE_BYTES 3, 2, 1, 0
 %endif
+%if HAVE_AVX512_EXTERNAL
+INIT_ZMM avx512
+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
+%endif
 %endif
 
 ;-----------------------------------------------------------------------------------------------