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
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162017-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
162017-02-xx - xxxxxxx - lavu 55.31.0 - cpu.h202017-02-xx - xxxxxxx - lavu 55.31.0 - cpu.h
17 Add av_cpu_max_align() for querying maximum required data alignment.21 Add av_cpu_max_align() for querying maximum required data alignment.
18 22
libavutil/frame.c+4−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
19#include "channel_layout.h"19#include "channel_layout.h"
20#include "buffer.h"20#include "buffer.h"
21#include "common.h"21#include "common.h"
22#include "cpu.h"
22#include "dict.h"23#include "dict.h"
23#include "frame.h"24#include "frame.h"
24#include "imgutils.h"25#include "imgutils.h"
@@ -103,6 +104,9 @@ static int get_video_buffer(AVFrame *frame, int align) · 78 unmodified lines
103 if (ret < 0)104 if (ret < 0)
104 return ret;105 return ret;
105 106
107 if (align <= 0)
108 align = av_cpu_max_align();
109
106 for (i = 0; i < 4 && frame->linesize[i]; i++)110 for (i = 0; i < 4 && frame->linesize[i]; i++)
107 frame->linesize[i] = FFALIGN(frame->linesize[i], align);111 frame->linesize[i] = FFALIGN(frame->linesize[i], align);
108 }112 }
libavutil/frame.h+3−1
@@ -475,7 +475,9 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src); · 474 unmodified lines
475 * cases.475 * cases.
476 *476 *
477 * @param frame frame in which to store the new buffers.477 * @param frame frame in which to store the new buffers.
478 * @param align required buffer size alignment478 * @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.
479 *481 *
480 * @return 0 on success, a negative AVERROR on error.482 * @return 0 on success, a negative AVERROR on error.
481 */483 */
libavutil/version.h+1−1
@@ -55,7 +55,7 @@ · 54 unmodified lines
55 55
56#define LIBAVUTIL_VERSION_MAJOR 5556#define LIBAVUTIL_VERSION_MAJOR 55
57#define LIBAVUTIL_VERSION_MINOR 3157#define LIBAVUTIL_VERSION_MINOR 31
58#define LIBAVUTIL_VERSION_MICRO 058#define LIBAVUTIL_VERSION_MICRO 1
59 59
60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \60#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
61 LIBAVUTIL_VERSION_MINOR, \61 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