• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * x3a_ciq_tuning_handler.cpp - x3a Common IQ tuning handler
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 #include "x3a_analyzer.h"
22 #include "x3a_ciq_tuning_handler.h"
23 
24 #define X3A_CIQ_CAMERA_ID   "IMX185"
25 
26 namespace XCam {
27 
X3aCiqTuningHandler(const char * name)28 X3aCiqTuningHandler::X3aCiqTuningHandler (const char *name)
29     : _tuning_data (NULL)
30     , _name (NULL)
31 {
32     if (name)
33         _name = strndup (name, XCAM_MAX_STR_SIZE);
34 }
35 
~X3aCiqTuningHandler()36 X3aCiqTuningHandler::~X3aCiqTuningHandler ()
37 {
38     if (_name)
39         xcam_free (_name);
40 }
41 
42 void
set_tuning_data(void * data)43 X3aCiqTuningHandler::set_tuning_data (void* data)
44 {
45     if (NULL != data) {
46         _tuning_data = data;
47     }
48 }
49 
50 void
set_ae_handler(SmartPtr<AeHandler> & handler)51 X3aCiqTuningHandler::set_ae_handler (SmartPtr<AeHandler> &handler)
52 {
53     if (!_ae_handler.ptr ()) {
54         _ae_handler = handler;
55     }
56 }
57 
58 void
set_awb_handler(SmartPtr<AwbHandler> & handler)59 X3aCiqTuningHandler::set_awb_handler (SmartPtr<AwbHandler> &handler)
60 {
61     if (!_awb_handler.ptr ()) {
62         _awb_handler = handler;
63     }
64 }
65 
66 double
get_max_analog_gain()67 X3aCiqTuningHandler::get_max_analog_gain()
68 {
69     AnalyzerHandler::HandlerLock lock(this);
70 
71     if (_ae_handler.ptr ()) {
72         return _ae_handler->get_max_analog_gain ();
73     }
74     return 0.0;
75 }
76 
77 double
get_current_analog_gain()78 X3aCiqTuningHandler::get_current_analog_gain ()
79 {
80     AnalyzerHandler::HandlerLock lock(this);
81 
82     if (_ae_handler.ptr ()) {
83         return _ae_handler->get_current_analog_gain ();
84     }
85     return 0.0;
86 }
87 
88 int64_t
get_current_exposure_time()89 X3aCiqTuningHandler::get_current_exposure_time ()
90 {
91     AnalyzerHandler::HandlerLock lock(this);
92 
93     if (_ae_handler.ptr ()) {
94         return _ae_handler->get_current_exposure_time ();
95     }
96     return 0.0;
97 }
98 
99 uint32_t
get_current_estimate_cct()100 X3aCiqTuningHandler::get_current_estimate_cct ()
101 {
102     AnalyzerHandler::HandlerLock lock(this);
103 
104     if (_awb_handler.ptr ()) {
105         return _awb_handler->get_current_estimate_cct ();
106     }
107     return 0;
108 }
109 
110 };
111