• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * cl_3d_denoise_handler.h - CL 3D noise reduction 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: Wei Zong <wei.zong@intel.com>
19  */
20 
21 #ifndef XCAM_CL_3D_DENOISE_HANLDER_H
22 #define XCAM_CL_3D_DENOISE_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 namespace XCam {
30 
31 class CL3DDenoiseImageHandler;
32 
33 class CL3DDenoiseImageKernel
34     : public CLImageKernel
35 {
36     typedef std::list<SmartPtr<CLImage>> CLImagePtrList;
37 
38 private:
39 
40 public:
41     explicit CL3DDenoiseImageKernel (
42         const SmartPtr<CLContext> &context,
43         const char *name,
44         uint32_t channel,
45         SmartPtr<CL3DDenoiseImageHandler> &handler);
46 
~CL3DDenoiseImageKernel()47     virtual ~CL3DDenoiseImageKernel () {
48         _image_in_list.clear ();
49     }
50 
51 protected:
52     virtual XCamReturn prepare_arguments (
53         CLArgList &args, CLWorkSize &work_size);
54 
55 private:
56     XCAM_DEAD_COPY (CL3DDenoiseImageKernel);
57 
58     uint32_t                           _channel;
59     uint8_t                            _ref_count;
60     SmartPtr<CL3DDenoiseImageHandler>  _handler;
61 
62     CLImagePtrList                     _image_in_list;
63     SmartPtr<CLImage>                  _image_out_prev;
64 };
65 
66 class CL3DDenoiseImageHandler
67     : public CLImageHandler
68 {
69 public:
70     explicit CL3DDenoiseImageHandler (
71         const SmartPtr<CLContext> &context, const char *name);
72 
73     bool set_ref_framecount (const uint8_t count);
get_ref_framecount()74     uint8_t get_ref_framecount () const {
75         return _ref_count;
76     };
77 
78     bool set_denoise_config (const XCam3aResultTemporalNoiseReduction& config);
get_denoise_config()79     XCam3aResultTemporalNoiseReduction& get_denoise_config () {
80         return _config;
81     };
get_input_buf()82     SmartPtr<VideoBuffer> get_input_buf () {
83         return _input_buf;
84     }
get_output_buf()85     SmartPtr<VideoBuffer> get_output_buf () {
86         return _output_buf;
87     }
88 
89 protected:
90     virtual XCamReturn prepare_parameters (SmartPtr<VideoBuffer> &input, SmartPtr<VideoBuffer> &output);
91 
92 private:
93     XCAM_DEAD_COPY (CL3DDenoiseImageHandler);
94 
95 private:
96     uint8_t                             _ref_count;
97     XCam3aResultTemporalNoiseReduction  _config;
98     SmartPtr<VideoBuffer>               _input_buf;
99     SmartPtr<VideoBuffer>               _output_buf;
100 };
101 
102 SmartPtr<CLImageHandler>
103 create_cl_3d_denoise_image_handler (
104     const SmartPtr<CLContext> &context, uint32_t channel, uint8_t ref_count);
105 
106 };
107 
108 #endif //XCAM_CL_3D_DENOISE_HANLDER_H
109