summaryrefslogtreecommitdiff
path: root/libavutil/frame.h
diff options
context:
space:
mode:
authorSoft Works <softworkz@hotmail.com>2021-11-14 20:15:56 +0000
committerMarton Balint <cus@passwd.hu>2021-11-18 20:40:24 +0100
commitdaef8cbff70389e0a5c8b5bd7f05536a4adc2933 (patch)
tree25c7529518e9743354b0ceb7d20c0e5ec7d0f213 /libavutil/frame.h
parent9181b9ec7c7e13a4f45847f2535ada67024ca16c (diff)
downloadffmpeg-daef8cbff70389e0a5c8b5bd7f05536a4adc2933.tar.gz
avutil/frame: Document the possibility of negative line sizes
Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavutil/frame.h')
-rw-r--r--libavutil/frame.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/libavutil/frame.h b/libavutil/frame.h
index 14097f0620..753234792e 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -311,7 +311,8 @@ typedef struct AVFrame {
#define AV_NUM_DATA_POINTERS 8
/**
* pointer to the picture/channel planes.
- * This might be different from the first allocated byte
+ * This might be different from the first allocated byte. For video,
+ * it could even point to the end of the image data.
*
* Some decoders access areas outside 0,0 - width,height, please
* see avcodec_align_dimensions2(). Some filters and swscale can read
@@ -320,12 +321,20 @@ typedef struct AVFrame {
*
* NOTE: Except for hwaccel formats, pointers not needed by the format
* MUST be set to NULL.
+ *
+ * @attention In case of video, the data[] pointers can point to the
+ * end of image data in order to reverse line order, when used in
+ * combination with negative values in the linesize[] array.
*/
uint8_t *data[AV_NUM_DATA_POINTERS];
/**
- * For video, size in bytes of each picture line.
- * For audio, size in bytes of each plane.
+ * For video, a positive or negative value, which is typically indicating
+ * the size in bytes of each picture line, but it can also be:
+ * - the negative byte size of lines for vertical flipping
+ * (with data[n] pointing to the end of the data
+ * - a positive or negative multiple of the byte size as for accessing
+ * even and odd fields of a frame (possibly flipped)
*
* For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size.
@@ -337,6 +346,9 @@ typedef struct AVFrame {
*
* @note The linesize may be larger than the size of usable data -- there
* may be extra padding present for performance reasons.
+ *
+ * @attention In case of video, line size values can be negative to achieve
+ * a vertically inverted iteration over image lines.
*/
int linesize[AV_NUM_DATA_POINTERS];