1 /* 2 * Copyright (C) Texas Instruments - http://www.ti.com/ 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @file General3A_Settings.h 19 * 20 * This file maps the Camera Hardware Interface to OMX. 21 * 22 */ 23 24 #include "OMX_TI_IVCommon.h" 25 #include "OMX_TI_Common.h" 26 #include "OMX_TI_Index.h" 27 #include "TICameraParameters.h" 28 29 #ifndef GENERAL_3A_SETTINGS_H 30 #define GENERAL_3A_SETTINGS_H 31 32 #define FOCUS_FACE_PRIORITY OMX_IMAGE_FocusControlMax -1 33 #define FOCUS_REGION_PRIORITY OMX_IMAGE_FocusControlMax -2 34 #define WB_FACE_PRIORITY OMX_WhiteBalControlMax -1 35 #define EXPOSURE_FACE_PRIORITY OMX_ExposureControlMax - 1 36 37 namespace android { 38 39 struct userToOMX_LUT{ 40 const char * userDefinition; 41 int omxDefinition; 42 }; 43 44 struct LUTtype{ 45 int size; 46 const userToOMX_LUT *Table; 47 }; 48 49 const userToOMX_LUT isoUserToOMX[] = { 50 { TICameraParameters::ISO_MODE_AUTO, 0 }, 51 { TICameraParameters::ISO_MODE_100, 100 }, 52 { TICameraParameters::ISO_MODE_200, 200 }, 53 { TICameraParameters::ISO_MODE_400, 400 }, 54 { TICameraParameters::ISO_MODE_800, 800 }, 55 { TICameraParameters::ISO_MODE_1000, 1000 }, 56 { TICameraParameters::ISO_MODE_1200, 1200 }, 57 { TICameraParameters::ISO_MODE_1600, 1600 }, 58 }; 59 60 const userToOMX_LUT effects_UserToOMX [] = { 61 { CameraParameters::EFFECT_NONE, OMX_ImageFilterNone }, 62 { CameraParameters::EFFECT_NEGATIVE, OMX_ImageFilterNegative }, 63 { CameraParameters::EFFECT_SOLARIZE, OMX_ImageFilterSolarize }, 64 { CameraParameters::EFFECT_SEPIA, OMX_ImageFilterSepia }, 65 { CameraParameters::EFFECT_MONO, OMX_ImageFilterGrayScale }, 66 { CameraParameters::EFFECT_BLACKBOARD, OMX_TI_ImageFilterBlackBoard }, 67 { CameraParameters::EFFECT_WHITEBOARD, OMX_TI_ImageFilterWhiteBoard }, 68 { CameraParameters::EFFECT_AQUA, OMX_TI_ImageFilterAqua }, 69 { CameraParameters::EFFECT_POSTERIZE, OMX_TI_ImageFilterPosterize }, 70 #ifdef OMAP_ENHANCEMENT 71 { TICameraParameters::EFFECT_NATURAL, OMX_ImageFilterNatural }, 72 { TICameraParameters::EFFECT_VIVID, OMX_ImageFilterVivid }, 73 { TICameraParameters::EFFECT_COLOR_SWAP, OMX_ImageFilterColourSwap }, 74 { TICameraParameters::EFFECT_BLACKWHITE, OMX_TI_ImageFilterBlackWhite } 75 #endif 76 }; 77 78 const userToOMX_LUT scene_UserToOMX [] = { 79 { CameraParameters::SCENE_MODE_AUTO, OMX_Manual }, 80 { CameraParameters::SCENE_MODE_ACTION, OMX_TI_Action }, 81 { CameraParameters::SCENE_MODE_NIGHT, OMX_TI_Night }, 82 { CameraParameters::SCENE_MODE_PARTY, OMX_TI_Party }, 83 { CameraParameters::SCENE_MODE_SUNSET, OMX_TI_Sunset }, 84 /*********** TODO: These scene modes are not verified. ************ 85 ***************** Have to verify and reeable later. ************** 86 { CameraParameters::SCENE_MODE_THEATRE, OMX_TI_Theatre }, 87 { CameraParameters::SCENE_MODE_LANDSCAPE, OMX_Landscape }, 88 { CameraParameters::SCENE_MODE_NIGHT_PORTRAIT, OMX_NightPortrait }, 89 { CameraParameters::SCENE_MODE_FIREWORKS, OMX_Fireworks }, 90 { CameraParameters::SCENE_MODE_BEACH, OMX_TI_Beach }, 91 { CameraParameters::SCENE_MODE_CANDLELIGHT, OMX_TI_Candlelight }, 92 { CameraParameters::SCENE_MODE_PORTRAIT, OMX_TI_Portrait }, 93 { CameraParameters::SCENE_MODE_SNOW, OMX_TI_Snow }, 94 { CameraParameters::SCENE_MODE_STEADYPHOTO, OMX_TI_Steadyphoto }, 95 *********************************************************************/ 96 #ifdef OMAP_ENHANCEMENT 97 { TICameraParameters::SCENE_MODE_CLOSEUP, OMX_Closeup }, 98 { TICameraParameters::SCENE_MODE_AQUA, OMX_Underwater }, 99 { TICameraParameters::SCENE_MODE_SPORT, OMX_Sport }, 100 { TICameraParameters::SCENE_MODE_MOOD, OMX_Mood }, 101 { TICameraParameters::SCENE_MODE_NIGHT_INDOOR, OMX_NightIndoor }, 102 { TICameraParameters::SCENE_MODE_DOCUMENT, OMX_Document }, 103 { TICameraParameters::SCENE_MODE_BARCODE, OMX_Barcode }, 104 { TICameraParameters::SCENE_MODE_VIDEO_SUPER_NIGHT, OMX_SuperNight }, 105 { TICameraParameters::SCENE_MODE_VIDEO_CINE, OMX_Cine }, 106 { TICameraParameters::SCENE_MODE_VIDEO_OLD_FILM, OMX_OldFilm }, 107 #endif 108 }; 109 110 const userToOMX_LUT whiteBal_UserToOMX [] = { 111 { CameraParameters::WHITE_BALANCE_AUTO, OMX_WhiteBalControlAuto }, 112 { CameraParameters::WHITE_BALANCE_DAYLIGHT, OMX_WhiteBalControlSunLight }, 113 { CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT, OMX_WhiteBalControlCloudy }, 114 { CameraParameters::WHITE_BALANCE_FLUORESCENT, OMX_WhiteBalControlFluorescent }, 115 { CameraParameters::WHITE_BALANCE_INCANDESCENT, OMX_WhiteBalControlIncandescent }, 116 /********************** THESE ARE CURRENT NOT TUNED PROPERLY ************************* 117 { CameraParameters::WHITE_BALANCE_SHADE, OMX_TI_WhiteBalControlShade }, 118 { CameraParameters::WHITE_BALANCE_TWILIGHT, OMX_TI_WhiteBalControlTwilight }, 119 { CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT, OMX_TI_WhiteBalControlWarmFluorescent }, 120 **************************************************************************************/ 121 #ifdef OMAP_ENHANCEMENT 122 { TICameraParameters::WHITE_BALANCE_TUNGSTEN, OMX_WhiteBalControlTungsten }, 123 { TICameraParameters::WHITE_BALANCE_HORIZON, OMX_WhiteBalControlHorizon }, 124 { TICameraParameters::WHITE_BALANCE_FACE, WB_FACE_PRIORITY }, 125 { TICameraParameters::WHITE_BALANCE_SUNSET, OMX_TI_WhiteBalControlSunset } 126 #endif 127 }; 128 129 const userToOMX_LUT antibanding_UserToOMX [] = { 130 { CameraParameters::ANTIBANDING_OFF, OMX_FlickerCancelOff }, 131 { CameraParameters::ANTIBANDING_AUTO, OMX_FlickerCancelAuto }, 132 { CameraParameters::ANTIBANDING_50HZ, OMX_FlickerCancel50 }, 133 { CameraParameters::ANTIBANDING_60HZ, OMX_FlickerCancel60 } 134 }; 135 136 const userToOMX_LUT focus_UserToOMX [] = { 137 { CameraParameters::FOCUS_MODE_AUTO, OMX_IMAGE_FocusControlAutoLock }, 138 { CameraParameters::FOCUS_MODE_INFINITY, OMX_IMAGE_FocusControlAutoInfinity }, 139 { CameraParameters::FOCUS_MODE_INFINITY, OMX_IMAGE_FocusControlHyperfocal }, 140 { CameraParameters::FOCUS_MODE_MACRO, OMX_IMAGE_FocusControlAutoMacro }, 141 { CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO, OMX_IMAGE_FocusControlAuto }, 142 { CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE, OMX_IMAGE_FocusControlAuto }, 143 #ifdef OMAP_ENHANCEMENT 144 { TICameraParameters::FOCUS_MODE_FACE , FOCUS_FACE_PRIORITY }, 145 { TICameraParameters::FOCUS_MODE_PORTRAIT, OMX_IMAGE_FocusControlPortrait }, 146 { TICameraParameters::FOCUS_MODE_EXTENDED, OMX_IMAGE_FocusControlExtended }, 147 #endif 148 }; 149 150 const userToOMX_LUT exposure_UserToOMX [] = { 151 { TICameraParameters::EXPOSURE_MODE_OFF, OMX_ExposureControlOff }, 152 { TICameraParameters::EXPOSURE_MODE_AUTO, OMX_ExposureControlAuto }, 153 { TICameraParameters::EXPOSURE_MODE_NIGHT, OMX_ExposureControlNight }, 154 { TICameraParameters::EXPOSURE_MODE_BACKLIGHT, OMX_ExposureControlBackLight }, 155 { TICameraParameters::EXPOSURE_MODE_SPOTLIGHT, OMX_ExposureControlSpotLight}, 156 { TICameraParameters::EXPOSURE_MODE_SPORTS, OMX_ExposureControlSports }, 157 { TICameraParameters::EXPOSURE_MODE_SNOW, OMX_ExposureControlSnow }, 158 { TICameraParameters::EXPOSURE_MODE_BEACH, OMX_ExposureControlBeach }, 159 { TICameraParameters::EXPOSURE_MODE_APERTURE, OMX_ExposureControlLargeAperture }, 160 { TICameraParameters::EXPOSURE_MODE_SMALL_APERTURE, OMX_ExposureControlSmallApperture }, 161 { TICameraParameters::EXPOSURE_MODE_FACE, EXPOSURE_FACE_PRIORITY }, 162 }; 163 164 const userToOMX_LUT flash_UserToOMX [] = { 165 { CameraParameters::FLASH_MODE_OFF ,OMX_IMAGE_FlashControlOff }, 166 { CameraParameters::FLASH_MODE_ON ,OMX_IMAGE_FlashControlOn }, 167 { CameraParameters::FLASH_MODE_AUTO ,OMX_IMAGE_FlashControlAuto }, 168 { CameraParameters::FLASH_MODE_TORCH ,OMX_IMAGE_FlashControlTorch }, 169 { CameraParameters::FLASH_MODE_RED_EYE ,OMX_IMAGE_FlashControlRedEyeReduction }, 170 #ifdef OMAP_ENHANCEMENT 171 { TICameraParameters::FLASH_MODE_FILL_IN ,OMX_IMAGE_FlashControlFillin } 172 #endif 173 }; 174 175 const LUTtype ExpLUT = 176 { 177 sizeof(exposure_UserToOMX)/sizeof(exposure_UserToOMX[0]), 178 exposure_UserToOMX 179 }; 180 181 const LUTtype WBalLUT = 182 { 183 sizeof(whiteBal_UserToOMX)/sizeof(whiteBal_UserToOMX[0]), 184 whiteBal_UserToOMX 185 }; 186 187 const LUTtype FlickerLUT = 188 { 189 sizeof(antibanding_UserToOMX)/sizeof(antibanding_UserToOMX[0]), 190 antibanding_UserToOMX 191 }; 192 193 const LUTtype SceneLUT = 194 { 195 sizeof(scene_UserToOMX)/sizeof(scene_UserToOMX[0]), 196 scene_UserToOMX 197 }; 198 199 const LUTtype FlashLUT = 200 { 201 sizeof(flash_UserToOMX)/sizeof(flash_UserToOMX[0]), 202 flash_UserToOMX 203 }; 204 205 const LUTtype EffLUT = 206 { 207 sizeof(effects_UserToOMX)/sizeof(effects_UserToOMX[0]), 208 effects_UserToOMX 209 }; 210 211 const LUTtype FocusLUT = 212 { 213 sizeof(focus_UserToOMX)/sizeof(focus_UserToOMX[0]), 214 focus_UserToOMX 215 }; 216 217 const LUTtype IsoLUT = 218 { 219 sizeof(isoUserToOMX)/sizeof(isoUserToOMX[0]), 220 isoUserToOMX 221 }; 222 223 /* 224 * class Gen3A_settings 225 * stores the 3A settings 226 * also defines the look up tables 227 * for mapping settings from Hal to OMX 228 */ 229 class Gen3A_settings{ 230 public: 231 232 int Exposure; 233 int WhiteBallance; 234 int Flicker; 235 int SceneMode; 236 int Effect; 237 int Focus; 238 int EVCompensation; 239 int Contrast; 240 int Saturation; 241 int Sharpness; 242 int ISO; 243 int FlashMode; 244 245 unsigned int Brightness; 246 OMX_BOOL ExposureLock; 247 OMX_BOOL FocusLock; 248 OMX_BOOL WhiteBalanceLock; 249 }; 250 251 /* 252 * Flags raised when a setting is changed 253 */ 254 enum E3ASettingsFlags 255 { 256 SetSceneMode = 1 << 0, 257 SetEVCompensation = 1 << 1, 258 SetWhiteBallance = 1 << 2, 259 SetFlicker = 1 << 3, 260 SetExposure = 1 << 4, 261 SetSharpness = 1 << 5, 262 SetBrightness = 1 << 6, 263 SetContrast = 1 << 7, 264 SetISO = 1 << 8, 265 SetSaturation = 1 << 9, 266 SetEffect = 1 << 10, 267 SetFocus = 1 << 11, 268 SetExpMode = 1 << 14, 269 SetFlash = 1 << 15, 270 SetExpLock = 1 << 16, 271 SetWBLock = 1 << 17, 272 SetMeteringAreas = 1 << 18, 273 274 E3aSettingMax, 275 E3AsettingsAll = ( ((E3aSettingMax -1 ) << 1) -1 ) /// all possible flags raised 276 }; 277 278 }; 279 280 #endif //GENERAL_3A_SETTINGS_H 281