1 /* 2 * xcam_3a_result.h - 3A result interface 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: Wind Yuan <feng.yuan (at) intel.com> 19 * Zong Wei <wei.zong (at) intel.com> 20 */ 21 22 #ifndef C_XCAM_3A_RESULT_H 23 #define C_XCAM_3A_RESULT_H 24 25 #include <stdlib.h> 26 #include <stdint.h> 27 #include <stddef.h> 28 #include <base/xcam_defs.h> 29 30 XCAM_BEGIN_DECLARE 31 32 #define XCAM_3A_MAX_RESULT_COUNT 256 33 #define xcam_3a_result_type(result) (((XCam3aResultHead*)result)->type) 34 35 typedef enum _ImageProcessType { 36 XCAM_IMAGE_PROCESS_ONCE, 37 XCAM_IMAGE_PROCESS_ALWAYS, 38 XCAM_IMAGE_PROCESS_POST, 39 } XCamImageProcessType; 40 41 typedef enum _XCam3aResultType { 42 XCAM_3A_RESULT_NULL = 0, 43 /* White Balance */ 44 XCAM_3A_RESULT_WHITE_BALANCE, 45 XCAM_3A_RESULT_BLACK_LEVEL, 46 XCAM_3A_RESULT_YUV2RGB_MATRIX, 47 XCAM_3A_RESULT_RGB2YUV_MATRIX, 48 49 /* Exposure */ 50 XCAM_3A_RESULT_EXPOSURE, 51 52 /* Focus */ 53 XCAM_3A_RESULT_FOCUS, 54 55 XCAM_3A_RESULT_DEMOSAIC, 56 //XCAM_3A_RESULT_EIGEN_COLOR_DEMOSAICING, 57 XCAM_3A_RESULT_DEFECT_PIXEL_CORRECTION, 58 59 /* noise reduction */ 60 XCAM_3A_RESULT_NOISE_REDUCTION, 61 XCAM_3A_RESULT_3D_NOISE_REDUCTION, 62 XCAM_3A_RESULT_TEMPORAL_NOISE_REDUCTION_YUV, 63 XCAM_3A_RESULT_LUMA_NOISE_REDUCTION, 64 XCAM_3A_RESULT_ADVANCED_NOISE_REDUCTION, 65 XCAM_3A_RESULT_CHROMA_NOISER_EDUCTION, 66 XCAM_3A_RESULT_BAYER_NOISE_REDUCTION, 67 XCAM_3A_RESULT_WAVELET_NOISE_REDUCTION, 68 69 XCAM_3A_RESULT_EDGE_ENHANCEMENT, 70 //XCAM_3A_RESULT_FRIGLE_CONTROL, 71 XCAM_3A_RESULT_MACC, 72 //XCAM_3A_RESULT_MACCTABLE, 73 XCAM_3A_RESULT_CHROMA_TONE_CONTROL, 74 //XCAM_3A_RESULT_CHROMATONECONTROLTABLE, 75 XCAM_3A_RESULT_CHROMA_ENHANCEMENT, 76 XCAM_3A_RESULT_Y_GAMMA, 77 XCAM_3A_RESULT_R_GAMMA, 78 XCAM_3A_RESULT_G_GAMMA, 79 XCAM_3A_RESULT_B_GAMMA, 80 XCAM_3A_RESULT_BRIGHTNESS, 81 //XCAM_3A_RESULT_SHADING_TABLE, 82 83 //Smart Analysis Type 84 XCAM_3A_RESULT_FACE_DETECTION = 0x4000, 85 XCAM_3A_RESULT_DVS, 86 87 XCAM_3A_RESULT_USER_DEFINED_TYPE = 0x8000, 88 } XCam3aResultType; 89 90 /* matrix size 3x3 */ 91 #define XCAM_COLOR_MATRIX_SIZE 9 92 #define XCAM_GAMMA_TABLE_SIZE 256 93 #define XCAM_CHROMA_AXIS_SIZE 16 94 #define XCAM_CHROMA_MATRIX_SIZE 4 95 #define XCAM_BNR_TABLE_SIZE 64 96 97 typedef struct _XCam3aResultHead XCam3aResultHead; 98 99 struct _XCam3aResultHead { 100 XCam3aResultType type; 101 XCamImageProcessType process_type; 102 uint32_t version; 103 void (*destroy) (XCam3aResultHead *); 104 }; 105 106 typedef struct _XCam3aResultWhiteBalance { 107 XCam3aResultHead head; 108 109 /* data */ 110 double r_gain; 111 double gr_gain; 112 double gb_gain; 113 double b_gain; 114 } XCam3aResultWhiteBalance; 115 116 typedef struct _XCam3aResultBlackLevel { 117 XCam3aResultHead head; 118 119 /* data */ 120 double r_level; 121 double gr_level; 122 double gb_level; 123 double b_level; 124 } XCam3aResultBlackLevel; 125 126 typedef struct _XCam3aResultColorMatrix { 127 XCam3aResultHead head; 128 129 /* data */ 130 double matrix [XCAM_COLOR_MATRIX_SIZE]; 131 } XCam3aResultColorMatrix; 132 133 typedef struct _XCam3aResultExposure { 134 XCam3aResultHead head; 135 136 /* data */ 137 int32_t exposure_time; //in micro seconds 138 double analog_gain; // multipler 139 double digital_gain; // multipler 140 double aperture; //fn 141 } XCam3aResultExposure; 142 143 typedef struct _XCam3aResultFocus { 144 XCam3aResultHead head; 145 146 /* data */ 147 int32_t position; 148 } XCam3aResultFocus; 149 150 typedef struct _XCam3aResultDemosaic { 151 XCam3aResultHead head; 152 153 /* data */ 154 double noise; 155 double threshold_cr; 156 double threshold_cb; 157 } XCam3aResultDemosaic; 158 159 160 /* DefectPixel Correction */ 161 typedef struct _XCam3aResultDefectPixel { 162 XCam3aResultHead head; 163 164 /* data */ 165 double gain; 166 double gr_threshold; 167 double r_threshold; 168 double b_threshold; 169 double gb_threshold; 170 } XCam3aResultDefectPixel; 171 172 typedef struct _XCam3aResultNoiseReduction { 173 XCam3aResultHead head; 174 175 /* data */ 176 double gain; 177 double threshold1; 178 double threshold2; 179 } XCam3aResultNoiseReduction; 180 181 typedef struct _XCam3aResultBayerNoiseReduction { 182 XCam3aResultHead head; 183 184 /* data */ 185 double bnr_gain; 186 double direction; 187 double table[XCAM_BNR_TABLE_SIZE]; 188 } XCam3aResultBayerNoiseReduction; 189 190 typedef struct _XCam3aResultEdgeEnhancement { 191 XCam3aResultHead head; 192 193 /* data */ 194 double gain; 195 double threshold; 196 } XCam3aResultEdgeEnhancement; 197 198 typedef struct _XCam3aResultGammaTable { 199 XCam3aResultHead head; 200 201 /* data */ 202 double table[XCAM_GAMMA_TABLE_SIZE]; 203 } XCam3aResultGammaTable; 204 205 typedef struct _XCam3aResultMaccMatrix { 206 XCam3aResultHead head; 207 208 /* data */ 209 double table[XCAM_CHROMA_AXIS_SIZE * XCAM_CHROMA_MATRIX_SIZE]; 210 } XCam3aResultMaccMatrix; 211 212 typedef struct _XCam3aResultChromaToneControl { 213 XCam3aResultHead head; 214 215 /* data */ 216 double uv_gain [XCAM_GAMMA_TABLE_SIZE]; // according to Y 217 } XCam3aResultChromaToneControl; 218 219 typedef struct _XCam3aResultBrightness { 220 XCam3aResultHead head; 221 222 /* data */ 223 double brightness_level; // range [-1,1], -1 is full dark , 0 is normal val, 1 is full bright 224 } XCam3aResultBrightness; 225 226 typedef struct _XCam3aResultTemporalNoiseReduction { 227 XCam3aResultHead head; 228 229 /* data */ 230 double gain; 231 double threshold[3]; 232 } XCam3aResultTemporalNoiseReduction; 233 234 typedef struct _XCam3aResultWaveletNoiseReduction { 235 XCam3aResultHead head; 236 237 /* data */ 238 uint8_t decomposition_levels; 239 double threshold[2]; /* [0]:soft threshold / [1]:hard threshold */ 240 double analog_gain; 241 } XCam3aResultWaveletNoiseReduction; 242 243 XCAM_END_DECLARE 244 245 #endif 246