xref: /utopia/UTPA2-700.0.x/modules/xc/drv/ace/drvACE.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 /// @file  drvACE.h
94 /// @brief ACE library interface header file
95 /// @author MStar Semiconductor Inc.
96 ///
97 ////////////////////////////////////////////////////////////////////////////////
98 
99 #ifndef DRV_ACE_H
100 #define DRV_ACE_H
101 
102 #ifdef _MDRV_ACE_C_
103 #define INTERFACE
104 #else
105 #define INTERFACE extern
106 #endif
107 #ifdef __cplusplus
108 extern "C"
109 {
110 #endif
111 //******** ENUM DEFINITIONS ********//
112 INTERFACE enum
113 {
114     E_ACE_POOL_ID_INTERNAL = 0, // just for test, please refine.
115     E_ACE_POOL_ID_INTERNAL_1, // just for test, please refine.
116     E_ACE_POOL_ID_MAX, // just for test, please refine.
117 } E_ACE_POOL_ID;
118 
119 /******************************************************************************/
120 /*                   Export variables                                                                                     */
121 /******************************************************************************/
122 typedef enum
123 {
124     ACE_INFO_TYPE_VERSION,
125     ACE_INFO_TYPE_CONTRAST,
126     ACE_INFO_TYPE_R_GAIN,
127     ACE_INFO_TYPE_G_GAIN,
128     ACE_INFO_TYPE_B_GAIN,
129     ACE_INFO_TYPE_SATURATION,
130     ACE_INFO_TYPE_HUE,
131     ACE_INFO_TYPE_COLOR_CORRECTION_XY_R,
132     ACE_INFO_TYPE_COLOR_CORRECTION_XY_G,
133     ACE_INFO_TYPE_COLOR_CORRECTION_XY_B,
134     ACE_INFO_TYPE_COLOR_CORRECTION_OFFSET_R,
135     ACE_INFO_TYPE_COLOR_CORRECTION_OFFSET_G,
136     ACE_INFO_TYPE_COLOR_CORRECTION_OFFSET_B,
137     ACE_INFO_TYPE_BRIGHTNESS_R,
138     ACE_INFO_TYPE_BRIGHTNESS_G,
139     ACE_INFO_TYPE_BRIGHTNESS_B,
140 
141     ACE_INFO_TYPE_COMPILER_VERSION,
142     ACE_INFO_TYPE_YUV_TO_RGB_MATRIX_SEL,
143 
144     ACE_INFO_TYPE_IHC_USER_COLOR1,
145     ACE_INFO_TYPE_IHC_USER_COLOR2,
146     ACE_INFO_TYPE_IHC_USER_COLOR3,
147     ACE_INFO_TYPE_IHC_USER_COLOR4,
148     ACE_INFO_TYPE_IHC_USER_COLOR5,
149     ACE_INFO_TYPE_IHC_USER_COLOR6,
150     ACE_INFO_TYPE_IHC_USER_COLOR7,
151     ACE_INFO_TYPE_IHC_USER_COLOR8,
152     ACE_INFO_TYPE_IHC_USER_COLOR9,
153     ACE_INFO_TYPE_IHC_USER_COLOR10,
154     ACE_INFO_TYPE_IHC_USER_COLOR11,
155     ACE_INFO_TYPE_IHC_USER_COLOR12,
156     ACE_INFO_TYPE_IHC_USER_COLOR13,
157     ACE_INFO_TYPE_IHC_USER_COLOR14,
158     ACE_INFO_TYPE_IHC_USER_COLOR15,
159     ACE_INFO_TYPE_IHC_USER_COLOR0,
160 
161     ACE_INFO_TYPE_ICC_USER_COLOR1,
162     ACE_INFO_TYPE_ICC_USER_COLOR2,
163     ACE_INFO_TYPE_ICC_USER_COLOR3,
164     ACE_INFO_TYPE_ICC_USER_COLOR4,
165     ACE_INFO_TYPE_ICC_USER_COLOR5,
166     ACE_INFO_TYPE_ICC_USER_COLOR6,
167     ACE_INFO_TYPE_ICC_USER_COLOR7,
168     ACE_INFO_TYPE_ICC_USER_COLOR8,
169     ACE_INFO_TYPE_ICC_USER_COLOR9,
170     ACE_INFO_TYPE_ICC_USER_COLOR10,
171     ACE_INFO_TYPE_ICC_USER_COLOR11,
172     ACE_INFO_TYPE_ICC_USER_COLOR12,
173     ACE_INFO_TYPE_ICC_USER_COLOR13,
174     ACE_INFO_TYPE_ICC_USER_COLOR14,
175     ACE_INFO_TYPE_ICC_USER_COLOR15,
176     ACE_INFO_TYPE_ICC_USER_COLOR0,
177 
178     ACE_INFO_TYPE_IBC_USER_COLOR1,
179     ACE_INFO_TYPE_IBC_USER_COLOR2,
180     ACE_INFO_TYPE_IBC_USER_COLOR3,
181     ACE_INFO_TYPE_IBC_USER_COLOR4,
182     ACE_INFO_TYPE_IBC_USER_COLOR5,
183     ACE_INFO_TYPE_IBC_USER_COLOR6,
184     ACE_INFO_TYPE_IBC_USER_COLOR7,
185     ACE_INFO_TYPE_IBC_USER_COLOR8,
186     ACE_INFO_TYPE_IBC_USER_COLOR9,
187     ACE_INFO_TYPE_IBC_USER_COLOR10,
188     ACE_INFO_TYPE_IBC_USER_COLOR11,
189     ACE_INFO_TYPE_IBC_USER_COLOR12,
190     ACE_INFO_TYPE_IBC_USER_COLOR13,
191     ACE_INFO_TYPE_IBC_USER_COLOR14,
192     ACE_INFO_TYPE_IBC_USER_COLOR15,
193     ACE_INFO_TYPE_IBC_USER_COLOR0,
194     ACE_INFO_TYPE_CONTRAST_MIN_VALUE,
195     ACE_INFO_TYPE_CONTRAST_MAX_VALUE,
196     ACE_INFO_TYPE_DUMMY,
197 } EnuACEInfoType;
198 
199 typedef enum
200 {
201     ACE_MATRIX_ID__YUV_TO_RGB,
202     ACE_MATRIX_ID__COLOR_CORRECTION,
203     ACE_MATRIX_ID__SRGB
204 }EnuAceMatrixId;
205 
206 typedef enum
207 {
208     ACE_YUV_TO_RGB_MATRIX_SDTV, // Use Std CSCM for SDTV
209     ACE_YUV_TO_RGB_MATRIX_HDTV, // Use Std CSCM for HDTV
210     ACE_YUV_TO_RGB_MATRIX_USER, // Use user define CSCM, specified by tUserYVUtoRGBMatrix
211 } E_ACE_YUVTORGBInfoType;
212 
213 /// MWE border color
214 typedef enum
215 {
216     MWE_BORDER_COLOR_BLACK,
217     MWE_BORDER_COLOR_WHITE,
218     MWE_BORDER_COLOR_BLUE,
219     MWE_BORDER_COLOR_RED,
220     MWE_BORDER_COLOR_GREEN,
221     MWE_BORDER_COLOR_MAX,
222 }EN_MWE_BORDER_COLOR;
223 
224 typedef struct  __attribute__((packed))
225 {
226     MS_U32 Xpos;
227     MS_U32 Ypos;
228     MS_U32 Xsize;
229     MS_U32 Ysize;
230 }MWE_RECT;
231 
232 typedef struct __attribute__((packed)) _PanelSizeType
233 {
234     MS_U16 u16Pnl_Hstart;
235     MS_U16 u16Pnl_Vstart;
236     MS_U16 u16Pnl_Width;
237     MS_U16 u16Pnl_Height;
238 }PanelSizeType;
239 
240 typedef enum MWEType
241 {
242     MWE_OFF,
243     MWE_H_SPLIT,
244     MWE_MOVE,
245     MWE_ZOOM,
246     MWE_NUMS,
247 }MWEType;
248 
249 typedef struct
250 {
251     MS_BOOL bSValid; // source data valid
252     MS_BOOL bTValid; // target data valid
253     MS_U8 u8SMode; // 0->KbKr, 1->YCgCo, 2->2020CL
254     MS_U16 u16SKb;
255     MS_U16 u16SKr;
256     MS_U8 u8TMode; // 0->KbKr, 1->YCgCo, 2->2020CL
257     MS_U16 u16TKb;
258     MS_U16 u16TKr;
259 } ACE_DRV_HDR_YUV2RGBData;
260 
261 typedef struct __attribute__((packed))
262 {
263     MS_U8      u8ColorPrimaries;
264     MS_U8      u8TransferCharacteristics;
265     MS_U8      u8MatrixCoefficients;
266 } ACE_DRV_HDRMetadataMpegVUI;
267 
268 typedef struct __attribute__((packed))
269 {
270     MS_U16 u16Smin; // 0.10
271     MS_U16 u16Smed; // 0.10
272     MS_U16 u16Smax; // 0.10
273     MS_U16 u16Tmin; // 0.10
274     MS_U16 u16Tmed; // 0.10
275     MS_U16 u16Tmax; // 0.10
276     MS_U16 u16MidSourceOffset;
277     MS_U16 u16MidTargetOffset;
278     MS_U16 u16MidSourceRatio;
279     MS_U16 u16MidTargetRatio;
280 } ACE_DRV_HDRToneMappingData;
281 
282 typedef struct __attribute__((packed))
283 {
284     MS_U16 u16tRx; // target Rx
285     MS_U16 u16tRy; // target Ry
286     MS_U16 u16tGx; // target Gx
287     MS_U16 u16tGy; // target Gy
288     MS_U16 u16tBx; // target Bx
289     MS_U16 u16tBy; // target By
290     MS_U16 u16tWx; // target Wx
291     MS_U16 u16tWy; // target Wy
292 } ACE_DRV_HDRGamutMappingData;
293 
294 typedef struct __attribute__((packed))
295 {
296     MS_U8      u8EOTF; // 0:SDR gamma, 1:HDR gamma, 2:SMPTE ST2084, 3:Future EOTF, 4-7:Reserved
297     MS_U16     u16Rx; // display primaries Rx
298     MS_U16     u16Ry; // display primaries Ry
299     MS_U16     u16Gx; // display primaries Gx
300     MS_U16     u16Gy; // display primaries Gy
301     MS_U16     u16Bx; // display primaries Bx
302     MS_U16     u16By; // display primaries By
303     MS_U16     u16Wx; // display primaries Wx
304     MS_U16     u16Wy; // display primaries Wy
305     MS_U16     u16Lmax; // max display mastering luminance
306     MS_U16     u16Lmin; // min display mastering luminance
307     MS_U16     u16MaxCLL; // maximum content light level
308     MS_U16     u16MaxFALL; // maximum frame-average light level
309 } ACE_DRV_HDRMetadataHdmiTxInfoFrame;
310 
311 typedef struct __attribute__((packed))
312 {
313     MS_U8 PixelFormat;              // Pixel Format
314     MS_U8 Colorimetry;              // Color imetry
315     MS_U8 ExtendedColorimetry;      // Extended Color imetry
316     MS_U8 RgbQuantizationRange;     // Rgb Quantization Range
317     MS_U8 YccQuantizationRange;     // Ycc Quantization Range
318     MS_U8 StaticMetadataDescriptorID; //Static Metadata Descriptor ID
319 } ACE_DRV_HDRHdmiTxAviInfoFrame;
320 
321 /*!
322  *  Initial  HDR   Settings
323  */
324 typedef struct __attribute__((packed))
325 {
326     /// HDR Version Info
327     MS_U16 u16HDRVerInfo;
328     /// HDR init Length
329     MS_U16 u16HDRInitLength;
330     /// HDR Enable
331     MS_BOOL bHDREnable;
332     /// HDR Function Select
333     MS_U16 u16HDRFunctionSelect;
334     /// HDR Metadata Mpeg VUI
335     ACE_DRV_HDRMetadataMpegVUI ACE_HDRMetadataMpegVUI;
336     //HDR Tone Mapping Data
337     ACE_DRV_HDRToneMappingData ACE_HDRToneMappingData;
338     //HDR Gamut Mapping Data
339     ACE_DRV_HDRGamutMappingData ACE_HDRGamutMappingData;
340     //HDR Metadata Hdmi Tx Info Frame
341     ACE_DRV_HDRMetadataHdmiTxInfoFrame ACE_HDRMetadataHdmiTxInfoFrame;
342     //HDR Metadata Hdmi Tx Info Frame
343     ACE_DRV_HDRHdmiTxAviInfoFrame ACE_HDRHdmiTxAviInfoFrame;
344 } ACE_DRV_HDRinit;
345 
346 INTERFACE ACE_DRV_HDRinit g_ACEinitParameters;
347 
348 
349 MS_U16  msACE_GetVersion(void);
350 void    InitACEVar(void* pInstance);
351 void    msACEPCForceYUVtoRGB(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bEnable );
352 void    msAdjustPCContrast(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Contrast );
353 void    msAdjustPCRGB(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Red, MS_U8 u8Green, MS_U8 u8Blue );
354 void    msAdjustVideoContrast(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Contrast );
355 void    msAdjustVideoRGB(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Red, MS_U8 u8Green, MS_U8 u8Blue);
356 void    msAdjustPCRGB_10Bits( void* pInstance, MS_BOOL bScalerWin, MS_U16 u16Red, MS_U16 u16Green, MS_U16 u16Blue );
357 void    msAdjustVideoRGB_10Bits(void* pInstance,  MS_BOOL bScalerWin, MS_U16 u16RCon, MS_U16 u16GCon, MS_U16 u16BCon);
358 void    msACESelectYUVtoRGBMatrix(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Matrix, MS_S16 *psUserYUVtoRGBMatrix );
359 void    msACESetColorCorrectionTable(void* pInstance, MS_BOOL bScalerWin, MS_S16 *psColorCorrectionTable );
360 void    msACESetPCsRGBTable(void* pInstance, MS_BOOL bScalerWin, MS_S16 *psPCsRGBTable );
361 void    msAdjustVideoSaturation(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Saturation );
362 void    msAdjustVideoHue(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Hue );
363 MS_U16  msACE_GetInfo(void* pInstance, MS_BOOL bWindow, EnuACEInfoType eACEInfoType );
364 void    msSetVideoColorMatrix(void* pInstance, MS_BOOL bScalerWin );
365 void    msSetPCColorMatrix(void* pInstance, MS_BOOL bScalerWin );
366 void    msACE_SetColorMatrixControl(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bEnable );
367 void    msACE_SetRBChannelRange(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bRange );
368 MS_BOOL  msACESetBypassColorMatrix(void* pInstance, MS_BOOL bEnable);
369 
370 /******************************************************************************/
371 /*                   Function Prototypes                                      */
372 /******************************************************************************/
373 ////////////////////////////////////////////////////////////////////////////////
374 /// @brief \b Function \b Name: MDrv_ACE_GetVersion()
375 /// @brief \b Function \b Description:  Get version of ACE library
376 /// @param <IN>        \b None
377 /// @param <OUT>       \b None
378 /// @param <RET>       \b Version
379 /// @param <GLOBAL>    \b None
380 ////////////////////////////////////////////////////////////////////////////////
381 MS_U16 MDrv_ACE_GetVersion(void);
382 
383 ////////////////////////////////////////////////////////////////////////////////
384 /// @brief \b Function \b Name: MDrv_ACE_Init()
385 /// @brief \b Function \b Description:  Initialize ACE
386 /// @param <IN>        \b None
387 /// @param <OUT>       \b None
388 /// @param <RET>       \b None
389 /// @param <GLOBAL>    \b None
390 ////////////////////////////////////////////////////////////////////////////////
391 void MDrv_ACE_Init(void* pInstance, MS_BOOL bScalerWin, MS_S16* psColorCorrectionTable, MS_S16* psPCsRGBTable );
392 
393 ////////////////////////////////////////////////////////////////////////////////
394 /// @brief \b Function \b Name: MDrv_ACE_PCForceYUVtoRGB()
395 /// @brief \b Function \b Description:  Force transfer YUV to RGB
396 /// @param <IN>        \b bScalerWin
397 /// @param <IN>        \b bEnable
398 /// @param <OUT>       \b None
399 /// @param <RET>       \b None
400 /// @param <GLOBAL>    \b None
401 ////////////////////////////////////////////////////////////////////////////////
402 void MDrv_ACE_PCForceYUVtoRGB(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bEnable );
403 
404 ////////////////////////////////////////////////////////////////////////////////
405 /// @brief \b Function \b Name: MDrv_ACE_PicSetContrast()
406 /// @brief \b Function \b Description:  Adjust Contrast
407 /// @param <IN>        \b bScalerWin
408 /// @param <IN>        \b u8Contrast
409 /// @param <OUT>       \b None
410 /// @param <RET>       \b None
411 /// @param <GLOBAL>    \b None
412 ////////////////////////////////////////////////////////////////////////////////
413 void MDrv_ACE_PicSetContrast(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bUseYUVSpace, MS_U8 u8Contrast );
414 
415 ////////////////////////////////////////////////////////////////////////////////
416 /// @brief \b Function \b Name: MDrv_ACE_PicSetRGB()
417 /// @brief \b Function \b Description:  Adjust Video RGB
418 /// @param <IN>        \b bScalerWin
419 /// @param <IN>        \b u8Red
420 /// @param <IN>        \b u8Green
421 /// @param <IN>        \b u8Blue
422 /// @param <OUT>       \b None
423 /// @param <RET>       \b None
424 /// @param <GLOBAL>    \b None
425 ////////////////////////////////////////////////////////////////////////////////
426 void MDrv_ACE_PicSetRGB(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bUseYUVSpace, MS_U8 u8Red, MS_U8 u8Green, MS_U8 u8Blue );
427 
428 ////////////////////////////////////////////////////////////////////////////////
429 /// @brief \b Function \b Name: MDrv_ACE_PicSetRGB_10Bits()
430 /// @brief \b Function \b Description:  Adjust Video RGB
431 /// @param <IN>        \b bScalerWin
432 /// @param <IN>        \b u16Red
433 /// @param <IN>        \b u16Green
434 /// @param <IN>        \b u16Blue
435 /// @param <OUT>       \b None
436 /// @param <RET>       \b None
437 /// @param <GLOBAL>    \b None
438 ////////////////////////////////////////////////////////////////////////////////
439 void MDrv_ACE_PicSetRGB_10Bits( void* pInstance,MS_BOOL bScalerWin, MS_BOOL bUseYUVSpace, MS_U16 u16Red, MS_U16 u16Green, MS_U16 u16Blue );
440 
441 ////////////////////////////////////////////////////////////////////////////////
442 /// @brief \b Function \b Name: MDrv_ACE_PicSetPostRGBGain()
443 /// @brief \b Function \b Description:  Adjust Video Post RGB Gain
444 /// @param <IN>        \b bScalerWin
445 /// @param <IN>        \b u8RedGain
446 /// @param <IN>        \b u8GreenGain
447 /// @param <IN>        \b u8BlueGain
448 /// @param <OUT>       \b None
449 /// @param <RET>       \b None
450 /// @param <GLOBAL>    \b None
451 ////////////////////////////////////////////////////////////////////////////////
452 void MDrv_ACE_PicSetPostRGBGain(void* pInstance,MS_BOOL bScalerWin, MS_U16 u8RedGain, MS_U16 u8GreenGain, MS_U16 u8BlueGain);
453 
454 ////////////////////////////////////////////////////////////////////////////////
455 /// @brief \b Function \b Name: MDrv_ACE_PicSetPostRGBGainOffset()
456 /// @brief \b Function \b Description:  Adjust Post RGB Gain and Offset simultaneously
457 /// @param <IN>        \b bScalerWin
458 /// @param <IN>        \b u8RedGain
459 /// @param <IN>        \b u8GreenGain
460 /// @param <IN>        \b u8BlueGain
461 /// @param <IN>        \b u16RedOffset
462 /// @param <IN>        \b u16GreenOffset
463 /// @param <IN>        \b u16BlueOffset
464 /// @param <OUT>       \b None
465 /// @param <RET>       \b None
466 /// @param <GLOBAL>    \b None
467 ////////////////////////////////////////////////////////////////////////////////
468 void MDrv_ACE_PicSetPostRGBGainOffset(void* pInstance,MS_BOOL bScalerWin,
469                                       MS_U16 u8RedGain,    MS_U16 u8GreenGain,    MS_U16 u8BlueGain,
470                                       MS_U16 u16RedOffset, MS_U16 u16GreenOffset, MS_U16 u16BlueOffset, MS_U8 u8Step);
471 
472 ////////////////////////////////////////////////////////////////////////////////
473 /// @brief \b Function \b Name: MDrv_ACE_GetInfo()
474 /// @brief \b Function \b Description:  Get ACE Info
475 /// @param <IN>        \b bScalerWin
476 /// @param <IN>        \b ucInfoType
477 /// @param <OUT>       \b None
478 /// @param <RET>       \b wReturnValue
479 /// @param <GLOBAL>    \b None
480 ////////////////////////////////////////////////////////////////////////////////
481 MS_U8 MDrv_ACE_GetPostRGBGain(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16ACEinfo);
482 
483 ////////////////////////////////////////////////////////////////////////////////
484 /// @brief \b Function \b Name: MDrv_ACE_PicSetPostRGBOffset()
485 /// @brief \b Function \b Description:  Adjust Video Post RGB Offset
486 /// @param <IN>        \b bScalerWin
487 /// @param <IN>        \b u16RedOffset
488 /// @param <IN>        \b u16GreenOffset
489 /// @param <IN>        \b u16BlueOffset
490 /// @param <IN>        \b u8Step
491 /// @param <OUT>       \b None
492 /// @param <RET>       \b None
493 /// @param <GLOBAL>    \b None
494 ////////////////////////////////////////////////////////////////////////////////
495 void MDrv_ACE_PicSetPostRGBOffset(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16RedOffset, MS_U16 u16GreenOffset, MS_U16 u16BlueOffset, MS_U8 u8Step);
496 ////////////////////////////////////////////////////////////////////////////////
497 /// @brief \b Function \b Name: MDrv_ACE_SelectYUVtoRGBMatrix()
498 /// @brief \b Function \b Description:  Select YUV to RGB Matrix
499 /// @param <IN>        \b bScalerWin
500 /// @param <IN>        \b ucMatrix
501 /// @param <IN>        \b psUserYUVtoRGBMatrix
502 /// @param <OUT>       \b None
503 /// @param <RET>       \b None
504 /// @param <GLOBAL>    \b None
505 ////////////////////////////////////////////////////////////////////////////////
506 void MDrv_ACE_SelectYUVtoRGBMatrix(void* pInstance, MS_BOOL bScalerWin, MS_U8 ucMatrix, MS_S16* psUserYUVtoRGBMatrix );
507 
508 ////////////////////////////////////////////////////////////////////////////////
509 /// @brief \b Function \b Name: MDrv_ACE_SetColorCorrectionTable()
510 /// @brief \b Function \b Description:  Set Color Correction Table
511 /// @param <IN>        \b bScalerWin
512 /// @param <IN>        \b psColorCorrectionTable
513 /// @param <OUT>       \b None
514 /// @param <RET>       \b None
515 /// @param <GLOBAL>    \b None
516 ////////////////////////////////////////////////////////////////////////////////
517 void MDrv_ACE_SetColorCorrectionTable(void* pInstance, MS_BOOL bScalerWin);
518 
519 ////////////////////////////////////////////////////////////////////////////////
520 /// @brief \b Function \b Name: MDrv_ACE_SetPCsRGBTable()
521 /// @brief \b Function \b Description:  Set PCs RGB Table
522 /// @param <IN>        \b bScalerWin
523 /// @param <IN>        \b psPCsRGBTable
524 /// @param <OUT>       \b None
525 /// @param <RET>       \b None
526 /// @param <GLOBAL>    \b None
527 ////////////////////////////////////////////////////////////////////////////////
528 void MDrv_ACE_SetPCsRGBTable(void* pInstance, MS_BOOL bScalerWin);
529 
530 ////////////////////////////////////////////////////////////////////////////////
531 /// @brief \b Function \b Name: MDrv_ACE_AdjustVideoSaturation()
532 /// @brief \b Function \b Description:  Adjust Video Saturation
533 /// @param <IN>        \b bScalerWin
534 /// @param <IN>        \b u8Saturation
535 /// @param <OUT>       \b None
536 /// @param <RET>       \b None
537 /// @param <GLOBAL>    \b None
538 ////////////////////////////////////////////////////////////////////////////////
539 void MDrv_ACE_SetSaturation(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Saturation );
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// @brief \b Function \b Name: MDrv_ACE_SetHue()
543 /// @brief \b Function \b Description:  Adjust Video Hue
544 /// @param <IN>        \b bScalerWin
545 /// @param <IN>        \b u8Hue
546 /// @param <OUT>       \b None
547 /// @param <RET>       \b None
548 /// @param <GLOBAL>    \b None
549 ////////////////////////////////////////////////////////////////////////////////
550 void MDrv_ACE_SetHue(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Hue );
551 
552 ////////////////////////////////////////////////////////////////////////////////
553 /// @brief \b Function \b Name: MDrv_ACE_GetInfo()
554 /// @brief \b Function \b Description:  Get ACE Info
555 /// @param <IN>        \b bScalerWin
556 /// @param <IN>        \b ucInfoType
557 /// @param <OUT>       \b None
558 /// @param <RET>       \b wReturnValue
559 /// @param <GLOBAL>    \b None
560 ////////////////////////////////////////////////////////////////////////////////
561 MS_U16 MDrv_ACE_GetACEInfo(void* pInstance, MS_BOOL bWindow, MS_U16 u16ACEinfo );
562 
563 
564 void MDrv_ACE_DMS(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bisATV );
565 void MDrv_ACE_GetColorMatrix(void* pInstance, MS_BOOL bScalerWin, MS_U16* pu16Matrix );
566 void MDrv_ACE_SetColorMatrix(void* pInstance, MS_BOOL bScalerWin, MS_U16* pu16Matrix );
567 MS_BOOL MDrv_ACE_SetBypassColorMatrix(void* pInstance, MS_BOOL bEnable );
568 void MDrv_ACE_PatchDTGColorChecker(void* pInstance, MS_U8 u8Mode);
569 void MDrv_ACE_SetFleshTone(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bEn, MS_U8 u8FlashTone); ///< set flash tone
570 void MDrv_ACE_SetBlackAdjust(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8BlackAdjust);
571 
572 void MDrv_ACE_init_riu_base(MS_VIRT ptr_riu_base );
573 void MDrv_ACE_SetSharpness(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8Sharpness );
574 void MDrv_ACE_SetBrightness (void* pInstance, MS_BOOL bScalerWin, MS_U8 u8RedBrightness, MS_U8 u8GreenBrightness, MS_U8 u8BlueBrightness );
575 void MDrv_ACE_SetBrightnessPrecise(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16RedBrightness, MS_U16 u16GreenBrightness, MS_U16 u16BlueBrightness);
576 MS_U16 MDrv_ACE_GetBrightness (void* pInstance, MS_BOOL bScalerWin, EnuACEInfoType eACEInfoType);
577 MS_BOOL MDrv_ACE_SetPreYOffset(void* pInstance, MS_BOOL bScalerWin, MS_U8 u8PreYOffset);
578 MS_U8 MDrv_ACE_GetPreYOffset(void* pInstance, MS_BOOL bScalerWin);
579 MS_BOOL MDrv_ACE_IsPostRGBGain(void* pInstance, MS_BOOL bWindow);
580 MS_BOOL MDrv_ACE_IsPostRGBOffset(void* pInstance, MS_BOOL bWindow);
581 MS_BOOL MDrv_XC_ACE_Set_IHC_SRAM(void* pInstance, MS_U16 *pBuf, MS_U16 u16ByteSize);
582 MS_BOOL MDrv_XC_ACE_Set_ICC_SRAM(void* pInstance, MS_U16 *pBuf, MS_U16 u16ByteSize);
583 
584 //------------------------------
585 // MWE related
586 //------------------------------
587 void MDrv_XC_ACE_MWEinit(void* pInstance, MS_U16 u16MWEHstart, MS_U16 u16MWEVstart, MS_U16 u16MWEWidth, MS_U16 u16MWEHeight);
588 void MDrv_XC_ACE_MWESetWin(void* pInstance, MWE_RECT *pRect);
589 void MDrv_XC_ACE_MWESetBorder(void* pInstance, MS_BOOL bScalerWin, MS_BOOL ben, MS_U8 u8color, MS_U16 u16_l, MS_U16 u16_r, MS_U16 u16_t, MS_U16 u16_d);
590 void MDrv_XC_ACE_MWEEnable(void* pInstance, MS_BOOL bEnable, MS_BOOL bLoadFromTable);
591 void MDrv_XC_ACE_MWECloneVisualEffect(void* pInstance);
592 void MDrv_ACE_3DClonePQMap(void* pInstance, XC_ACE_WEAVETYPE enWeaveType);
593 void MDrv_XC_ACE_MWESetRegRow(void* pInstance, MS_U32 u32Addr, MS_U8 u8Value, MS_U8 u8Mask);
594 
595 //------------------------------
596 // DynamicnNR related
597 //------------------------------
598 
599 MS_U8 MDrv_XC_ACE_DNR_GetMotion(void* pInstance);
600 MS_U8 MDrv_ACE_DNR_GetCoringThreshold(void* pInstance, MS_BOOL bScalerWin);
601 MS_U8 MDrv_ACE_DNR_GetSharpnessAdjust(void* pInstance, MS_BOOL bScalerWin);
602 MS_U8 MDrv_ACE_DNR_GetGuassin_SNR_Threshold(void* pInstance, MS_BOOL bScalerWin);
603 
604 void MDrv_ACE_DNR_SetCoringThreshold(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
605 void MDrv_ACE_DNR_SetSharpnessAdjust(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
606 void MDrv_ACE_DNR_SetNM_V(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
607 void MDrv_ACE_DNR_SetGNR_0(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
608 void MDrv_ACE_DNR_SetGNR_1(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
609 void MDrv_ACE_DNR_SetCP(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
610 void MDrv_ACE_DNR_SetDP(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
611 void MDrv_ACE_DNR_SetNM_H_0(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
612 void MDrv_ACE_DNR_SetNM_H_1(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
613 void MDrv_ACE_DNR_SetGray_Ground_Gain(void* pInstance, MS_U16 u16val);
614 void MDrv_ACE_DNR_SetGray_Ground_En(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
615 void MDrv_ACE_DNR_SetSC_Coring(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
616 void MDrv_ACE_DNR_SetSpikeNR_0(void* pInstance, MS_U16 u16val);
617 void MDrv_ACE_DNR_SetSpikeNR_1(void* pInstance, MS_U16 u16val);
618 void MDrv_ACE_DNR_SetSNR_NM(void* pInstance, MS_U16 u16val);
619 void MDrv_ACE_DNR_SetBank_Coring(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
620 void MDrv_ACE_DNR_SetGuassin_SNR_Threshold(void* pInstance, MS_BOOL bScalerWin, MS_U16 u16val);
621 void MDrv_ACE_DNR_SetNRTable(void* pInstance, MS_U8 *pTbl);
622 void MDrv_ACE_SetColorMatrixControl(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bEnable );
623 void MDrv_ACE_SetRBChannelRange(void* pInstance, MS_BOOL bScalerWin, MS_BOOL bRange);
624 void MDrv_ACE_WriteColorMatrixBurst(void* pInstance, MS_BOOL bWindow, MS_U16* psMatrix );
625 MS_BOOL MDrv_ACE_IsSupportMLoad(void* pInstance);
626 MS_BOOL MDrv_ACE_SetIHC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_IHC_COLOR_TYPE eIHC, MS_U8 u8Val);
627 MS_BOOL MDrv_ACE_GetIHC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_IHC_COLOR_TYPE eIHC, MS_U8* pu8Val);
628 MS_BOOL MDrv_ACE_SetICC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_ICC_COLOR_TYPE eICC, MS_U8 u8Val);
629 MS_BOOL MDrv_ACE_GetICC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_ICC_COLOR_TYPE eICC, MS_U8* pu8Val);
630 MS_BOOL MDrv_ACE_SetIBC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_IBC_COLOR_TYPE eIBC, MS_U8 u8Val);
631 MS_BOOL MDrv_ACE_GetIBC(void* pInstance, MS_BOOL bScalerWin, XC_ACE_IBC_COLOR_TYPE eIBC, MS_U8* pu8Val);
632 
633 MS_BOOL MDrv_ACE_SetHDRInit(void* pInstance,ACE_DRV_HDRinit * pstACE_HDRInitData);
634 void msACE_HDR_Main(void *pInstance);
635 
636 void MDrv_ACE_ColorCorrectionTable(void* pInstance, MS_BOOL bScalerWin, MS_S16 *psColorCorrectionTable );
637 //OS dependent.
638 
639 void MDrv_ACE_SetSkipWaitVsync(void* pInstance, MS_BOOL eWindow,MS_BOOL bIsSkipWaitVsyn);
640 MS_BOOL MDrv_ACE_GetSkipWaitVsync(void* pInstance, MS_BOOL bScalerWin);
641 
642 MS_U32 MDrv_ACE_GetDeviceNum(void);
643 
644 
645 #ifdef __cplusplus
646 }
647 #endif
648 #endif // DRV_ACE_H
649 
650