History

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.

Anton Khirnov committed 9 years ago

Commit 4de220d1 parent f44ec224 files · +12 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavutil/frame.c +4 −0
  3. libavutil/frame.h +3 −1
  4. libavutil/version.h +1 −1
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2015-08-28 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2017-02-xx - xxxxxxx - lavu 55.31.1 - frame.h
17+ Allow passing the value of 0 (meaning "automatic") as the required alignment
18+ to av_frame_get_buffer().
19+
1620 2017-02-xx - xxxxxxx - lavu 55.31.0 - cpu.h
1721 Add av_cpu_max_align() for querying maximum required data alignment.
1822
libavutil/frame.c+4−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include "channel_layout.h"
2020 #include "buffer.h"
2121 #include "common.h"
22+#include "cpu.h"
2223 #include "dict.h"
2324 #include "frame.h"
2425 #include "imgutils.h"
@@ -103,6 +104,9 @@ static int get_video_buffer(AVFrame *frame, int align) · 78 unmodified lines
103104 if (ret < 0)
104105 return ret;
105106
107+ if (align <= 0)
108+ align = av_cpu_max_align();
109+
106110 for (i = 0; i < 4 && frame->linesize[i]; i++)
107111 frame->linesize[i] = FFALIGN(frame->linesize[i], align);
108112 }
libavutil/frame.h+3−1
@@ -475,7 +475,9 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src); · 474 unmodified lines
475475 * cases.
476476 *
477477 * @param frame frame in which to store the new buffers.
478− * @param align required buffer size alignment
478+ * @param align Required buffer size alignment. If equal to 0, alignment will be
479+ * chosen automatically for the current CPU. It is highly
480+ * recommended to pass 0 here unless you know what you are doing.
479481 *
480482 * @return 0 on success, a negative AVERROR on error.
481483 */
libavutil/version.h+1−1
@@ -55,7 +55,7 @@ · 54 unmodified lines
5555
5656 #define LIBAVUTIL_VERSION_MAJOR 55
5757 #define LIBAVUTIL_VERSION_MINOR 31
58−#define LIBAVUTIL_VERSION_MICRO 0
58+#define LIBAVUTIL_VERSION_MICRO 1
5959
6060 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
6161 LIBAVUTIL_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t