Browse code

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 <jamrial@gmail.com>

James Almer authored on 2017/09/28 11:29:20
Showing 4 changed files
... ...
@@ -15,6 +15,10 @@ libavutil:     2015-08-28
15 15
 
16 16
 API changes, most recent first:
17 17
 
18
+2017-09-27 - xxxxxxx - lavu 55.77.101 / lavu 55.31.1 - frame.h
19
+  Allow passing the value of 0 (meaning "automatic") as the required alignment
20
+  to av_frame_get_buffer().
21
+
18 22
 2017-09-27 - xxxxxxx - lavu 55.77.100 / lavu 55.31.0 - cpu.h
19 23
   Add av_cpu_max_align() for querying maximum required data alignment.
20 24
 
... ...
@@ -181,6 +181,9 @@ static int get_video_buffer(AVFrame *frame, int align)
181 181
         return ret;
182 182
 
183 183
     if (!frame->linesize[0]) {
184
+        if (align <= 0)
185
+            align = 32; /* STRIDE_ALIGN. Should be av_cpu_max_align() */
186
+
184 187
         for(i=1; i<=align; i+=i) {
185 188
             ret = av_image_fill_linesizes(frame->linesize, frame->format,
186 189
                                           FFALIGN(frame->width, i));
... ...
@@ -681,7 +681,9 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
681 681
  *           cases.
682 682
  *
683 683
  * @param frame frame in which to store the new buffers.
684
- * @param align required buffer size alignment
684
+ * @param align Required buffer size alignment. If equal to 0, alignment will be
685
+ *              chosen automatically for the current CPU. It is highly
686
+ *              recommended to pass 0 here unless you know what you are doing.
685 687
  *
686 688
  * @return 0 on success, a negative AVERROR on error.
687 689
  */
... ...
@@ -81,7 +81,7 @@
81 81
 
82 82
 #define LIBAVUTIL_VERSION_MAJOR  55
83 83
 #define LIBAVUTIL_VERSION_MINOR  77
84
-#define LIBAVUTIL_VERSION_MICRO 100
84
+#define LIBAVUTIL_VERSION_MICRO 101
85 85
 
86 86
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
87 87
                                                LIBAVUTIL_VERSION_MINOR, \