Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Kim <bkkim@google.com>2020-07-13 20:09:37 +0300
committerJames Almer <jamrial@gmail.com>2020-07-22 17:41:57 +0300
commit3a8e9271765a07e509655346ef88a28578cbff47 (patch)
treefc08c101d0352a09bb07103d4221c4cc1683bbd9 /libavutil/imgutils.h
parentb5f1e057e1d102606156fd982eea5d74b305fc74 (diff)
avutil/imgutils: add utility to get plane sizes
This utility helps avoid undefined behavior when doing things like checking how much memory we need to allocate for an image before we have allocated a buffer. Signed-off-by: Brian Kim <bkkim@google.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavutil/imgutils.h')
-rw-r--r--libavutil/imgutils.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index 5b790ecf0a..5eccbf0bf7 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -68,6 +68,20 @@ int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane);
int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width);
/**
+ * Fill plane sizes for an image with pixel format pix_fmt and height height.
+ *
+ * @param size the array to be filled with the size of each image plane
+ * @param linesizes the array containing the linesize for each
+ * plane, should be filled by av_image_fill_linesizes()
+ * @return >= 0 in case of success, a negative error code otherwise
+ *
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
+ * int for av_image_fill_linesizes().
+ */
+int av_image_fill_plane_sizes(size_t size[4], enum AVPixelFormat pix_fmt,
+ int height, const ptrdiff_t linesizes[4]);
+
+/**
* Fill plane data pointers for an image with pixel format pix_fmt and
* height height.
*