blob: a5011576bf5811f849f50f525dcddcfc4120f2d5 [file] [log] [blame]
Wind Yuand50fde62015-03-25 17:43:49 +08001/*
2 * cl_3a_image_processor.h - CL 3A image processor
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 */
20
21#ifndef XCAM_CL_3A_IMAGE_PROCESSOR_H
22#define XCAM_CL_3A_IMAGE_PROCESSOR_H
23
Wind Yuan9fbfce62017-11-24 19:24:15 +080024#include <xcam_std.h>
Jia Meng66efecf2015-06-17 11:11:10 +000025#include <base/xcam_3a_types.h>
Wind Yuan9fbfce62017-11-24 19:24:15 +080026#include <ocl/cl_image_processor.h>
27#include <stats_callback_interface.h>
Wind Yuand50fde62015-03-25 17:43:49 +080028
29namespace XCam {
30
wangfei1a7d9f32015-03-26 18:30:00 +080031class CLCscImageHandler;
wangfei2c0a48f2015-06-16 09:44:34 +080032class CLEeImageHandler;
Wind Yuana8cdc362015-11-19 04:03:53 +080033class CLBayerBasicImageHandler;
Wind Yuan4b2a37a2015-07-21 17:27:58 +080034class CLBayerPipeImageHandler;
Wangfei347f7042015-07-29 18:06:57 +080035class CLYuvPipeImageHandler;
yaowang16e051152015-08-14 13:49:03 +080036class CLTonemappingImageHandler;
wujunkai166b0bd5512016-02-18 18:25:42 +080037class CLNewTonemappingImageHandler;
Wind Yuand50fde62015-03-25 17:43:49 +080038
Wind Yuan4338bd22015-12-11 23:20:19 +080039#define ENABLE_YEENR_HANDLER 0
40
Wind Yuand50fde62015-03-25 17:43:49 +080041class CL3aImageProcessor
42 : public CLImageProcessor
43{
Wind Yuand281e242015-08-14 14:37:50 +080044public:
Wind Yuane4ba0c92015-03-26 16:59:06 +080045 enum OutSampleType {
46 OutSampleYuv,
47 OutSampleRGB,
48 OutSampleBayer,
49 };
50
Wind Yuand281e242015-08-14 14:37:50 +080051 enum PipelineProfile {
52 BasicPipelineProfile = 0,
53 AdvancedPipelineProfile,
54 ExtremePipelineProfile,
55 };
56
wujunkai166a84ba052015-09-08 15:54:12 +080057 enum CaptureStage {
58 BasicbayerStage,
59 TonemappingStage,
60 };
61
wujunkai16606f77622016-03-18 14:41:10 +080062 enum CLTonemappingMode {
63 WDRdisabled = 0,
64 Gaussian,
65 Haleq,
66 };
67
Wind Yuand50fde62015-03-25 17:43:49 +080068public:
69 explicit CL3aImageProcessor ();
70 virtual ~CL3aImageProcessor ();
71
Wind Yuand281e242015-08-14 14:37:50 +080072 bool set_profile (PipelineProfile value);
Wind Yuan7ddf2602015-04-14 18:49:45 +080073 void set_stats_callback (const SmartPtr<StatsCallback> &callback);
74
Wind Yuand50fde62015-03-25 17:43:49 +080075 bool set_output_format (uint32_t fourcc);
wujunkai166a84ba052015-09-08 15:54:12 +080076 bool set_capture_stage (CaptureStage capture_stage);
Wind Yuan43584312015-12-11 23:21:49 +080077 bool set_3a_stats_bits (uint32_t bits);
Jia Mengc66de802015-05-05 17:27:37 +080078
Jia Mengc66de802015-05-05 17:27:37 +080079 virtual bool set_denoise (uint32_t mode);
80 virtual bool set_gamma (bool enable);
Jia Mengc66de802015-05-05 17:27:37 +080081 virtual bool set_macc (bool enable);
zongwaved7e13892015-05-20 11:19:04 +080082 virtual bool set_tnr (uint32_t mode, uint8_t level);
wujunkai16606f77622016-03-18 14:41:10 +080083 virtual bool set_tonemapping (CLTonemappingMode wdr_mode);
Wind Yuand50fde62015-03-25 17:43:49 +080084
Wind Yuand281e242015-08-14 14:37:50 +080085 PipelineProfile get_profile () const {
86 return _pipeline_profile;
87 }
88
Wind Yuand50fde62015-03-25 17:43:49 +080089protected:
90
91 //derive from ImageProcessor
92 virtual bool can_process_result (SmartPtr<X3aResult> &result);
93 virtual XCamReturn apply_3a_results (X3aResultList &results);
94 virtual XCamReturn apply_3a_result (SmartPtr<X3aResult> &result);
95
96private:
97 virtual XCamReturn create_handlers ();
Wind Yuan641a0832016-02-27 00:36:20 +080098
99 bool post_config ();
Wind Yuand50fde62015-03-25 17:43:49 +0800100 XCAM_DEAD_COPY (CL3aImageProcessor);
101
102private:
Wind Yuan4338bd22015-12-11 23:20:19 +0800103 uint32_t _output_fourcc;
Wind Yuan43584312015-12-11 23:21:49 +0800104 uint32_t _3a_stats_bits;
Wind Yuan4338bd22015-12-11 23:20:19 +0800105 PipelineProfile _pipeline_profile;
106 CaptureStage _capture_stage;
wujunkai16606f77622016-03-18 14:41:10 +0800107 CLTonemappingMode _wdr_mode;
Wind Yuan4338bd22015-12-11 23:20:19 +0800108 SmartPtr<StatsCallback> _stats_callback;
yaowang16e051152015-08-14 13:49:03 +0800109 SmartPtr<CLCscImageHandler> _csc;
yaowang16e051152015-08-14 13:49:03 +0800110 SmartPtr<CLTonemappingImageHandler> _tonemapping;
wujunkai166b0bd5512016-02-18 18:25:42 +0800111 SmartPtr<CLNewTonemappingImageHandler> _newtonemapping;
Wind Yuan4338bd22015-12-11 23:20:19 +0800112#if ENABLE_YEENR_HANDLER
113 SmartPtr<CLEeImageHandler> _ee;
114#endif
Juan Zhao0022d352015-05-07 07:18:09 +0000115
Wind Yuan4b2a37a2015-07-21 17:27:58 +0800116 // simple 3a bayer pipeline
Wind Yuan4338bd22015-12-11 23:20:19 +0800117 SmartPtr<CLBayerBasicImageHandler> _bayer_basic_pipe;
118 SmartPtr<CLBayerPipeImageHandler> _bayer_pipe;
119 SmartPtr<CLYuvPipeImageHandler> _yuv_pipe;
Wind Yuan4b2a37a2015-07-21 17:27:58 +0800120
Wind Yuan4338bd22015-12-11 23:20:19 +0800121 uint32_t _tnr_mode;
122 bool _enable_gamma;
Wind Yuan4338bd22015-12-11 23:20:19 +0800123 bool _enable_macc;
Wind Yuan4338bd22015-12-11 23:20:19 +0800124 uint32_t _snr_mode; // spatial nr mode
Wind Yuand50fde62015-03-25 17:43:49 +0800125};
126
127};
Juan Zhaoab5e6fe2015-04-08 14:12:46 +0800128#endif //XCAM_CL_3A_IMAGE_PROCESSOR_H