diff options
author | Yinhang Liu <yinhangx.liu@intel.com> | 2017-09-15 16:57:05 +0800 |
---|---|---|
committer | windyuan <feng.yuan@intel.com> | 2017-09-15 21:12:40 +0800 |
commit | 8d73ad32492403d20d505a9eeac8fa2a1e88cf0c (patch) | |
tree | f03b030a7514f37f83d2f97ac253685d5ea2a434 /modules/ocl/cl_utils.cpp | |
parent | 6b5f71042b969ae41362e07660181a676685702b (diff) | |
download | libxcam-8d73ad32492403d20d505a9eeac8fa2a1e88cf0c.tar.gz |
standard-OCL: add CLVideoBuffer class
* support CLVideoBuffer path [WIP]
Diffstat (limited to 'modules/ocl/cl_utils.cpp')
-rw-r--r-- | modules/ocl/cl_utils.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/modules/ocl/cl_utils.cpp b/modules/ocl/cl_utils.cpp index 9583989..e2a927b 100644 --- a/modules/ocl/cl_utils.cpp +++ b/modules/ocl/cl_utils.cpp @@ -61,8 +61,13 @@ convert_to_clbuffer ( { SmartPtr<CLBuffer> cl_buf; - SmartPtr<DrmBoBuffer> bo_buf = buf.dynamic_cast_ptr<DrmBoBuffer> (); - cl_buf = new CLVaBuffer (context, bo_buf); + SmartPtr<CLVideoBuffer> cl_video_buf = buf.dynamic_cast_ptr<CLVideoBuffer> (); + if (cl_video_buf.ptr ()) { + cl_buf = cl_video_buf->get_cl_buffer (); + } else { + SmartPtr<DrmBoBuffer> bo_buf = buf.dynamic_cast_ptr<DrmBoBuffer> (); + cl_buf = new CLVaBuffer (context, bo_buf); + } XCAM_FAIL_RETURN (WARNING, cl_buf.ptr (), NULL, "convert to clbuffer failed"); return cl_buf; @@ -78,8 +83,14 @@ convert_to_climage ( { SmartPtr<CLImage> cl_image; - SmartPtr<DrmBoBuffer> bo_buf = buf.dynamic_cast_ptr<DrmBoBuffer> (); - cl_image = new CLVaImage (context, bo_buf, desc, offset); + 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 (); + cl_image = new CLImage2D (context, desc, flags, cl_buf); + } else { + SmartPtr<DrmBoBuffer> bo_buf = buf.dynamic_cast_ptr<DrmBoBuffer> (); + cl_image = new CLVaImage (context, bo_buf, desc, offset); + } XCAM_FAIL_RETURN (WARNING, cl_image.ptr (), NULL, "convert to climage failed"); return cl_image; |