diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-07 00:09:10 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-09-12 09:42:27 +0200 |
commit | 423b6a7e493828dd91d5e590e0905236f1f46557 (patch) | |
tree | 2bdbe0020ba7ecab45e3f0909a7f3d862520a6c7 /libavutil/imgutils.h | |
parent | 5094d1f429e58a67c542f1c5940a3de5184c35ca (diff) | |
download | ffmpeg-423b6a7e493828dd91d5e590e0905236f1f46557.tar.gz |
avutil/imgutils: Add wrapper for av_image_copy() to avoid casts
av_image_copy() accepts const uint8_t* const * as source;
lots of user have uint8_t* const * and therefore either
cast (the majority) or copy the array of pointers.
This commit changes this by adding a static inline wrapper
for av_image_copy() that casts between the two types
so that we do not need to add casts everywhere else.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavutil/imgutils.h')
-rw-r--r-- | libavutil/imgutils.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index 91312a72d3..fa3bb101b1 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -175,6 +175,22 @@ void av_image_copy(uint8_t * const dst_data[4], const int dst_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height); /** + * Wrapper around av_image_copy() to workaround the limitation + * that the conversion from uint8_t * const * to const uint8_t * const * + * is not performed automatically in C. + * @see av_image_copy() + */ +static inline +void av_image_copy2(uint8_t * const dst_data[4], const int dst_linesizes[4], + uint8_t * const src_data[4], const int src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height) +{ + av_image_copy(dst_data, dst_linesizes, + (const uint8_t * const *)src_data, src_linesizes, + pix_fmt, width, height); +} + +/** * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where * available, this function will use special functionality for reading from such * memory, which may result in greatly improved performance compared to plain |