Home | History | Annotate | Download | only in iq
      1 /*
      2  * x3a_ciq_tuning_handler.h - 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 (at) intel.com>
     19  */
     20 
     21 #ifndef XCAM_3A_CIQ_TUNING_HANDLER_H
     22 #define XCAM_3A_CIQ_TUNING_HANDLER_H
     23 
     24 #include "handler_interface.h"
     25 
     26 namespace XCam {
     27 
     28 #define X3A_CIQ_PIXEL_DEPTH 10
     29 
     30 #define X3A_CIQ_EXPOSURE_TIME_STEPS  4 //Number of Exposure Time steps
     31 #define X3A_CIQ_EXPOSURE_TIME_MAX    40000 //Max ET in microseconds (40ms)
     32 #define X3A_CIQ_EXPOSURE_TIME_TICK   (X3A_CIQ_EXPOSURE_TIME_MAX / X3A_CIQ_EXPOSURE_TIME_STEPS)
     33 
     34 #define X3A_CIQ_EE_GAIN_STEPS 6 //Number of EE Gain steps
     35 #define X3A_CIQ_GAIN_STEPS 5 //Number of Gain steps
     36 #define X3A_CIQ_GAIN_MAX   249 //Max Gain
     37 
     38 #define X3A_CIQ_LSC_LUT_WIDTH    16
     39 #define X3A_CIQ_LSC_LUT_HEIGHT   9
     40 #define X3A_CIQ_LSC_LUT_SIZE    (16 * 9)
     41 
     42 typedef enum _X3aCiqBayerOrder {
     43     X3A_CIQ_RGrGbB = 0,
     44     X3A_CIQ_GrRBGb = 1,
     45     X3A_CIQ_GbBRGr = 2,
     46     X3A_CIQ_BGbGrR = 3,
     47 } X3aCiqBayerOrder;
     48 
     49 typedef enum _X3aCiqCIEIlluminants {
     50     X3A_CIQ_ILLUMINANT_HALO = 0,  // Incandescent / Tungsten
     51     X3A_CIQ_ILLUMINANT_F2 =   1,    // Cool White Fluorescent
     52     X3A_CIQ_ILLUMINANT_F11 =  2,   // Philips TL84
     53     X3A_CIQ_ILLUMINANT_D50 =  3,   // Horizon Light
     54     X3A_CIQ_ILLUMINANT_D65 =  4,   // Noon Daylight
     55     X3A_CIQ_ILLUMINANT_D75 =  5,   // North sky Daylight
     56     X3A_CIQ_ILLUMINANT_COUNT
     57 } X3aCiqCIEIlluminants;
     58 
     59 typedef struct _X3aCiqCIEIlluminantsTable
     60 {
     61     X3aCiqCIEIlluminants CIEIlluminantIndex;
     62     uint16_t CCT;
     63 } X3aCiqCIEIlluminantsTable;
     64 
     65 static const X3aCiqCIEIlluminantsTable X3a_Ciq_illuminants_table[X3A_CIQ_ILLUMINANT_COUNT] =
     66 {
     67     {X3A_CIQ_ILLUMINANT_HALO, 2100},
     68     {X3A_CIQ_ILLUMINANT_F2, 3000},
     69     {X3A_CIQ_ILLUMINANT_F11, 4051},
     70     {X3A_CIQ_ILLUMINANT_D50, 5000},
     71     {X3A_CIQ_ILLUMINANT_D65, 6500},
     72     {X3A_CIQ_ILLUMINANT_D75, 7500},
     73 };
     74 
     75 class X3aCiqTuningHandler
     76     : public AnalyzerHandler
     77 {
     78 public:
     79     explicit X3aCiqTuningHandler (const char *name = NULL);
     80     virtual ~X3aCiqTuningHandler ();
     81 
     82     void set_tuning_data (void* data);
     83     void set_ae_handler (SmartPtr<AeHandler> &handler);
     84     void set_awb_handler (SmartPtr<AwbHandler> &handler);
     85 
     86     double get_max_analog_gain ();
     87     double get_current_analog_gain ();
     88     int64_t get_current_exposure_time ();
     89     uint32_t get_current_estimate_cct ();
     90 
     91 private:
     92     XCAM_DEAD_COPY (X3aCiqTuningHandler);
     93 
     94 protected:
     95     const void           *_tuning_data;
     96 
     97 private:
     98     char                 *_name;
     99     SmartPtr<AeHandler>   _ae_handler;
    100     SmartPtr<AwbHandler>  _awb_handler;
    101 };
    102 
    103 };
    104 
    105 #endif // XCAM_3A_CIQ_TUNING_HANDLER_H
    106