1 /* 2 * cl_gauss_handler.h - CL gauss handler. 3 * 4 * Copyright (c) 2016 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_GAUSS_HANLDER_H 22 #define XCAM_CL_GAUSS_HANLDER_H 23 24 #include <xcam_std.h> 25 #include <base/xcam_3a_result.h> 26 #include <x3a_stats_pool.h> 27 #include <ocl/cl_image_handler.h> 28 29 #define XCAM_GAUSS_DEFAULT_RADIUS 2 30 #define XCAM_GAUSS_DEFAULT_SIGMA 2.0f 31 32 namespace XCam { 33 34 class CLGaussImageKernel 35 : public CLImageKernel 36 { 37 public: 38 explicit CLGaussImageKernel ( 39 const SmartPtr<CLContext> &context, uint32_t radius, float sigma); 40 virtual ~CLGaussImageKernel (); 41 bool set_gaussian(uint32_t radius, float sigma); 42 43 protected: 44 virtual XCamReturn prepare_arguments (CLArgList &args, CLWorkSize &work_size); 45 46 // new virtual fucntions 47 virtual SmartPtr<VideoBuffer> get_input_buf () = 0; 48 virtual SmartPtr<VideoBuffer> get_output_buf () = 0; 49 50 protected: 51 SmartPtr<CLBuffer> _g_table_buffer; 52 uint32_t _g_radius; 53 float *_g_table; 54 }; 55 56 class CLGaussImageHandler 57 : public CLImageHandler 58 { 59 public: 60 explicit CLGaussImageHandler (const SmartPtr<CLContext> &context, const char *name); 61 bool set_gauss_kernel(SmartPtr<CLGaussImageKernel> &kernel); 62 bool set_gaussian_table(int size, float sigma); 63 64 private: 65 SmartPtr<CLGaussImageKernel> _gauss_kernel; 66 }; 67 68 SmartPtr<CLImageHandler> 69 create_cl_gauss_image_handler ( 70 const SmartPtr<CLContext> &context, 71 uint32_t radius = XCAM_GAUSS_DEFAULT_RADIUS, 72 float sigma = XCAM_GAUSS_DEFAULT_SIGMA); 73 74 }; 75 76 #endif //XCAM_CL_GAUSS_HANLDER_H 77