diff options
author | Yinhang Liu <yinhangx.liu@intel.com> | 2017-09-25 21:16:28 +0800 |
---|---|---|
committer | Wind Yuan <feng.yuan@intel.com> | 2017-09-26 18:18:04 +0800 |
commit | cff638b59385036cbc91873a9965282c8861a306 (patch) | |
tree | 9d412ca19e2ba294200a72ef78b6f6d1dc09ee73 /modules/ocl/cl_utils.cpp | |
parent | 9e7e0ab2f59470fae36f28999520e01cb3a2299f (diff) | |
download | libxcam-cff638b59385036cbc91873a9965282c8861a306.tar.gz |
standard-OCL: switch to CLVideoBuffer path
* CLVideoBuffer inherited from BufferProxy and CLBuffer
Signed-off-by: Wind Yuan <feng.yuan@intel.com>
Diffstat (limited to 'modules/ocl/cl_utils.cpp')
-rw-r--r-- | modules/ocl/cl_utils.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/ocl/cl_utils.cpp b/modules/ocl/cl_utils.cpp index e2a927b..23a30b1 100644 --- a/modules/ocl/cl_utils.cpp +++ b/modules/ocl/cl_utils.cpp @@ -85,7 +85,18 @@ convert_to_climage ( SmartPtr<CLVideoBuffer> cl_video_buf = buf.dynamic_cast_ptr<CLVideoBuffer> (); if (cl_video_buf.ptr ()) { - SmartPtr<CLBuffer> cl_buf = cl_video_buf->get_cl_buffer (); + SmartPtr<CLBuffer> cl_buf; + + if (offset == 0) { + cl_buf = cl_video_buf; + } else { + uint32_t row_pitch = CLImage::calculate_pixel_bytes (desc.format) * + XCAM_ALIGN_UP (desc.width, XCAM_CL_IMAGE_ALIGNMENT_X); + uint32_t size = row_pitch * desc.height; + + cl_buf = new CLSubBuffer (context, cl_video_buf, flags, offset, size); + } + cl_image = new CLImage2D (context, desc, flags, cl_buf); } else { SmartPtr<DrmBoBuffer> bo_buf = buf.dynamic_cast_ptr<DrmBoBuffer> (); |