[vlc-commits] [Git][videolan/vlc][master] postproc: update SIMD variant selection

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Sun Aug 8 17:52:31 UTC 2021



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
a58030bc by Lyndon Brown at 2021-08-08T17:31:39+00:00
postproc: update SIMD variant selection

the cpu SIMD selection code removed here dates from a time when vlc had
options for disabling use of select SIMD variants, from before postproc
added cpu auto-detection ([1]), and from before postproc seems to have
added SSE2 ([2] and [3]).

we are purging MMX/MMXEXT from vlc v4.0-dev, and thus have an interest in
removing the corresponding MMX/MMXEXT bits here. rather than just removing
those lines, alongside adding an entry for SSE2 though, i have instead
chosen to convert the code to use auto-detection, which avoids having to
keep the block of code explicitly enabling implementations in sync with the
set of implementations available.

note, the version of postproc in contribs is very old, pre-dating the
SSE2 and CPU feature auto-detection enhancements. accordingly i have had to
ensure that we define `PP_CPU_CAPS_AUTO` ourselves when not found, as had
been done for `PP_CPU_CAPS_ALTIVEC`. effectively, for users like myself on
linux with a new enough version, the auto-detection will work correctly and
now make use of SSE2, which we were ignoring before; while where the
contrib package is used, its use will fall back to the C implementation
until such time that the contrib gets updated.

[1]: https://github.com/FFmpeg/FFmpeg/commit/59d686f100863d00b8f171dd891e893c2bfd951e
[2]: https://github.com/FFmpeg/FFmpeg/commit/4e264d1c79cfae8c3e05aacf77e350ed1b6d7e4b
[3]: https://github.com/FFmpeg/FFmpeg/commit/f48cddfe4cf04e2d6e802d12e973301ff5a1a9a8

- - - - -


1 changed file:

- modules/video_filter/postproc.c


Changes:

=====================================
modules/video_filter/postproc.c
=====================================
@@ -46,8 +46,8 @@
 #   include <libpostproc/postprocess.h>
 #endif
 
-#ifndef PP_CPU_CAPS_ALTIVEC
-#   define PP_CPU_CAPS_ALTIVEC 0
+#ifndef PP_CPU_CAPS_AUTO
+#   define PP_CPU_CAPS_AUTO 0
 #endif
 
 /*****************************************************************************
@@ -120,7 +120,7 @@ static int OpenPostproc( filter_t *p_filter )
     filter_sys_t *p_sys;
     vlc_value_t val, val_orig;
     const char *desc;
-    int i_flags = 0;
+    int i_flags = PP_CPU_CAPS_AUTO;
 
     if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma ||
         p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height ||
@@ -130,17 +130,6 @@ static int OpenPostproc( filter_t *p_filter )
         return VLC_EGENERIC;
     }
 
-    /* Set CPU capabilities */
-#if defined(__i386__) || defined(__x86_64__)
-    if( vlc_CPU_MMX() )
-        i_flags |= PP_CPU_CAPS_MMX;
-    if( vlc_CPU_MMXEXT() )
-        i_flags |= PP_CPU_CAPS_MMX2;
-#elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__)
-    if( vlc_CPU_ALTIVEC() )
-        i_flags |= PP_CPU_CAPS_ALTIVEC;
-#endif
-
     switch( p_filter->fmt_in.video.i_chroma )
     {
         case VLC_CODEC_I444:



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a58030bc4b94a40cb96bc269b69c7e028590db23

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/a58030bc4b94a40cb96bc269b69c7e028590db23
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list