cl_3d_denoise_handler.h revision 9fbfce6bd98f1d790f75215932de854892a58154
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
29namespace XCam {
30
31class CL3DDenoiseImageHandler;
32
33class CL3DDenoiseImageKernel
34    : public CLImageKernel
35{
36    typedef std::list<SmartPtr<CLImage>> CLImagePtrList;
37
38private:
39
40public:
41    explicit CL3DDenoiseImageKernel (
42        const SmartPtr<CLContext> &context,
43        const char *name,
44        uint32_t channel,
45        SmartPtr<CL3DDenoiseImageHandler> &handler);
46
47    virtual ~CL3DDenoiseImageKernel () {
48        _image_in_list.clear ();
49    }
50
51protected:
52    virtual XCamReturn prepare_arguments (
53        CLArgList &args, CLWorkSize &work_size);
54
55private:
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
66class CL3DDenoiseImageHandler
67    : public CLImageHandler
68{
69public:
70    explicit CL3DDenoiseImageHandler (
71        const SmartPtr<CLContext> &context, const char *name);
72
73    bool set_ref_framecount (const uint8_t count);
74    uint8_t get_ref_framecount () const {
75        return _ref_count;
76    };
77
78    bool set_denoise_config (const XCam3aResultTemporalNoiseReduction& config);
79    XCam3aResultTemporalNoiseReduction& get_denoise_config () {
80        return _config;
81    };
82    SmartPtr<VideoBuffer> get_input_buf () {
83        return _input_buf;
84    }
85    SmartPtr<VideoBuffer> get_output_buf () {
86        return _output_buf;
87    }
88
89protected:
90    virtual XCamReturn prepare_parameters (SmartPtr<VideoBuffer> &input, SmartPtr<VideoBuffer> &output);
91
92private:
93    XCAM_DEAD_COPY (CL3DDenoiseImageHandler);
94
95private:
96    uint8_t                             _ref_count;
97    XCam3aResultTemporalNoiseReduction  _config;
98    SmartPtr<VideoBuffer>               _input_buf;
99    SmartPtr<VideoBuffer>               _output_buf;
100};
101
102SmartPtr<CLImageHandler>
103create_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