x86: Replace checks for CPU extensions and flags by convenience macros
This separates code relying on inline from that relying on external assembly and fixes instances where the coalesced check was incorrect.
This commit is contained in:
parent
6a0200f24d
commit
e0c6cce447
21 changed files with 133 additions and 156 deletions
|
@ -17,29 +17,29 @@
|
|||
*/
|
||||
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/x86/cpu.h"
|
||||
#include "libavcodec/dsputil.h"
|
||||
#include "libavcodec/dct.h"
|
||||
#include "fft.h"
|
||||
|
||||
av_cold void ff_fft_init_mmx(FFTContext *s)
|
||||
{
|
||||
#if HAVE_YASM
|
||||
int has_vectors = av_get_cpu_flags();
|
||||
#if ARCH_X86_32
|
||||
if (has_vectors & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
|
||||
if (EXTERNAL_AMD3DNOW(has_vectors)) {
|
||||
/* 3DNow! for K6-2/3 */
|
||||
s->imdct_calc = ff_imdct_calc_3dnow;
|
||||
s->imdct_half = ff_imdct_half_3dnow;
|
||||
s->fft_calc = ff_fft_calc_3dnow;
|
||||
}
|
||||
if (has_vectors & AV_CPU_FLAG_3DNOWEXT && HAVE_AMD3DNOWEXT) {
|
||||
if (EXTERNAL_AMD3DNOWEXT(has_vectors)) {
|
||||
/* 3DNowEx for K7 */
|
||||
s->imdct_calc = ff_imdct_calc_3dnowext;
|
||||
s->imdct_half = ff_imdct_half_3dnowext;
|
||||
s->fft_calc = ff_fft_calc_3dnowext;
|
||||
}
|
||||
#endif
|
||||
if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE) {
|
||||
if (EXTERNAL_SSE(has_vectors)) {
|
||||
/* SSE for P3/P4/K8 */
|
||||
s->imdct_calc = ff_imdct_calc_sse;
|
||||
s->imdct_half = ff_imdct_half_sse;
|
||||
|
@ -47,26 +47,23 @@ av_cold void ff_fft_init_mmx(FFTContext *s)
|
|||
s->fft_calc = ff_fft_calc_sse;
|
||||
s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
|
||||
}
|
||||
if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX && s->nbits >= 5) {
|
||||
if (EXTERNAL_AVX(has_vectors) && s->nbits >= 5) {
|
||||
/* AVX for SB */
|
||||
s->imdct_half = ff_imdct_half_avx;
|
||||
s->fft_calc = ff_fft_calc_avx;
|
||||
s->fft_permutation = FF_FFT_PERM_AVX;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_DCT
|
||||
av_cold void ff_dct_init_mmx(DCTContext *s)
|
||||
{
|
||||
#if HAVE_YASM
|
||||
int has_vectors = av_get_cpu_flags();
|
||||
if (has_vectors & AV_CPU_FLAG_SSE && HAVE_SSE)
|
||||
if (EXTERNAL_SSE(has_vectors))
|
||||
s->dct32 = ff_dct32_float_sse;
|
||||
if (has_vectors & AV_CPU_FLAG_SSE2 && HAVE_SSE)
|
||||
if (EXTERNAL_SSE2(has_vectors))
|
||||
s->dct32 = ff_dct32_float_sse2;
|
||||
if (has_vectors & AV_CPU_FLAG_AVX && HAVE_AVX)
|
||||
if (EXTERNAL_AVX(has_vectors))
|
||||
s->dct32 = ff_dct32_float_avx;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue