cpu: add a function for querying maximum required data alignment

This commit is contained in:
Anton Khirnov
2017-02-08 09:32:17 +01:00
parent 5c8a5765dc
commit e6bff23f1e
4 changed files with 30 additions and 1 deletions

View File

@@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stddef.h>
#include <stdint.h>
#include <stdatomic.h>
@@ -180,3 +181,15 @@ int av_cpu_count(void)
return nb_cpus;
}
size_t av_cpu_max_align(void)
{
int flags = av_get_cpu_flags();
if (flags & AV_CPU_FLAG_AVX)
return 32;
if (flags & (AV_CPU_FLAG_ALTIVEC | AV_CPU_FLAG_SSE | AV_CPU_FLAG_NEON))
return 16;
return 8;
}