• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * cl_newtonemapping_handler.h - CL tonemapping 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: Wu Junkai <junkai.wu@intel.com>
19  */
20 
21 #ifndef XCAM_CL_NEWTONEMAPPING_HANLDER_H
22 #define XCAM_CL_NEWTONEMAPPING_HANLDER_H
23 
24 #include <xcam_std.h>
25 #include <ocl/cl_image_handler.h>
26 #include <x3a_stats_pool.h>
27 
28 namespace XCam {
29 
30 class CLNewTonemappingImageKernel
31     : public CLImageKernel
32 {
33 public:
34     explicit CLNewTonemappingImageKernel (
35         const SmartPtr<CLContext> &context, const char *name);
36 
37 private:
38     SmartPtr<CLBuffer>      _y_max_buffer;
39     SmartPtr<CLBuffer>      _y_avg_buffer;
40     SmartPtr<CLBuffer>      _map_hist_buffer;
41 };
42 
43 class CLNewTonemappingImageHandler
44     : public CLImageHandler
45 {
46 public:
47     explicit CLNewTonemappingImageHandler (const SmartPtr<CLContext> &context, const char *name);
48     bool set_tonemapping_kernel(SmartPtr<CLNewTonemappingImageKernel> &kernel);
49 
50 protected:
51     virtual XCamReturn prepare_buffer_pool_video_info (
52         const VideoBufferInfo &input, VideoBufferInfo &output);
53     virtual XCamReturn prepare_parameters (
54         SmartPtr<VideoBuffer> &input, SmartPtr<VideoBuffer> &output);
55 
56 private:
57     SmartPtr<CLNewTonemappingImageKernel>   _tonemapping_kernel;
58     int32_t                                 _output_format;
59     int                                     _block_factor;
60     float                                   _map_hist[65536];
61     float                                   _y_max[16];
62     float                                   _y_avg[16];
63 };
64 
65 SmartPtr<CLImageHandler>
66 create_cl_newtonemapping_image_handler (const SmartPtr<CLContext> &context);
67 
68 };
69 
70 #endif //XCAM_CL_NEWTONEMAPPING_HANLDER_H
71