---
doc/APIchanges | 3 +++
libavutil/cpu.c | 13 +++++++++++++
libavutil/cpu.h | 13 +++++++++++++
libavutil/version.h | 2 +-
4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index c161618..acd1536 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2015-08-28
API changes, most recent first:
+2017-02-xx - xxxxxxx - lavu 55.31.0 - cpu.h
+ Add av_cpu_max_align() for querying maximum required data alignment.
+
2017-02-01 - xxxxxxx - lavc - avcodec.h
Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated
API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 0109c9e..5aef6af 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;
+}
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index c205ee1..5790f9e 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -21,6 +21,8 @@
#ifndef AVUTIL_CPU_H
#define AVUTIL_CPU_H
+#include <stddef.h>
+
#include "version.h"
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR)
*/
@@ -88,4 +90,15 @@ int av_parse_cpu_flags(const char *s);
*/
int av_cpu_count(void);
+/**
+ * Get the maximum data alignment that may be required by Libav.
+ *
+ * Note that this is affected by the build configuration and the CPU flags
mask,
+ * so e.g. if the CPU supports AVX, but libavutil has been built with
+ * --disable-avx or the AV_CPU_FLAG_AVX has been disabled through
+ * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
+ * present.
+ */
+size_t av_cpu_max_align(void);
+
#endif /* AVUTIL_CPU_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 7856a0a..0fcd19a 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 30
+#define LIBAVUTIL_VERSION_MINOR 31
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel