Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 1 | /* |
| 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 Yuan | 9fbfce6 | 2017-11-24 19:24:15 +0800 | [diff] [blame] | 24 | #include <xcam_std.h> |
Jia Meng | 66efecf | 2015-06-17 11:11:10 +0000 | [diff] [blame] | 25 | #include <base/xcam_3a_types.h> |
Wind Yuan | 9fbfce6 | 2017-11-24 19:24:15 +0800 | [diff] [blame] | 26 | #include <ocl/cl_image_processor.h> |
| 27 | #include <stats_callback_interface.h> |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 28 | |
| 29 | namespace XCam { |
| 30 | |
wangfei | 1a7d9f3 | 2015-03-26 18:30:00 +0800 | [diff] [blame] | 31 | class CLCscImageHandler; |
wangfei | 2c0a48f | 2015-06-16 09:44:34 +0800 | [diff] [blame] | 32 | class CLEeImageHandler; |
Wind Yuan | a8cdc36 | 2015-11-19 04:03:53 +0800 | [diff] [blame] | 33 | class CLBayerBasicImageHandler; |
Wind Yuan | 4b2a37a | 2015-07-21 17:27:58 +0800 | [diff] [blame] | 34 | class CLBayerPipeImageHandler; |
Wangfei | 347f704 | 2015-07-29 18:06:57 +0800 | [diff] [blame] | 35 | class CLYuvPipeImageHandler; |
yaowang1 | 6e05115 | 2015-08-14 13:49:03 +0800 | [diff] [blame] | 36 | class CLTonemappingImageHandler; |
wujunkai166 | b0bd551 | 2016-02-18 18:25:42 +0800 | [diff] [blame] | 37 | class CLNewTonemappingImageHandler; |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 38 | |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 39 | #define ENABLE_YEENR_HANDLER 0 |
| 40 | |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 41 | class CL3aImageProcessor |
| 42 | : public CLImageProcessor |
| 43 | { |
Wind Yuan | d281e24 | 2015-08-14 14:37:50 +0800 | [diff] [blame] | 44 | public: |
Wind Yuan | e4ba0c9 | 2015-03-26 16:59:06 +0800 | [diff] [blame] | 45 | enum OutSampleType { |
| 46 | OutSampleYuv, |
| 47 | OutSampleRGB, |
| 48 | OutSampleBayer, |
| 49 | }; |
| 50 | |
Wind Yuan | d281e24 | 2015-08-14 14:37:50 +0800 | [diff] [blame] | 51 | enum PipelineProfile { |
| 52 | BasicPipelineProfile = 0, |
| 53 | AdvancedPipelineProfile, |
| 54 | ExtremePipelineProfile, |
| 55 | }; |
| 56 | |
wujunkai166 | a84ba05 | 2015-09-08 15:54:12 +0800 | [diff] [blame] | 57 | enum CaptureStage { |
| 58 | BasicbayerStage, |
| 59 | TonemappingStage, |
| 60 | }; |
| 61 | |
wujunkai166 | 06f7762 | 2016-03-18 14:41:10 +0800 | [diff] [blame] | 62 | enum CLTonemappingMode { |
| 63 | WDRdisabled = 0, |
| 64 | Gaussian, |
| 65 | Haleq, |
| 66 | }; |
| 67 | |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 68 | public: |
| 69 | explicit CL3aImageProcessor (); |
| 70 | virtual ~CL3aImageProcessor (); |
| 71 | |
Wind Yuan | d281e24 | 2015-08-14 14:37:50 +0800 | [diff] [blame] | 72 | bool set_profile (PipelineProfile value); |
Wind Yuan | 7ddf260 | 2015-04-14 18:49:45 +0800 | [diff] [blame] | 73 | void set_stats_callback (const SmartPtr<StatsCallback> &callback); |
| 74 | |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 75 | bool set_output_format (uint32_t fourcc); |
wujunkai166 | a84ba05 | 2015-09-08 15:54:12 +0800 | [diff] [blame] | 76 | bool set_capture_stage (CaptureStage capture_stage); |
Wind Yuan | 4358431 | 2015-12-11 23:21:49 +0800 | [diff] [blame] | 77 | bool set_3a_stats_bits (uint32_t bits); |
Jia Meng | c66de80 | 2015-05-05 17:27:37 +0800 | [diff] [blame] | 78 | |
Jia Meng | c66de80 | 2015-05-05 17:27:37 +0800 | [diff] [blame] | 79 | virtual bool set_denoise (uint32_t mode); |
| 80 | virtual bool set_gamma (bool enable); |
Jia Meng | c66de80 | 2015-05-05 17:27:37 +0800 | [diff] [blame] | 81 | virtual bool set_macc (bool enable); |
zongwave | d7e1389 | 2015-05-20 11:19:04 +0800 | [diff] [blame] | 82 | virtual bool set_tnr (uint32_t mode, uint8_t level); |
wujunkai166 | 06f7762 | 2016-03-18 14:41:10 +0800 | [diff] [blame] | 83 | virtual bool set_tonemapping (CLTonemappingMode wdr_mode); |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 84 | |
Wind Yuan | d281e24 | 2015-08-14 14:37:50 +0800 | [diff] [blame] | 85 | PipelineProfile get_profile () const { |
| 86 | return _pipeline_profile; |
| 87 | } |
| 88 | |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 89 | protected: |
| 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 | |
| 96 | private: |
| 97 | virtual XCamReturn create_handlers (); |
Wind Yuan | 641a083 | 2016-02-27 00:36:20 +0800 | [diff] [blame] | 98 | |
| 99 | bool post_config (); |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 100 | XCAM_DEAD_COPY (CL3aImageProcessor); |
| 101 | |
| 102 | private: |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 103 | uint32_t _output_fourcc; |
Wind Yuan | 4358431 | 2015-12-11 23:21:49 +0800 | [diff] [blame] | 104 | uint32_t _3a_stats_bits; |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 105 | PipelineProfile _pipeline_profile; |
| 106 | CaptureStage _capture_stage; |
wujunkai166 | 06f7762 | 2016-03-18 14:41:10 +0800 | [diff] [blame] | 107 | CLTonemappingMode _wdr_mode; |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 108 | SmartPtr<StatsCallback> _stats_callback; |
yaowang1 | 6e05115 | 2015-08-14 13:49:03 +0800 | [diff] [blame] | 109 | SmartPtr<CLCscImageHandler> _csc; |
yaowang1 | 6e05115 | 2015-08-14 13:49:03 +0800 | [diff] [blame] | 110 | SmartPtr<CLTonemappingImageHandler> _tonemapping; |
wujunkai166 | b0bd551 | 2016-02-18 18:25:42 +0800 | [diff] [blame] | 111 | SmartPtr<CLNewTonemappingImageHandler> _newtonemapping; |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 112 | #if ENABLE_YEENR_HANDLER |
| 113 | SmartPtr<CLEeImageHandler> _ee; |
| 114 | #endif |
Juan Zhao | 0022d35 | 2015-05-07 07:18:09 +0000 | [diff] [blame] | 115 | |
Wind Yuan | 4b2a37a | 2015-07-21 17:27:58 +0800 | [diff] [blame] | 116 | // simple 3a bayer pipeline |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 117 | SmartPtr<CLBayerBasicImageHandler> _bayer_basic_pipe; |
| 118 | SmartPtr<CLBayerPipeImageHandler> _bayer_pipe; |
| 119 | SmartPtr<CLYuvPipeImageHandler> _yuv_pipe; |
Wind Yuan | 4b2a37a | 2015-07-21 17:27:58 +0800 | [diff] [blame] | 120 | |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 121 | uint32_t _tnr_mode; |
| 122 | bool _enable_gamma; |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 123 | bool _enable_macc; |
Wind Yuan | 4338bd2 | 2015-12-11 23:20:19 +0800 | [diff] [blame] | 124 | uint32_t _snr_mode; // spatial nr mode |
Wind Yuan | d50fde6 | 2015-03-25 17:43:49 +0800 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | }; |
Juan Zhao | ab5e6fe | 2015-04-08 14:12:46 +0800 | [diff] [blame] | 128 | #endif //XCAM_CL_3A_IMAGE_PROCESSOR_H |