Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2017-02-08 11:32:17 +0300
committerAnton Khirnov <anton@khirnov.net>2017-02-11 13:37:45 +0300
commite6bff23f1e11aefb16a2b5d6ee72bf7469c5a66e (patch)
treea5093654857657901adc9792b40a93a974e5be50 /libavutil/cpu.c
parent5c8a5765dc5f4e29afb85b95be393c30f45412a8 (diff)
cpu: add a function for querying maximum required data alignment
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r--libavutil/cpu.c13
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;
+}