| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_picture_ctrl.h $ |
|---|
| 39 | * $brcm_Revision: 20 $ |
|---|
| 40 | * $brcm_Date: 3/2/11 3:13p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/modules/display/7400/include/nexus_picture_ctrl.h $ |
|---|
| 47 | * |
|---|
| 48 | * 20 3/2/11 3:13p erickson |
|---|
| 49 | * SW7420-1285: fix null_allowed attr |
|---|
| 50 | * |
|---|
| 51 | * 19 12/14/10 3:18p erickson |
|---|
| 52 | * SW7420-1285: add null_allowed attribute |
|---|
| 53 | * |
|---|
| 54 | * 18 12/9/10 12:00p erickson |
|---|
| 55 | * SW35230-2492: move NEXUS_ClipRect to nexus_types.h |
|---|
| 56 | * |
|---|
| 57 | * 17 3/3/10 2:38p erickson |
|---|
| 58 | * SW7420-565: add fields to NEXUS_PictureCtrlContrastStretch, remove |
|---|
| 59 | * duplicate fields from NEXUS_PictureCtrlAdvColorSettings |
|---|
| 60 | * |
|---|
| 61 | * 16 6/22/09 3:59p erickson |
|---|
| 62 | * PR56233: remove NEXUS_PictureCtrlAdvColorSettings.monochrome. believed |
|---|
| 63 | * to be DTV feature. |
|---|
| 64 | * |
|---|
| 65 | * 15 11/14/08 5:43p jgarrett |
|---|
| 66 | * PR 48957: Updating to match new VDC API style |
|---|
| 67 | * |
|---|
| 68 | * 14 9/24/08 11:25a erickson |
|---|
| 69 | * PR47300: update NEXUS_PictureCtrlColorClipSettings |
|---|
| 70 | * |
|---|
| 71 | * 13 9/22/08 12:10p erickson |
|---|
| 72 | * PR47190: added NEXUS_PictureCtrl_SetColorClipSettings |
|---|
| 73 | * |
|---|
| 74 | * 12 9/22/08 10:34a erickson |
|---|
| 75 | * PR46948: merge |
|---|
| 76 | * |
|---|
| 77 | * PR46948/1 9/22/08 2:55p chengs |
|---|
| 78 | * PR46948: Backlight Dimming in Dynamic Contrast code. |
|---|
| 79 | * |
|---|
| 80 | * 11 9/5/08 1:16p erickson |
|---|
| 81 | * PR45897: add dynamic backlight options for panels |
|---|
| 82 | * |
|---|
| 83 | * 10 9/2/08 10:21a erickson |
|---|
| 84 | * PR45181: update hungarian notation change |
|---|
| 85 | * |
|---|
| 86 | * 9 8/13/08 11:47a erickson |
|---|
| 87 | * PR45479: merge |
|---|
| 88 | * |
|---|
| 89 | * PR45479/1 8/12/08 12:25p chengs |
|---|
| 90 | * PR45479: Updated Dynamic Contrast code. |
|---|
| 91 | * |
|---|
| 92 | * 8 6/26/08 10:20a erickson |
|---|
| 93 | * PR44071: prevent overlap of NEXUS_PictureCtrlCommonSettings.colorTemp |
|---|
| 94 | * and NEXUS_PictureCtrlAdvColorSettings attenuation settings. added |
|---|
| 95 | * enable booleans. |
|---|
| 96 | * |
|---|
| 97 | * 7 5/9/08 3:47p erickson |
|---|
| 98 | * PR42552: readd Display luma stats functions |
|---|
| 99 | * |
|---|
| 100 | * 6 4/30/08 3:08p erickson |
|---|
| 101 | * PR39453: add 3548/3556 features |
|---|
| 102 | * |
|---|
| 103 | * 5 4/2/08 2:47p erickson |
|---|
| 104 | * PR40950: move PictureCtrl custom data into function params |
|---|
| 105 | * |
|---|
| 106 | * 4 2/29/08 5:39p erickson |
|---|
| 107 | * PR40156: implement ColorMatrix function |
|---|
| 108 | * |
|---|
| 109 | * 3 2/21/08 5:48p erickson |
|---|
| 110 | * PR39003: PQ api change |
|---|
| 111 | * |
|---|
| 112 | * PR38710/1 2/1/08 5:41p chengs |
|---|
| 113 | * PR38710: Rename GreenStretch and BlueStretch to GreenBoost and |
|---|
| 114 | * BlueBoost, support new BlueStretch. |
|---|
| 115 | * |
|---|
| 116 | * 2 1/28/08 1:07p erickson |
|---|
| 117 | * PR35457: add change notice |
|---|
| 118 | * |
|---|
| 119 | * 1 1/18/08 2:20p jgarrett |
|---|
| 120 | * PR 38808: Merging to main branch |
|---|
| 121 | * |
|---|
| 122 | * Nexus_Devel/14 1/11/08 11:04a erickson |
|---|
| 123 | * PR36159: refactored LumaStatistics api |
|---|
| 124 | * |
|---|
| 125 | * Nexus_Devel/13 1/11/08 10:34a erickson |
|---|
| 126 | * PR36159: update comments |
|---|
| 127 | * |
|---|
| 128 | * Nexus_Devel/12 1/8/08 10:57a erickson |
|---|
| 129 | * PR36159: refactor some 3563 Display API's |
|---|
| 130 | * |
|---|
| 131 | * Nexus_Devel/11 12/18/07 1:35p erickson |
|---|
| 132 | * PR38213: analog video input rework |
|---|
| 133 | * |
|---|
| 134 | * Nexus_Devel/10 11/30/07 10:52a erickson |
|---|
| 135 | * PR35457: api update |
|---|
| 136 | * |
|---|
| 137 | **************************************************************************/ |
|---|
| 138 | #ifndef NEXUS_PICTURE_CTRL_H__ |
|---|
| 139 | #define NEXUS_PICTURE_CTRL_H__ |
|---|
| 140 | |
|---|
| 141 | #include "nexus_types.h" |
|---|
| 142 | #include "nexus_display_types.h" |
|---|
| 143 | |
|---|
| 144 | #ifdef __cplusplus |
|---|
| 145 | extern "C" { |
|---|
| 146 | #endif |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | /*=************************************************************************ |
|---|
| 150 | The PictureCtrl interface manipulates the backend picture enhancement units. |
|---|
| 151 | in future Nexus releases. |
|---|
| 152 | **************************************************************************/ |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | /*************************************************************************** |
|---|
| 156 | Summary: |
|---|
| 157 | Dither settings |
|---|
| 158 | |
|---|
| 159 | Description: |
|---|
| 160 | Used in NEXUS_PictureCtrl_SetDitherSettings |
|---|
| 161 | **************************************************************************/ |
|---|
| 162 | typedef struct NEXUS_PictureCtrlDitherSettings |
|---|
| 163 | { |
|---|
| 164 | bool reduceSmooth; |
|---|
| 165 | bool smoothEnable; |
|---|
| 166 | uint32_t smoothLimit; |
|---|
| 167 | } NEXUS_PictureCtrlDitherSettings; |
|---|
| 168 | |
|---|
| 169 | /*************************************************************************** |
|---|
| 170 | Summary: |
|---|
| 171 | CMS parameters used in NEXUS_PictureCtrlCmsSettings |
|---|
| 172 | **************************************************************************/ |
|---|
| 173 | typedef struct NEXUS_PictureCtrlCmsParameters |
|---|
| 174 | { |
|---|
| 175 | uint32_t red; |
|---|
| 176 | uint32_t green; |
|---|
| 177 | uint32_t blue; |
|---|
| 178 | uint32_t cyan; |
|---|
| 179 | uint32_t magenta; |
|---|
| 180 | uint32_t yellow; |
|---|
| 181 | } NEXUS_PictureCtrlCmsParameters; |
|---|
| 182 | |
|---|
| 183 | /*************************************************************************** |
|---|
| 184 | Summary: |
|---|
| 185 | CMS settings |
|---|
| 186 | |
|---|
| 187 | Description: |
|---|
| 188 | Used in NEXUS_PictureCtrl_SetCmsSettings |
|---|
| 189 | **************************************************************************/ |
|---|
| 190 | typedef struct NEXUS_PictureCtrlCmsSettings |
|---|
| 191 | { |
|---|
| 192 | NEXUS_PictureCtrlCmsParameters saturationGain; |
|---|
| 193 | NEXUS_PictureCtrlCmsParameters hueGain; |
|---|
| 194 | } NEXUS_PictureCtrlCmsSettings; |
|---|
| 195 | |
|---|
| 196 | /*************************************************************************** |
|---|
| 197 | Summary: |
|---|
| 198 | Sharpness register Settings (TNT_CMP_0_V0) |
|---|
| 199 | |
|---|
| 200 | Description: |
|---|
| 201 | Please refer to the register database (RDB) for details on these settings. |
|---|
| 202 | Used in NEXUS_PictureCtrl_SetSharpnessValue |
|---|
| 203 | **************************************************************************/ |
|---|
| 204 | typedef struct NEXUS_PictureCtrlSharpnessValue |
|---|
| 205 | { |
|---|
| 206 | bool enable; /* TOP_CONTROL.ENABLE */ |
|---|
| 207 | uint32_t lumaControlCore; /* LUMA_CONTROL.CORE */ |
|---|
| 208 | uint32_t lumaControlGain; /* LUMA_CONTROL.GAIN */ |
|---|
| 209 | uint32_t lumaControlBlur; /* LUMA_CONTROL.BLUR */ |
|---|
| 210 | bool lumaCtrlSoften; /* LUMA_CONTROL.SOFTEN */ |
|---|
| 211 | bool lumaCtrlHOnly; /* LUMA_CONTROL.H_ONLY */ |
|---|
| 212 | uint32_t lumaPeakingHAvoid; /* LUMA_PEAKING.H_AVOID */ |
|---|
| 213 | uint32_t lumaPeakingVAvoid; /* LUMA_PEAKING.V_AVOID */ |
|---|
| 214 | uint32_t lumaPeakingPeakLimit; /* LUMA_PEAKING.PEAK_LIMIT */ |
|---|
| 215 | uint32_t lumaPeakingPeakValue; /* LUMA_PEAKING.PEAK_VALUE */ |
|---|
| 216 | uint32_t chromaControlCore; /* CHROMA_CONTROL.CORE */ |
|---|
| 217 | bool chromaCtrlWideChroma; /* CHROMA_CONTROL.WIDE_CHROMA */ |
|---|
| 218 | uint32_t chromaControlFalseColor;/* CHROMA_CONTROL.FALSE_COLOR */ |
|---|
| 219 | uint32_t chromaControlGain; /* CHROMA_CONTROL.GAIN */ |
|---|
| 220 | bool chromaCtrlHOnly; /* CHROMA_CONTROL.H_ONLY */ |
|---|
| 221 | uint32_t wideLumaControlCore; /* WIDE_LUMA_CONTROL.CORE */ |
|---|
| 222 | uint32_t wideLumaControlMode; /* WIDE_LUMA_CONTROL.MODE */ |
|---|
| 223 | } NEXUS_PictureCtrlSharpnessValue; |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | #define NEXUS_DC_TABLE_ROWS (15) |
|---|
| 227 | #define NEXUS_DC_TABLE_COLS (17) |
|---|
| 228 | |
|---|
| 229 | /*************************************************************************** |
|---|
| 230 | Summary: |
|---|
| 231 | This structure describes the settings used the contrast stretch algorithm. |
|---|
| 232 | |
|---|
| 233 | Description: |
|---|
| 234 | The fields are for the dynamic contrast stretch algorithm. These, |
|---|
| 235 | however, do not allow the user direct control of the LAB table. |
|---|
| 236 | The algorithm just uses these fields as basis for calculating |
|---|
| 237 | the contrast stretch. |
|---|
| 238 | |
|---|
| 239 | Warning: These can change in future chip revisions. |
|---|
| 240 | **************************************************************************/ |
|---|
| 241 | typedef struct NEXUS_PictureCtrlContrastStretch |
|---|
| 242 | { |
|---|
| 243 | bool enabled; /* enable contrast stretch. if false, all other values in this structure are ignored. */ |
|---|
| 244 | int gain; /* the amount of stretch towards min and max |
|---|
| 245 | (recommended value of 1 in fixed point format) */ |
|---|
| 246 | int gainShift; /* fractional number of gain */ |
|---|
| 247 | |
|---|
| 248 | int filterNum; /* unused: the numerator of the min, mid, max low pass filter */ |
|---|
| 249 | int filterDenom; /* unused: the denomerator of the min, mid, max low pass filter */ |
|---|
| 250 | int dynamicContrastBlackGain; /* unused: gain for black stretch side in Dynamic Contrast (in fixed point format) */ |
|---|
| 251 | int dynamicContrastWhiteGain; /* unused: gain for white stretch side in Dynamic Contrast (in fixed point format) */ |
|---|
| 252 | uint16_t dynamicContrastBlackLimit; /* unused: limit for black stretch in Dynamic Contrast */ |
|---|
| 253 | uint16_t dynamicContrastWhiteLimit; /* unused: limit for white stretch in Dynamic Contrast */ |
|---|
| 254 | uint16_t dynamicContrastEstCurMaxPt; /* unused: point to estimate current max luma in dynamic contrast */ |
|---|
| 255 | uint16_t dynamicContrastEstCurMinPt; /* unused: point to estimate current min luma in dynamic contrast */ |
|---|
| 256 | bool dynamicBacklightControl; /* unused */ |
|---|
| 257 | |
|---|
| 258 | int32_t ireTable[NEXUS_DC_TABLE_COLS -1]; |
|---|
| 259 | uint32_t dcTable1[NEXUS_DC_TABLE_ROWS * NEXUS_DC_TABLE_COLS]; |
|---|
| 260 | uint32_t dcTable2[NEXUS_DC_TABLE_ROWS * NEXUS_DC_TABLE_COLS]; |
|---|
| 261 | } NEXUS_PictureCtrlContrastStretch; |
|---|
| 262 | |
|---|
| 263 | /*************************************************************************** |
|---|
| 264 | Summary: |
|---|
| 265 | Array sizes used in NEXUS_LumaStatistics |
|---|
| 266 | **************************************************************************/ |
|---|
| 267 | #define NEXUS_LUMA_HISTOGRAM_COUNT (16) |
|---|
| 268 | #define NEXUS_LUMA_HISTOGRAM_LEVELS (4) |
|---|
| 269 | |
|---|
| 270 | /*************************************************************************** |
|---|
| 271 | Summary: |
|---|
| 272 | This structure describes the luma statistics. |
|---|
| 273 | |
|---|
| 274 | Description: |
|---|
| 275 | NEXUS_LumaStatistics contains luma statistics for the current picture coming out of the window. |
|---|
| 276 | |
|---|
| 277 | See NEXUS_PictureCtrl_GetLumaStatistics |
|---|
| 278 | ***************************************************************************/ |
|---|
| 279 | typedef struct NEXUS_LumaStatistics |
|---|
| 280 | { |
|---|
| 281 | uint32_t average; /* the average of all luma in the specified region */ |
|---|
| 282 | uint32_t min; /* the min of all luma in the specified region */ |
|---|
| 283 | uint32_t max; /* the min of all luma in the specified region */ |
|---|
| 284 | uint32_t histogram[NEXUS_LUMA_HISTOGRAM_COUNT]; /* histogram data of luma */ |
|---|
| 285 | uint32_t levelStats[NEXUS_LUMA_HISTOGRAM_LEVELS]; /* only valid on some chips */ |
|---|
| 286 | } NEXUS_LumaStatistics; |
|---|
| 287 | |
|---|
| 288 | /*************************************************************************** |
|---|
| 289 | Summary: |
|---|
| 290 | Common picture control settings |
|---|
| 291 | |
|---|
| 292 | Description: |
|---|
| 293 | All int16_t values in this structure range between -32768 and 32767. The default is 0. |
|---|
| 294 | Used in NEXUS_PictureCtrl_SetCommonSettings |
|---|
| 295 | **************************************************************************/ |
|---|
| 296 | typedef struct NEXUS_PictureCtrlCommonSettings |
|---|
| 297 | { |
|---|
| 298 | int16_t contrast; |
|---|
| 299 | int16_t saturation; |
|---|
| 300 | int16_t hue; |
|---|
| 301 | int16_t brightness; |
|---|
| 302 | |
|---|
| 303 | bool colorTempEnabled; /* If true, set colorTemp. This will be overridden if NEXUS_PictureCtrlAdvColorSettings.attenuationRbgEnabled is true. */ |
|---|
| 304 | int16_t colorTemp; |
|---|
| 305 | |
|---|
| 306 | bool sharpnessEnable; /* enable or disable sharpness adjustment */ |
|---|
| 307 | int16_t sharpness; |
|---|
| 308 | } NEXUS_PictureCtrlCommonSettings; |
|---|
| 309 | |
|---|
| 310 | /*************************************************************************** |
|---|
| 311 | Summary: |
|---|
| 312 | Attenutation base |
|---|
| 313 | **************************************************************************/ |
|---|
| 314 | #define NEXUS_PICTURE_ATTENUATION_BASE (2048) |
|---|
| 315 | |
|---|
| 316 | /*************************************************************************** |
|---|
| 317 | Summary: |
|---|
| 318 | Blue stretch settings |
|---|
| 319 | **************************************************************************/ |
|---|
| 320 | typedef struct |
|---|
| 321 | { |
|---|
| 322 | uint16_t blueStretchOffset; |
|---|
| 323 | uint16_t blueStretchSlope; |
|---|
| 324 | } NEXUS_BlueStretchSettings; |
|---|
| 325 | |
|---|
| 326 | /*************************************************************************** |
|---|
| 327 | Summary: |
|---|
| 328 | Enhanced picture control color settings |
|---|
| 329 | |
|---|
| 330 | Description: |
|---|
| 331 | See NEXUS_PictureCtrl_GetAdvColorSettings |
|---|
| 332 | **************************************************************************/ |
|---|
| 333 | typedef struct NEXUS_PictureCtrlAdvColorSettings |
|---|
| 334 | { |
|---|
| 335 | bool attenuationRbgEnabled; /* If true, apply the following attenuation RGB convert matrix settings. |
|---|
| 336 | This will be overridden if NEXUS_PictureCtrlCommonSettings.colorTempEnabled is true. */ |
|---|
| 337 | unsigned attenuationR; /* attenuation_R in convert matrix */ |
|---|
| 338 | unsigned attenuationG; /* attenuation_G in convert matrix */ |
|---|
| 339 | unsigned attenuationB; /* attenuation_B in convert matrix */ |
|---|
| 340 | int16_t offsetR; /* offset_R in convert matrix */ |
|---|
| 341 | int16_t offsetG; /* offset_G in convert matrix */ |
|---|
| 342 | int16_t offsetB; /* offset_B in convert matrix */ |
|---|
| 343 | |
|---|
| 344 | int16_t fleshTone; /* value for Flesh Tone */ |
|---|
| 345 | int16_t greenBoost; /* value for Green Boost */ |
|---|
| 346 | int16_t blueBoost; /* value for Blue Boost */ |
|---|
| 347 | NEXUS_BlueStretchSettings blueStretchSettings; /* settings for Blue Stretch */ |
|---|
| 348 | } NEXUS_PictureCtrlAdvColorSettings; |
|---|
| 349 | |
|---|
| 350 | /*************************************************************************** |
|---|
| 351 | Summary: |
|---|
| 352 | Color Correction Settings |
|---|
| 353 | |
|---|
| 354 | Description: |
|---|
| 355 | See NEXUS_PictureCtrl_SetColorCorrectionTable |
|---|
| 356 | **************************************************************************/ |
|---|
| 357 | typedef struct NEXUS_PictureControlColorCorrectionSettings |
|---|
| 358 | { |
|---|
| 359 | bool enabled; |
|---|
| 360 | unsigned gammaId; /* identifier for gamma */ |
|---|
| 361 | unsigned colorId; /* identifier for the color temperature */ |
|---|
| 362 | } NEXUS_PictureControlColorCorrectionSettings; |
|---|
| 363 | |
|---|
| 364 | /*************************************************************************** |
|---|
| 365 | Summary: |
|---|
| 366 | Get common color settings |
|---|
| 367 | ****************************************************************************/ |
|---|
| 368 | void NEXUS_PictureCtrl_GetCommonSettings( |
|---|
| 369 | NEXUS_VideoWindowHandle window, |
|---|
| 370 | NEXUS_PictureCtrlCommonSettings *pSettings /* [out] */ |
|---|
| 371 | ); |
|---|
| 372 | |
|---|
| 373 | /*************************************************************************** |
|---|
| 374 | Summary: |
|---|
| 375 | Set common color settings |
|---|
| 376 | |
|---|
| 377 | Description: |
|---|
| 378 | NEXUS_PictureCtrl_SetCommonSettings is used to do the basic picture |
|---|
| 379 | control of contrast, saturation, hue, brightness, color temperature |
|---|
| 380 | and sharpness. |
|---|
| 381 | |
|---|
| 382 | It sets the color space convertor (CSC) in the compositor (CMP). |
|---|
| 383 | This function will override anything set by NEXUS_VideoWindow_SetColorMatrix. |
|---|
| 384 | |
|---|
| 385 | See Also: |
|---|
| 386 | NEXUS_VideoWindow_SetColorMatrix - more detailed control of the CSC block |
|---|
| 387 | NEXUS_PictureCtrl_SetSharpnessValue - more detailed control of sharpness |
|---|
| 388 | ****************************************************************************/ |
|---|
| 389 | NEXUS_Error NEXUS_PictureCtrl_SetCommonSettings( |
|---|
| 390 | NEXUS_VideoWindowHandle window, |
|---|
| 391 | const NEXUS_PictureCtrlCommonSettings *pSettings |
|---|
| 392 | ); |
|---|
| 393 | |
|---|
| 394 | /*************************************************************************** |
|---|
| 395 | Summary: |
|---|
| 396 | Get enhanced color settings |
|---|
| 397 | ****************************************************************************/ |
|---|
| 398 | void NEXUS_PictureCtrl_GetAdvColorSettings( |
|---|
| 399 | NEXUS_VideoWindowHandle window, |
|---|
| 400 | NEXUS_PictureCtrlAdvColorSettings *pSettings /* [out] */ |
|---|
| 401 | ); |
|---|
| 402 | |
|---|
| 403 | /*************************************************************************** |
|---|
| 404 | Summary: |
|---|
| 405 | Set enhanced color settings |
|---|
| 406 | |
|---|
| 407 | Description: |
|---|
| 408 | NEXUS_PictureCtrl_SetAdvColorSettings is used to advanced picture |
|---|
| 409 | control of dynamic contrast, flesh tone, green boost, blue boost |
|---|
| 410 | and monochrome. |
|---|
| 411 | |
|---|
| 412 | See Also: |
|---|
| 413 | NEXUS_PictureCtrl_SetCmsSettings - overrides any fleshTone, greenBoost and blueBoost setting |
|---|
| 414 | NEXUS_PictureCtrl_LoadCabTable - overrides any fleshTone, greenBoost and blueBoost setting |
|---|
| 415 | ****************************************************************************/ |
|---|
| 416 | NEXUS_Error NEXUS_PictureCtrl_SetAdvColorSettings( |
|---|
| 417 | NEXUS_VideoWindowHandle window, |
|---|
| 418 | const NEXUS_PictureCtrlAdvColorSettings *pSettings |
|---|
| 419 | ); |
|---|
| 420 | |
|---|
| 421 | /*************************************************************************** |
|---|
| 422 | Summary: |
|---|
| 423 | Get CMS control settings |
|---|
| 424 | ****************************************************************************/ |
|---|
| 425 | void NEXUS_PictureCtrl_GetCmsSettings( |
|---|
| 426 | NEXUS_VideoWindowHandle window, |
|---|
| 427 | NEXUS_PictureCtrlCmsSettings *pSettings /* [out] */ |
|---|
| 428 | ); |
|---|
| 429 | |
|---|
| 430 | /*************************************************************************** |
|---|
| 431 | Summary: |
|---|
| 432 | Set CMS control settings |
|---|
| 433 | |
|---|
| 434 | Description: |
|---|
| 435 | NEXUS_PictureCtrl_SetCmsSettings sets the saturation gain and hue gain |
|---|
| 436 | for six basic colors(red/green/blue/cyan/magenta/yellow). It provides |
|---|
| 437 | the capability to manage each color in the color bar independently. |
|---|
| 438 | |
|---|
| 439 | Note that NEXUS_PictureCtrl_SetCmsSettings is exclusive with the |
|---|
| 440 | parameters of fleshTone, greenBoost and blueBoost in |
|---|
| 441 | NEXUS_PictureCtrl_SetAdvColorSettings because both are based on CAB |
|---|
| 442 | block and they are implemented through different algorithm internally. |
|---|
| 443 | |
|---|
| 444 | If the user turns on CMS by NEXUS_PictureCtrl_SetCmsSettings, it is not |
|---|
| 445 | allowed to call NEXUS_PictureCtrl_SetAdvColorSettings to turn on |
|---|
| 446 | flesh tone, green boost or blue boost before user turn off CMS. |
|---|
| 447 | |
|---|
| 448 | If the user turn on fleshTone, greenBoost or blueBoost by calling |
|---|
| 449 | NEXUS_PictureCtrl_SetAdvColorSettings, it is not allowed to turn on |
|---|
| 450 | CMS by NEXUS_PictureCtrl_SetCmsSettings before user turn off fleshTone, |
|---|
| 451 | greenBoost and blueBoost. |
|---|
| 452 | |
|---|
| 453 | See Also: |
|---|
| 454 | NEXUS_PictureCtrl_SetAdvColorSettings |
|---|
| 455 | NEXUS_PictureCtrl_LoadCabTable |
|---|
| 456 | ****************************************************************************/ |
|---|
| 457 | NEXUS_Error NEXUS_PictureCtrl_SetCmsSettings( |
|---|
| 458 | NEXUS_VideoWindowHandle window, |
|---|
| 459 | const NEXUS_PictureCtrlCmsSettings *pSettings |
|---|
| 460 | ); |
|---|
| 461 | |
|---|
| 462 | /*************************************************************************** |
|---|
| 463 | Summary: |
|---|
| 464 | Get current window dither settings |
|---|
| 465 | ****************************************************************************/ |
|---|
| 466 | void NEXUS_PictureCtrl_GetDitherSettings( |
|---|
| 467 | NEXUS_VideoWindowHandle window, |
|---|
| 468 | NEXUS_PictureCtrlDitherSettings *pSettings /* [out] */ |
|---|
| 469 | ); |
|---|
| 470 | |
|---|
| 471 | /*************************************************************************** |
|---|
| 472 | Summary: |
|---|
| 473 | Set new window dither settings |
|---|
| 474 | ****************************************************************************/ |
|---|
| 475 | NEXUS_Error NEXUS_PictureCtrl_SetDitherSettings( |
|---|
| 476 | NEXUS_VideoWindowHandle window, |
|---|
| 477 | const NEXUS_PictureCtrlDitherSettings *pSettings |
|---|
| 478 | ); |
|---|
| 479 | |
|---|
| 480 | /*************************************************************************** |
|---|
| 481 | Summary: |
|---|
| 482 | Get contrast stretch parameters |
|---|
| 483 | ****************************************************************************/ |
|---|
| 484 | void NEXUS_PictureCtrl_GetContrastStretch( |
|---|
| 485 | NEXUS_VideoWindowHandle window, |
|---|
| 486 | NEXUS_PictureCtrlContrastStretch *pContrast /* [out] histogram data */ |
|---|
| 487 | ); |
|---|
| 488 | |
|---|
| 489 | /*************************************************************************** |
|---|
| 490 | Summary: |
|---|
| 491 | Set contrast stretch parameters |
|---|
| 492 | |
|---|
| 493 | Description: |
|---|
| 494 | This is an advanced usage of dynamic contrast feature. User can call this |
|---|
| 495 | API to customize dynamic contrast config. |
|---|
| 496 | |
|---|
| 497 | See Also: |
|---|
| 498 | NEXUS_PictureCtrl_SetAdvColorSettings |
|---|
| 499 | NEXUS_PictureCtrl_LoadLabTable |
|---|
| 500 | ****************************************************************************/ |
|---|
| 501 | NEXUS_Error NEXUS_PictureCtrl_SetContrastStretch( |
|---|
| 502 | NEXUS_VideoWindowHandle window, |
|---|
| 503 | const NEXUS_PictureCtrlContrastStretch *pContrast /* attr{null_allowed=y} histogram data */ |
|---|
| 504 | ); |
|---|
| 505 | |
|---|
| 506 | /*************************************************************************** |
|---|
| 507 | Summary: |
|---|
| 508 | Set contrast stretch parameters along with custom data for LAB processing |
|---|
| 509 | ****************************************************************************/ |
|---|
| 510 | NEXUS_Error NEXUS_PictureCtrl_SetCustomContrastStretch( |
|---|
| 511 | NEXUS_VideoWindowHandle window, |
|---|
| 512 | const NEXUS_PictureCtrlContrastStretch *pContrast, |
|---|
| 513 | const int16_t *pTable, /* attr{nelem=numTableEntries} custom LAB parameters */ |
|---|
| 514 | unsigned numTableEntries |
|---|
| 515 | ); |
|---|
| 516 | |
|---|
| 517 | /*************************************************************************** |
|---|
| 518 | Summary: |
|---|
| 519 | Get custom sharpness setting registers. |
|---|
| 520 | ****************************************************************************/ |
|---|
| 521 | void NEXUS_PictureCtrl_GetSharpnessValue( |
|---|
| 522 | NEXUS_VideoWindowHandle window, |
|---|
| 523 | NEXUS_PictureCtrlSharpnessValue *pData /* [out] */ |
|---|
| 524 | ); |
|---|
| 525 | |
|---|
| 526 | /*************************************************************************** |
|---|
| 527 | Summary: |
|---|
| 528 | Set custom sharpness setting registers. |
|---|
| 529 | |
|---|
| 530 | Description: |
|---|
| 531 | NEXUS_PictureCtrl_SetSharpnessValue provides more detail controls for |
|---|
| 532 | advanced user to adjust sharpness. |
|---|
| 533 | |
|---|
| 534 | NEXUS_PictureCtrl_SetSharpnessValue will override the sharpness |
|---|
| 535 | settings that were set through NEXUS_PictureCtrl_SetCommonSettings.sharpness. |
|---|
| 536 | |
|---|
| 537 | Call NEXUS_PictureCtrl_SetSharpnessValue with NEXUS_PictureCtrlSharpnessValue.enable=false to |
|---|
| 538 | disable the custom settings. |
|---|
| 539 | |
|---|
| 540 | See Also: |
|---|
| 541 | NEXUS_PictureCtrl_SetCommonSettings |
|---|
| 542 | ****************************************************************************/ |
|---|
| 543 | NEXUS_Error NEXUS_PictureCtrl_SetSharpnessValue( |
|---|
| 544 | NEXUS_VideoWindowHandle window, |
|---|
| 545 | const NEXUS_PictureCtrlSharpnessValue *pData |
|---|
| 546 | ); |
|---|
| 547 | |
|---|
| 548 | /*************************************************************************** |
|---|
| 549 | Summary: |
|---|
| 550 | Load the CAB table |
|---|
| 551 | |
|---|
| 552 | Description: |
|---|
| 553 | Disable or enable CAB block by providing the CAB table pointer. |
|---|
| 554 | A NULL pointer disables CAB. A partial table can be loaded by |
|---|
| 555 | using the offset and size parameters. |
|---|
| 556 | |
|---|
| 557 | A few caveats follow: |
|---|
| 558 | |
|---|
| 559 | 1. If partial tables are to be loaded, it is required that the entire |
|---|
| 560 | table be loaded first because the uninitialized portions of the table |
|---|
| 561 | cannot be filled in with initial values that are guaranteed to work |
|---|
| 562 | correctly with the partially loaded table. |
|---|
| 563 | 2. When loading partial tables, the VDC cannot guarantee that it |
|---|
| 564 | would be error free. It is the responsiblilty of the end user to |
|---|
| 565 | assure its validity and operationability with the rest of the PEP block. |
|---|
| 566 | 3. The CAB table is persistent. If disabled, the table will not be |
|---|
| 567 | erased. The window would have to be closed to reset the table. |
|---|
| 568 | 4. Once user table is loaded, user cannot select auto flesh, green |
|---|
| 569 | boost and blue boost algorithm until user disable customized |
|---|
| 570 | table by passing in the NULL pointer table. |
|---|
| 571 | |
|---|
| 572 | See Also: |
|---|
| 573 | This function overrides values set by NEXUS_PictureCtrl_SetAdvColorSettings or |
|---|
| 574 | NEXUS_PictureCtrl_SetCmsSettings. See them for details of which features are overridden. |
|---|
| 575 | **************************************************************************/ |
|---|
| 576 | NEXUS_Error NEXUS_PictureCtrl_LoadCabTable( |
|---|
| 577 | NEXUS_VideoWindowHandle window, |
|---|
| 578 | const uint32_t *pTable, /* attr{null_allowed=y;nelem=numTableEntries} table data */ |
|---|
| 579 | unsigned numTableEntries, /* size of the CAB table, size 0 is used to disable custom table. */ |
|---|
| 580 | unsigned offset /* start offset in the table */ |
|---|
| 581 | ); |
|---|
| 582 | |
|---|
| 583 | /*************************************************************************** |
|---|
| 584 | Summary: |
|---|
| 585 | Load the LAB table |
|---|
| 586 | |
|---|
| 587 | Description: |
|---|
| 588 | NEXUS_PictureCtrl_LoadLabTable loads the raw LAB table into LAB block. |
|---|
| 589 | It will override the dynamic contrast settings set through |
|---|
| 590 | NEXUS_PictureCtrl_SetAdvColorSettings or NEXUS_PictureCtrl_SetContrastStretch. |
|---|
| 591 | |
|---|
| 592 | See Also: |
|---|
| 593 | This function overrides values set by NEXUS_PictureCtrl_SetAdvColorSettings or |
|---|
| 594 | NEXUS_PictureCtrl_SetContrastStretch. See them for details of which features are overridden. |
|---|
| 595 | **************************************************************************/ |
|---|
| 596 | NEXUS_Error NEXUS_PictureCtrl_LoadLabTable( |
|---|
| 597 | NEXUS_VideoWindowHandle window, |
|---|
| 598 | const uint32_t *pTable, /* attr{null_allowed=y;nelem=numTableEntries} table data */ |
|---|
| 599 | unsigned numTableEntries, /* size of the LAB table, size 0 is used to disable custom table. */ |
|---|
| 600 | unsigned offset /* start offset in the table */ |
|---|
| 601 | ); |
|---|
| 602 | |
|---|
| 603 | /*************************************************************************** |
|---|
| 604 | Summary: |
|---|
| 605 | Set luma average calculation region for the display |
|---|
| 606 | **************************************************************************/ |
|---|
| 607 | NEXUS_Error NEXUS_PictureCtrl_ConfigDisplayLumaStatistics( |
|---|
| 608 | NEXUS_DisplayHandle display, |
|---|
| 609 | const NEXUS_ClipRect *pRect /* Luma average calculation region. */ |
|---|
| 610 | ); |
|---|
| 611 | |
|---|
| 612 | /*************************************************************************** |
|---|
| 613 | Summary: |
|---|
| 614 | Get luma average value of the display |
|---|
| 615 | **************************************************************************/ |
|---|
| 616 | NEXUS_Error NEXUS_PictureCtrl_GetDisplayLumaStatistics( |
|---|
| 617 | NEXUS_DisplayHandle display, |
|---|
| 618 | NEXUS_LumaStatistics *pLumaStat /* [out] */ |
|---|
| 619 | ); |
|---|
| 620 | |
|---|
| 621 | |
|---|
| 622 | /*************************************************************************** |
|---|
| 623 | Summary: |
|---|
| 624 | Set luma average calculation region for the video window |
|---|
| 625 | **************************************************************************/ |
|---|
| 626 | NEXUS_Error NEXUS_PictureCtrl_ConfigWindowLumaStatistics( |
|---|
| 627 | NEXUS_VideoWindowHandle window, |
|---|
| 628 | const NEXUS_ClipRect *pRect /* Luma average calculation region. */ |
|---|
| 629 | ); |
|---|
| 630 | |
|---|
| 631 | /*************************************************************************** |
|---|
| 632 | Summary: |
|---|
| 633 | Get luma average value of video window's surface |
|---|
| 634 | **************************************************************************/ |
|---|
| 635 | NEXUS_Error NEXUS_PictureCtrl_GetWindowLumaStatistics( |
|---|
| 636 | NEXUS_VideoWindowHandle window, |
|---|
| 637 | NEXUS_LumaStatistics *pLumaStat /* [out] */ |
|---|
| 638 | ); |
|---|
| 639 | |
|---|
| 640 | /*************************************************************************** |
|---|
| 641 | Summary: |
|---|
| 642 | Load color correction table for white balance |
|---|
| 643 | **************************************************************************/ |
|---|
| 644 | NEXUS_Error NEXUS_PictureCtrl_SetColorCorrectionTable( |
|---|
| 645 | NEXUS_DisplayHandle display, |
|---|
| 646 | const NEXUS_PictureControlColorCorrectionSettings *pSettings |
|---|
| 647 | ); |
|---|
| 648 | |
|---|
| 649 | /*************************************************************************** |
|---|
| 650 | Summary: |
|---|
| 651 | Load custom color correction table for white balance |
|---|
| 652 | **************************************************************************/ |
|---|
| 653 | NEXUS_Error NEXUS_PictureCtrl_SetCustomColorCorrectionTable( |
|---|
| 654 | NEXUS_DisplayHandle display, |
|---|
| 655 | const uint32_t *pTable, /* attr{null_allowed=y;nelem=numTableEntries} */ |
|---|
| 656 | unsigned numTableEntries |
|---|
| 657 | ); |
|---|
| 658 | |
|---|
| 659 | /*************************************************************************** |
|---|
| 660 | Summary: |
|---|
| 661 | Color clip modes used in NEXUS_PictureCtrlColorClipSettings |
|---|
| 662 | ***************************************************************************/ |
|---|
| 663 | typedef enum NEXUS_ColorClipMode |
|---|
| 664 | { |
|---|
| 665 | NEXUS_ColorClipMode_eNone = 0, /* Disable color clip */ |
|---|
| 666 | NEXUS_ColorClipMode_eWhite, /* Enable color clip for white */ |
|---|
| 667 | NEXUS_ColorClipMode_eBlack, /* Enable color clip for black */ |
|---|
| 668 | NEXUS_ColorClipMode_eBoth, /* Enable color clip for both */ |
|---|
| 669 | NEXUS_ColorClipMode_eMax |
|---|
| 670 | } NEXUS_ColorClipMode; |
|---|
| 671 | |
|---|
| 672 | /*************************************************************************** |
|---|
| 673 | Summary: |
|---|
| 674 | This structure describes Color Clip slopes/joints configurations. |
|---|
| 675 | |
|---|
| 676 | Description: |
|---|
| 677 | The job of the color clip is to gracefully remap out of range RGB values in a |
|---|
| 678 | graceful way before hardware does the clipping to 0 or 1023. What gets clipped |
|---|
| 679 | is purely a function of the matrix which converts display-colorspace YCbCr to |
|---|
| 680 | display-colorspace RGB. This matrix is completely determined by the display's |
|---|
| 681 | primaries and white point. |
|---|
| 682 | It only depends on the primaries and white point of the display, which is fixed. |
|---|
| 683 | Therefore, the slopes and joints can be computed offline and stored for each |
|---|
| 684 | TV model or individual unit. |
|---|
| 685 | |
|---|
| 686 | Note: slopes are unsigned and the derivation should follow the provided |
|---|
| 687 | programming guide. |
|---|
| 688 | ***************************************************************************/ |
|---|
| 689 | typedef struct NEXUS_PictureCtrlColorClipSettings |
|---|
| 690 | { |
|---|
| 691 | uint32_t crYSlopeA; /* Chroma versus (219-Luma) Slope; in U16.16 fixed point format. */ |
|---|
| 692 | uint32_t crYSlopeB; /* Chroma versus (219-Luma) Slope; in U16.16 fixed point format. */ |
|---|
| 693 | uint32_t cbYSlopeA; /* Chroma versus (219-Luma) Slope; in U16.16 fixed point format. */ |
|---|
| 694 | uint32_t cbYSlopeB; /* Chroma versus (219-Luma) Slope; in U16.16 fixed point format. */ |
|---|
| 695 | uint32_t crJoint; /* Joint of Cr Slope_A and Slope_B. */ |
|---|
| 696 | uint32_t cbJoint; /* Joint of Cb Slope_A and Slope_B. */ |
|---|
| 697 | bool extendedWhite; |
|---|
| 698 | bool extendedBlack; |
|---|
| 699 | NEXUS_ColorClipMode colorClipMode; |
|---|
| 700 | } NEXUS_PictureCtrlColorClipSettings; |
|---|
| 701 | |
|---|
| 702 | /*************************************************************************** |
|---|
| 703 | Summary: |
|---|
| 704 | Get color clip settings |
|---|
| 705 | **************************************************************************/ |
|---|
| 706 | void NEXUS_PictureCtrl_GetColorClipSettings( |
|---|
| 707 | NEXUS_DisplayHandle display, |
|---|
| 708 | NEXUS_PictureCtrlColorClipSettings *pSettings /* [out] */ |
|---|
| 709 | ); |
|---|
| 710 | |
|---|
| 711 | /*************************************************************************** |
|---|
| 712 | Summary: |
|---|
| 713 | Set color clip settings |
|---|
| 714 | **************************************************************************/ |
|---|
| 715 | NEXUS_Error NEXUS_PictureCtrl_SetColorClipSettings( |
|---|
| 716 | NEXUS_DisplayHandle display, |
|---|
| 717 | const NEXUS_PictureCtrlColorClipSettings *pSettings /* attr{null_allowed=y} */ |
|---|
| 718 | ); |
|---|
| 719 | |
|---|
| 720 | #ifdef __cplusplus |
|---|
| 721 | } |
|---|
| 722 | #endif |
|---|
| 723 | |
|---|
| 724 | #endif /* NEXUS_PICTURE_CTRL_H__ */ |
|---|
| 725 | |
|---|