diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-02-08 11:46:04 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2017-02-11 13:37:45 +0300 |
commit | 4de220d2e3751c459f8739a08ac6ca52e63eba30 (patch) | |
tree | 099e9902726a41b8f0dd7d39fa66d6874c79cc4c /libavutil/frame.c | |
parent | f44ec22e095c5ba00ffeadd891655c456e3dd014 (diff) |
frame: allow align=0 (meaning automatic) for av_frame_get_buffer()
This will avoid every caller from hardcoding some specific alignment,
which may break in the future with new instruction sets.
Diffstat (limited to 'libavutil/frame.c')
-rw-r--r-- | libavutil/frame.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c index aafaa57d8b..aa5820c0e9 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(); + for (i = 0; i < 4 && frame->linesize[i]; i++) frame->linesize[i] = FFALIGN(frame->linesize[i], align); } |