| 1 | /****************************************************************************** |
|---|
| 2 | *_Copyright (c) 2009 Digital Stream Technology Inc. All Rights Reserved. |
|---|
| 3 | * |
|---|
| 4 | * Module: dsthalpic.c |
|---|
| 5 | * |
|---|
| 6 | * Description |
|---|
| 7 | * |
|---|
| 8 | * Notes |
|---|
| 9 | * |
|---|
| 10 | * @author Junku Park (hwatk@dstreamtech.com) |
|---|
| 11 | * @version $Revision: 1.1 $ |
|---|
| 12 | * |
|---|
| 13 | ******************************************************************************/ |
|---|
| 14 | |
|---|
| 15 | #include <stdlib.h> |
|---|
| 16 | #include <string.h> |
|---|
| 17 | |
|---|
| 18 | #include "dsthalcommon.h" |
|---|
| 19 | #include "dsthallocal.h" |
|---|
| 20 | #include "dstddsys.h" |
|---|
| 21 | #include "dstddpic.h" |
|---|
| 22 | |
|---|
| 23 | /****************************************************************************** |
|---|
| 24 | * Global variable declaration |
|---|
| 25 | ******************************************************************************/ |
|---|
| 26 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 27 | // Picture Configuration |
|---|
| 28 | // |
|---|
| 29 | // g_CurPicConfig: Current Picture Configuration |
|---|
| 30 | // g_NextPicConfig: Will be applied on next capture stop/start. |
|---|
| 31 | // g_DefaultPicConfig |
|---|
| 32 | // |
|---|
| 33 | ////////////////////////////////////////////////////////////////////////////// |
|---|
| 34 | PIC_CONFIG_t g_CurPicConfig, g_NextPicConfig; |
|---|
| 35 | PIC_CONFIG_t g_CurPicConfigPIP, g_NextPicConfigPIP; |
|---|
| 36 | PIC_CONFIG_t g_DefaultPicConfig = { |
|---|
| 37 | // Picture Parameters |
|---|
| 38 | { 50, 455, 50, 0, 50 }, |
|---|
| 39 | // Extended Picture Parameters |
|---|
| 40 | { |
|---|
| 41 | ColorTemp: 0, |
|---|
| 42 | NR: 0, |
|---|
| 43 | ColorSystem: 0, |
|---|
| 44 | BlackExtension: 1, |
|---|
| 45 | WhiteExtension: 0, |
|---|
| 46 | BlueStretch: 0, |
|---|
| 47 | APL: 0, |
|---|
| 48 | DCI: 0, |
|---|
| 49 | ACR: 0, |
|---|
| 50 | ColorMgmt: 0, |
|---|
| 51 | MpegNR: 0, |
|---|
| 52 | RCont: 0x100, |
|---|
| 53 | GCont: 0x100, |
|---|
| 54 | BCont: 0xE6, |
|---|
| 55 | BlackExtVal: 3, |
|---|
| 56 | WhiteExtVal: 3, |
|---|
| 57 | BlackLevel: 0x44, |
|---|
| 58 | SubContrast: 0x93 |
|---|
| 59 | }, |
|---|
| 60 | }; |
|---|
| 61 | |
|---|
| 62 | PIC_CONFIG_t g_DefaultPicConfigPIP = { |
|---|
| 63 | // Picture Parameters |
|---|
| 64 | { 50, 255, 22, 0, 25 }, |
|---|
| 65 | // Extended Picture Parameters |
|---|
| 66 | { |
|---|
| 67 | ColorTemp: 0, |
|---|
| 68 | NR: 0, |
|---|
| 69 | ColorSystem: 0, |
|---|
| 70 | BlackExtension: 0, |
|---|
| 71 | WhiteExtension: 0, |
|---|
| 72 | BlueStretch: 0, |
|---|
| 73 | APL: 0, |
|---|
| 74 | DCI: 0, |
|---|
| 75 | ACR: 0, |
|---|
| 76 | ColorMgmt: 0, |
|---|
| 77 | MpegNR: 0, |
|---|
| 78 | RCont: 0x100, |
|---|
| 79 | GCont: 0x100, |
|---|
| 80 | BCont: 0xE6, |
|---|
| 81 | BlackExtVal: 3, |
|---|
| 82 | WhiteExtVal: 3, |
|---|
| 83 | BlackLevel: 0x44, |
|---|
| 84 | SubContrast: 0x93 |
|---|
| 85 | }, |
|---|
| 86 | }; |
|---|
| 87 | |
|---|
| 88 | /****************************************************************************** |
|---|
| 89 | * Imported variable declaration |
|---|
| 90 | ******************************************************************************/ |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | /****************************************************************************** |
|---|
| 94 | * Imported function declaration |
|---|
| 95 | ******************************************************************************/ |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | /****************************************************************************** |
|---|
| 99 | * Local definitions |
|---|
| 100 | ******************************************************************************/ |
|---|
| 101 | #define PIC_PARAM_ACTUAL_READ 0 // ½ÇÁ¦ °ªÀ» ÀÐ¾î¼ °è»êÇÒ °ÍÀÎÁö ¿©ºÎ. |
|---|
| 102 | |
|---|
| 103 | /****************************************************************************** |
|---|
| 104 | * Local typedefs |
|---|
| 105 | ******************************************************************************/ |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | /****************************************************************************** |
|---|
| 109 | * Local variables declaration |
|---|
| 110 | ******************************************************************************/ |
|---|
| 111 | static int g_NextPicConfigFlag = 0; |
|---|
| 112 | static int g_NextPicConfigFlagPIP = 0; |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | /****************************************************************************** |
|---|
| 116 | * Local function prototypes |
|---|
| 117 | ******************************************************************************/ |
|---|
| 118 | |
|---|
| 119 | #if 0 |
|---|
| 120 | ___Pictue_Parameter_Functions___() |
|---|
| 121 | #endif |
|---|
| 122 | /**************************************************************************** |
|---|
| 123 | * |
|---|
| 124 | * Picture Tuning Range |
|---|
| 125 | * |
|---|
| 126 | * - Sharpness 0 ~ 100 (Default: 50) |
|---|
| 127 | * - Contrast 0 ~ 100 (Default: 50) |
|---|
| 128 | * - Brightness 0 ~ 100 (Default: 50) |
|---|
| 129 | * - Saturation (Color) 0 ~ 100 (Default: 50) |
|---|
| 130 | * - Tint (Hue) -50 ~ +50 (Default: 0) |
|---|
| 131 | * |
|---|
| 132 | ***************************************************************************/ |
|---|
| 133 | DHL_RESULT DHL_PIC_PresetParams(P_PIC_CONFIG_t pParamConfig) |
|---|
| 134 | { |
|---|
| 135 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 136 | P_PIC_PARAM_t pPicConfig; |
|---|
| 137 | |
|---|
| 138 | pPicConfig = &(pParamConfig->Param); |
|---|
| 139 | |
|---|
| 140 | memcpy( &g_NextPicConfig, pParamConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 141 | g_NextPicConfigFlag = 1; |
|---|
| 142 | |
|---|
| 143 | return dhlResult; |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | DHL_RESULT DHL_PIC_PresetDefaultParams(void) |
|---|
| 147 | { |
|---|
| 148 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 149 | |
|---|
| 150 | if ( g_NextPicConfigFlag == 0 ) |
|---|
| 151 | memcpy( &g_NextPicConfig, &g_DefaultPicConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 152 | g_NextPicConfigFlag = 1; |
|---|
| 153 | |
|---|
| 154 | return dhlResult; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | DHL_RESULT DHL_PIC_PresetParamsPIP(P_PIC_CONFIG_t pPicConfig) |
|---|
| 158 | { |
|---|
| 159 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 160 | |
|---|
| 161 | memcpy( &g_NextPicConfigPIP, pPicConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 162 | g_NextPicConfigFlagPIP = 1; |
|---|
| 163 | |
|---|
| 164 | return dhlResult; |
|---|
| 165 | } |
|---|
| 166 | |
|---|
| 167 | DHL_RESULT DHL_PIC_PresetDefaultParamsPIP(void) |
|---|
| 168 | { |
|---|
| 169 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 170 | |
|---|
| 171 | if ( g_NextPicConfigFlagPIP == 0 ) |
|---|
| 172 | memcpy( &g_NextPicConfig, &g_DefaultPicConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 173 | g_NextPicConfigFlagPIP = 1; |
|---|
| 174 | |
|---|
| 175 | return dhlResult; |
|---|
| 176 | } |
|---|
| 177 | |
|---|
| 178 | DHL_RESULT DHL_PIC_EnableSharpness(DS_BOOL ON) |
|---|
| 179 | { |
|---|
| 180 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 181 | |
|---|
| 182 | dhlResult = DD_PIC_EnableSharpness(ON); |
|---|
| 183 | g_CurPicConfig.SharpnessOn = ON; |
|---|
| 184 | |
|---|
| 185 | return dhlResult; |
|---|
| 186 | } |
|---|
| 187 | |
|---|
| 188 | DHL_RESULT DHL_PIC_EnableHueSaturation(DS_BOOL ON) |
|---|
| 189 | { |
|---|
| 190 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 191 | dhlResult = DD_PIC_EnableHueSaturation(ON); |
|---|
| 192 | g_CurPicConfig.HueSaturationOn = ON; |
|---|
| 193 | return dhlResult; |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | DHL_RESULT DHL_PIC_EnableBrightness(DS_BOOL ON) |
|---|
| 197 | { |
|---|
| 198 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 199 | dhlResult = DD_PIC_EnableBrightness(ON); |
|---|
| 200 | g_CurPicConfig.BrightnessOn = ON; |
|---|
| 201 | return dhlResult; |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | DHL_RESULT DHL_PIC_SetSharpness(DS_U32 uHorzSharpness, DS_U32 uVertSharpness) |
|---|
| 205 | { |
|---|
| 206 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 207 | |
|---|
| 208 | if ( uHorzSharpness > 100 ) { |
|---|
| 209 | printf("[WARNING] Sharpness is larger than 100, truncated it to 100.\n"); |
|---|
| 210 | uHorzSharpness = 100; |
|---|
| 211 | } |
|---|
| 212 | |
|---|
| 213 | g_CurPicConfig.Param.hSharpness = uHorzSharpness; |
|---|
| 214 | g_CurPicConfig.Param.vSharpness = uVertSharpness; |
|---|
| 215 | |
|---|
| 216 | dhlResult = DD_PIC_SetSharpness(uHorzSharpness, uVertSharpness); |
|---|
| 217 | |
|---|
| 218 | return dhlResult; |
|---|
| 219 | } |
|---|
| 220 | |
|---|
| 221 | DHL_RESULT DHL_PIC_GetSharpness(DS_U32 *puHorzSharpness, DS_U32 *puVertSharpness) |
|---|
| 222 | { |
|---|
| 223 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 224 | |
|---|
| 225 | if (!puHorzSharpness) { |
|---|
| 226 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 227 | return DHL_FAIL; |
|---|
| 228 | } |
|---|
| 229 | |
|---|
| 230 | #if PIC_PARAM_ACTUAL_READ |
|---|
| 231 | dhlResult = DD_PIC_GetSharpness( puHorzSharpness, puVertSharpness ); |
|---|
| 232 | if ( dhlResult == DHL_OK ) { |
|---|
| 233 | if (*puHorzSharpness>100) |
|---|
| 234 | *puHorzSharpness = 100; |
|---|
| 235 | } |
|---|
| 236 | #else |
|---|
| 237 | *puHorzSharpness = g_CurPicConfig.Param.hSharpness; |
|---|
| 238 | *puVertSharpness = g_CurPicConfig.Param.vSharpness; |
|---|
| 239 | #endif |
|---|
| 240 | |
|---|
| 241 | return dhlResult; |
|---|
| 242 | } |
|---|
| 243 | |
|---|
| 244 | DHL_RESULT DHL_PIC_SetContrast(DS_U32 uContrast) |
|---|
| 245 | { |
|---|
| 246 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 247 | #if 0 //(hwatk/070620) |
|---|
| 248 | if ( uContrast > 100 ) { |
|---|
| 249 | printf("[WARNING] uContrast is larger than 100, truncated it to 100.\n"); |
|---|
| 250 | uContrast = 100; |
|---|
| 251 | } |
|---|
| 252 | #endif |
|---|
| 253 | |
|---|
| 254 | g_CurPicConfig.Param.Contrast = uContrast; |
|---|
| 255 | |
|---|
| 256 | dhlResult = DD_PIC_SetContrast(uContrast); |
|---|
| 257 | |
|---|
| 258 | return dhlResult; |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | DHL_RESULT DHL_PIC_GetContrast(DS_U32 *puContrast) |
|---|
| 262 | { |
|---|
| 263 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 264 | |
|---|
| 265 | if (!puContrast) { |
|---|
| 266 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 267 | return DHL_FAIL; |
|---|
| 268 | } |
|---|
| 269 | |
|---|
| 270 | #if PIC_PARAM_ACTUAL_READ |
|---|
| 271 | dhlResult = DD_PIC_GetContrast(puContrast); |
|---|
| 272 | #else |
|---|
| 273 | *puContrast = g_CurPicConfig.Param.Contrast; |
|---|
| 274 | #endif |
|---|
| 275 | return dhlResult; |
|---|
| 276 | } |
|---|
| 277 | |
|---|
| 278 | DHL_RESULT DHL_PIC_SetBrightness(DS_U32 uBrightness) |
|---|
| 279 | { |
|---|
| 280 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 281 | |
|---|
| 282 | #if 0 //(hwatk/070620) |
|---|
| 283 | if ( uBrightness > 100 ) { |
|---|
| 284 | printf("[WARNING] uBrightness is larger than 100, truncated it to 100.\n"); |
|---|
| 285 | uBrightness = 100; |
|---|
| 286 | } |
|---|
| 287 | #endif |
|---|
| 288 | |
|---|
| 289 | g_CurPicConfig.Param.Brightness = uBrightness; |
|---|
| 290 | |
|---|
| 291 | dhlResult = DD_PIC_SetBrightness(uBrightness); |
|---|
| 292 | |
|---|
| 293 | return dhlResult; |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | DHL_RESULT DHL_PIC_GetBrightness(DS_U32 *puBrightness) |
|---|
| 297 | { |
|---|
| 298 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 299 | |
|---|
| 300 | if (!puBrightness) { |
|---|
| 301 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 302 | return DHL_FAIL; |
|---|
| 303 | } |
|---|
| 304 | |
|---|
| 305 | #if PIC_PARAM_ACTUAL_READ |
|---|
| 306 | dhlResult = DD_PIC_GetBrightness(puBrightness); |
|---|
| 307 | #else |
|---|
| 308 | *puBrightness = g_CurPicConfig.Param.Brightness; |
|---|
| 309 | #endif |
|---|
| 310 | return dhlResult; |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | DHL_RESULT DHL_PIC_SetSaturation(DS_U32 uSaturation) |
|---|
| 314 | { |
|---|
| 315 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 316 | |
|---|
| 317 | if ( uSaturation > 120 ) { // ÇØ»óµµ¸¶´Ù ´Ù¸£±â ¶§¹®¿¡ 100ÀÌ»óÀÎ °ªÀÌ °¡´ÉÇÏ´Ù. megakiss 20070820 |
|---|
| 318 | printf("[WARNING] uSaturation is larger than 100, truncated it to 100.\n"); |
|---|
| 319 | uSaturation = 120; |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | g_CurPicConfig.Param.Saturation = uSaturation; |
|---|
| 323 | |
|---|
| 324 | dhlResult = DD_PIC_SetSaturation(uSaturation); |
|---|
| 325 | |
|---|
| 326 | return dhlResult; |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | DHL_RESULT DHL_PIC_GetSaturation(DS_U32 *puSaturation) |
|---|
| 330 | { |
|---|
| 331 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 332 | |
|---|
| 333 | if (!puSaturation) { |
|---|
| 334 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 335 | return DHL_FAIL; |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | #if PIC_PARAM_ACTUAL_READ |
|---|
| 339 | dhlResult = DD_PIC_GetSaturation(puSaturation); |
|---|
| 340 | #else |
|---|
| 341 | *puSaturation = g_CurPicConfig.Param.Saturation; |
|---|
| 342 | #endif |
|---|
| 343 | return dhlResult; |
|---|
| 344 | } |
|---|
| 345 | |
|---|
| 346 | DHL_RESULT DHL_PIC_SetHue(int iHue) |
|---|
| 347 | { |
|---|
| 348 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 349 | |
|---|
| 350 | if ( iHue > 50 ) { |
|---|
| 351 | printf("[WARNING] uSaturation is larger than 50, truncated it to 50.\n"); |
|---|
| 352 | iHue = 50; |
|---|
| 353 | } |
|---|
| 354 | |
|---|
| 355 | if ( iHue < -50 ) { |
|---|
| 356 | printf("[WARNING] uSaturation is smaller than -50, truncated it to -50.\n"); |
|---|
| 357 | iHue = -50; |
|---|
| 358 | } |
|---|
| 359 | |
|---|
| 360 | |
|---|
| 361 | g_CurPicConfig.Param.Hue = iHue; |
|---|
| 362 | |
|---|
| 363 | dhlResult = DD_PIC_SetHue(iHue); |
|---|
| 364 | |
|---|
| 365 | return dhlResult; |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | DHL_RESULT DHL_PIC_GetHue(int *piHue) |
|---|
| 369 | { |
|---|
| 370 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 371 | |
|---|
| 372 | if (!piHue) { |
|---|
| 373 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 374 | return DHL_FAIL; |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | #if PIC_PARAM_ACTUAL_READ |
|---|
| 378 | dhlResult = DD_PIC_GetHue(piHue); |
|---|
| 379 | #else |
|---|
| 380 | *piHue = g_CurPicConfig.Param.Hue; |
|---|
| 381 | #endif |
|---|
| 382 | return dhlResult; |
|---|
| 383 | } |
|---|
| 384 | |
|---|
| 385 | DHL_RESULT DHL_PIC_SetParams(int bFull) |
|---|
| 386 | { |
|---|
| 387 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 388 | P_PIC_PARAM_t pPicConfig; |
|---|
| 389 | |
|---|
| 390 | pPicConfig = &(g_CurPicConfig.Param); |
|---|
| 391 | |
|---|
| 392 | #if 0 |
|---|
| 393 | printf("Next Picture Paramters\n"); |
|---|
| 394 | |
|---|
| 395 | printf("Sharpness ( 0 ~ 100): %ld\n", g_CurPicConfig.Param.Sharpness); |
|---|
| 396 | printf("Contrast ( 0 ~ 100): %ld\n", g_CurPicConfig.Param.Contrast); |
|---|
| 397 | printf("Brightness ( 0 ~ 100): %ld\n", g_CurPicConfig.Param.Brightness); |
|---|
| 398 | printf("Saturation ( 0 ~ 100): %ld\n", g_CurPicConfig.Param.Saturation); |
|---|
| 399 | printf("Hue(Color) (-50 ~ +50): %d\n", g_CurPicConfig.Param.Hue); |
|---|
| 400 | |
|---|
| 401 | printf("ColorTemp: %d\n", g_CurPicConfig.ExtParam.ColorTemp); |
|---|
| 402 | printf("NR: %d\n", g_CurPicConfig.ExtParam.NR); |
|---|
| 403 | printf("ColorSystem: %d\n", g_CurPicConfig.ExtParam.ColorSystem); |
|---|
| 404 | printf("BlackExtension: %d\n", g_CurPicConfig.ExtParam.BlackExtension); |
|---|
| 405 | printf("WhiteExtension: %d\n", g_CurPicConfig.ExtParam.WhiteExtension); |
|---|
| 406 | printf("BlueStretch: %d\n", g_CurPicConfig.ExtParam.BlueStretch); |
|---|
| 407 | printf("APL: %d\n", g_CurPicConfig.ExtParam.APL); |
|---|
| 408 | printf("DCI: %d\n", g_CurPicConfig.ExtParam.DCI); |
|---|
| 409 | printf("ACR: %d\n", g_CurPicConfig.ExtParam.ACR); |
|---|
| 410 | printf("ColorMgmt: %d\n", g_CurPicConfig.ExtParam.ColorMgmt); |
|---|
| 411 | printf("MpegNR: %d\n", g_CurPicConfig.ExtParam.MpegNR); |
|---|
| 412 | |
|---|
| 413 | printf("FleshTone: %d\n", g_CurPicConfig.ExtParam.FleshTone); |
|---|
| 414 | printf("Red: %d\n", g_CurPicConfig.ExtParam.Red); |
|---|
| 415 | printf("Green: %d\n", g_CurPicConfig.ExtParam.Green); |
|---|
| 416 | printf("Blue: %d\n", g_CurPicConfig.ExtParam.Blue); |
|---|
| 417 | printf("RedCont: %d\n", g_CurPicConfig.ExtParam.RCont); |
|---|
| 418 | printf("GreenCont: %d\n", g_CurPicConfig.ExtParam.GCont); |
|---|
| 419 | printf("BlueCont: %d\n", g_CurPicConfig.ExtParam.BCont); |
|---|
| 420 | |
|---|
| 421 | printf("BlackExt: %d\n", g_CurPicConfig.ExtParam.BlackExtVal); |
|---|
| 422 | printf("WhiteExt: %d\n", g_CurPicConfig.ExtParam.WhiteExtVal); |
|---|
| 423 | printf("BlackLvl: %d\n", g_CurPicConfig.ExtParam.BlackLevel); |
|---|
| 424 | printf("SubContrast: %d\n", g_CurPicConfig.ExtParam.SubContrast); |
|---|
| 425 | printf("MEMC: %d\n", g_CurPicConfig.ExtParam.MEMC); |
|---|
| 426 | #endif |
|---|
| 427 | |
|---|
| 428 | dhlResult = DD_PIC_SetSharpness(pPicConfig->hSharpness, pPicConfig->vSharpness); |
|---|
| 429 | if ( dhlResult != DHL_OK ) |
|---|
| 430 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 431 | |
|---|
| 432 | // if ( DHL_CAP_GetVideoSrc(0) != DHL_CAP_VGA0_VIDEO ) { |
|---|
| 433 | dhlResult = DD_PIC_SetContrast(pPicConfig->Contrast); |
|---|
| 434 | if ( dhlResult != DHL_OK ) |
|---|
| 435 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 436 | //} |
|---|
| 437 | |
|---|
| 438 | if (bFull) { |
|---|
| 439 | dhlResult = DD_PIC_SetColorTemperature(g_CurPicConfig.ExtParam.ColorTemp); |
|---|
| 440 | if ( dhlResult != DHL_OK ) |
|---|
| 441 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | dhlResult = DD_PIC_SetBrightness(pPicConfig->Brightness); |
|---|
| 445 | if ( dhlResult != DHL_OK ) |
|---|
| 446 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 447 | |
|---|
| 448 | dhlResult = DD_PIC_SetSaturation(pPicConfig->Saturation); |
|---|
| 449 | if ( dhlResult != DHL_OK ) |
|---|
| 450 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 451 | |
|---|
| 452 | dhlResult = DD_PIC_SetHue(pPicConfig->Hue); |
|---|
| 453 | if ( dhlResult != DHL_OK ) |
|---|
| 454 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 455 | |
|---|
| 456 | // |
|---|
| 457 | // Advanced Picture Parameters |
|---|
| 458 | // |
|---|
| 459 | |
|---|
| 460 | dhlResult = DHL_PIC_SetAPL(g_CurPicConfig.ExtParam.APL); |
|---|
| 461 | if ( dhlResult != DHL_OK ) |
|---|
| 462 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 463 | |
|---|
| 464 | dhlResult = DHL_PIC_SetNR(g_CurPicConfig.ExtParam.NR); |
|---|
| 465 | if ( dhlResult != DHL_OK ) |
|---|
| 466 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 467 | |
|---|
| 468 | dhlResult = DHL_PIC_SetMpegNR(g_CurPicConfig.ExtParam.MpegNR); |
|---|
| 469 | if ( dhlResult != DHL_OK ) |
|---|
| 470 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 471 | |
|---|
| 472 | if ( DHL_CAP_GetVideoSrc(0) == DHL_CAP_ATV0_VIDEO ) |
|---|
| 473 | dhlResult = DHL_PIC_SetColorMgmt(/*ATV*/3); |
|---|
| 474 | else |
|---|
| 475 | dhlResult = DHL_PIC_SetColorMgmt(/*NORMAL*/2); |
|---|
| 476 | if ( dhlResult != DHL_OK ) |
|---|
| 477 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 478 | |
|---|
| 479 | // |
|---|
| 480 | // Blue Strecth; This shall be called prior to DHL_PIC_SetBlueColor, since Blue stretch depends on Blue color. |
|---|
| 481 | // |
|---|
| 482 | dhlResult = DHL_PIC_SetBlueStretch(g_CurPicConfig.ExtParam.BlueStretch); |
|---|
| 483 | if ( dhlResult != DHL_OK ) |
|---|
| 484 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 485 | |
|---|
| 486 | // |
|---|
| 487 | // Flesh Tone (Skin Color) |
|---|
| 488 | // |
|---|
| 489 | dhlResult = DHL_PIC_SetFleshTone(g_CurPicConfig.ExtParam.FleshTone); |
|---|
| 490 | if ( dhlResult != DHL_OK ) |
|---|
| 491 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 492 | |
|---|
| 493 | // |
|---|
| 494 | // Red, Green, Blue |
|---|
| 495 | // |
|---|
| 496 | dhlResult = DHL_PIC_SetRGBOffset(g_CurPicConfig.ExtParam.Red, g_CurPicConfig.ExtParam.Green, g_CurPicConfig.ExtParam.Blue); |
|---|
| 497 | if ( dhlResult != DHL_OK ) |
|---|
| 498 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 499 | |
|---|
| 500 | dhlResult = DHL_PIC_SetRGBContrast(g_CurPicConfig.ExtParam.RCont, g_CurPicConfig.ExtParam.GCont, g_CurPicConfig.ExtParam.BCont); |
|---|
| 501 | if ( dhlResult != DHL_OK ) |
|---|
| 502 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 503 | |
|---|
| 504 | dhlResult = DHL_PIC_SetBlackWhiteStretch(g_CurPicConfig.ExtParam.BlackExtVal, g_CurPicConfig.ExtParam.WhiteExtVal); |
|---|
| 505 | if ( dhlResult != DHL_OK ) |
|---|
| 506 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 507 | |
|---|
| 508 | dhlResult = DHL_PIC_SetBlackLevel(g_CurPicConfig.ExtParam.BlackLevel); |
|---|
| 509 | if ( dhlResult != DHL_OK ) |
|---|
| 510 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 511 | |
|---|
| 512 | dhlResult = DHL_PIC_SetSubContrast(g_CurPicConfig.ExtParam.SubContrast); |
|---|
| 513 | if ( dhlResult != DHL_OK ) |
|---|
| 514 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 515 | |
|---|
| 516 | dhlResult = DHL_PIC_SetColorSystem(g_CurPicConfig.ExtParam.ColorSystem); |
|---|
| 517 | if ( dhlResult != DHL_OK ) |
|---|
| 518 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 519 | |
|---|
| 520 | dhlResult = DHL_PIC_SetMEMCMode(g_CurPicConfig.ExtParam.MEMC); |
|---|
| 521 | if ( dhlResult != DHL_OK ) |
|---|
| 522 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 523 | dhlResult = DHL_PIC_SetColorMgmt(/*ATV*/0); |
|---|
| 524 | if ( dhlResult != DHL_OK ) |
|---|
| 525 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 526 | |
|---|
| 527 | if ( DHL_DISP_GetDispAspect() == DHL_DISP_ASPECT_1_1 ) |
|---|
| 528 | DD_PIC_SetAutoMovieMode(0); |
|---|
| 529 | else |
|---|
| 530 | DD_PIC_SetAutoMovieMode(g_CurPicConfig.ExtParam.Movie); |
|---|
| 531 | if ( dhlResult != DHL_OK ) |
|---|
| 532 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 533 | |
|---|
| 534 | dhlResult = DHL_PIC_EnableSharpness(0); |
|---|
| 535 | if ( dhlResult != DHL_OK ) |
|---|
| 536 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 537 | |
|---|
| 538 | dhlResult = DHL_PIC_EnableHueSaturation(1); |
|---|
| 539 | if ( dhlResult != DHL_OK ) |
|---|
| 540 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 541 | |
|---|
| 542 | dhlResult = DHL_PIC_EnableBrightness(0); |
|---|
| 543 | if ( dhlResult != DHL_OK ) |
|---|
| 544 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 545 | |
|---|
| 546 | return dhlResult; |
|---|
| 547 | } |
|---|
| 548 | |
|---|
| 549 | DHL_RESULT DHL_PIC_SetParamsPIP(void) |
|---|
| 550 | { |
|---|
| 551 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 552 | P_PIC_PARAM_t pPicConfig; |
|---|
| 553 | |
|---|
| 554 | pPicConfig = &(g_CurPicConfig.Param); |
|---|
| 555 | |
|---|
| 556 | return dhlResult; |
|---|
| 557 | } |
|---|
| 558 | |
|---|
| 559 | |
|---|
| 560 | DHL_RESULT DHL_PIC_SetRGBContrast( DS_U16 R, DS_U16 G, DS_U16 B ) |
|---|
| 561 | { |
|---|
| 562 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 563 | |
|---|
| 564 | if ( R>511 || G>511 || B>511 ) { |
|---|
| 565 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 566 | dhlResult = DHL_FAIL; |
|---|
| 567 | } |
|---|
| 568 | |
|---|
| 569 | g_CurPicConfig.ExtParam.RCont = R; |
|---|
| 570 | g_CurPicConfig.ExtParam.GCont = G; |
|---|
| 571 | g_CurPicConfig.ExtParam.BCont = B; |
|---|
| 572 | |
|---|
| 573 | dhlResult = DD_PIC_SetRGBContrast( R, G, B ); |
|---|
| 574 | |
|---|
| 575 | return dhlResult; |
|---|
| 576 | } |
|---|
| 577 | |
|---|
| 578 | DHL_RESULT DHL_PIC_SetBlackWhiteStretch( DS_U8 B, DS_U8 W ) |
|---|
| 579 | { |
|---|
| 580 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 581 | |
|---|
| 582 | g_CurPicConfig.ExtParam.BlackExtVal = B; |
|---|
| 583 | g_CurPicConfig.ExtParam.WhiteExtVal = W; |
|---|
| 584 | |
|---|
| 585 | dhlResult = DD_PIC_SetBlackWhiteStretch( B, W ); |
|---|
| 586 | |
|---|
| 587 | return dhlResult; |
|---|
| 588 | } |
|---|
| 589 | |
|---|
| 590 | DHL_RESULT DHL_PIC_SetBlackLevel( DS_U8 BlackLevel ) |
|---|
| 591 | { |
|---|
| 592 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 593 | |
|---|
| 594 | g_CurPicConfig.ExtParam.BlackLevel = BlackLevel; |
|---|
| 595 | |
|---|
| 596 | dhlResult = DD_PIC_SetBlackLevel(BlackLevel); |
|---|
| 597 | |
|---|
| 598 | return dhlResult; |
|---|
| 599 | } |
|---|
| 600 | |
|---|
| 601 | DHL_RESULT DHL_PIC_SetSubContrast( DS_U8 SubContrast ) |
|---|
| 602 | { |
|---|
| 603 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 604 | |
|---|
| 605 | g_CurPicConfig.ExtParam.SubContrast = SubContrast; |
|---|
| 606 | |
|---|
| 607 | dhlResult = DD_PIC_SetSubContrast(SubContrast); |
|---|
| 608 | |
|---|
| 609 | return dhlResult; |
|---|
| 610 | } |
|---|
| 611 | |
|---|
| 612 | #if 0 |
|---|
| 613 | ___Picture_Ext_Patameter_Functions___() |
|---|
| 614 | #endif |
|---|
| 615 | /**************************************************************************** |
|---|
| 616 | * |
|---|
| 617 | * Picture Extended Parameters |
|---|
| 618 | * |
|---|
| 619 | * - DCISpeed Normal(0), Faster than normal(2), Fastest(4) |
|---|
| 620 | * - ColorTemperature Normal(0), Warm(1), Cool(2) |
|---|
| 621 | * - NR 0 ~ 100 |
|---|
| 622 | * - ColorSystem Normal(0), EU(1), ASIA(2) |
|---|
| 623 | * - BlackExtension On(1)/Off(0) |
|---|
| 624 | * - WhiteExtension On(1)/Off(0) |
|---|
| 625 | * - APL On(1)/Off(0) |
|---|
| 626 | * - ColorMgmt TBD |
|---|
| 627 | * - MpegNR 0 ~ 100 |
|---|
| 628 | * |
|---|
| 629 | ***************************************************************************/ |
|---|
| 630 | DHL_RESULT DHL_PIC_SetDCISpeed(int Speed) |
|---|
| 631 | { |
|---|
| 632 | DD_PIC_SetDCISpeed(Speed); |
|---|
| 633 | |
|---|
| 634 | return DHL_OK; |
|---|
| 635 | } |
|---|
| 636 | |
|---|
| 637 | DHL_RESULT DHL_PIC_SetColorTemperature(int ColorTemp) |
|---|
| 638 | { |
|---|
| 639 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 640 | |
|---|
| 641 | g_CurPicConfig.ExtParam.ColorTemp = ColorTemp; |
|---|
| 642 | dhlResult = DD_PIC_SetColorTemperature(ColorTemp); |
|---|
| 643 | |
|---|
| 644 | return dhlResult; |
|---|
| 645 | } |
|---|
| 646 | |
|---|
| 647 | DHL_RESULT DHL_PIC_SetNR(int NR) |
|---|
| 648 | { |
|---|
| 649 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 650 | |
|---|
| 651 | g_CurPicConfig.ExtParam.NR = NR; |
|---|
| 652 | dhlResult = DD_PIC_SetNR(NR); |
|---|
| 653 | |
|---|
| 654 | return dhlResult; |
|---|
| 655 | } |
|---|
| 656 | |
|---|
| 657 | |
|---|
| 658 | DHL_RESULT DHL_PIC_SetColorSystem(int ColorSystem) |
|---|
| 659 | { |
|---|
| 660 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 661 | |
|---|
| 662 | g_CurPicConfig.ExtParam.ColorSystem = ColorSystem; |
|---|
| 663 | dhlResult = DD_PIC_SetColorSystem(ColorSystem); |
|---|
| 664 | |
|---|
| 665 | return dhlResult; |
|---|
| 666 | } |
|---|
| 667 | |
|---|
| 668 | DHL_RESULT DHL_PIC_SetBlackExtension(int BlackExtension) |
|---|
| 669 | { |
|---|
| 670 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 671 | |
|---|
| 672 | g_CurPicConfig.ExtParam.BlackExtension = BlackExtension; |
|---|
| 673 | dhlResult = DD_PIC_SetBlackExtension(BlackExtension); |
|---|
| 674 | |
|---|
| 675 | return dhlResult; |
|---|
| 676 | } |
|---|
| 677 | |
|---|
| 678 | |
|---|
| 679 | DHL_RESULT DHL_PIC_SetWhiteExtension(int WhiteExtension) |
|---|
| 680 | { |
|---|
| 681 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 682 | |
|---|
| 683 | g_CurPicConfig.ExtParam.WhiteExtension = WhiteExtension; |
|---|
| 684 | dhlResult = DD_PIC_SetWhiteExtension(WhiteExtension); |
|---|
| 685 | |
|---|
| 686 | return dhlResult; |
|---|
| 687 | } |
|---|
| 688 | |
|---|
| 689 | DHL_RESULT DHL_PIC_SetBlueStretch(int BlueStretch) |
|---|
| 690 | { |
|---|
| 691 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 692 | |
|---|
| 693 | g_CurPicConfig.ExtParam.BlueStretch = BlueStretch; |
|---|
| 694 | dhlResult = DD_PIC_SetBlueStretch(BlueStretch); |
|---|
| 695 | dhlResult = DD_PIC_SetContrast(g_CurPicConfig.Param.Contrast); |
|---|
| 696 | |
|---|
| 697 | return dhlResult; |
|---|
| 698 | } |
|---|
| 699 | |
|---|
| 700 | DHL_RESULT DHL_PIC_SetAPL(int APL) |
|---|
| 701 | { |
|---|
| 702 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 703 | |
|---|
| 704 | g_CurPicConfig.ExtParam.APL = APL; |
|---|
| 705 | // dhlResult = DD_PIC_SetAPL( APL ? 0 : 1 ); |
|---|
| 706 | dhlResult = DD_PIC_SetAPL( APL ? 1 : 0 ); |
|---|
| 707 | |
|---|
| 708 | return dhlResult; |
|---|
| 709 | } |
|---|
| 710 | |
|---|
| 711 | DHL_RESULT DHL_PIC_SetDCI(int DCI) |
|---|
| 712 | { |
|---|
| 713 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 714 | |
|---|
| 715 | g_CurPicConfig.ExtParam.DCI = DCI; |
|---|
| 716 | dhlResult = DD_PIC_SetDCI(DCI); |
|---|
| 717 | |
|---|
| 718 | return dhlResult; |
|---|
| 719 | } |
|---|
| 720 | |
|---|
| 721 | DHL_RESULT DHL_PIC_SetACR(int ACR) |
|---|
| 722 | { |
|---|
| 723 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 724 | |
|---|
| 725 | g_CurPicConfig.ExtParam.ACR = ACR; |
|---|
| 726 | dhlResult = DD_PIC_SetACR(ACR); |
|---|
| 727 | |
|---|
| 728 | return dhlResult; |
|---|
| 729 | } |
|---|
| 730 | |
|---|
| 731 | DHL_RESULT DHL_PIC_SetColorMgmt(int ColorMgmt) |
|---|
| 732 | { |
|---|
| 733 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 734 | |
|---|
| 735 | g_CurPicConfig.ExtParam.ColorMgmt = ColorMgmt; |
|---|
| 736 | dhlResult = DD_PIC_SetColorMgmt(ColorMgmt); |
|---|
| 737 | |
|---|
| 738 | return dhlResult; |
|---|
| 739 | } |
|---|
| 740 | |
|---|
| 741 | DHL_RESULT DHL_PIC_SetFleshTone(int FleshTone) |
|---|
| 742 | { |
|---|
| 743 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 744 | |
|---|
| 745 | g_CurPicConfig.ExtParam.FleshTone = FleshTone; |
|---|
| 746 | dhlResult = DD_PIC_SetFleshTone(FleshTone); |
|---|
| 747 | |
|---|
| 748 | return dhlResult; |
|---|
| 749 | } |
|---|
| 750 | |
|---|
| 751 | DHL_RESULT DHL_PIC_SetRedColor(int Red) |
|---|
| 752 | { |
|---|
| 753 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 754 | |
|---|
| 755 | g_CurPicConfig.ExtParam.Red = Red; |
|---|
| 756 | //dhlResult = DD_DISP_SetRedColor(Red); |
|---|
| 757 | |
|---|
| 758 | return dhlResult; |
|---|
| 759 | } |
|---|
| 760 | |
|---|
| 761 | DHL_RESULT DHL_PIC_SetGreenColor(int Green) |
|---|
| 762 | { |
|---|
| 763 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 764 | |
|---|
| 765 | g_CurPicConfig.ExtParam.Green = Green; |
|---|
| 766 | //dhlResult = DD_DISP_SetGreenColor(Green); |
|---|
| 767 | |
|---|
| 768 | return dhlResult; |
|---|
| 769 | } |
|---|
| 770 | |
|---|
| 771 | DHL_RESULT DHL_PIC_SetBlueColor(int Blue) |
|---|
| 772 | { |
|---|
| 773 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 774 | |
|---|
| 775 | if ( g_CurPicConfig.ExtParam.BlueStretch == 0 ) { |
|---|
| 776 | //dhlResult = DHL_PIC_SetBlueStretch(1); |
|---|
| 777 | if ( dhlResult != DHL_OK ) |
|---|
| 778 | printf("|%s| ERROR, LINE=%d\n", __FUNCTION__, __LINE__); |
|---|
| 779 | } |
|---|
| 780 | g_CurPicConfig.ExtParam.Blue = Blue; |
|---|
| 781 | //dhlResult = DD_DISP_SetBlueColor(Blue); |
|---|
| 782 | |
|---|
| 783 | return dhlResult; |
|---|
| 784 | } |
|---|
| 785 | |
|---|
| 786 | DHL_RESULT DHL_PIC_SetRGBOffset(int Red, int Green, int Blue) |
|---|
| 787 | { |
|---|
| 788 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 789 | |
|---|
| 790 | g_CurPicConfig.ExtParam.Red = Red; |
|---|
| 791 | g_CurPicConfig.ExtParam.Green = Green; |
|---|
| 792 | g_CurPicConfig.ExtParam.Blue = Blue; |
|---|
| 793 | |
|---|
| 794 | dhlResult = DD_PIC_SetRedOffset(Red); |
|---|
| 795 | SysASSERT( dhlResult == DHL_OK ); |
|---|
| 796 | |
|---|
| 797 | dhlResult = DD_PIC_SetGreenOffset(Red); |
|---|
| 798 | SysASSERT( dhlResult == DHL_OK ); |
|---|
| 799 | |
|---|
| 800 | dhlResult = DD_PIC_SetBlueOffset(Red); |
|---|
| 801 | SysASSERT( dhlResult == DHL_OK ); |
|---|
| 802 | |
|---|
| 803 | return dhlResult; |
|---|
| 804 | } |
|---|
| 805 | |
|---|
| 806 | DHL_RESULT DHL_PIC_SetMpegNR(int MpegNR) |
|---|
| 807 | { |
|---|
| 808 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 809 | |
|---|
| 810 | g_CurPicConfig.ExtParam.MpegNR = MpegNR; |
|---|
| 811 | dhlResult = DD_PIC_SetMpegNR(MpegNR); |
|---|
| 812 | |
|---|
| 813 | return dhlResult; |
|---|
| 814 | } |
|---|
| 815 | |
|---|
| 816 | DHL_RESULT DHL_PIC_GetHistogram(DS_U8 *pHistogram) |
|---|
| 817 | { |
|---|
| 818 | return DD_PIC_GetHistogram(pHistogram); |
|---|
| 819 | } |
|---|
| 820 | |
|---|
| 821 | DHL_RESULT DHL_PIC_SetMEMCMode(DHL_PIC_MEMC_MODE mode) |
|---|
| 822 | { |
|---|
| 823 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 824 | |
|---|
| 825 | g_CurPicConfig.ExtParam.MEMC = mode; |
|---|
| 826 | dhlResult = DD_PIC_SetMEMCMode(mode); |
|---|
| 827 | if ( dhlResult != DHL_OK ) |
|---|
| 828 | printf("|%s| failure. (ERR=%d)\n", __FUNCTION__, dhlResult); |
|---|
| 829 | |
|---|
| 830 | return dhlResult; |
|---|
| 831 | } |
|---|
| 832 | |
|---|
| 833 | DHL_RESULT DHL_PIC_SetAutoMovieMode( DS_BOOL enable ) |
|---|
| 834 | { |
|---|
| 835 | DHL_RESULT dhlResult = DHL_OK; |
|---|
| 836 | |
|---|
| 837 | dhlResult = DD_PIC_SetAutoMovieMode(enable); |
|---|
| 838 | |
|---|
| 839 | g_CurPicConfig.ExtParam.Movie = enable; |
|---|
| 840 | if ( dhlResult != DHL_OK ) |
|---|
| 841 | printf("|%s| failure. (ERR=%d)\n", __FUNCTION__, dhlResult); |
|---|
| 842 | |
|---|
| 843 | return dhlResult; |
|---|
| 844 | } |
|---|
| 845 | |
|---|
| 846 | int DHL_PIC_GetColorTemperature(void) |
|---|
| 847 | { |
|---|
| 848 | return g_CurPicConfig.ExtParam.ColorTemp; |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | int DHL_PIC_GetNR(void) |
|---|
| 852 | { |
|---|
| 853 | return g_CurPicConfig.ExtParam.NR; |
|---|
| 854 | } |
|---|
| 855 | |
|---|
| 856 | int DHL_PIC_GetColorSystem(void) |
|---|
| 857 | { |
|---|
| 858 | return g_CurPicConfig.ExtParam.ColorSystem; |
|---|
| 859 | } |
|---|
| 860 | |
|---|
| 861 | int DHL_PIC_GetBlackExtension(void) |
|---|
| 862 | { |
|---|
| 863 | return g_CurPicConfig.ExtParam.BlackExtension; |
|---|
| 864 | } |
|---|
| 865 | |
|---|
| 866 | int DHL_PIC_GetWhiteExtension(void) |
|---|
| 867 | { |
|---|
| 868 | return g_CurPicConfig.ExtParam.WhiteExtension; |
|---|
| 869 | } |
|---|
| 870 | |
|---|
| 871 | int DHL_PIC_GetBlueStretch(void) |
|---|
| 872 | { |
|---|
| 873 | return g_CurPicConfig.ExtParam.BlueStretch; |
|---|
| 874 | } |
|---|
| 875 | |
|---|
| 876 | int DHL_PIC_GetAPL(void) |
|---|
| 877 | { |
|---|
| 878 | return g_CurPicConfig.ExtParam.APL; |
|---|
| 879 | } |
|---|
| 880 | |
|---|
| 881 | int DHL_PIC_GetDCI(void) |
|---|
| 882 | { |
|---|
| 883 | return g_CurPicConfig.ExtParam.DCI; |
|---|
| 884 | } |
|---|
| 885 | |
|---|
| 886 | int DHL_PIC_GetACR(void) |
|---|
| 887 | { |
|---|
| 888 | return g_CurPicConfig.ExtParam.ACR; |
|---|
| 889 | } |
|---|
| 890 | |
|---|
| 891 | int DHL_PIC_GetColorMgmt(void) |
|---|
| 892 | { |
|---|
| 893 | return g_CurPicConfig.ExtParam.ColorMgmt; |
|---|
| 894 | } |
|---|
| 895 | |
|---|
| 896 | int DHL_PIC_GetFleshTone(void) |
|---|
| 897 | { |
|---|
| 898 | return g_CurPicConfig.ExtParam.FleshTone; |
|---|
| 899 | } |
|---|
| 900 | |
|---|
| 901 | void DHL_PIC_GetRedOffset(int *pRed, int *pGreen, int *pBlue) |
|---|
| 902 | { |
|---|
| 903 | if (pRed) |
|---|
| 904 | *pRed = g_CurPicConfig.ExtParam.Red; |
|---|
| 905 | if (pGreen) |
|---|
| 906 | *pGreen = g_CurPicConfig.ExtParam.Green; |
|---|
| 907 | if (pBlue) |
|---|
| 908 | *pBlue = g_CurPicConfig.ExtParam.Blue; |
|---|
| 909 | } |
|---|
| 910 | |
|---|
| 911 | int DHL_PIC_GetMpegNR(void) |
|---|
| 912 | { |
|---|
| 913 | return g_CurPicConfig.ExtParam.MpegNR; |
|---|
| 914 | } |
|---|
| 915 | |
|---|
| 916 | |
|---|
| 917 | DHL_PIC_MEMC_MODE DHL_PIC_GetMEMCMode(void) |
|---|
| 918 | { |
|---|
| 919 | return g_CurPicConfig.ExtParam.MEMC; |
|---|
| 920 | } |
|---|
| 921 | |
|---|
| 922 | DS_BOOL DHL_PIC_GetAutoMovieMode(void) |
|---|
| 923 | { |
|---|
| 924 | return g_CurPicConfig.ExtParam.Movie; |
|---|
| 925 | } |
|---|
| 926 | |
|---|
| 927 | #if 0 |
|---|
| 928 | ___Internal_Functions___() |
|---|
| 929 | #endif |
|---|
| 930 | void DHL_PIC_UpdateNextParam(void) |
|---|
| 931 | { |
|---|
| 932 | memcpy( &g_CurPicConfig, &g_NextPicConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 933 | |
|---|
| 934 | } |
|---|
| 935 | |
|---|
| 936 | void DHL_PIC_UpdateNextParamPIP(void) |
|---|
| 937 | { |
|---|
| 938 | memcpy( &g_CurPicConfigPIP, &g_NextPicConfigPIP, sizeof(PIC_CONFIG_t) ); |
|---|
| 939 | } |
|---|
| 940 | |
|---|
| 941 | #if 0 |
|---|
| 942 | ___Debug_Functions___() |
|---|
| 943 | #endif |
|---|
| 944 | void PrintParam(int arg) |
|---|
| 945 | { |
|---|
| 946 | DHL_RESULT dhlResult; |
|---|
| 947 | DS_U32 hSharpness, vSharpness, Contrast, Brightness, Saturation; |
|---|
| 948 | int Hue; |
|---|
| 949 | |
|---|
| 950 | hSharpness = vSharpness = Contrast = Brightness = Saturation = Hue = -1; |
|---|
| 951 | dhlResult = DHL_PIC_GetSharpness( &hSharpness, &vSharpness ); |
|---|
| 952 | dhlResult = DHL_PIC_GetContrast( &Contrast ); |
|---|
| 953 | dhlResult = DHL_PIC_GetBrightness( &Brightness ); |
|---|
| 954 | dhlResult = DHL_PIC_GetSaturation( &Saturation ); |
|---|
| 955 | dhlResult = DHL_PIC_GetHue( &Hue ); |
|---|
| 956 | |
|---|
| 957 | printf("Sharpness ( 0 ~ 100): %ld\n", hSharpness); |
|---|
| 958 | printf("Contrast ( 0 ~ 100): %ld\n", Contrast); |
|---|
| 959 | printf("Brightness ( 0 ~ 100): %ld\n", Brightness); |
|---|
| 960 | printf("Saturation ( 0 ~ 100): %ld\n", Saturation); |
|---|
| 961 | printf("Hue(Color) (-50 ~ +50): %d\n", Hue); |
|---|
| 962 | } |
|---|
| 963 | |
|---|
| 964 | void set_dp(int arg) |
|---|
| 965 | { |
|---|
| 966 | DHL_PIC_SetSharpness( 25, 25 ); |
|---|
| 967 | DHL_PIC_SetContrast( 52 ); |
|---|
| 968 | DHL_PIC_SetBrightness( 50 ); |
|---|
| 969 | DHL_PIC_SetSaturation( 22 ); |
|---|
| 970 | DHL_PIC_SetHue( 0 ); |
|---|
| 971 | } |
|---|
| 972 | |
|---|
| 973 | void h_dp(void) |
|---|
| 974 | { |
|---|
| 975 | DS_U32 hSharpness, vSharpness, Contrast, Brightness, Saturation; |
|---|
| 976 | int Hue; |
|---|
| 977 | |
|---|
| 978 | hSharpness = vSharpness = Contrast = Brightness = Saturation = Hue = -1; |
|---|
| 979 | DD_PIC_GetSharpness( &hSharpness, &vSharpness ); |
|---|
| 980 | DD_PIC_GetContrast( &Contrast ); |
|---|
| 981 | DD_PIC_GetBrightness( &Brightness ); |
|---|
| 982 | DD_PIC_GetSaturation( &Saturation ); |
|---|
| 983 | DD_PIC_GetHue( &Hue ); |
|---|
| 984 | |
|---|
| 985 | printf("Sharpness ( 0 ~ 100): %ld\n", hSharpness); |
|---|
| 986 | printf("Contrast ( 0 ~ 100): %ld\n", Contrast); |
|---|
| 987 | printf("Brightness ( 0 ~ 100): %ld\n", Brightness); |
|---|
| 988 | printf("Saturation ( 0 ~ 100): %ld\n", Saturation); |
|---|
| 989 | printf("Hue(Color) (-50 ~ +50): %d\n", Hue); |
|---|
| 990 | } |
|---|
| 991 | |
|---|
| 992 | void PrintExtParam(int arg) |
|---|
| 993 | { |
|---|
| 994 | printf("ColorTemp: %d\n", g_CurPicConfig.ExtParam.ColorTemp); |
|---|
| 995 | printf("NR: %d\n", g_CurPicConfig.ExtParam.NR); |
|---|
| 996 | printf("ColorSystem: %d\n", g_CurPicConfig.ExtParam.ColorSystem); |
|---|
| 997 | printf("BlackExtension: %d\n", g_CurPicConfig.ExtParam.BlackExtension); |
|---|
| 998 | printf("WhiteExtension: %d\n", g_CurPicConfig.ExtParam.WhiteExtension); |
|---|
| 999 | printf("BlueStretch: %d\n", g_CurPicConfig.ExtParam.BlueStretch); |
|---|
| 1000 | printf("APL: %d\n", g_CurPicConfig.ExtParam.APL); |
|---|
| 1001 | printf("DCI: %d\n", g_CurPicConfig.ExtParam.DCI); |
|---|
| 1002 | printf("ACR: %d\n", g_CurPicConfig.ExtParam.ACR); |
|---|
| 1003 | printf("ColorMgmt: %d\n", g_CurPicConfig.ExtParam.ColorMgmt); |
|---|
| 1004 | printf("MpegNR: %d\n", g_CurPicConfig.ExtParam.MpegNR); |
|---|
| 1005 | } |
|---|
| 1006 | |
|---|
| 1007 | void PresetSetParam(int sh, int c, int b, int sa, int hue) |
|---|
| 1008 | { |
|---|
| 1009 | PIC_CONFIG_t picConfig; |
|---|
| 1010 | |
|---|
| 1011 | memcpy( &picConfig, &g_CurPicConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 1012 | |
|---|
| 1013 | picConfig.Param.Brightness = b; |
|---|
| 1014 | picConfig.Param.Contrast = c; |
|---|
| 1015 | picConfig.Param.Saturation = sa; |
|---|
| 1016 | picConfig.Param.Hue = hue; |
|---|
| 1017 | picConfig.Param.hSharpness = sh; |
|---|
| 1018 | |
|---|
| 1019 | DHL_PIC_PresetParams( &picConfig ); |
|---|
| 1020 | } |
|---|
| 1021 | |
|---|
| 1022 | void PresetSetExtParam(int nr, int mnr, int apl, int bs, int f, int r, int b, int g,int memc) |
|---|
| 1023 | { |
|---|
| 1024 | PIC_CONFIG_t picConfig; |
|---|
| 1025 | |
|---|
| 1026 | memcpy( &picConfig, &g_CurPicConfig, sizeof(PIC_CONFIG_t) ); |
|---|
| 1027 | |
|---|
| 1028 | picConfig.ExtParam.NR = nr; |
|---|
| 1029 | picConfig.ExtParam.MpegNR = mnr; |
|---|
| 1030 | picConfig.ExtParam.APL = apl; |
|---|
| 1031 | picConfig.ExtParam.BlueStretch = bs; |
|---|
| 1032 | picConfig.ExtParam.FleshTone = f; |
|---|
| 1033 | picConfig.ExtParam.Red = r; |
|---|
| 1034 | picConfig.ExtParam.Blue = b; |
|---|
| 1035 | picConfig.ExtParam.Green = g; |
|---|
| 1036 | picConfig.ExtParam.MEMC = memc; |
|---|
| 1037 | |
|---|
| 1038 | DHL_PIC_PresetParams( &picConfig ); |
|---|
| 1039 | } |
|---|
| 1040 | |
|---|
| 1041 | void TestParam(int arg) |
|---|
| 1042 | { |
|---|
| 1043 | DS_U32 dwValue, tmp; |
|---|
| 1044 | int iValue; |
|---|
| 1045 | int i; |
|---|
| 1046 | |
|---|
| 1047 | switch(arg) { |
|---|
| 1048 | case 6: |
|---|
| 1049 | case 1: |
|---|
| 1050 | printf("Sharpness Test\n"); |
|---|
| 1051 | for (i=0; i<=100; i++) { |
|---|
| 1052 | DHL_PIC_SetSharpness( i, i ); |
|---|
| 1053 | DHL_PIC_GetSharpness( &dwValue, &tmp ); |
|---|
| 1054 | if ( i != dwValue ) { |
|---|
| 1055 | printf("|%s| Value is different; expected=%d, read=%ld\n", __FUNCTION__, i, dwValue); |
|---|
| 1056 | break; |
|---|
| 1057 | } |
|---|
| 1058 | } |
|---|
| 1059 | |
|---|
| 1060 | if ( i==101 ) |
|---|
| 1061 | printf("Passed.\n"); |
|---|
| 1062 | |
|---|
| 1063 | if (arg!=6) |
|---|
| 1064 | break; |
|---|
| 1065 | |
|---|
| 1066 | case 2: |
|---|
| 1067 | printf("Contrast Test\n"); |
|---|
| 1068 | for (i=0; i<=100; i++) { |
|---|
| 1069 | DHL_PIC_SetContrast( i ); |
|---|
| 1070 | DHL_PIC_GetContrast( &dwValue ); |
|---|
| 1071 | if ( i != dwValue ) { |
|---|
| 1072 | printf("|%s| Value is different; expected=%d, read=%ld\n", __FUNCTION__, i, dwValue); |
|---|
| 1073 | break; |
|---|
| 1074 | } |
|---|
| 1075 | } |
|---|
| 1076 | |
|---|
| 1077 | if ( i==101 ) |
|---|
| 1078 | printf("Passed.\n"); |
|---|
| 1079 | |
|---|
| 1080 | if (arg!=6) |
|---|
| 1081 | break; |
|---|
| 1082 | |
|---|
| 1083 | case 3: |
|---|
| 1084 | printf("Brightness Test\n"); |
|---|
| 1085 | for (i=0; i<=100; i++) { |
|---|
| 1086 | DHL_PIC_SetBrightness( i ); |
|---|
| 1087 | DHL_PIC_GetBrightness( &dwValue ); |
|---|
| 1088 | if ( i != dwValue ) { |
|---|
| 1089 | printf("|%s| Value is different; expected=%d, read=%ld\n", __FUNCTION__, i, dwValue); |
|---|
| 1090 | break; |
|---|
| 1091 | } |
|---|
| 1092 | } |
|---|
| 1093 | |
|---|
| 1094 | if ( i==101 ) |
|---|
| 1095 | printf("Passed.\n"); |
|---|
| 1096 | |
|---|
| 1097 | if (arg!=6) |
|---|
| 1098 | break; |
|---|
| 1099 | |
|---|
| 1100 | case 4: |
|---|
| 1101 | printf("Saturation Test\n"); |
|---|
| 1102 | for (i=0; i<=100; i++) { |
|---|
| 1103 | DHL_PIC_SetSaturation( i ); |
|---|
| 1104 | DHL_PIC_GetSaturation( &dwValue ); |
|---|
| 1105 | if ( i != dwValue ) { |
|---|
| 1106 | printf("|%s| Value is different; expected=%d, read=%ld\n", __FUNCTION__, i, dwValue); |
|---|
| 1107 | break; |
|---|
| 1108 | } |
|---|
| 1109 | } |
|---|
| 1110 | |
|---|
| 1111 | if ( i==101 ) |
|---|
| 1112 | printf("Passed.\n"); |
|---|
| 1113 | |
|---|
| 1114 | if (arg!=6) |
|---|
| 1115 | break; |
|---|
| 1116 | |
|---|
| 1117 | case 5: |
|---|
| 1118 | printf("Hue Test\n"); |
|---|
| 1119 | for (i=-50; i<=50; i++) { |
|---|
| 1120 | DHL_PIC_SetHue( i ); |
|---|
| 1121 | DHL_PIC_GetHue( &iValue ); |
|---|
| 1122 | if ( i != iValue ) { |
|---|
| 1123 | printf("|%s| Value is different; expected=%d, read=%d\n", __FUNCTION__, i, iValue); |
|---|
| 1124 | break; |
|---|
| 1125 | } |
|---|
| 1126 | } |
|---|
| 1127 | |
|---|
| 1128 | if ( i==51 ) |
|---|
| 1129 | printf("Passed.\n"); |
|---|
| 1130 | |
|---|
| 1131 | break; |
|---|
| 1132 | |
|---|
| 1133 | case 0: |
|---|
| 1134 | default: |
|---|
| 1135 | printf("Usage: %s [arg]\n", __FUNCTION__); |
|---|
| 1136 | printf(" 1: Sharpness\n"); |
|---|
| 1137 | printf(" 2: Contrast\n"); |
|---|
| 1138 | printf(" 3: Brightness\n"); |
|---|
| 1139 | printf(" 4: Saturation\n"); |
|---|
| 1140 | printf(" 5: Hue(Color)\n"); |
|---|
| 1141 | } |
|---|
| 1142 | } |
|---|
| 1143 | |
|---|
| 1144 | void get_hist(void) |
|---|
| 1145 | { |
|---|
| 1146 | DS_U8 hist[16]; |
|---|
| 1147 | int i, sum; |
|---|
| 1148 | |
|---|
| 1149 | DHL_PIC_GetHistogram( hist ); |
|---|
| 1150 | |
|---|
| 1151 | for (i=0; i<16; i++) { |
|---|
| 1152 | printf("HIST[%2d]: 0x%-4x\n", i, hist[i]); |
|---|
| 1153 | } |
|---|
| 1154 | |
|---|
| 1155 | for (i=0, sum=0; i<16; i++) { |
|---|
| 1156 | sum += hist[i] * 0x10 * (i+1); |
|---|
| 1157 | } |
|---|
| 1158 | sum /= 0x93; |
|---|
| 1159 | printf("SUM: %d\n", sum); |
|---|
| 1160 | } |
|---|
| 1161 | |
|---|