1 /*
2  * hybrid_analyzer.h - hybrid analyzer
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: Jia Meng <jia.meng@intel.com>
19  */
20 
21 #ifndef XCAM_HYBRID_ANALYZER_H
22 #define XCAM_HYBRID_ANALYZER_H
23 
24 #include "dynamic_analyzer.h"
25 #include "hybrid_analyzer_loader.h"
26 
27 namespace XCam {
28 class IspController;
29 class X3aAnalyzerAiq;
30 class X3aStatisticsQueue;
31 class X3aIspStatistics;
32 
33 class HybridAnalyzer
34     : public DynamicAnalyzer
35     , public AnalyzerCallback
36 {
37 public:
38     explicit HybridAnalyzer (XCam3ADescription *desc,
39                              SmartPtr<AnalyzerLoader> &loader,
40                              SmartPtr<IspController> &isp,
41                              const char *cpf_path);
42     ~HybridAnalyzer ();
43 
44     virtual XCamReturn analyze_ae (XCamAeParam &param);
45     virtual XCamReturn analyze_awb (XCamAwbParam &param);
46     virtual XCamReturn analyze_af (XCamAfParam &param);
47 
48     virtual void x3a_calculation_done (XAnalyzer *analyzer, X3aResultList &results);
49     virtual void x3a_calculation_failed (XAnalyzer *analyzer, int64_t timestamp, const char *msg);
50 
51 protected:
52     virtual XCamReturn internal_init (uint32_t width, uint32_t height, double framerate);
53     virtual XCamReturn internal_deinit ();
54 
55     virtual XCamReturn configure_3a ();
56     virtual XCamReturn pre_3a_analyze (SmartPtr<X3aStats> &stats);
57     virtual XCamReturn post_3a_analyze (X3aResultList &results);
58 
59 private:
60     XCAM_DEAD_COPY (HybridAnalyzer);
61     XCamReturn setup_stats_pool (const XCam3AStats *stats);
62     SmartPtr<X3aIspStatistics> convert_to_isp_stats (SmartPtr<X3aStats>& stats);
63 
64     SmartPtr<IspController>       _isp;
65     const char                    *_cpf_path;
66     SmartPtr<X3aAnalyzerAiq>      _analyzer_aiq;
67     SmartPtr<X3aStatisticsQueue>  _stats_pool;
68 };
69 
70 }
71 
72 #endif //XCAM_HYBRID_ANALYZER_H
73