[FFmpeg-devel,11/11] avcodec/lossless_videodsp: add AVX-512 version of add_bytes

Submitted by James Darnley on Nov. 9, 2017, 11:58 a.m.

Details

Message ID 20171109115837.32618-12-jdarnley@obe.tv
State New
Headers show

Commit Message

James Darnley Nov. 9, 2017, 11:58 a.m.
---
 libavcodec/x86/lossless_videodsp.asm    | 5 +++++
 libavcodec/x86/lossless_videodsp_init.c | 5 +++++
 2 files changed, 10 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavcodec/x86/lossless_videodsp.asm b/libavcodec/x86/lossless_videodsp.asm
index ba4d4f0153..5649348f86 100644
--- a/libavcodec/x86/lossless_videodsp.asm
+++ b/libavcodec/x86/lossless_videodsp.asm
@@ -229,6 +229,11 @@  INIT_YMM avx2
 ADD_BYTES
 %endif
 
+%if HAVE_AVX512_EXTERNAL
+INIT_ZMM avx512
+ADD_BYTES
+%endif
+
 %macro ADD_HFYU_LEFT_LOOP_INT16 2 ; %1 = dst alignment (a/u), %2 = src alignment (a/u)
     add     wd, wd
     add     srcq, wq
diff --git a/libavcodec/x86/lossless_videodsp_init.c b/libavcodec/x86/lossless_videodsp_init.c
index 4f20c1ce92..80d6972f36 100644
--- a/libavcodec/x86/lossless_videodsp_init.c
+++ b/libavcodec/x86/lossless_videodsp_init.c
@@ -26,6 +26,7 @@ 
 void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, ptrdiff_t w);
 void ff_add_bytes_sse2(uint8_t *dst, uint8_t *src, ptrdiff_t w);
 void ff_add_bytes_avx2(uint8_t *dst, uint8_t *src, ptrdiff_t w);
+void ff_add_bytes_avx512(uint8_t *dst, uint8_t *src, ptrdiff_t w);
 
 void ff_add_median_pred_mmxext(uint8_t *dst, const uint8_t *top,
                                const uint8_t *diff, ptrdiff_t w,
@@ -119,4 +120,8 @@  void ff_llviddsp_init_x86(LLVidDSPContext *c)
     if (EXTERNAL_AVX2_FAST(cpu_flags)) {
         c->add_bytes       = ff_add_bytes_avx2;
     }
+
+    if (EXTERNAL_AVX512(cpu_flags)) {
+        c->add_bytes       = ff_add_bytes_avx512;
+    }
 }