[FFmpeg-devel,02/14] lavu: Add OpenCL hardware pixfmt

Submitted by Mark Thompson on Sept. 10, 2017, 8:53 p.m.

Details

Message ID 20170910205338.29687-3-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Sept. 10, 2017, 8:53 p.m.
---
 doc/APIchanges      | 3 +++
 libavutil/pixdesc.c | 4 ++++
 libavutil/pixfmt.h  | 7 +++++++
 3 files changed, 14 insertions(+)

Patch hide | download patch | download mbox

diff --git a/doc/APIchanges b/doc/APIchanges
index cc67cbf6f8..0cea594f25 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@  libavutil:     2015-08-28
 
 API changes, most recent first:
 
+2017-xx-xx - xxxxxxx - lavu 55.n+1.0 - pixfmt.h
+  Add AV_PIX_FMT_OPENCL.
+
 2017-09-08 - xxxxxxx - lavfi 6.103.100 - buffersrc.h
   Add av_buffersrc_close().
 
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 33aa2d705f..0c328bcd5a 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2241,6 +2241,10 @@  static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .name = "drm_prime",
         .flags = AV_PIX_FMT_FLAG_HWACCEL,
     },
+    [AV_PIX_FMT_OPENCL] = {
+        .name  = "opencl",
+        .flags = AV_PIX_FMT_FLAG_HWACCEL,
+    },
 };
 #if FF_API_PLUS1_MINUS1
 FF_ENABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 24889c8e52..1469c0e8ff 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -340,6 +340,13 @@  enum AVPixelFormat {
      * data[0] points to an AVDRMFrameDescriptor.
      */
     AV_PIX_FMT_DRM_PRIME,
+    /**
+     * Hardware surfaces for OpenCL.
+     *
+     * data[i] contain 2D image objects (typed in C as cl_mem, used
+     * in OpenCL as image2d_t) for each plane of the surface.
+     */
+    AV_PIX_FMT_OPENCL,
 
     AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
 };