From d7bc52bf456deba0f32d9fe5c288ec441f1ebef5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Aug 2016 21:46:50 +0200 Subject: imgutils: add a function for copying image data from GPU mapped memory See https://software.intel.com/en-us/articles/copying-accelerated-video-decode-frame-buffers --- libavutil/imgutils.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libavutil/imgutils.h') diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index 04d6138f67..f98a18ff21 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -117,6 +117,24 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int 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 + * av_image_copy(). + * + * The data pointers and the linesizes must be aligned to the maximum required + * by the CPU architecture. + * + * @note The linesize parameters have the type ptrdiff_t here, while they are + * int for av_image_copy(). + * @note On x86, the linesizes currently need to be aligned to the cacheline + * size (i.e. 64) to get improved performance. + */ +void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4], + const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + /** * Setup the data pointers and linesizes based on the specified image * parameters and the provided array. -- cgit v1.2.3