From: James Almer Date: Thu, 28 Sep 2017 02:29:20 +0000 (-0300) Subject: Merge commit '4de220d2e3751c459f8739a08ac6ca52e63eba30' X-Git-Tag: n3.5-dev~183 X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/7aa6b8a68fce93d84c359158f198cd55324d0025 Merge commit '4de220d2e3751c459f8739a08ac6ca52e63eba30' * commit '4de220d2e3751c459f8739a08ac6ca52e63eba30': frame: allow align=0 (meaning automatic) for av_frame_get_buffer() See https://ffmpeg.org/pipermail/ffmpeg-devel/2017-September/215834.html Merged-by: James Almer --- 7aa6b8a68fce93d84c359158f198cd55324d0025 diff --cc doc/APIchanges index 4838ec3,9b9f46e..606ba7f --- a/doc/APIchanges +++ b/doc/APIchanges @@@ -15,10 -13,17 +15,14 @@@ libavutil: 2015-08-2 API changes, most recent first: -2017-02-xx - xxxxxxx - lavu 55.31.1 - frame.h ++2017-09-27 - xxxxxxx - lavu 55.77.101 / 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 +2017-09-27 - xxxxxxx - lavu 55.77.100 / lavu 55.31.0 - cpu.h Add av_cpu_max_align() for querying maximum required data alignment. -2016-xx-xx - xxxxxxx - lavf 57.11.0 - avio.h - Add avio_context_free(). From now on it must be used for freeing AVIOContext. - -2017-02-01 - xxxxxxx - lavc - avcodec.h +2017-09-26 - xxxxxxx - lavc 57.106.102 - avcodec.h Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs (avcodec_send_packet/avcodec_receive_frame) always work with reference diff --cc libavutil/frame.c index 85d89b9,aa5820c..d5fd293 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@@ -181,14 -99,13 +181,17 @@@ static int get_video_buffer(AVFrame *fr return ret; if (!frame->linesize[0]) { - ret = av_image_fill_linesizes(frame->linesize, frame->format, - frame->width); - if (ret < 0) - return ret; - + if (align <= 0) - align = av_cpu_max_align(); ++ align = 32; /* STRIDE_ALIGN. Should be av_cpu_max_align() */ ++ + for(i=1; i<=align; i+=i) { + ret = av_image_fill_linesizes(frame->linesize, frame->format, + FFALIGN(frame->width, i)); + if (ret < 0) + return ret; + if (!(frame->linesize[0] & (align-1))) + break; + } for (i = 0; i < 4 && frame->linesize[i]; i++) frame->linesize[i] = FFALIGN(frame->linesize[i], align); diff --cc libavutil/version.h index 9dbcdc4,0768f9f..dee4f5b --- a/libavutil/version.h +++ b/libavutil/version.h @@@ -78,10 -53,9 +78,10 @@@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 31 -#define LIBAVUTIL_VERSION_MICRO 1 + +#define LIBAVUTIL_VERSION_MAJOR 55 +#define LIBAVUTIL_VERSION_MINOR 77 - #define LIBAVUTIL_VERSION_MICRO 100 ++#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \