History

imgutils: expose av_image_copy_plane_uc_from()

The reason why the generic av_image_copy_uc_from() doesn't really fit in the case for Vulkan is because some planes may be copied via other methods (such as mapping GPU memory), and if they don't satisfy the strict alignment requirements, a gpu image->gpu buffer->cpu ram copy is performed. We need this for hwcontext_vulkan, and I think this will also be useful to API users like libplacebo who would rather not write a custom SIMD memcpy.

Lynne committed 5 years ago

Commit d5de9961 parent c44c0324 files · +26 −5Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/imgutils.c +4 −4
  3. libavutil/imgutils.h +18 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -14,6 +14,9 @@ libavutil: 2021-04-27 · 13 unmodified lines
14 14
15API changes, most recent first:15API changes, most recent first:
16 16
172021-08-14 - xxxxxxxxxx - lavu 57.4.100 - imgutils.h
18 Add av_image_copy_plane_uc_from()
19
172021-08-02 - xxxxxxxxxx - lavc 59.4.100 - packet.h202021-08-02 - xxxxxxxxxx - lavc 59.4.100 - packet.h
18 Add AVPacket.opaque, AVPacket.opaque_ref, AVPacket.time_base.21 Add AVPacket.opaque, AVPacket.opaque_ref, AVPacket.time_base.
19 22
libavutil/imgutils.c+4−4
@@ -356,9 +356,9 @@ static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize, · 355 unmodified lines
356 }356 }
357}357}
358 358
359static void image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,359void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
360 const uint8_t *src, ptrdiff_t src_linesize,360 const uint8_t *src, ptrdiff_t src_linesize,
361 ptrdiff_t bytewidth, int height)361 ptrdiff_t bytewidth, int height)
362{362{
363 int ret = -1;363 int ret = -1;
364 364
@@ -440,7 +440,7 @@ void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4 · 75 unmodified lines
440 enum AVPixelFormat pix_fmt, int width, int height)440 enum AVPixelFormat pix_fmt, int width, int height)
441{441{
442 image_copy(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt,442 image_copy(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt,
443 width, height, image_copy_plane_uc_from);443 width, height, av_image_copy_plane_uc_from);
444}444}
445 445
446int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],446int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
libavutil/imgutils.h+18−0
@@ -124,6 +124,24 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize, · 123 unmodified lines
124 const uint8_t *src, int src_linesize,124 const uint8_t *src, int src_linesize,
125 int bytewidth, int height);125 int bytewidth, int height);
126 126
127/**
128 * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
129 * available, this function will use special functionality for reading from such
130 * memory, which may result in greatly improved performance compared to plain
131 * av_image_copy_plane().
132 *
133 * bytewidth must be contained by both absolute values of dst_linesize
134 * and src_linesize, otherwise the function behavior is undefined.
135 *
136 * @note The linesize parameters have the type ptrdiff_t here, while they are
137 * int for av_image_copy_plane().
138 * @note On x86, the linesizes currently need to be aligned to the cacheline
139 * size (i.e. 64) to get improved performance.
140 */
141void av_image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
142 const uint8_t *src, ptrdiff_t src_linesize,
143 ptrdiff_t bytewidth, int height);
144
127/**145/**
128 * Copy image in src_data to dst_data.146 * Copy image in src_data to dst_data.
129 *147 *
libavutil/version.h+1−1
@@ -79,7 +79,7 @@ · 78 unmodified lines
79 */79 */
80 80
81#define LIBAVUTIL_VERSION_MAJOR 5781#define LIBAVUTIL_VERSION_MAJOR 57
82#define LIBAVUTIL_VERSION_MINOR 382#define LIBAVUTIL_VERSION_MINOR 4
83#define LIBAVUTIL_VERSION_MICRO 10083#define LIBAVUTIL_VERSION_MICRO 100
84 84
85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \85#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

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