xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiXC_Dlc.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 ///////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   apiXC_Dlc.h
98 /// @brief  DLC API layer Interface
99 /// @author MStar Semiconductor Inc.
100 //  CL171075++: sync to DLC libv32.59 :
101 //      1.Add guard condition to msDlcOnOff & msDlc_CGC_Init; msDlcOnOff & msDlc_CGC_Init will check
102 //        DLC On/Off status before execution.
103 ///////////////////////////////////////////////////////////////////////////////////////////////////
104 
105 /*! \defgroup Video Video modules
106 
107  *  \defgroup XC_BE XC_BE modules
108  *  \ingroup Video
109 
110     DLC is used for\n
111     1. Dynamic Luma Curve : Calculate the DLC curve base on histogram and average value.\n
112     For more information,see \link DLC DLC interface (apiXC_DLC.h) \endlink
113 
114  *  \defgroup DLC DLC interface (apiXC_DLC.h)
115  *  \ingroup XC_BE
116 
117     DLC is used for:
118 
119     - Dynamic Luma Curve : Calculate the DLC curve base on histogram and average value.
120 
121     <b> Operation Code Flow: </b> \n
122     check flow chart directly.
123     \image html apiXC_DLC_DBC_Handler_flow.png
124 
125  *  \defgroup DLC_INIT DLC init control
126  *  \ingroup DLC
127 
128  *! \defgroup DLC_FEATURE DLC feature operation
129  *  \ingroup DLC
130 
131  *! \defgroup DLC_INFO DLC Infomation pool
132  *  \ingroup DLC
133 
134  *! \defgroup DLC_ToBeModified DLC api to be modified
135  *  \ingroup DLC
136 
137  *! \defgroup DLC_ToBeRemove DLC api to be removed
138  *  \ingroup DLC
139  */
140 
141 #ifndef _API_XC_DLC_H_
142 #define _API_XC_DLC_H_
143 #include "MsCommon.h"
144 #include "MsDevice.h"
145 
146 #ifdef __cplusplus
147 extern "C"
148 {
149 #endif
150 
151 //-------------------------------------------------------------------------------------------------
152 //  Macro and Define
153 //-------------------------------------------------------------------------------------------------
154 
155 
156 //-------------------------------------------------------------------------------------------------
157 //  Type and Structure
158 //-------------------------------------------------------------------------------------------------
159 #define MSIF_DLC_LIB_CODE               {'D','L','C','_'}
160 #define MSIF_DLC_LIBVER                 {'0','0'}
161 #define MSIF_DLC_BUILDNUM               {'3','0'}
162 #define MSIF_DLC_CHANGELIST             {'0','0','6','1','8','0','7','0'}
163 #define XC_DLC_API_VERSION /* Character String for DRV/API version */  \
164     MSIF_TAG           ,   /* 'MSIF'                               */  \
165     MSIF_CLASS         ,   /* '00'                                 */  \
166     MSIF_CUS           ,   /* 0x0000                               */  \
167     MSIF_MOD           ,   /* 0x0000                               */  \
168     MSIF_CHIP          , \
169     MSIF_CPU           , \
170     MSIF_DLC_LIB_CODE  ,   /* IP__                                 */  \
171     MSIF_DLC_LIBVER    ,   /* 0.0 ~ Z.Z                            */  \
172     MSIF_DLC_BUILDNUM  ,   /* 00 ~ 99                              */  \
173     MSIF_DLC_CHANGELIST,   /* CL#                                  */  \
174     MSIF_OS
175 
176 #define XC_DLC_HDR_VERSION  1
177 
178 #define ENABLE_10_BIT_DLC   0
179 
180 /// DLC_MFINIT_Ex version of current DLC lib
181 #define DLC_MFINIT_EX_VERSION                      1
182 
183 /// The ucDlcHistogramLimitCurve arrary num
184 #define DLC_HISTOGRAM_LIMIT_CURVE_ARRARY_NUM       17
185 
186 #ifndef UNUSED
187 #define UNUSED(x) (void)(x)
188 #endif
189 
190 /*!
191  *  The DLC curve settings, ways of enable DLC or, disable DLC.
192  */
193 typedef enum
194 {
195     /// DLC curve
196     E_XC_DLC_PURE_IMAGE_DLC_CURVE = 0,
197     /// Linear curve
198     E_XC_DLC_PURE_IMAGE_LINEAR_CURVE ,
199     /// get base address failed when initialize panel driver
200     E_XC_DLC_PURE_IMAGE_DO_NOTHING ,
201 } E_XC_DLC_PURE_IMAGE_CURVE ;
202 
203 /*!
204  *  The DLC curve mode, ways of decide DLC algorithm.
205  */
206 typedef enum
207 {
208     ///
209     E_XC_DLC_CURVE_MODE_BY_YAVG = 0,
210     ///
211     E_XC_DLC_CURVE_MODE_BY_HISTOGRAM ,
212     ///
213     E_XC_DLC_CURVE_MODE_BY_MIX ,
214 } E_XC_DLC_CURVE_MODE ;
215 
216 /*!
217  *  The DLC algorthm mode, ways of decide DLC algorithm.
218  */
219 typedef enum
220 {
221     ///
222     E_XC_DLC_ALGORITHM_OLD = 0,
223     ///
224     E_XC_DLC_ALGORITHM_NEW ,
225 } E_XC_DLC_ALGORITHM_MODE ;
226 /*!
227  *  The DLC curve settings, ways of enable DLC or, disable DLC.
228  */
229 typedef enum
230 {
231     /// fail
232     E_XC_DLC_FAIL = 0,
233     /// ok
234     E_XC_DLC_OK = 1,
235     /// get base address failed when initialize panel driver
236     E_XC_DLC_GET_BASEADDR_FAIL,
237     /// obtain mutex timeout when calling this function
238     E_XC_DLC_OBTAIN_MUTEX_FAIL,
239 } E_XC_DLC_RESULT;
240 
241 
242 typedef enum
243 {
244     E_XC_DLC_HISTOGRAM_32,
245     E_XC_DLC_HISTOGRAM_8,
246 }E_XC_DLC_HISTOGRAM_TYPE;
247 /******************************************************************************/
248 /*         Structures                                                         */
249 /******************************************************************************/
250 
251 //----------------------------
252 // XC DLC initialize
253 //----------------------------
254 /*!
255  *  Initial Settings of MF Dyanmic Luma Curve
256  */
257 typedef struct
258 {
259     /// Default luma curve
260     MS_U8 ucLumaCurve[16];
261     /// Default luma curve 2a
262     MS_U8 ucLumaCurve2_a[16];
263     /// Default luma curve 2b
264     MS_U8 ucLumaCurve2_b[16];
265     /// Default luma curve 2
266     MS_U8 ucLumaCurve2[16];
267 
268     /// default value: 10
269     MS_U8 u8_L_L_U;
270     /// default value: 10
271     MS_U8 u8_L_L_D;
272     /// default value: 10
273     MS_U8 u8_L_H_U;
274     /// default value: 10
275     MS_U8 u8_L_H_D;
276     /// default value: 128 (0x80)
277     MS_U8 u8_S_L_U;
278     /// default value: 128 (0x80)
279     MS_U8 u8_S_L_D;
280     /// default value: 128 (0x80)
281     MS_U8 u8_S_H_U;
282     /// default value: 128 (0x80)
283     MS_U8 u8_S_H_D;
284     /// -31 ~ 31 (bit7 = minus, ex. 0x88 => -8)
285     MS_U8 ucCGCCGain_offset;
286     /// 0x00~0x6F
287     MS_U8 ucCGCChroma_GainLimitH;
288     /// 0x00~0x10
289     MS_U8 ucCGCChroma_GainLimitL;
290     /// 0x01~0x20
291     MS_U8 ucCGCYCslope;
292     /// 0x01
293     MS_U8 ucCGCYth;
294     /// Compare difference of max and min bright
295     MS_U8 ucDlcPureImageMode;
296     /// n = 0 ~ 4 => Limit n levels => ex. n=2, limit 2 level 0xF7, 0xE7
297     MS_U8 ucDlcLevelLimit;
298     /// n = 0 ~ 50, default value: 12
299     MS_U8 ucDlcAvgDelta;
300     /// n = 0 ~ 15 => 0: disable still curve, 1 ~ 15: enable still curve
301     MS_U8 ucDlcAvgDeltaStill;
302     /// min 17 ~ max 32
303     MS_U8 ucDlcFastAlphaBlending;
304     /// some event is triggered, DLC must do slowly // for PIP On/Off, msMultiPic.c
305     MS_U8 ucDlcSlowEvent;
306     /// for IsrApp.c
307     MS_U8 ucDlcTimeOut;
308     /// for force to do fast DLC in a while
309     MS_U8 ucDlcFlickAlphaStart;
310     /// default value: 128
311     MS_U8 ucDlcYAvgThresholdH;
312     /// default value: 0
313     MS_U8 ucDlcYAvgThresholdL;
314     /// n = 24 ~ 64, default value: 48
315     MS_U8 ucDlcBLEPoint;
316     /// n = 24 ~ 64, default value: 48
317     MS_U8 ucDlcWLEPoint;
318     /// 1: enable; 0: disable
319     MS_U8 bCGCCGainCtrl : 1;
320     /// 1: enable; 0: disable
321     MS_U8 bEnableBLE : 1;
322     /// 1: enable; 0: disable
323     MS_U8 bEnableWLE : 1;
324 } XC_DLC_MFinit;
325 
326 
327 typedef struct
328 {
329     MS_U32 u32DLC_MFinit_Ex_Version;   ///<Version of current structure. Please always set to "DLC_MFINIT_EX_VERSION" as input
330     /// Default luma curve
331     MS_U8 ucLumaCurve[16];
332     /// Default luma curve 2a
333     MS_U8 ucLumaCurve2_a[16];
334     /// Default luma curve 2b
335     MS_U8 ucLumaCurve2_b[16];
336     /// Default luma curve 2
337     MS_U8 ucLumaCurve2[16];
338 
339     /// default value: 10
340     MS_U8 u8_L_L_U;
341     /// default value: 10
342     MS_U8 u8_L_L_D;
343     /// default value: 10
344     MS_U8 u8_L_H_U;
345     /// default value: 10
346     MS_U8 u8_L_H_D;
347     /// default value: 128 (0x80)
348     MS_U8 u8_S_L_U;
349     /// default value: 128 (0x80)
350     MS_U8 u8_S_L_D;
351     /// default value: 128 (0x80)
352     MS_U8 u8_S_H_U;
353     /// default value: 128 (0x80)
354     MS_U8 u8_S_H_D;
355     /// -31 ~ 31 (bit7 = minus, ex. 0x88 => -8)
356     MS_U8 ucCGCCGain_offset;
357     /// 0x00~0x6F
358     MS_U8 ucCGCChroma_GainLimitH;
359     /// 0x00~0x10
360     MS_U8 ucCGCChroma_GainLimitL;
361     /// 0x01~0x20
362     MS_U8 ucCGCYCslope;
363     /// 0x01
364     MS_U8 ucCGCYth;
365     /// Compare difference of max and min bright
366     MS_U8 ucDlcPureImageMode;
367     /// n = 0 ~ 4 => Limit n levels => ex. n=2, limit 2 level 0xF7, 0xE7
368     MS_U8 ucDlcLevelLimit;
369     /// n = 0 ~ 50, default value: 12
370     MS_U8 ucDlcAvgDelta;
371     /// n = 0 ~ 15 => 0: disable still curve, 1 ~ 15: enable still curve
372     MS_U8 ucDlcAvgDeltaStill;
373     /// min 17 ~ max 32
374     MS_U8 ucDlcFastAlphaBlending;
375     /// some event is triggered, DLC must do slowly // for PIP On/Off, msMultiPic.c
376     MS_U8 ucDlcSlowEvent;
377     /// for IsrApp.c
378     MS_U8 ucDlcTimeOut;
379     /// for force to do fast DLC in a while
380     MS_U8 ucDlcFlickAlphaStart;
381     /// default value: 128
382     MS_U8 ucDlcYAvgThresholdH;
383     /// default value: 0
384     MS_U8 ucDlcYAvgThresholdL;
385     /// n = 24 ~ 64, default value: 48
386     MS_U8 ucDlcBLEPoint;
387     /// n = 24 ~ 64, default value: 48
388     MS_U8 ucDlcWLEPoint;
389     /// 1: enable; 0: disable
390     MS_U8 bCGCCGainCtrl : 1;
391     /// 1: enable; 0: disable
392     MS_U8 bEnableBLE : 1;
393     /// 1: enable; 0: disable
394     MS_U8 bEnableWLE : 1;
395     /// default value: 64
396     MS_U8 ucDlcYAvgThresholdM;
397     /// Compare difference of max and min bright
398     MS_U8 ucDlcCurveMode;
399     /// min 00 ~ max 128
400     MS_U8 ucDlcCurveModeMixAlpha;
401     ///
402     MS_U8 ucDlcAlgorithmMode;
403     /// Dlc Histogram Limit Curve
404     MS_U8 ucDlcHistogramLimitCurve[DLC_HISTOGRAM_LIMIT_CURVE_ARRARY_NUM];
405     ///
406     MS_U8 ucDlcSepPointH;
407     ///
408     MS_U8 ucDlcSepPointL;
409     ///
410     MS_U16 uwDlcBleStartPointTH;
411     ///
412     MS_U16 uwDlcBleEndPointTH;
413     ///
414     MS_U8 ucDlcCurveDiff_L_TH;
415     ///
416     MS_U8 ucDlcCurveDiff_H_TH;
417     ///
418     MS_U16 uwDlcBLESlopPoint_1;
419     ///
420     MS_U16 uwDlcBLESlopPoint_2;
421     ///
422     MS_U16 uwDlcBLESlopPoint_3;
423     ///
424     MS_U16 uwDlcBLESlopPoint_4;
425     ///
426     MS_U16 uwDlcBLESlopPoint_5;
427     ///
428     MS_U16 uwDlcDark_BLE_Slop_Min;
429     ///
430     MS_U8 ucDlcCurveDiffCoringTH;
431     ///
432     MS_U8 ucDlcAlphaBlendingMin;
433     ///
434     MS_U8 ucDlcAlphaBlendingMax;
435     ///
436     MS_U8 ucDlcFlicker_alpha;
437     ///
438     MS_U8 ucDlcYAVG_L_TH;
439     ///
440     MS_U8 ucDlcYAVG_H_TH;
441     ///
442     MS_U8 ucDlcDiffBase_L;
443     ///
444     MS_U8 ucDlcDiffBase_M;
445     ///
446     MS_U8 ucDlcDiffBase_H;
447 } XC_DLC_MFinit_Ex;
448 
449 /*!
450  *  Initial Settings of Dynamic Backlight Control
451  */
452 typedef struct
453 {
454     /// Max PWM
455     MS_U8 ucMaxPWM;
456     /// Min PWM
457     MS_U8 ucMinPWM;
458     /// Max Video
459     MS_U8 ucMax_Video;
460     /// Mid Video
461     MS_U8 ucMid_Video;
462     /// Min Video
463     MS_U8 ucMin_Video;
464     /// Current PWM
465     MS_U8 ucCurrentPWM;
466     /// Alpha
467     MS_U8 ucAlpha;
468     /// Backlight thres
469     MS_U8 ucBackLight_Thres;
470     /// Avg delta
471     MS_U8 ucAvgDelta;
472     /// Flick alpha
473     MS_U8 ucFlickAlpha;
474     /// Fast alpha blending, min 17 ~ max 32
475     MS_U8 ucFastAlphaBlending;
476     // TBD
477     MS_U8 ucLoop_Dly;
478     // TBD
479     MS_U8 ucLoop_Dly_H_Init;
480     // TBD
481     MS_U8 ucLoop_Dly_MH_Init;
482     // TBD
483     MS_U8 ucLoop_Dly_ML_Init;
484     // TBD
485     MS_U8 ucLoop_Dly_L_Init;
486     /// Y gain H
487     MS_U8 ucY_Gain_H;
488     /// C gain H
489     MS_U8 ucC_Gain_H;
490     /// Y gain M
491     MS_U8 ucY_Gain_M;
492     /// C gain M
493     MS_U8 ucC_Gain_M;
494     /// Y gain L
495     MS_U8 ucY_Gain_L;
496     /// C gain L
497     MS_U8 ucC_Gain_L;
498     /// 1: enable; 0: disable
499     MS_U8 bYGainCtrl : 1;
500     /// 1: enable; 0: disable
501     MS_U8 bCGainCtrl : 1;
502 }XC_DLC_DBC_MFinit;
503 
504 typedef struct
505 {
506     MS_U8      u8ColorPrimaries;
507     MS_U8      u8TransferCharacteristics;
508     MS_U8      u8MatrixCoefficients;
509 } XC_DLC_HDRMetadataMpegVUI;
510 
511 ///HDR Code////
512 typedef struct
513 {
514     MS_U16 u16Smin; // 0.10
515     MS_U16 u16Smed; // 0.10
516     MS_U16 u16Smax; // 0.10
517     MS_U16 u16Tmin; // 0.10
518     MS_U16 u16Tmed; // 0.10
519     MS_U16 u16Tmax; // 0.10
520     MS_U16 u16MidSourceOffset;
521     MS_U16 u16MidTargetOffset;
522     MS_U16 u16MidSourceRatio;
523     MS_U16 u16MidTargetRatio;
524 } XC_DLC_HDRToneMappingData;
525 
526 typedef struct
527 {
528     MS_U16 u16tRx; // target Rx
529     MS_U16 u16tRy; // target Ry
530     MS_U16 u16tGx; // target Gx
531     MS_U16 u16tGy; // target Gy
532     MS_U16 u16tBx; // target Bx
533     MS_U16 u16tBy; // target By
534     MS_U16 u16tWx; // target Wx
535     MS_U16 u16tWy; // target Wy
536 } XC_DLC_HDRGamutMappingData;
537 
538 typedef struct
539 {
540     MS_U8      u8EOTF; // 0:SDR gamma, 1:HDR gamma, 2:SMPTE ST2084, 3:Future EOTF, 4-7:Reserved
541     MS_U16     u16Rx; // display primaries Rx
542     MS_U16     u16Ry; // display primaries Ry
543     MS_U16     u16Gx; // display primaries Gx
544     MS_U16     u16Gy; // display primaries Gy
545     MS_U16     u16Bx; // display primaries Bx
546     MS_U16     u16By; // display primaries By
547     MS_U16     u16Wx; // display primaries Wx
548     MS_U16     u16Wy; // display primaries Wy
549     MS_U16     u16Lmax; // max display mastering luminance
550     MS_U16     u16Lmin; // min display mastering luminance
551     MS_U16     u16MaxCLL; // maximum content light level
552     MS_U16     u16MaxFALL; // maximum frame-average light level
553 } XC_DLC_HDRMetadataHdmiTxInfoFrame;
554 
555 /*!
556  *  Initial  HDR   Settings
557  */
558 typedef struct
559 {
560     /// HDR Version Info
561     MS_U16 u16HDRVerInfo;
562     /// HDR init Length
563     MS_U16 u16HDRInitLength;
564     /// HDR Enable
565     MS_BOOL bHDREnable;
566     /// HDR Function Select
567     MS_U16 u16HDRFunctionSelect;
568     /// HDR Metadata Mpeg VUI
569     XC_DLC_HDRMetadataMpegVUI DLC_HDRMetadataMpegVUI;
570     //HDR Tone Mapping Data
571     XC_DLC_HDRToneMappingData DLC_HDRToneMappingData;
572     //HDR Gamut Mapping Data
573     XC_DLC_HDRGamutMappingData DLC_HDRGamutMappingData;
574     //HDR Metadata Hdmi Tx Info Frame
575     XC_DLC_HDRMetadataHdmiTxInfoFrame DLC_HDRMetadataHdmiTxInfoFrame;
576 
577 } XC_DLC_HDRinit;
578 
579 
580 /*!
581  *  Initial Settings of Dyanmic Luma Curve
582  */
583 typedef struct
584 {
585     /// Scaler DCL MF init
586     XC_DLC_MFinit DLC_MFinit;
587     /// Scaler DCL MF init Ex
588     XC_DLC_MFinit_Ex DLC_MFinit_Ex;
589     /// Curve Horizontal start
590     MS_U16 u16CurveHStart;
591     /// Curve Horizontal end
592     MS_U16 u16CurveHEnd;
593     /// Curve Vertical start
594     MS_U16 u16CurveVStart;
595     /// Curve Vertical end
596     MS_U16 u16CurveVEnd;
597     /// Scaler DLC MF init
598     XC_DLC_DBC_MFinit DLC_DBC_MFinit;
599 #if (ENABLE_10_BIT_DLC)
600     /// DLC init ext
601     MS_BOOL b10BitsEn;
602 #endif
603 } XC_DLC_init;
604 
605 /*!
606  *  Luma Statistics & Data of Dyanmic Luma Curve
607  */
608 typedef struct
609 {
610     /// Luma histogram 32H
611     MS_U16 g_wLumaHistogram32H[32];
612     /// Luma total count
613     MS_U16 g_wLumiTotalCount;
614     /// Luma average temp
615     MS_U16 g_wLumiAverageTemp;
616     /// table
617     MS_U8 g_ucTable[16];
618     /// Histogram max
619     MS_U8 g_ucHistogramMax;
620     /// Histogram min
621     MS_U8 g_ucHistogramMin;
622 } XC_DLC_lumadata;
623 
624 /*!
625  *  Infomation of XC_DLC library.
626  */
627 typedef struct
628 {
629 
630 } XC_DLC_ApiInfo;
631 
632 
633 /*!
634  *  Current Status of XC_DLC and library info.
635  */
636 typedef struct
637 {
638     /// Scaler DLC init
639     XC_DLC_init DLCinit;
640     /// Scaler DLC Luma data
641     XC_DLC_lumadata DLCluma;
642     /// DLC Lib version
643     MS_U8  u8DLC_LibVer;
644     /// DLC MF version
645     MS_U16 u16DLC_MFVer;
646     /// DLC CGC MF version
647     MS_U16 u16DLC_CGC_MFVer;
648     /// DLC DBC init
649     XC_DLC_DBC_MFinit DLC_DBCinit;
650     /// DLC DBC MF version
651     MS_U16 u16DLC_DBC_MFVer;
652 } XC_DLC_ApiStatus;
653 /*
654  * DLC capture Range
655  */
656 typedef struct
657 {
658     MS_U16 wHStart;
659     MS_U16 wHEnd;
660     MS_U16 wVStart;
661     MS_U16 wVEnd;
662 }XC_DLC_CAPTURE_Range;
663 
664 
665 /******************************************************************************/
666 /*         Variables                                                         */
667 /******************************************************************************/
668 
669 /******************************************************************************/
670 /*         Function Prototypes                                                */
671 /******************************************************************************/
672 
673 //-------------------------------------------------------------------------------------------------
674 /// DLC initiation
675 /// @ingroup DLC_INIT
676 // @param  pstXC_DLC_InitData             \b IN: TBD
677 // @param  u32InitDataLen                 \b IN: TBD
678 // @return @ref MS_BOOL
679 //-------------------------------------------------------------------------------------------------
680 MS_BOOL MApi_XC_DLC_Init_Ex(XC_DLC_init *pstXC_DLC_InitData, MS_U32 u32InitDataLen);
681 
682 //-------------------------------------------------------------------------------------------------
683 /// Setting DLC
684 /// @ingroup DLC_FEATURE
685 // @param  DLC_MFinit_Ex             \b IN: DLC data
686 //-------------------------------------------------------------------------------------------------
687 void MApi_XC_DLC_SetSetting_Ex(XC_DLC_MFinit_Ex *DLC_MFinit_Ex );
688 
689 
690 //-------------------------------------------------------------------------------------------------
691 /// Set DLC curve
692 /// @ingroup DLC_FEATURE
693 // @param  pNormal             \b IN: DLC normal curve
694 // @param  pLight              \b IN: DLC light curve
695 // @param  pDark               \b IN: DLC dark curve
696 //-------------------------------------------------------------------------------------------------
697 void MApi_XC_DLC_SetCurve(MS_U8 *pNormal, MS_U8 *pLight, MS_U8 *pDark);
698 
699 //-------------------------------------------------------------------------------------------------
700 /// Set BLE Slop Point
701 /// @ingroup DLC_FEATURE
702 // @param  pBLESlopPoint             \b IN: BLE Slop Point
703 //-------------------------------------------------------------------------------------------------
704 // void MApi_XC_DLC_SetBleSlopPoint(MS_U16 *pBLESlopPoint);
705 
706 //-------------------------------------------------------------------------------------------------
707 /// Set Set HDR Init
708 // @param  pstDLC_HDRInitData             \b IN: HDR Init Info
709 //-------------------------------------------------------------------------------------------------
710 MS_BOOL SYMBOL_WEAK MApi_XC_DLC_SetHDRInit(XC_DLC_HDRinit *pstDLC_HDRInitData);
711 
712 //-------------------------------------------------------------------------------------------------
713 /// DLC exit
714 /// @ingroup DLC_INIT
715 /// @return @ref MS_BOOL
716 //-------------------------------------------------------------------------------------------------
717 // MS_BOOL MApi_XC_DLC_Exit(void);
718 
719 //-------------------------------------------------------------------------------------------------
720 ///Enable/disable DLC to control MDrv_DLC_SetOnOff ,used DLC enbale register to control.
721 /// @ingroup DLC_FEATURE
722 ///@param bSwitch \b IN:
723 ///   - # TRUE  Enable
724 ///   - # FALSE Disable
725 ///@param  bWindow                 \b IN: The window which applys the function effect, MAIN_WINDOW:0
726 ///                                                                                    SUB_WINDOW: 1
727 //-------------------------------------------------------------------------------------------------
728 void    MApi_XC_DLC_SetOnOff(MS_BOOL bSwitch, MS_BOOL bWindow);
729 
730 //-------------------------------------------------------------------------------------------------
731 ///Enable/disable DLC to control MDrv_DLC_Handler function.
732 /// @ingroup DLC_FEATURE
733 ///@param bSwitch \b IN:
734 ///   - # TRUE  Enable
735 ///   - # FALSE Disable
736 // @return @ref MS_BOOL
737 //-------------------------------------------------------------------------------------------------
738 // MS_BOOL MApi_XC_DLC_SetDlcHandlerOnOff(MS_BOOL bDlcEnable );
739 
740 /******************************************************************************/
741 //Enable/disable BLE to control BLE function.
742 /// @ingroup DLC_FEATURE
743 //@param bSwitch \b IN
744 //   - # TRUE  Enable
745 //   - # FALSE Disable
746 // @return @ref MS_BOOL
747 /******************************************************************************/
748 MS_BOOL MApi_XC_DLC_SetBleOnOff( MS_BOOL bSwitch );
749 
750 /******************************************************************************/
751 //Enable/disable DLC Set Curve Both for main and sub.
752 /// @ingroup DLC_FEATURE
753 //@param bEnable \b IN
754 //   - # TRUE  Enable
755 //   - # FALSE Disable
756 /******************************************************************************/
757 void MApi_XC_DLC_EnableMainSubCurveSynchronization (MS_BOOL bEnable);
758 
759 //-------------------------------------------------------------------------------------------------
760 /// DLC handler
761 /// @ingroup DLC_FEATURE
762 ///@param  bWindow                 \b IN: The window which applys the function effect, MAIN_WINDOW:0
763 ///                                                                                    SUB_WINDOW: 1
764 //-------------------------------------------------------------------------------------------------
765 void    MApi_XC_DLC_Handler(MS_BOOL bWindow);
766 
767 //-------------------------------------------------------------------------------------------------
768 /// DLC get histogram handler
769 /// @ingroup DLC_INFO
770 ///@param  bWindow                 \b IN: The window which applys the function effect, MAIN_WINDOW:0
771 ///                                                                                    SUB_WINDOW: 1
772 /// @return @ref MS_BOOL
773 //-------------------------------------------------------------------------------------------------
774 MS_BOOL MApi_XC_DLC_GetHistogramHandler(MS_BOOL bWindow);
775 
776 //-------------------------------------------------------------------------------------------------
777 /// DLC get average value from 0 to 255
778 /// @ingroup DLC_INFO
779 /// @return @ref MS_U8
780 //-------------------------------------------------------------------------------------------------
781 MS_U8   MApi_XC_DLC_GetAverageValue(void);
782 
783 //-------------------------------------------------------------------------------------------------
784 /// DLC get average exactness value from 0 to 1023
785 /// @ingroup DLC_INFO
786 /// @return @ref MS_U16
787 //-------------------------------------------------------------------------------------------------
788 // MS_U16 MApi_XC_DLC_GetAverageValue_Ex(void);
789 
790 //-------------------------------------------------------------------------------------------------
791 /// DLC initilization curve
792 /// @ingroup DLC_INIT
793 // @param  u16HStart               \b IN: TBD
794 // @param  u16HEnd                 \b IN: TBD
795 // @param  u16VStart               \b IN: TBD
796 // @param  u16VEnd                 \b IN: TBD
797 //-------------------------------------------------------------------------------------------------
798 // void    MApi_XC_DLC_InitCurve (MS_U16 u16HStart, MS_U16 u16HEnd, MS_U16 u16VStart, MS_U16 u16VEnd);
799 
800 //-------------------------------------------------------------------------------------------------
801 /// DLC speedup trigger
802 /// @ingroup DLC_FEATURE
803 // @param  u8Loop               \b IN: TBD
804 //-------------------------------------------------------------------------------------------------
805 // void    MApi_XC_DLC_SpeedupTrigger (MS_U8 u8Loop);
806 
807 //-------------------------------------------------------------------------------------------------
808 /// DLC get luma curve status
809 /// @ingroup DLC_INFO
810 /// @return @ref MS_BOOL
811 //-------------------------------------------------------------------------------------------------
812 MS_BOOL MApi_XC_DLC_GetLumaCurveStatus( void );
813 
814 //-------------------------------------------------------------------------------------------------
815 /// DLC CGC reset C gain
816 /// @ingroup DLC_FEATURE
817 //-------------------------------------------------------------------------------------------------
818 void    MApi_XC_DLC_CGC_ResetCGain(void);
819 
820 //-------------------------------------------------------------------------------------------------
821 /// DLC CGC check C gain in PQCom
822 /// @ingroup DLC_FEATURE
823 //-------------------------------------------------------------------------------------------------
824 void    MApi_XC_DLC_CGC_CheckCGainInPQCom(void);
825 
826 //-------------------------------------------------------------------------------------------------
827 /// DLC CGC reset Y gain
828 /// @ingroup DLC_FEATURE
829 //-------------------------------------------------------------------------------------------------
830 void    MApi_XC_DLC_CGC_ResetYGain(void);
831 
832 //-------------------------------------------------------------------------------------------------
833 /// DLC CGC reset Y gain in PQCom
834 /// @ingroup DLC_FEATURE
835 //-------------------------------------------------------------------------------------------------
836 void    MApi_XC_DLC_CGC_CheckYGainInPQCom(void);
837 
838 //-------------------------------------------------------------------------------------------------
839 /// DLC CGC reset
840 /// @ingroup DLC_FEATURE
841 //-------------------------------------------------------------------------------------------------
842 void    MApi_XC_DLC_CGC_Reset(void);
843 
844 //-------------------------------------------------------------------------------------------------
845 /// DLC CGC initilization
846 /// @ingroup DLC_INIT
847 //-------------------------------------------------------------------------------------------------
848 void    MApi_XC_DLC_CGC_Init(void);
849 
850 //-------------------------------------------------------------------------------------------------
851 /// DLC CGC Re-initilization
852 /// @ingroup DLC_INIT
853 //-------------------------------------------------------------------------------------------------
854 // void    MApi_XC_DLC_CGC_ReInit(void);
855 
856 //-------------------------------------------------------------------------------------------------
857 /// DLC CGC handler
858 /// @ingroup DLC_FEATURE
859 //-------------------------------------------------------------------------------------------------
860 void    MApi_XC_DLC_CGC_Handler(void);
861 
862 //-------------------------------------------------------------------------------------------------
863 /// Get version (without Mutex protect)
864 /// @ingroup DLC_INFO
865 // @param ppVersion               \b IN: TBD
866 /// @return @ref E_XC_DLC_RESULT
867 //-------------------------------------------------------------------------------------------------
868 // E_XC_DLC_RESULT MApi_XC_DLC_GetLibVer(const MSIF_Version **ppVersion) ;
869 
870 //-------------------------------------------------------------------------------------------------
871 /// DLC get information
872 /// @ingroup DLC_INFO
873 /// @return XC_DLC_ApiInfo
874 //-------------------------------------------------------------------------------------------------
875 // const XC_DLC_ApiInfo * MApi_XC_DLC_GetInfo(void);                                      ///< Get info from driver (without Mutex protect)
876 
877 //-------------------------------------------------------------------------------------------------
878 /// Get DLC current status
879 /// @ingroup DLC_INFO
880 // @param pDrvStatus               \b IN: TBD
881 // @param bWindow                  \b IN: TBD
882 /// @return @ref MS_BOOL
883 //-------------------------------------------------------------------------------------------------
884 MS_BOOL MApi_XC_DLC_GetStatus_Ex(XC_DLC_ApiStatus *pDrvStatus, MS_BOOL bWindow);       ///< Get panel current status
885 
886 //-------------------------------------------------------------------------------------------------
887 /// DLC get Dbg level
888 /// @ingroup DLC_INFO
889 /// @param u16DbgSwitch               \b IN: Set debug level
890 /// @return @ref MS_BOOL
891 //-------------------------------------------------------------------------------------------------
892 MS_BOOL MApi_XC_DLC_SetDbgLevel(MS_U16 u16DbgSwitch);                                  ///< Set debug level (without Mutex protect), refer to XC_DBGLEVEL_OFF
893 
894 //-------------------------------------------------------------------------------------------------
895 /// Write DLC curve
896 /// @ingroup DLC_FEATURE
897 /// @param pu8Table                     \b IN: the value of curve
898 // @return @ref MS_BOOL
899 //-------------------------------------------------------------------------------------------------
900 MS_BOOL MApi_XC_DLC_WriteCurve(MS_U8 *pu8Table);
901 
902 //-------------------------------------------------------------------------------------------------
903 /// Write DLC curve
904 /// @ingroup DLC_FEATURE
905 /// @param pu8Table                     \b IN: the value of curve
906 // @return @ref MS_BOOL
907 //-------------------------------------------------------------------------------------------------
908 // MS_BOOL MApi_XC_DLC_WriteCurve_Sub(MS_U8 *pu8Table);
909 
910 //-------------------------------------------------------------------------------------------------
911 /// get histogram data
912 /// @ingroup DLC_INFO
913 /// @param pu16Histogram                \b OUT: the value of histogram
914 /// @param u8section_num                \b IN: the number of histogram section
915 // @return @ref MS_BOOL
916 //-------------------------------------------------------------------------------------------------
917 // MS_BOOL MApi_XC_DLC_GetHistogram(MS_U16 *pu16Histogram, E_XC_DLC_HISTOGRAM_TYPE enHistogramType);
918 
919 /******************************************************************************/
920 /// API DLC DBC library start
921 /******************************************************************************/
922 typedef void   (*MApi_XC_DLC_Print_Callback)(MS_U8 /*PWM_VALUE*/);
923 
924 typedef struct {
925     MS_U8 *pCmdBuff;                           ///<1. command buffer from UART
926     MS_U16 u16PNL_Width;                       ///<2. Panel Widht
927     MS_U16 u16PNL_Height;                      ///<3. Panel Height
928     MApi_XC_DLC_Print_Callback fnDLC_Putchar;  ///<4. User putchar function
929 }tDLC_CONTROL_PARAMS;
930 
931 //-------------------------------------------------------------------------------------------------
932 /// brief uart debug command decoder for Dynamic Luminance Control.
933 /// @ingroup DLC_FEATURE
934 /// @param params   passin params
935 //-------------------------------------------------------------------------------------------------
936 void MApi_XC_DLC_DecodeExtCmd(tDLC_CONTROL_PARAMS *params);
937 
938 //-------------------------------------------------------------------------------------------------
939 /// Setup DLC capture range
940 /// @ingroup DLC_FEATURE
941 /// @param StuDlc_Range                     \b IN: Hstart, Hend, Vstart, Vend
942 //-------------------------------------------------------------------------------------------------
943 void MApi_XC_DLC_SetCaptureRange(XC_DLC_CAPTURE_Range *pu16_Range);
944 
945 //-------------------------------------------------------------------------------------------------
946 /// Dlc power state control for fastboot
947 /// @ingroup DLC_FEATURE
948 /// @param  u16PowerState                 \b IN: power state
949 // @return @ref MS_U32                      \b return result of power state control.
950 //-------------------------------------------------------------------------------------------------
951 // MS_U32 MApi_XC_DLC_SetPowerState(EN_POWER_MODE enPowerState);
952 
953 /******************************************************************************/
954 /// API DLC DBC library end
955 /******************************************************************************/
956 
957 
958 //================================ Obsolete Function Start =======================================
959 //-------------------------------------------------------------------------------------------------
960 /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  Alert !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
961 /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  Alert !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
962 /// !!! below function will be "REMOVED" or "REFACTORING" later, please do not use it !!!!!!!!!
963 //-------------------------------------------------------------------------------------------------
964 
965 //-------------------------------------------------------------------------------------------------
966 /// @ingroup DLC_ToBeRemove
967 //-------------------------------------------------------------------------------------------------
968 
969 // void MApi_XC_DLC_SetSetting(XC_DLC_MFinit DLC_MFinit ); // Setting DLC
970 //-------------------------------------------------------------------------------------------------
971 /// @ingroup DLC_ToBeRemove
972 //-------------------------------------------------------------------------------------------------
973 MS_BOOL MApi_XC_DLC_Init(XC_DLC_init *pstXC_DLC_InitData, MS_U32 u32InitDataLen); // DLC initiation
974 
975 //-------------------------------------------------------------------------------------------------
976 /// @ingroup DLC_ToBeRemove
977 //-------------------------------------------------------------------------------------------------
978 MS_BOOL MApi_XC_DLC_GetStatus(XC_DLC_ApiStatus *pDrvStatus, MS_BOOL bWindow);  // Get DLC current status
979 
980 //================================ Obsolete Function End =======================================
981 
982 
983 #ifdef __cplusplus
984 }
985 #endif
986 
987 #endif // _API_XC_DLC_H_
988 
989 
990