diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-02-08 09:32:17 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2017-02-11 11:37:45 +0100 |
commit | e6bff23f1e11aefb16a2b5d6ee72bf7469c5a66e (patch) | |
tree | a5093654857657901adc9792b40a93a974e5be50 /libavutil/cpu.c | |
parent | 5c8a5765dc5f4e29afb85b95be393c30f45412a8 (diff) | |
download | ffmpeg-e6bff23f1e11aefb16a2b5d6ee72bf7469c5a66e.tar.gz |
cpu: add a function for querying maximum required data alignment
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r-- | libavutil/cpu.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c index 0109c9e8d1..5aef6af217 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -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; +} |