On Wed, Feb 8, 2017 at 5:50 AM, Anton Khirnov <an...@khirnov.net> wrote:
> This will avoid every caller from hardcoding some specific alignment,
> which may break in the future with new instruction sets.
> ---
>  doc/APIchanges      | 4 ++++
>  libavutil/frame.c   | 4 ++++
>  libavutil/frame.h   | 4 +++-
>  libavutil/version.h | 2 +-
>  4 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/doc/APIchanges b/doc/APIchanges
> index acd1536..fd751f3 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,10 @@ libavutil:     2015-08-28
>
>  API changes, most recent first:
>
> +2017-02-xx - xxxxxxx - lavu 55.31.1 - frame.h
> +  Allow passing the value of 0 (meaning "automatic") as the required 
> alignment
> +  to av_frame_get_buffer().
> +
>  2017-02-xx - xxxxxxx - lavu 55.31.0 - cpu.h
>    Add av_cpu_max_align() for querying maximum required data alignment.
>
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index aafaa57..aa5820c 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -19,6 +19,7 @@
>  #include "channel_layout.h"
>  #include "buffer.h"
>  #include "common.h"
> +#include "cpu.h"
>  #include "dict.h"
>  #include "frame.h"
>  #include "imgutils.h"
> @@ -103,6 +104,9 @@ static int get_video_buffer(AVFrame *frame, int align)
>          if (ret < 0)
>              return ret;
>
> +        if (align <= 0)
> +            align = av_cpu_max_align();

should you maybe be stricter here and check for == 0, failing for negative?
-- 
Vittorio
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to