1 /* 2 * cl_csc_handler.h - CL csc handler 3 * 4 * Copyright (c) 2015 Intel Corporation 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * Author: wangfei <feix.w.wang@intel.com> 19 */ 20 21 #ifndef XCAM_CL_CSC_HANLDER_H 22 #define XCAM_CL_CSC_HANLDER_H 23 24 #include <xcam_std.h> 25 #include <base/xcam_3a_result.h> 26 #include <ocl/cl_image_handler.h> 27 28 namespace XCam { 29 30 enum CLCscType { 31 CL_CSC_TYPE_RGBATONV12, 32 CL_CSC_TYPE_RGBATOLAB, 33 CL_CSC_TYPE_RGBA64TORGBA, 34 CL_CSC_TYPE_YUYVTORGBA, 35 CL_CSC_TYPE_NV12TORGBA, 36 CL_CSC_TYPE_MAX, 37 }; 38 39 class CLCscImageKernel 40 : public CLImageKernel 41 { 42 public: 43 explicit CLCscImageKernel (const SmartPtr<CLContext> &context, CLCscType type); 44 45 private: 46 CLCscType _kernel_csc_type; 47 }; 48 49 class CLCscImageHandler 50 : public CLImageHandler 51 { 52 public: 53 explicit CLCscImageHandler (const SmartPtr<CLContext> &context, const char *name, CLCscType type); 54 bool set_csc_kernel (SmartPtr<CLCscImageKernel> &kernel); 55 bool set_matrix (const XCam3aResultColorMatrix &matrix); 56 bool set_output_format (uint32_t fourcc); 57 58 protected: 59 virtual XCamReturn prepare_buffer_pool_video_info ( 60 const VideoBufferInfo &input, 61 VideoBufferInfo &output); 62 virtual XCamReturn prepare_parameters (SmartPtr<VideoBuffer> &input, SmartPtr<VideoBuffer> &output); 63 64 private: 65 XCAM_DEAD_COPY (CLCscImageHandler); 66 67 private: 68 float _rgbtoyuv_matrix[XCAM_COLOR_MATRIX_SIZE]; 69 uint32_t _output_format; 70 CLCscType _csc_type; 71 SmartPtr<CLCscImageKernel> _csc_kernel; 72 }; 73 74 SmartPtr<CLImageHandler> 75 create_cl_csc_image_handler (const SmartPtr<CLContext> &context, CLCscType type); 76 77 }; 78 79 #endif //XCAM_CL_CSC_HANLDER_H 80