• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * x3a_analyze_tuner.h - x3a Common IQ tuner
3  *
4  *  Copyright (c) 2014-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: Zong Wei <wei.zong@intel.com>
19  */
20 
21 #ifndef XCAM_3A_ANALYZE_TUNER_H
22 #define XCAM_3A_ANALYZE_TUNER_H
23 
24 namespace XCam {
25 
26 class X3aCiqTuningHandler;
27 class X3aAnalyzer;
28 
29 class X3aAnalyzeTuner
30     : public X3aAnalyzer
31     , public AnalyzerCallback
32 {
33     typedef std::list<SmartPtr<X3aCiqTuningHandler>> X3aCiqTuningHandlerList;
34 
35 public:
36     explicit X3aAnalyzeTuner ();
37     virtual ~X3aAnalyzeTuner ();
38 
39     void enable_handler ();
40     void set_analyzer (SmartPtr<X3aAnalyzer> &analyzer);
41 
42     XCamReturn analyze_ae (XCamAeParam &param);
43     XCamReturn analyze_awb (XCamAwbParam &param);
44     XCamReturn analyze_af (XCamAfParam &param);
45     XCamReturn analyze_common (XCamCommonParam &param);
46 
47 protected:
48     virtual SmartPtr<AeHandler> create_ae_handler ();
49     virtual SmartPtr<AwbHandler> create_awb_handler ();
50     virtual SmartPtr<AfHandler> create_af_handler ();
51     virtual SmartPtr<CommonHandler> create_common_handler ();
52 
53     virtual XCamReturn internal_init (uint32_t width, uint32_t height, double framerate);
54     virtual XCamReturn internal_deinit ();
55 
56     virtual XCamReturn configure_3a ();
57     virtual XCamReturn pre_3a_analyze (SmartPtr<X3aStats> &stats);
58     virtual XCamReturn post_3a_analyze (X3aResultList &results);
59 
60     // derive from AnalyzerCallback
61     virtual void x3a_calculation_done (XAnalyzer *analyzer, X3aResultList &results);
62 
63 private:
64     XCAM_DEAD_COPY (X3aAnalyzeTuner);
65 
66     XCamReturn create_tuning_handlers ();
67     bool add_handler (SmartPtr<X3aCiqTuningHandler> &handler);
68 
69 protected:
70 
71 private:
72     SmartPtr<X3aAnalyzer> _analyzer;
73     X3aCiqTuningHandlerList _handlers;
74     SmartPtr<X3aStats> _stats;
75     X3aResultList _results;
76 };
77 
78 class X3aCiqTuningAeHandler
79     : public AeHandler
80 {
81 public:
X3aCiqTuningAeHandler(X3aAnalyzeTuner * analyzer)82     explicit X3aCiqTuningAeHandler (X3aAnalyzeTuner *analyzer)
83         : _analyzer (analyzer)
84     {}
analyze(X3aResultList & output)85     virtual XCamReturn analyze (X3aResultList &output) {
86         XCAM_UNUSED (output);
87         AnalyzerHandler::HandlerLock lock(this);
88         XCamAeParam param = this->get_params_unlock ();
89         return _analyzer->analyze_ae (param);
90     }
91 
92 private:
93     X3aAnalyzeTuner *_analyzer;
94 };
95 
96 class X3aCiqTuningAwbHandler
97     : public AwbHandler
98 {
99 public:
X3aCiqTuningAwbHandler(X3aAnalyzeTuner * analyzer)100     explicit X3aCiqTuningAwbHandler (X3aAnalyzeTuner *analyzer)
101         : _analyzer (analyzer)
102     {}
analyze(X3aResultList & output)103     virtual XCamReturn analyze (X3aResultList &output) {
104         XCAM_UNUSED (output);
105         AnalyzerHandler::HandlerLock lock(this);
106         XCamAwbParam param = this->get_params_unlock ();
107         return _analyzer->analyze_awb (param);
108     }
109 
110 private:
111     X3aAnalyzeTuner *_analyzer;
112 };
113 
114 class X3aCiqTuningAfHandler
115     : public AfHandler
116 {
117 public:
X3aCiqTuningAfHandler(X3aAnalyzeTuner * analyzer)118     explicit X3aCiqTuningAfHandler (X3aAnalyzeTuner *analyzer)
119         : _analyzer (analyzer)
120     {}
analyze(X3aResultList & output)121     virtual XCamReturn analyze (X3aResultList &output) {
122         XCAM_UNUSED (output);
123         AnalyzerHandler::HandlerLock lock(this);
124         XCamAfParam param = this->get_params_unlock ();
125         return _analyzer->analyze_af (param);
126     }
127 
128 private:
129     X3aAnalyzeTuner *_analyzer;
130 };
131 
132 class X3aCiqTuningCommonHandler
133     : public CommonHandler
134 {
135 public:
X3aCiqTuningCommonHandler(X3aAnalyzeTuner * analyzer)136     explicit X3aCiqTuningCommonHandler (X3aAnalyzeTuner *analyzer)
137         : _analyzer (analyzer)
138     {}
analyze(X3aResultList & output)139     virtual XCamReturn analyze (X3aResultList &output) {
140         XCAM_UNUSED (output);
141         AnalyzerHandler::HandlerLock lock(this);
142         XCamCommonParam param = this->get_params_unlock ();
143         return _analyzer->analyze_common (param);
144     }
145 
146 private:
147     X3aAnalyzeTuner *_analyzer;
148 };
149 
150 };
151 #endif // XCAM_3A_ANALYZE_TUNER_H
152