mirror of https://git.ffmpeg.org/ffmpeg.git
cpu: split flag checks per arch in av_cpu_max_align()
Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
ebfcce16ac
commit
3d828c9fd5
|
@ -26,3 +26,12 @@ int ff_get_cpu_flags_aarch64(void)
|
||||||
AV_CPU_FLAG_NEON * HAVE_NEON |
|
AV_CPU_FLAG_NEON * HAVE_NEON |
|
||||||
AV_CPU_FLAG_VFP * HAVE_VFP;
|
AV_CPU_FLAG_VFP * HAVE_VFP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ff_get_cpu_max_align_aarch64(void)
|
||||||
|
{
|
||||||
|
int flags = av_get_cpu_flags();
|
||||||
|
|
||||||
|
if (flags & AV_CPU_FLAG_NEON)
|
||||||
|
return 16;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
|
@ -151,3 +151,12 @@ int ff_get_cpu_flags_arm(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
size_t ff_get_cpu_max_align_arm(void)
|
||||||
|
{
|
||||||
|
int flags = av_get_cpu_flags();
|
||||||
|
|
||||||
|
if (flags & AV_CPU_FLAG_NEON)
|
||||||
|
return 16;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
|
@ -184,12 +184,13 @@ int av_cpu_count(void)
|
||||||
|
|
||||||
size_t av_cpu_max_align(void)
|
size_t av_cpu_max_align(void)
|
||||||
{
|
{
|
||||||
int flags = av_get_cpu_flags();
|
if (ARCH_AARCH64)
|
||||||
|
return ff_get_cpu_max_align_aarch64();
|
||||||
if (flags & AV_CPU_FLAG_AVX)
|
if (ARCH_ARM)
|
||||||
return 32;
|
return ff_get_cpu_max_align_arm();
|
||||||
if (flags & (AV_CPU_FLAG_ALTIVEC | AV_CPU_FLAG_SSE | AV_CPU_FLAG_NEON))
|
if (ARCH_PPC)
|
||||||
return 16;
|
return ff_get_cpu_max_align_ppc();
|
||||||
|
if (ARCH_X86)
|
||||||
|
return ff_get_cpu_max_align_x86();
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,4 +41,9 @@ int ff_get_cpu_flags_arm(void);
|
||||||
int ff_get_cpu_flags_ppc(void);
|
int ff_get_cpu_flags_ppc(void);
|
||||||
int ff_get_cpu_flags_x86(void);
|
int ff_get_cpu_flags_x86(void);
|
||||||
|
|
||||||
|
size_t ff_get_cpu_max_align_aarch64(void);
|
||||||
|
size_t ff_get_cpu_max_align_arm(void);
|
||||||
|
size_t ff_get_cpu_max_align_ppc(void);
|
||||||
|
size_t ff_get_cpu_max_align_x86(void);
|
||||||
|
|
||||||
#endif /* AVUTIL_CPU_INTERNAL_H */
|
#endif /* AVUTIL_CPU_INTERNAL_H */
|
||||||
|
|
|
@ -142,3 +142,12 @@ out:
|
||||||
#endif /* HAVE_ALTIVEC */
|
#endif /* HAVE_ALTIVEC */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ff_get_cpu_max_align_ppc(void)
|
||||||
|
{
|
||||||
|
int flags = av_get_cpu_flags();
|
||||||
|
|
||||||
|
if (flags & AV_CPU_FLAG_ALTIVEC)
|
||||||
|
return 16;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
|
@ -233,3 +233,14 @@ int ff_get_cpu_flags_x86(void)
|
||||||
|
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ff_get_cpu_max_align_x86(void)
|
||||||
|
{
|
||||||
|
int flags = av_get_cpu_flags();
|
||||||
|
|
||||||
|
if (flags & AV_CPU_FLAG_AVX)
|
||||||
|
return 32;
|
||||||
|
if (flags & AV_CPU_FLAG_SSE)
|
||||||
|
return 16;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue