• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * cl_bayer_pipe_handler.h - CL bayer pipe 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: Wind Yuan <feng.yuan@intel.com>
19  * Author: wangfei <feix.w.wang@intel.com>
20  * Author: Shincy Tu <shincy.tu@intel.com>
21  */
22 
23 #ifndef XCAM_CL_BAYER_PIPE_HANDLER_H
24 #define XCAM_CL_BAYER_PIPE_HANDLER_H
25 
26 #include <xcam_std.h>
27 #include <stats_callback_interface.h>
28 #include <x3a_stats_pool.h>
29 #include <ocl/cl_context.h>
30 #include <ocl/cl_image_handler.h>
31 #include <ocl/cl_3a_stats_context.h>
32 
33 #define XCAM_BNR_TABLE_SIZE 64
34 
35 namespace XCam {
36 
37 class CLBayerPipeImageHandler;
38 
39 typedef struct
40 {
41     float           ee_gain;
42     float           ee_threshold;
43     float           nr_gain;
44 } CLEeConfig;
45 
46 class CLBayerPipeImageKernel
47     : public CLImageKernel
48 {
49 public:
50     explicit CLBayerPipeImageKernel (
51         const SmartPtr<CLContext> &context,
52         SmartPtr<CLBayerPipeImageHandler> &handler);
53 
54 private:
55     SmartPtr<CLBayerPipeImageHandler>     _handler;
56 };
57 
58 class CLBayerPipeImageHandler
59     : public CLImageHandler
60 {
61     friend class CLBayerPipeImageKernel;
62 
63 public:
64     explicit CLBayerPipeImageHandler (const SmartPtr<CLContext> &context, const char *name);
65     bool set_bayer_kernel (SmartPtr<CLBayerPipeImageKernel> &kernel);
66     bool set_ee_config (const XCam3aResultEdgeEnhancement &ee);
67     bool set_bnr_config (const XCam3aResultBayerNoiseReduction &bnr);
68     bool set_output_format (uint32_t fourcc);
69     bool enable_denoise (bool enable);
70 
71 protected:
72     virtual XCamReturn prepare_buffer_pool_video_info (
73         const VideoBufferInfo &input, VideoBufferInfo &output);
74     virtual XCamReturn prepare_parameters (
75         SmartPtr<VideoBuffer> &input, SmartPtr<VideoBuffer> &output);
76 
77 private:
78     XCAM_DEAD_COPY (CLBayerPipeImageHandler);
79 
80 private:
81     SmartPtr<CLBayerPipeImageKernel>   _bayer_kernel;
82     uint32_t                           _output_format;
83 
84     uint32_t                           _enable_denoise;
85     float                              _bnr_table[XCAM_BNR_TABLE_SIZE];
86     CLEeConfig                         _ee_config;
87 };
88 
89 SmartPtr<CLImageHandler>
90 create_cl_bayer_pipe_image_handler (const SmartPtr<CLContext> &context);
91 
92 };
93 
94 #endif //XCAM_CL_BAYER_PIPE_HANDLER_H
95