mirror of https://git.ffmpeg.org/ffmpeg.git
avutil/cpu_internal: Fix check for SSE2SLOW
For SSE2 and SSE3, there are four states that the two flags involved (AV_CPU_FLAG_SSE[23] and AV_CPU_FLAG_SSE[23]SLOW) can convey. When ordered from worst to best they are: 1. both flags unset (SSE[23] unavailable) 2. the slow flag set, the ordinary flag unset (this is designed for cases where SSE2 is available, but so slow that MMX(EXT)/SSE code is usually faster) 3. both flags set (SSE2 is available, but there might be scenarios where MMX(EXT)/SSE code is faster) 4. the ordinary flag set, the slow flag unset (this is the normal case) The ordinary macros for checking cpuflags return true in the latter two cases; the fast macros only return true for the latter case. Yet the macros to check for slow currently only return true in case three. This seems unintended. In fact, the only uses of the slow macros are all of the form if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags)) where the check for EXTERNAL_SSE2_SLOW is completely redundant. Even more importantly, it is not what was intended. Before6369ba3c9c
, the checks passed in cases 2 to 4. Said commit changed this to something that only passes for the third case. Commits7fb758cd8e
andc1913064e3
restored the old behaviour, yet merging4efab89332
(in commitac774cfa57
) broke this again by changing it to what it is now.* This commit changes the macros to make the slow macros check whether a specific instruction is supported, even if slow. This restores the intended meaning to all uses of the SLOW macros and is generally more natural. *: Libav only checks for EXTERNAL_SSE2_SLOW, i.e. for the third case only. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
b3cca50638
commit
ac322ec214
|
@ -30,12 +30,15 @@
|
|||
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext) && \
|
||||
!((flags) & AV_CPU_FLAG_ ## slow_cpuext ## SLOW))
|
||||
|
||||
#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext) \
|
||||
(HAVE_ ## cpuext ## suffix && \
|
||||
((flags) & (AV_CPU_FLAG_ ## cpuext | AV_CPU_FLAG_ ## cpuext ## SLOW)))
|
||||
|
||||
#define CPUEXT_SUFFIX_SLOW2(flags, suffix, cpuext, slow_cpuext) \
|
||||
(HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext) && \
|
||||
((flags) & AV_CPU_FLAG_ ## slow_cpuext ## SLOW))
|
||||
((flags) & (AV_CPU_FLAG_ ## slow_cpuext | AV_CPU_FLAG_ ## slow_cpuext ## SLOW)))
|
||||
|
||||
#define CPUEXT_SUFFIX_FAST(flags, suffix, cpuext) CPUEXT_SUFFIX_FAST2(flags, suffix, cpuext, cpuext)
|
||||
#define CPUEXT_SUFFIX_SLOW(flags, suffix, cpuext) CPUEXT_SUFFIX_SLOW2(flags, suffix, cpuext, cpuext)
|
||||
|
||||
#define CPUEXT(flags, cpuext) CPUEXT_SUFFIX(flags, , cpuext)
|
||||
#define CPUEXT_FAST(flags, cpuext) CPUEXT_SUFFIX_FAST(flags, , cpuext)
|
||||
|
|
Loading…
Reference in New Issue