1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef IMAGE_OPENCL_WRAPPER_H_ 17 #define IMAGE_OPENCL_WRAPPER_H_ 18 19 #include <memory> 20 #include <string> 21 #define CL_TARGET_OPENCL_VERSION 300 22 #include <CL/cl.h> 23 #include <CL/cl_ext.h> 24 25 #define MS_ASSERT(f) ((void)0) 26 27 namespace OHOS { 28 // This is a opencl function wrapper. 29 namespace Media { 30 31 using clImportMemoryFunc = cl_mem (*)(cl_context, cl_mem_flags, const cl_import_properties_arm *, void *, size_t, 32 cl_int *); 33 34 extern clImportMemoryFunc clImportMemory; 35 } // namespace Media 36 } // namespace OHOS 37 struct ClImportMemoryParam { 38 cl_context context; 39 cl_mem_flags flags; 40 const cl_import_properties_arm* properties; 41 void* fd; 42 size_t size; 43 cl_int* errcode_ret; 44 }; 45 namespace OHOS { 46 namespace Media { 47 namespace VideoProcessingEngine { 48 extern cl_mem ClImportMemory(ClImportMemoryParam clImportMemoryParam); 49 extern void ClDeInitOpenCL(); 50 } // namespace VideoProcessingEngine 51 } // namespace Media 52 } // namespace OHOS 53 54 #endif // IMAGE_OPENCL_WRAPPER_H_ 55