[FFmpeg-cvslog] avfilter/x86/vf_threshold : add avx2 version for threshold 8

Martin Vignali git at videolan.org
Sun Dec 3 20:19:22 EET 2017


ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Sun Dec  3 17:02:44 2017 +0100| [9719d57b34f2156dc26d7a46ba809b1f9427011c] | committer: Martin Vignali

avfilter/x86/vf_threshold : add avx2 version for threshold 8

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9719d57b34f2156dc26d7a46ba809b1f9427011c
---

 libavfilter/x86/vf_threshold.asm    |  7 ++++++-
 libavfilter/x86/vf_threshold_init.c | 18 ++++++++++++++++--
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/libavfilter/x86/vf_threshold.asm b/libavfilter/x86/vf_threshold.asm
index 38499dcd04..117cc98fe2 100644
--- a/libavfilter/x86/vf_threshold.asm
+++ b/libavfilter/x86/vf_threshold.asm
@@ -34,7 +34,7 @@ SECTION .text
 cglobal threshold8, 10, 13, 5, in, threshold, min, max, out, ilinesize, tlinesize, flinesize, slinesize, olinesize, w, h, x
     mov         wd, dword wm
     mov         hd, dword hm
-    mova        m4, [pb_128]
+    VBROADCASTI128  m4, [pb_128]
     add        inq, wq
     add thresholdq, wq
     add       minq, wq
@@ -70,4 +70,9 @@ RET
 INIT_XMM sse4
 THRESHOLD_8
 
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+THRESHOLD_8
+%endif
+
 %endif
diff --git a/libavfilter/x86/vf_threshold_init.c b/libavfilter/x86/vf_threshold_init.c
index e2bbae11d5..f448cb4b39 100644
--- a/libavfilter/x86/vf_threshold_init.c
+++ b/libavfilter/x86/vf_threshold_init.c
@@ -30,12 +30,26 @@ void ff_threshold8_sse4(const uint8_t *in, const uint8_t *threshold,
                         ptrdiff_t flinesize, ptrdiff_t slinesize,
                         ptrdiff_t olinesize,
                         int w, int h);
+void ff_threshold8_avx2(const uint8_t *in, const uint8_t *threshold,
+                        const uint8_t *min, const uint8_t *max,
+                        uint8_t *out,
+                        ptrdiff_t ilinesize, ptrdiff_t tlinesize,
+                        ptrdiff_t flinesize, ptrdiff_t slinesize,
+                        ptrdiff_t olinesize,
+                        int w, int h);
 
 av_cold void ff_threshold_init_x86(ThresholdContext *s)
 {
     int cpu_flags = av_get_cpu_flags();
 
-    if (ARCH_X86_64 && EXTERNAL_SSE4(cpu_flags) && s->depth == 8) {
-        s->threshold = ff_threshold8_sse4;
+    if (ARCH_X86_64) {
+        if (s->depth == 8) {
+            if (EXTERNAL_SSE4(cpu_flags)) {
+                s->threshold = ff_threshold8_sse4;
+            }
+            if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+                s->threshold = ff_threshold8_avx2;
+            }
+        }
     }
 }



More information about the ffmpeg-cvslog mailing list