[FFmpeg-devel] [PATCH 04/11] avutil: add alignment needed for AVX-512
James Almer
jamrial at gmail.com
Fri Nov 10 04:17:27 EET 2017
On 11/9/2017 8:58 AM, James Darnley wrote:
> ---
> This patch gained the alignmnet increase in mem.c
>
> libavutil/mem.c | 2 +-
> libavutil/x86/cpu.c | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/mem.c b/libavutil/mem.c
> index 6ad409daf4..cdf539306f 100644
> --- a/libavutil/mem.c
> +++ b/libavutil/mem.c
> @@ -61,7 +61,7 @@ void free(void *ptr);
>
> #include "mem_internal.h"
>
> -#define ALIGN (HAVE_AVX ? 32 : 16)
> +#define ALIGN (HAVE_AVX512 ? 64 : HAVE_AVX ? 32 : 16)
Wrap the second ternary conditional operation with brackets, just to be
safe.
>
> /* NOTE: if you want to override these functions with your own
> * implementations (not recommended) you have to link libav* as
> diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c
> index 589fdef7da..01b3c39c1e 100644
> --- a/libavutil/x86/cpu.c
> +++ b/libavutil/x86/cpu.c
> @@ -246,6 +246,8 @@ size_t ff_get_cpu_max_align_x86(void)
> {
> int flags = av_get_cpu_flags();
>
> + if (flags & AV_CPU_FLAG_AVX512)
> + return 64;
> if (flags & (AV_CPU_FLAG_AVX2 |
> AV_CPU_FLAG_AVX |
> AV_CPU_FLAG_XOP |
>
LGTM if all the align functions used in mem.c accept the value 64.
More information about the ffmpeg-devel
mailing list