xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiVDEC_EX.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   apiVDEC_EX.h
98 /// @brief  VDEC EXTENSION API FOR DUAL STREAMS
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /*! \defgroup VDEC VDEC Modules
103    <b> VDEC Arch for HW IP </b> \n
104    \image html VDEC_Arch_layer.PNG
105 
106    <b> VDEC API rule for Get Free Stream  </b> \n
107    \image html GetFreeStreamID_pic.PNG
108 
109    <b> VDEC API call flow for DTV </b> \n
110    \image html VDEC_DTV_pic1.PNG
111 
112    <b> VDEC API call flow in SN vdplayer </b> \n
113    \image html apiVDEC_EX_SN_MM.png
114 
115    <b> VDEC TEE API call flow in HK and Secure R2 </b> \n
116    \image html apiVDEC_EX_TEE.png
117 
118    <b> VDEC TEE API call flow in MSTplayer </b> \n
119    \image html apiVDEC_EX_Mstplayer.png
120 
121 *! \defgroup VDEC_Init VDEC_Init
122 *  \ingroup VDEC
123 *! \defgroup VDEC_Normal_decode VDEC Normal decode
124 *  \ingroup VDEC
125 *! \defgroup Decode Decode
126 *  \ingroup VDEC
127 *! \defgroup VDEC_Display_Q_Control VDEC Display Q_Control
128 *  \ingroup VDEC
129 *! \defgroup VDEC_ES_buffer_manage VDEC ES buffer manage
130 *  \ingroup VDEC
131 *! \defgroup VDEC_Flush_pattern VDEC Flush pattern
132 *  \ingroup VDEC
133 *! \defgroup Get_information Getinformation
134 *  \ingroup VDEC
135 *! \defgroup VdecEventGroup Vdec Event Group
136 *  \ingroup VDEC
137 *! \defgroup VDEC_Hardware VDEC Hardware
138 *  \ingroup VDEC
139 *! \defgroup VDEC_Enhanced VDEC Enhanced
140 *  \ingroup VDEC
141 *! \defgroup VDEC_DS VDEC DS
142 *  \ingroup VDEC
143 *! \defgroup VDEC_MHEG_DECODE_I_Frame VDEC MHEG DECODE I Frame
144 *  \ingroup VDEC
145 *! \defgroup VdecDebug Vdec Debug
146 *  \ingroup VDEC
147 *! \defgroup VDEC_TEE VDEC TEE
148 *  \ingroup VDEC
149 *! \defgroup VdecCloseCaption Vdec Close Caption
150 *  \ingroup VDEC
151 */
152 
153 #ifndef _API_VDEC_EX_H_
154 #define _API_VDEC_EX_H_
155 
156 #ifdef __cplusplus
157 extern "C"
158 {
159 #endif
160 
161 #if !defined(MSOS_TYPE_NUTTX) || defined(SUPPORT_X_MODEL_FEATURE)
162 
163 //-------------------------------------------------------------------------------------------------
164 //  Macro and Define
165 //-------------------------------------------------------------------------------------------------
166 #define MSIF_VDEC_EX_LIB_CODE      {'V','E','X','_'}
167 #define MSIF_VDEC_EX_LIBVER        {'0','5'}
168 #define MSIF_VDEC_EX_BUILDNUM      {'0','3'}
169 #define MSIF_VDEC_EX_CHANGELIST    {'0','0','6','9','3','0','7','7'}
170 
171 /// Version string.
172 #define VDEC_EX_API_VERSION                /* Character String for DRV/API version             */  \
173     MSIF_TAG,                           /* 'MSIF'                                           */  \
174     MSIF_CLASS,                         /* '00'                                             */  \
175     MSIF_CUS,                           /* 0x0000                                           */  \
176     MSIF_MOD,                           /* 0x0000                                           */  \
177     MSIF_CHIP,                                                                                  \
178     MSIF_CPU,                                                                                   \
179     MSIF_VDEC_EX_LIB_CODE,                 /* IP__                                             */  \
180     MSIF_VDEC_EX_LIBVER,                   /* 0.0 ~ Z.Z                                        */  \
181     MSIF_VDEC_EX_BUILDNUM,                 /* 00 ~ 99                                          */  \
182     MSIF_VDEC_EX_CHANGELIST,               /* CL#                                              */  \
183     MSIF_OS
184 
185 #define VDEC_EX_DEFAULT_DBG_MSG_LEVEL  E_VDEC_EX_DBG_LEVEL_DBG
186 #define VDEC_EX_RVD_BROKEN_BY_US   0x80000000
187 #define VDEC_EX_MVD_PIC_START_FLAG 0x40000000
188 
189 #define VDEC_EX_BIT(_bit_)                  (1 << (_bit_))
190 #define VDEC_CAP_REPORT_SCAN_TYPE
191 #define VDEC_CAP_DYNAMIC_CMA
192 #define VDEC_CAP_HEVC_HDR //enable HDR
193 //#define VDEC_CAP_HEVC_HDR_V2 //enable HDR version2
194 #define VDEC_CAP_DISABLE_HEVC_10BITS    // MApi_VDEC_EX_PreSetControl((VDEC_StreamId *)pHandle, E_VDEC_EX_USER_CMD_VDEC_FEATURE, E_VDEC_EX_FEATURE_FORCE_MAIN_PROFILE);
195 //-------------------------------------------------------------------------------------------------
196 //  Type and Structure
197 //-------------------------------------------------------------------------------------------------
198 
199 #define VDEC_EX_FPA_TYPE_CHECKERBOARD_INTERLEAVING  0
200 #define VDEC_EX_FPA_TYPE_COLUMN_INTERLEAVEING       1
201 #define VDEC_EX_FPA_TYPE_ROW_INTERLEAVEING          2
202 #define VDEC_EX_FPA_TYPE_SIDE_BY_SIDE_PACKING       3
203 #define VDEC_EX_FPA_TYPE_TOP_BOTTOM_PACKING         4
204 #define VDEC_EX_FPA_TYPE_TEMPORAL_INTERLEAVING_FRM  5
205 
206 #define VDEC_MAX_DEC_NUM 2
207 
208 typedef enum
209 {
210     E_VDEC_EX_MAIN_STREAM = 0,
211     E_VDEC_EX_SUB_STREAM,
212 } VDEC_EX_Stream;
213 
214 /// decoder event enumerator.
215 typedef enum
216 {
217     /// turn off all event
218     E_VDEC_EX_EVENT_OFF                = 0x00,
219     /// display one frame/field
220     E_VDEC_EX_EVENT_DISP_ONE           = VDEC_EX_BIT(0),
221     /// repeat one frame/field
222     E_VDEC_EX_EVENT_DISP_REPEAT        = VDEC_EX_BIT(1),
223     /// one CC data should be displayed
224     E_VDEC_EX_EVENT_DISP_WITH_CC       = VDEC_EX_BIT(2),
225     /// decode one frame
226     E_VDEC_EX_EVENT_DEC_ONE            = VDEC_EX_BIT(3),
227     /// decode one I frame
228     E_VDEC_EX_EVENT_DEC_I              = VDEC_EX_BIT(4),
229     /// decode error
230     E_VDEC_EX_EVENT_DEC_ERR            = VDEC_EX_BIT(5),
231     /// display information is changed
232     E_VDEC_EX_EVENT_DISP_INFO_CHG      = VDEC_EX_BIT(6),
233     /// find user data
234     E_VDEC_EX_EVENT_USER_DATA_FOUND    = VDEC_EX_BIT(7),
235     /// display information ready after be changed
236     E_VDEC_EX_EVENT_DISP_INFO_RDY      = VDEC_EX_BIT(8),
237     /// first frame decoded
238     E_VDEC_EX_EVENT_FIRST_FRAME        = VDEC_EX_BIT(9),
239     /// first picture found
240     E_VDEC_EX_EVENT_PIC_FOUND          = VDEC_EX_BIT(10),
241     /// video is ready to display (no garbage and avsync done)
242     E_VDEC_EX_EVENT_VIDEO_UNMUTE       = VDEC_EX_BIT(11),
243     /// new sequence header found
244     E_VDEC_EX_EVENT_SEQ_HDR_FOUND      = VDEC_EX_BIT(12),
245     /// active format description found
246     E_VDEC_EX_EVENT_AFD_FOUND          = VDEC_EX_BIT(13),
247     // ES data invalid
248     E_VDEC_EX_EVENT_ES_DATA_ERR        = VDEC_EX_BIT(14),
249     /// speed up the un-mute screen on XC.
250     E_VDEC_EX_EVENT_XC_LOW_DEALY          = VDEC_EX_BIT(16),
251     /// VDEC FW need driver to handle CMA action(allocate/release)
252     E_VDEC_EX_EVENT_DEC_CMA_ACTION      = VDEC_EX_BIT(17)
253 } VDEC_EX_EventFlag;
254 
255 //define VDEC CB type
256 typedef enum
257 {
258     E_VDEC_EX_CB_MAIN  = 0,
259     E_VDEC_EX_CB_SUB,
260 } VDEC_EX_CB_TYPE;
261 
262 /// codec type enumerator
263 typedef enum
264 {
265     ///unsupported codec type
266     E_VDEC_EX_CODEC_TYPE_NONE = 0,
267     ///MPEG 1/2
268     E_VDEC_EX_CODEC_TYPE_MPEG2,
269     ///H263 (short video header)
270     E_VDEC_EX_CODEC_TYPE_H263,
271     ///MPEG4 (default)
272     E_VDEC_EX_CODEC_TYPE_MPEG4,
273     ///MPEG4 (Divx311)
274     E_VDEC_EX_CODEC_TYPE_DIVX311,
275     ///MPEG4 (Divx412)
276     E_VDEC_EX_CODEC_TYPE_DIVX412,
277     ///FLV
278     E_VDEC_EX_CODEC_TYPE_FLV,
279     ///VC1 advanced profile (VC1)
280     E_VDEC_EX_CODEC_TYPE_VC1_ADV,
281     ///VC1 main profile (RCV)
282     E_VDEC_EX_CODEC_TYPE_VC1_MAIN,
283     ///Real Video version 8
284     E_VDEC_EX_CODEC_TYPE_RV8,
285     ///Real Video version 9 and 10
286     E_VDEC_EX_CODEC_TYPE_RV9,
287     ///H264
288     E_VDEC_EX_CODEC_TYPE_H264,
289     ///AVS
290     E_VDEC_EX_CODEC_TYPE_AVS,
291     ///MJPEG
292     E_VDEC_EX_CODEC_TYPE_MJPEG,
293     ///MVC
294     E_VDEC_EX_CODEC_TYPE_MVC,
295     ///VP8
296     E_VDEC_EX_CODEC_TYPE_VP8,
297     ///HEVC
298     E_VDEC_EX_CODEC_TYPE_HEVC,
299     ///VP9
300     E_VDEC_EX_CODEC_TYPE_VP9,
301     E_VDEC_EX_CODEC_TYPE_NUM
302 } VDEC_EX_CodecType;
303 
304 /// input source select enumerator
305 typedef enum
306 {
307     ///DTV mode
308     E_VDEC_EX_SRC_MODE_DTV = 0,
309     ///TS file mode
310     E_VDEC_EX_SRC_MODE_TS_FILE,
311     ///generic file mode
312     E_VDEC_EX_SRC_MODE_FILE,
313     /// TS file and dual ES buffer mode
314     E_VDEC_EX_SRC_MODE_TS_FILE_DUAL_ES,
315     ///generic file and dual ES buffer mode
316     E_VDEC_EX_SRC_MODE_FILE_DUAL_ES,
317 } VDEC_EX_SrcMode;
318 
319 /// function return enumerator
320 typedef enum
321 {
322     ///failed
323     E_VDEC_EX_FAIL = 0,
324     ///success
325     E_VDEC_EX_OK,
326     ///invalid parameter
327     E_VDEC_EX_RET_INVALID_PARAM,
328     ///access not allow
329     E_VDEC_EX_RET_ILLEGAL_ACCESS,
330     ///hardware abnormal
331     E_VDEC_EX_RET_HARDWARE_BREAKDOWN,
332      ///unsupported
333     E_VDEC_EX_RET_UNSUPPORTED,
334      ///timeout
335     E_VDEC_EX_RET_TIMEOUT,
336     ///not ready
337     E_VDEC_EX_RET_NOT_READY,
338     ///not initial
339     E_VDEC_EX_RET_NOT_INIT,
340     ///not exit after last initialization
341     E_VDEC_EX_RET_NOT_EXIT,
342     ///not running, counter does not change
343     E_VDEC_EX_RET_NOT_RUNNING,
344     ///max value
345     E_VDEC_EX_RET_NUM,
346 } VDEC_EX_Result;
347 
348 /// Action enumerator of display commands
349 typedef enum
350 {
351     /// Action- display frame
352     E_VDEC_EX_DISP_ACTION_DISPLAY   = 1,
353     /// Action - release frame
354     E_VDEC_EX_DISP_ACTION_RELEASE,
355 } VDEC_EX_DispCmdAction;
356 
357 /// Freeze picture select after flush decoder
358 typedef enum
359 {
360     /// Freeze at current display picture
361     E_VDEC_EX_FREEZE_AT_CUR_PIC = 1,
362     /// freeze at the latest decode picture
363     E_VDEC_EX_FREEZE_AT_LAST_PIC,
364 } VDEC_EX_FreezePicSelect;
365 
366 /// error code enumerator
367 typedef enum
368 {
369     E_VDEC_EX_ERR_CODE_BASE = 0x01000000,
370     E_VDEC_EX_ERR_CODE_NOT_SUPPORT,
371     E_VDEC_EX_ERR_CODE_ILLEGAL_ACCESS,
372     E_VDEC_EX_ERR_CODE_FRMRATE_NOT_SUPPORT,
373     E_VDEC_EX_ERR_CODE_DIVX_PLUS_UNSUPPORTED,
374 
375     E_VDEC_EX_MVD_ERR_CODE_BASE = 0x02000000,
376         E_VDEC_EX_MVD_ERR_CODE_SHAPE,
377         E_VDEC_EX_MVD_ERR_CODE_USED_SPRITE,
378         E_VDEC_EX_MVD_ERR_CODE_NOT_8_BIT,         //error_status : bits per pixel
379         E_VDEC_EX_MVD_ERR_CODE_NERPRED_ENABLE,
380         E_VDEC_EX_MVD_ERR_CODE_REDUCED_RES_ENABLE,
381         E_VDEC_EX_MVD_ERR_CODE_SCALABILITY,
382         E_VDEC_EX_MVD_ERR_CODE_OTHER,
383         E_VDEC_EX_MVD_ERR_CODE_H263_ERROR,
384         E_VDEC_EX_MVD_ERR_CODE_RES_NOT_SUPPORT,   //error_status : none
385         E_VDEC_EX_MVD_ERR_CODE_MPEG4_NOT_SUPPORT, //error_status : none
386         E_VDEC_EX_MVD_ERR_CODE_PROFILE_NOT_SUPPORT  , ///< error_status : none
387         E_VDEC_EX_MVD_ERR_CODE_RCV_ERROR_OCCUR,
388         E_VDEC_EX_MVD_ERR_CODE_VC1_NOT_SUPPORT,   //error_status : none
389         E_VDEC_EX_MVD_ERR_CODE_UNKNOW_CODEC_NOT_SUPPORT  ,   ///< error_status : none
390         E_VDEC_EX_MVD_ERR_CODE_SLQ_TBL_NOT_SUPPORT  , ///< error_status : none
391         E_VDEC_EX_MVD_ERR_CODE_FRAME_BUF_NOT_ENOUGH , ///< error_status : none
392 
393     E_VDEC_EX_HVD_ERR_CODE_BASE = 0x03000000,
394         E_VDEC_EX_HVD_ERR_CODE_GENERAL_BASE = (0x0000|E_VDEC_EX_HVD_ERR_CODE_BASE),
395         E_VDEC_EX_HVD_ERR_CODE_OUT_OF_SPEC ,
396         E_VDEC_EX_HVD_ERR_CODE_UNKNOW_ERR,
397         E_VDEC_EX_HVD_ERR_CODE_HW_BREAK_DOWN,
398         E_VDEC_EX_HVD_ERR_CODE_HW_DEC_TIMEOUT,
399         E_VDEC_EX_HVD_ERR_CODE_OUT_OF_MEMORY,
400         E_VDEC_EX_HVD_ERR_CODE_UNKNOWN_CODEC,
401         // AVC
402         E_VDEC_EX_HVD_ERR_CODE_AVC_BASE = (0x1000|E_VDEC_EX_HVD_ERR_CODE_BASE),
403         E_VDEC_EX_HVD_ERR_CODE_AVC_SPS_BROKEN,
404         E_VDEC_EX_HVD_ERR_CODE_AVC_SPS_NOT_IN_SPEC,
405         E_VDEC_EX_HVD_ERR_CODE_AVC_SPS_NOT_ENOUGH_FRM,   // DPB size at specified level is smaller than the specified number of reference frames. This is not allowed
406         E_VDEC_EX_HVD_ERR_CODE_AVC_PPS_BROKEN,           // PPS is not valid
407         E_VDEC_EX_HVD_ERR_CODE_AVC_REF_LIST,
408         E_VDEC_EX_HVD_ERR_CODE_AVC_NO_REF,
409         E_VDEC_EX_HVD_ERR_CODE_AVC_RES,             // out of supported resolution
410         // AVS
411         E_VDEC_EX_HVD_ERR_CODE_AVS_BASE = (0x2000|E_VDEC_EX_HVD_ERR_CODE_BASE),
412         E_VDEC_EX_HVD_ERR_CODE_AVS_RES,             // out of supported resolution
413         // RM
414         E_VDEC_EX_HVD_ERR_CODE_RM_BASE = (0x3000|E_VDEC_EX_HVD_ERR_CODE_BASE),
415         E_VDEC_EX_HVD_ERR_CODE_RM_PACKET_HEADER,
416         E_VDEC_EX_HVD_ERR_CODE_RM_FRAME_HEADER,
417         E_VDEC_EX_HVD_ERR_CODE_RM_SLICE_HEADER,
418         E_VDEC_EX_HVD_ERR_CODE_RM_BYTE_CNT,
419         E_VDEC_EX_HVD_ERR_CODE_RM_DISP_TIMEOUT,
420         E_VDEC_EX_HVD_ERR_CODE_RM_NO_REF,
421         E_VDEC_EX_HVD_ERR_CODE_RM_RES,              // out of supported resolution
422         E_VDEC_EX_HVD_ERR_CODE_RM_VLC,
423         E_VDEC_EX_HVD_ERR_CODE_RM_SIZE_OUT_FB_LAYOUT,
424 
425     E_VDEC_EX_RVD_ERR_CODE_BASE = 0x04000000,
426         E_VDEC_EX_RVD_ERR_CODE_PACKET_HEADER, ///< packet header version error
427         E_VDEC_EX_RVD_ERR_CODE_FRAME_HEADER,  ///< frame type error
428         E_VDEC_EX_RVD_ERR_CODE_SLICE_HEADER,  ///<slice header error
429         E_VDEC_EX_RVD_ERR_CODE_DECODE_TIMEOUT,///< decode MB timeout
430         E_VDEC_EX_RVD_ERR_CODE_OUT_OF_MEMORY, ///< frame buffer is out of memory
431         E_VDEC_EX_RVD_ERR_CODE_BYTE_POS,      ///< can not find in ID table
432         E_VDEC_EX_RVD_ERR_CODE_DISPLAY_TIMEOUT,
433 
434     E_VDEC_EX_MJPEG_ERR_CODE_BASE = 0x05000000,
435         E_VDEC_EX_HVD_ERR_CODE_MJPEG_RES,
436 } VDEC_EX_ErrCode;
437 
438 /// frame rate conversion mode enumerator
439 typedef enum
440 {
441     /// disable FRC mode.
442     E_VDEC_EX_FRC_NORMAL = 0,
443     /// output rate is twice of input rate (ex. 30p to 60p)
444     E_VDEC_EX_FRC_DISP_TWICE,
445     /// 3:2 pulldown mode (ex. 24p to 60i or 60p)
446     E_VDEC_EX_FRC_3_2_PULLDOWN,
447     /// PAL to NTSC conversion (50i to 60i)
448     E_VDEC_EX_FRC_PAL_TO_NTSC,
449     /// NTSC to PAL conversion (60i to 50i)
450     E_VDEC_EX_FRC_NTSC_TO_PAL,
451     /// output rate 50P ->60P
452     E_VDEC_EX_FRC_MODE_50P_60P,
453     /// output rate 60P ->50P
454     E_VDEC_EX_FRC_MODE_60P_50P,
455 } VDEC_EX_FrcMode;
456 
457 /// trick decode mode enumerator
458 typedef enum
459 {
460     /// decode all frame
461     E_VDEC_EX_TRICK_DEC_ALL = 0,
462     /// decode all except of non-reference frame
463     E_VDEC_EX_TRICK_DEC_IP,
464     /// only decode I frame
465     E_VDEC_EX_TRICK_DEC_I,
466     E_VDEC_EX_TRICK_DEC_NUM
467 } VDEC_EX_TrickDec;
468 
469 /// display speed setting enumerator
470 typedef enum
471 {
472     /// default speed type
473     E_VDEC_EX_SPEED_DEFAULT = 0,
474     /// fast display
475     E_VDEC_EX_SPEED_FAST,
476     /// slow display
477     E_VDEC_EX_SPEED_SLOW,
478 } VDEC_EX_SpeedType;
479 
480 /// The display speed enumerator
481 typedef enum
482 {
483     /// Normal display speed.
484     E_VDEC_EX_DISP_SPEED_1X = 1,
485     /// 2X
486     E_VDEC_EX_DISP_SPEED_2X = 2,
487     /// 4X
488     E_VDEC_EX_DISP_SPEED_4X = 4,
489     /// 8X
490     E_VDEC_EX_DISP_SPEED_8X = 8,
491     /// 16X
492     E_VDEC_EX_DISP_SPEED_16X = 16,
493     /// 32X
494     E_VDEC_EX_DISP_SPEED_32X = 32,
495 } VDEC_EX_DispSpeed;
496 
497 /// motion JPEG down scale factor enumerator
498 typedef enum
499 {
500     ///original size
501     E_VDEC_EX_MJPEG_SCALE_1to1 = 0,
502     ///down scale to 1/2
503     E_VDEC_EX_MJPEG_SCALE_2to1,
504     ///down scale to 1/4
505     E_VDEC_EX_MJPEG_SCALE_4to1,
506     ///down scale to 1/8
507     E_VDEC_EX_MJPEG_SCALE_8to1,
508 } VDEC_EX_MJpegScaleFactor;
509 
510 /// timestamp type of command queue
511 typedef enum
512 {
513     ///without timestamp information
514     E_VDEC_EX_TIME_STAMP_NONE = 0,
515     ///PTS (Presentation Time Stamp)
516     E_VDEC_EX_TIME_STAMP_PTS,
517     ///DTS (Decode Time Stamp)
518     E_VDEC_EX_TIME_STAMP_DTS,
519     ///STS (Sorted Time Stamp)
520     E_VDEC_EX_TIME_STAMP_STS,
521     ///PTS_RVU (Presentation Time Stamp)
522     E_VDEC_EX_TIME_STAMP_PTS_MPEG_DIRECTV_SD,
523     ///DTS_RVU (Decode Time Stamp)
524     E_VDEC_EX_TIME_STAMP_DTS_MPEG_DIRECTV_SD,
525 } VDEC_EX_TimeStampType;
526 
527 /// The debug level of VDEC
528 typedef enum
529 {
530     /// disable all uart message.
531     E_VDEC_EX_DBG_LEVEL_NONE = 0,
532     /// Only output error message
533     E_VDEC_EX_DBG_LEVEL_ERR,
534     /// output general message, and above.
535     E_VDEC_EX_DBG_LEVEL_INFO,
536     /// output debug message, and above.
537     E_VDEC_EX_DBG_LEVEL_DBG,
538     /// output function tracing message, and above.
539     E_VDEC_EX_DBG_LEVEL_TRACE,
540     /// output FW message.
541     E_VDEC_EX_DBG_LEVEL_FW,
542 } VDEC_EX_DbgLevel;
543 
544 /// Type of FW source
545 typedef enum
546 {
547     E_VDEC_EX_FW_SOURCE_NONE,
548     E_VDEC_EX_FW_SOURCE_DRAM,
549     E_VDEC_EX_FW_SOURCE_FLASH,
550 }VDEC_EX_FWSourceType;
551 
552 /// Format of CC (Closed Caption)
553 typedef enum
554 {
555     E_VDEC_EX_CC_NONE       = 0x00,
556     E_VDEC_EX_CC_608        = 0x01, //For CC608 or 157
557     E_VDEC_EX_CC_708        = 0x02, //For CC708
558     E_VDEC_EX_CC_UNPACKED   = 0x03,
559 } VDEC_EX_CCFormat;
560 
561 /// Type of CC
562 typedef enum
563 {
564     E_VDEC_EX_CC_TYPE_NONE = 0,
565     E_VDEC_EX_CC_TYPE_NTSC_FIELD1 = 1,
566     E_VDEC_EX_CC_TYPE_NTSC_FIELD2 = 2,
567     E_VDEC_EX_CC_TYPE_DTVCC = 3,
568     E_VDEC_EX_CC_TYPE_NTSC_TWOFIELD = 4,
569 } VDEC_EX_CCType;
570 
571 typedef enum
572 {
573     E_VDEC_EX_CC_GET_BUFF_START = 0x1,
574     E_VDEC_EX_CC_GET_BUFF_SIZE,
575     E_VDEC_EX_CC_GET_708_ENABLE
576 } VDEC_EX_CCInfoCmd;
577 
578 typedef enum
579 {
580     E_VDEC_EX_STAGE_STOP = 0,
581     E_VDEC_EX_STAGE_INIT,
582     E_VDEC_EX_STAGE_PLAY,
583     E_VDEC_EX_STAGE_PAUSE,
584 } VDEC_EX_Stage;
585 
586 
587 typedef enum
588 {
589     /// Used before MApi_VDEC_EX_Flush().
590     E_VDEC_EX_PATTERN_FLUSH = 0,
591     /// Used after MApi_VDEC_EX_EnableLastFrameShow().
592     E_VDEC_EX_PATTERN_FILEEND,
593 }VDEC_EX_PatternType;
594 
595 typedef enum
596 {
597     E_VDEC_EX_FW_STATUS_FLAG_NONE       = 0,
598     E_VDEC_EX_FW_STATUS_FLAG_SEEK_TO_I  = VDEC_EX_BIT(0),
599 }VDEC_EX_FW_STATUS_FLAG;
600 
601 typedef struct
602 {
603     MS_BOOL bInit;
604     MS_BOOL bIdle;
605     VDEC_EX_Stage  eStage;
606 } VDEC_EX_Status;
607 
608 typedef struct
609 {
610     MS_U32 u32Tmp;
611 } VDEC_EX_Info;
612 
613 typedef enum
614 {
615     E_VDEC_EX_FRM_TYPE_I = 0,
616     E_VDEC_EX_FRM_TYPE_P,
617     E_VDEC_EX_FRM_TYPE_B,
618     E_VDEC_EX_FRM_TYPE_OTHER,
619     E_VDEC_EX_FRM_TYPE_NUM
620 } VDEC_EX_FrameType;
621 
622 typedef enum
623 {
624     ///< no field.
625     E_VDEC_EX_FIELDTYPE_NONE,
626     ///< Top field only.
627     E_VDEC_EX_FIELDTYPE_TOP,
628     ///< Bottom field only.
629     E_VDEC_EX_FIELDTYPE_BOTTOM,
630     ///< Both fields.
631     E_VDEC_EX_FIELDTYPE_BOTH,
632     E_VDEC_EX_FIELDTYPE_NUM
633 } VDEC_EX_FieldType;
634 
635 typedef enum
636 {
637     E_VDEC_EX_PATTERN_BEFORE_FRM = 0,
638     E_VDEC_EX_PATTERN_AFTER_FRM,
639     E_VDEC_EX_PATTERN_SKIP_DATA,
640 } VDEC_EX_PatchPattern;
641 
642 typedef enum
643 {
644     E_VDEC_EX_PIC_STRUCTURE_RSV = 0, //reserved
645     E_VDEC_EX_PIC_STRUCTURE_TOP,
646     E_VDEC_EX_PIC_STRUCTURE_BOT,
647     E_VDEC_EX_PIC_STRCUTURE_FRM,
648 } VDEC_EX_PicStructure;
649 
650 //VDEC FB reduction type
651 typedef enum
652 {
653     VDEC_EX_FB_REDUCTION_NONE  = 0,
654     VDEC_EX_FB_REDUCTION_1_2,
655     VDEC_EX_FB_REDUCTION_1_4
656 } VDEC_EX_FBReductionType;
657 
658 //VDEC XC_LOW_DELAY
659 typedef enum
660 {
661     // no any XC_LOW_DELAY event happened.
662     VDEC_EX_XC_LOW_DELAY_NONE              = 0x00,
663     // XC_LOW_DELAY event for disable black screen.
664     VDEC_EX_XC_DISABLE_BLACK_SCREEN        = VDEC_EX_BIT(0),
665     // XC_LOW_DELAY event for release force_read_bank.
666     VDEC_EX_XC_RELEASE_FORCE_READ_BANK     = VDEC_EX_BIT(1),
667     // XC_LOW_DELAY event for release bob_mode.
668     VDEC_EX_XC_RELEASE_BOB_MODE            = VDEC_EX_BIT(2),
669 } VDEC_EX_XcLowDelayType;
670 
671 //VDEC set debug mode
672 typedef enum
673 {
674     E_VDEC_EX_DBG_MODE_BYPASS_INSERT_START_CODE = 0,    /// for  UT
675     E_VDEC_EX_DBG_MODE_BYPASS_DIVX_MC_PATCH,            /// for  UT
676     E_VDEC_EX_DBG_MODE_NUM
677 } VDEC_EX_DbgMode;
678 
679 //VDEC set clock speed
680 typedef enum
681 {
682     E_VDEC_EX_CLOCK_SPEED_NONE = 0,
683     E_VDEC_EX_CLOCK_SPEED_HIGHEST,
684     E_VDEC_EX_CLOCK_SPEED_HIGH,
685     E_VDEC_EX_CLOCK_SPEED_MEDIUM,
686     E_VDEC_EX_CLOCK_SPEED_LOW,
687     E_VDEC_EX_CLOCK_SPEED_LOWEST,
688     E_VDEC_EX_CLOCK_SPEED_DEFAULT,
689 } VDEC_EX_ClockSpeed;
690 
691 
692 //VDEC set secure mode
693 typedef enum
694 {
695     E_VDEC_EX_SECURE_MODE_NONE = 0,
696     E_VDEC_EX_SECURE_MODE_TRUSTZONE
697 } VDEC_EX_SecureMode;
698 
699 //VDEC set smooth rewind
700 typedef enum
701 {
702     E_VDEC_EX_SMOOTH_REWIND_DISABLE = 0,
703     E_VDEC_EX_SMOOTH_REWIND_SUPPORT, // memory at lastest 300mb
704     E_VDEC_EX_SMOOTH_REWIND_ENABLE,
705 }VDEC_EX_Smooth_rewind_mode;
706 
707 typedef struct
708 {
709     MS_BOOL bEnable;
710     MS_U8   u8Tolerance;
711 }VDEC_EX_Err_Tolerance;
712 
713 //VDEC set MFcodec Mode
714 typedef enum
715 {
716     E_VDEC_EX_MFCODEC_DEFAULT = 0,
717     E_VDEC_EX_MFCODEC_FORCE_ENABLE,
718     E_VDEC_EX_MFCODEC_FORCE_DISABLE,
719 } VDEC_EX_MFCodec_mode;
720 
721 typedef enum
722 {
723     E_VDEC_EX_FEATURE_DEFAULT = 0,
724     E_VDEC_EX_FEATURE_FORCE_MAIN_PROFILE = 1, //BIT0=1: HEVC Only support Main profile decode
725 } VDEC_EX_Feature;
726 
727 //VDEC user command id
728 typedef enum
729 {
730     //Group1:Set Control command================================
731     E_VDEC_EX_USER_CMD_SET_CONTROL_BASE  = 0x0000,
732     E_VDEC_EX_USER_CMD_REPEAT_LAST_FIELD,               // Param: 1(ON), 0(OFF)
733     E_VDEC_EX_USER_CMD_AVSYNC_REPEAT_TH,                // Param:0x01 ~ 0xFF(repeat times), 0xFF:always repeat when av is not sync
734     E_VDEC_EX_USER_CMD_DISP_ONE_FIELD,                  // Param: 1(ON), 0(OFF)
735     E_VDEC_EX_USER_CMD_FD_MASK_DELAY_COUNT,             // Param: unit is in vsync base for mute the fd_mask
736     E_VDEC_EX_USER_CMD_FRC_OUTPUT,                      // Param: the address of VDEC_FRC_OutputParam
737     E_VDEC_EX_USER_CMD_FRC_DROP_TYPE,                   // Param: 1(FRC_DROP_FIELD), 0(FRC_DROP_FRAME), default:0
738     E_VDEC_EX_USER_CMD_FAST_DISPLAY,                    // Param: TRUE(Fast display), FALSE(Display until synced)
739     E_VDEC_EX_USER_CMD_IGNORE_ERR_REF,                  // Param: TRUE(Ignore error reference), FALSE(Enable error reference handle)
740     E_VDEC_EX_USER_CMD_FORCE_FOLLOW_DTV_SPEC,           // Param: 1(ON), 0(OFF)
741     E_VDEC_EX_USER_CMD_AVC_MIN_FRM_GAP,                 // Param: Set the theshold of H264 frame gap, 0xFFFFFFFF don't care frame gap
742     E_VDEC_EX_USER_CMD_DISABLE_SEQ_CHG,                 // Param: 1(Disable), 0(Enable)
743     E_VDEC_EX_USER_CMD_SET_DISP_OUTSIDE_CTRL_MODE,      // Param: 1(ON) used for Openmax, 0(OFF) used for mstreamer and mm mode ,default : off
744     E_VDEC_EX_USER_CMD_SET_DTV_USER_DATA_MODE,          // Param: 0(Support normal DVB CC, default case), 1(Support ATSC DirectTV CC), 2,3,4(Reserved)
745     E_VDEC_EX_USER_CMD_SET_SINGLE_TASK_MODE,
746     E_VDEC_EX_USER_CMD_AVC_DISABLE_ANTI_VDEAD,
747     E_VDEC_EX_USER_CMD_DTV_RESET_MVD_PARSER,            // Param: 0(Disable), 1(Enable)
748     E_VDEC_EX_USER_CMD_PVR_FLUSH_FRAME_BUFFER,
749     E_VDEC_EX_USER_CMD_FORCE_INTERLACE_MODE,
750     E_VDEC_EX_USER_CMD_RELEASE_FD_MASK,                 // Param: 1 to release fd mask when zooming or slow motion
751     E_VDEC_EX_USER_CMD_SET_DECODE_MODE,
752     E_VDEC_EX_USER_CMD_SUPPORT_AVC_TO_MVC,              // Param: 0(Do not support), 1(Support AVC to MVC)
753     E_VDEC_EX_USER_CMD_3DLR_VIEW_EXCHANGE,              // Param: 0(Disable), 1(View L/R exhange)
754     E_VDEC_EX_USER_CMD_SET_VSIZE_ALIGN,                 // Param: 0(Disable), 1(Enable)
755     E_VDEC_EX_USER_CMD_SHOW_DECODE_ORDER,               // Param: 0(Disable), 1(Enable)
756     E_VDEC_EX_USER_CMD_AVC_DISP_IGNORE_CROP,            // Param: 0(Disable), 1(Enable)
757     E_VDEC_EX_USER_CMD_SET_DISP_FINISH_MODE,
758     E_VDEC_EX_USER_CMD_SET_AVSYNC_MODE,
759     E_VDEC_EX_USER_CMD_SUSPEND_DYNAMIC_SCALE,           // Param: 0(Disable, non-suspend DS), 1(Enable, suspend DS)
760     E_VDEC_EX_USER_CMD_FORCE_AUTO_MUTE,
761     E_VDEC_EX_USER_CMD_AVC_NEW_SLOW_MOTION,             // Param: 0(Disable), 1(Enable)
762     E_VDEC_EX_USER_CMD_PUSH_DISPQ_WITH_REF_NUM,         // Param: 0(Disable), 1(Enable)
763     E_VDEC_EX_USER_CMD_DS_RESV_N_BUFFER,                // Param: 0(Disable), 1(Enable)
764     E_VDEC_EX_USER_CMD_RM_ENABLE_PTS_TBL,               // Param: 0(Disable), 1(Enable)
765     E_VDEC_EX_USER_CMD_FLUSH_PTS_BUF,
766     E_VDEC_EX_USER_CMD_SET_IDCT_MODE,                   // Param: 0(Original), 1(new IDCT)
767     E_VDEC_EX_USER_CMD_DROP_ERR_FRAME,                  // Param: 0(Disable), 1(Enable)
768     E_VDEC_EX_USER_CMD_SET_CC608_INFO_ENHANCE_MODE,
769     E_VDEC_EX_USER_CMD_IGNORE_PIC_OVERRUN,              // Param: 0(Disable), 1(Enable)
770     E_VDEC_EX_USER_CMD_SET_SELF_SEQCHANGE,
771     E_VDEC_EX_USER_CMD_AUTO_EXHAUST_ES_MODE,            // Param: set the upper bound (arg[31:16]), and lower bound (arg[15:0])of ES level, Unit = 1KBytes, Auto drop display to consume ES data as soon as possible when ES level is higher than upper bound
772     E_VDEC_EX_USER_CMD_CTL_SPEED_IN_DISP_ONLY,          // Param: 0(Original: Dec and disp time), 1(In Disp only)
773     E_VDEC_EX_USER_CMD_AVC_SUPPORT_REF_NUM_OVER_MAX_DPB_SIZE, // Param: 0(Disable), 1(Enable)
774     E_VDEC_EX_USER_CMD_RETURN_INVALID_AFD,              // Param: 0(Disable), 1(Enable)
775     E_VDEC_EX_USER_CMD_FIELD_POLARITY_DISPLAY_ONE_FIELD,// Param : VDEC_EX_Field_Polarity
776     E_VDEC_EX_USER_CMD_AVC_FORCE_BROKEN_BY_US,          // Param: 0(Disable), 1(Enable)
777     E_VDEC_EX_USER_CMD_SHOW_FIRST_FRAME_DIRECT,         // Param: 0(Disable), 1(Enable), Push first frame to display queue directly..
778     E_VDEC_EX_USER_CMD_AVC_RESIZE_DOS_DISP_PEND_BUF,    // Param:  size of AVC display pending buffer for display outside mode
779     E_VDEC_EX_USER_CMD_SET_XC_LOW_DELAY_PARA,           // Param: arg0 for diff_field_number...
780     E_VDEC_EX_USER_CMD_SET_SECURE_MODE,                 // Param: use enum VDEC_EX_SecureMode
781     E_VDEC_EX_USER_CMD_RVU_SETTING_MODE,                // Param: 0(Disable), 1(drop B-frame and force IDR)
782     E_VDEC_EX_USER_CMD_FRAMERATE_HANDLING,              // Arg 0~60000, 0: Disable, 1000 ~ 60000: Used the arg to set frame rate when the sequence did not have frame rate info. and arg is not zero. (The frame unit is (arg/1000)fps, Exp: 30000 = 30.000 fps), others: Do not thing.
783     E_VDEC_EX_USER_CMD_DUAL_NON_BLOCK_MODE,             // Param: 0(Disable), 1(Enable)
784     E_VDEC_EX_USER_CMD_IGNORE_PIC_STRUCT_DISPLAY,       // Param: 0(Disable), 1(Enable) Ignore Pic_struct when display progressive frame.
785     E_VDEC_EX_USER_CMD_INPUT_PTS_FREERUN_MODE,          // Param: 0(Disable), 1(Enable) Video free run when the difference between input PTS and current STC is large than E_HVD_CMD_FREERUN_THRESHOLD + 1s;
786     E_VDEC_EX_USER_CMD_ERR_CONCEAL_SLICE_1ST_MB,        // Param: 0(disable), Error concealment from current/last MB position; 1(enale) Error concealment from current slice first MB.(Need enable E_HVD_CMD_ERR_CONCEAL)
787     E_VDEC_EX_USER_CMD_SET_EXTERNAL_DS_BUFFER,          // Param: External DS Buffer info.
788     E_VDEC_EX_USER_CMD_SET_MIN_TSP_DATA_SIZE,           // Param: Resize HVD_FW_AVC_ES_MIN_TSP_DATA_SIZE
789     E_VDEC_EX_USER_CMD_SET_DMX_FRAMERATE,
790     E_VDEC_EX_USER_CMD_SET_DMX_FRAMERATEBASE,
791     E_VDEC_EX_USER_CMD_ENABLE_CC_608_EXTERNAL_BUFFER,   // Param: u32_ccinfo 32bits-->([31:8]+[7:0] = addr+size), addr is kb unit, if u32_ccinfo ==0, it will turn off this feature
792     E_VDEC_EX_USER_CMD_ENABLE_CC_708_EXTERNAL_BUFFER,   // Param: u32_ccinfo 32bits-->([31:8]+[7:0] = addr+size), addr is kb unit, if u32_ccinfo ==0, it will turn off this feature
793     E_VDEC_EX_USER_CMD_SET_TIME_INC_PREDICT_PARA,
794     E_VDEC_EX_USER_CMD_ENABLE_DECODE_ENGINE_TIMEOUT,    // Param: Enable/Disable decode timeout solution, timeout value unit:ms (VDEC_EX_Decode_Timeout_Param)
795     E_VDEC_EX_USER_CMD_AUTO_FREE_ES,                    // Param: 0(Disable), 1(Enable)
796     E_VDEC_EX_USER_CMD_FRAMEBUFFER_AUTO_MODE,           // Param: 0(Disable),1(Enable), this cmd is used for MVD.
797     E_VDEC_EX_USER_CMD_SET_SMOOTH_REWIND,               // enable/disable or support smooth rewind
798     E_VDEC_EX_USER_CMD_SET_ERROR_TOLERANCE,
799     E_VDEC_EX_USER_CMD_AUTO_DROP_DISPLAY_QUEUE,         // Param: 0(Disable), N = 1~16: Drop display queue when display queue above than N frames.
800     E_VDEC_EX_USER_CMD_USE_CPB_REMOVAL_DEALY,           // Param: 0(Disable), 1(Enable)
801     E_VDEC_EX_USER_CMD_SKIP_N_FRAME,                    // Param: 0:disable, N = 1~63. Skip N frame.
802     E_VDEC_EX_USER_CMD_SET_PTS_US_MODE,                 // Param: 1(enable), 0(disable ) PTS output by micro second level,
803     E_VDEC_EX_USER_CMD_AUTO_INSERT_DUMMY_DATA,          // Param: 1(enable),0(disable), Enable/Disable utopia auto insert dummy pattern in SLQ/BBU mode.
804     E_VDEC_EX_USER_CMD_DROP_ONE_PTS,
805     E_VDEC_EX_USER_CMD_PVR_TIMESHIFT_SEAMLESS_MODE,
806     E_VDEC_EX_USER_CMD_AUTO_REDUCE_ES_DATA,
807     E_VDEC_EX_USER_CMD_RM_FORCE_MCU_MODE_ES,            // Param: 0(Disable), 1(Enable)
808     E_VDEC_EX_USER_CMD_FORCE_PROGRESSIVE_MODE,          // Param: 1(enable),0(disable), Enable/Disable force progressive mode
809     E_VDEC_EX_USER_CMD_SET_FRAMEBUFF2,                  // Param[0]=Addr and Param[1]=size for the second frame buffer
810 
811     E_VDEC_EX_USER_CMD_MVC_SET_CMD_BASE  = 0x0800,
812     E_VDEC_EX_USER_CMD_MVC_BBU2_PUSH_PACKET,            // Param: Packet Info.
813     E_VDEC_EX_USER_CMD_MVC_BBU2_FIRE_DECCMD,            // Param: Non
814 
815     E_VDEC_EX_USER_CMD_UT_SET_CMD_BASE = 0x0900,
816     E_VDEC_EX_USER_CMD_UT_SET_DBG_MODE,                    // Param: for enable the specify dbg mode for UT
817     E_VDEC_EX_USER_CMD_UT_CLR_DBG_MODE,                    // Param: for disable the specify dbg mode for UT
818 
819     //Group2:Get Control command================================
820     E_VDEC_EX_USER_CMD_GET_CONTROL_BASE  = 0x1000,
821     E_VDEC_EX_USER_CMD_GET_CHROMA_TYPE,
822     E_VDEC_EX_USER_CMD_GET_REAL_FRAMERATE,              // Get Real FrameRate reported by decoder
823     E_VDEC_EX_USER_CMD_GET_COLOR_MATRIX,                // Get color matrix coefficients reported by decoder
824     E_VDEC_EX_USER_CMD_GET_MAIN_STREAM_ID,              // Get activated main stream ID
825     E_VDEC_EX_USER_CMD_GET_SUB_STREAM_ID,               // Get activated sub stream ID
826     E_VDEC_EX_USER_CMD_GET_DYNSCALE_ENABLED,
827     E_VDEC_EX_USER_CMD_GET_FPA_SEI,                     //Get SEI info
828     E_VDEC_EX_USER_CMD_GET_U64PTS,
829     E_VDEC_EX_USER_CMD_GET_ORI_INTERLACE_MODE,
830     E_VDEC_EX_USER_CMD_GET_MBS_ONLY_FLAG,
831     E_VDEC_EX_USER_CMD_GET_CRC_VALUE,                   //Get frame Y/UV crc value
832     E_VDEC_EX_USER_CMD_GET_BBU_Q_NUM,
833     E_VDEC_EX_USER_CMD_GET_DISP_FRAME_NUM,
834     E_VDEC_EX_USER_CMD_GET_FPA_SEI_EX,                  //Get SEI info(enhancement)
835     E_VDEC_EX_USER_CMD_GET_ES_BUFFER_STATUS,            //Get ES buffer over/under flow status
836     E_VDEC_EX_USER_CMD_GET_CODEC_TYPE,                  // Get Codec type
837     E_VDEC_EX_USER_CMD_GET_SHAREMEMORY_BASE,
838     E_VDEC_EX_USER_CMD_GET_IS_LEAST_DISPQ_SIZE_FLAG,
839     E_VDEC_EX_USER_CMD_GET_FIELD_PIC_FLAG,              // Param: Get Field Pic Flag
840     E_VDEC_EX_USER_CMD_GET_SUPPORT_2ND_MVOP_INTERFACE,  // Param: TRUE : support, FALSE : not support
841     E_VDEC_EX_USER_CMD_GET_FB_USAGE_MEM,                // Get FrameBuufer Size needed by decoder
842     E_VDEC_EX_USER_CMD_GET_XC_LOW_DELAY_INT_STATE,      // Get xc_low_delay int state...
843     E_VDEC_EX_USER_CMD_GET_VSYNC_BRIDGE_ADDR,
844     E_VDEC_EX_USER_CMD_GET_FRAME_INFO_EX,
845     E_VDEC_EX_USER_CMD_GET_FLUSH_PATTEN_ENTRY_NUM,
846     E_VDEC_EX_USER_CMD_GET_DS_BUF_MIU_SEL,              //For those chips which has 3 MIU, use this get control to get correct miu select of DS buffer
847     E_VDEC_EX_USER_CMD_GET_FW_STATUS_FLAG,
848     E_VDEC_EX_USER_CMD_GET_HW_MAX_PIXEL,
849     E_VDEC_EX_USER_CMD_GET_FLOW_CONTROL_U64PTS_DIFF,    // based on PTS table Rdptr and Wrptr, support TSP mode only
850     E_VDEC_EX_USER_CMD_GET_NEXT_DISP_FRAME_INFO_EXT,    // replace of E_VDEC_EX_USER_CMD_GET_FRAME_INFO_EX
851     E_VDEC_EX_USER_CMD_GET_VSYNC_BRIDGE_EXT_ADDR,       //get vsync bridge ext addr
852     E_VDEC_EX_USER_CMD_GET_DCV_SEI,
853     E_VDEC_EX_USER_CMD_GET_VUI_DISP_INFO,
854 
855     //MVC Get Control command================================
856     E_VDEC_EX_USER_CMD_MVC_GET_CMD_BASE  = 0x1800,
857     E_VDEC_EX_USER_CMD_GET_MVC_SUB_FRAME_DISP_INFO,     // Param: VDEC_FrameInfo pointer.
858     E_VDEC_EX_USER_CMD_GET_MVC_BBU2_DECQ_VACANCY,       // Param: BBU2 Dec Q Vacancy.
859     E_VDEC_EX_USER_CMD_GET_MVC_ES2_READ_PTR,            // Param: ES2 read pointer.
860     E_VDEC_EX_USER_CMD_GET_MVC_ES2_WRITE_PTR,           // Param: ES2 Write pointer.
861     E_VDEC_EX_USER_CMD_GET_ES_QUANTITY,                 // Param: Get ES buffer Level.
862     E_VDEC_EX_USER_CMD_GET_ES2_QUANTITY,                // Param: Get ES2 buffer Level.
863 
864 
865     //Group3:System Preset Control command======================
866     //Group3-1:Common system Preset Control command
867     E_VDEC_EX_USER_CMD_SYSTEM_PRESET_CONTROL_BASE   = 0x2000,
868     E_VDEC_EX_USER_CMD_SYSTEM_PRESET_VPU_CLOCK,         //Param: VDEC_EX_ClockSpeed
869 
870     //Group3-2:HVD System Preset Control command
871     E_VDEC_EX_USER_CMD_SYSTEM_PRESET_HVD_BASE       = 0x2100,
872     E_VDEC_EX_USER_CMD_SYSTEM_PRESET_HVD_CLOCK,         //Param: VDEC_EX_ClockSpeed
873 
874     //Group3-3:MVD System Preset Control command
875     E_VDEC_EX_USER_CMD_SYSTEM_PRESET_MVD_BASE       = 0x2200,
876     E_VDEC_EX_USER_CMD_SYSTEM_PRESET_MVD_CLOCK,         //Param: VDEC_EX_ClockSpeed
877     E_VDEC_EX_USER_CMD_VPU_SECURITY_MODE,               //Param: 0:disable,1:enable
878 
879     //Group3-4:Preset Control command=============================
880     E_VDEC_EX_USER_CMD_PRESET_CONTROL_BASE          = 0x2300,
881     E_VDEC_EX_USER_CMD_HVD_ONE_PENDING_BUFFER_MODE,  //Param: 0(Disable), 1(Enable), use only one pending buffer instead of two for HVD
882     E_VDEC_EX_USER_CMD_MVD_HWBUFFER_REMAPPING_MODE,  //Param: 0(Disable), 1(Enable),Allcate HW buffer to start of frame buffer
883     E_VDEC_EX_USER_CMD_SET_SHAREMEMORY_BASE,
884     E_VDEC_EX_USER_CMD_HVD_COL_BBU_MODE,                //Param: HVD use colocated BBU mode, 0: disable, 1: enable /*johnny.ko*/
885     E_VDEC_EX_USER_CMD_HVD_IAPGN_BUF_SHARE_BW_MODE,     //Param: HVD IAP GN Buffer address,
886     /***/E_VDEC_EX_USER_CMD_DTV_DEBUG_MODE,
887     E_VDEC_EX_USER_CMD_HVD_TS_IN_BBU_MODE,
888     E_VDEC_EX_USER_CMD_AUTO_ARRANGE_FRAMEBUFFER_USAGE,  //Param: 0:disable,1:enable, address:PA,size:unit is byte
889     E_VDEC_EX_USER_CMD_THUMBNAIL_MODE,                  //Param: 0(Disable), 1(Enable), use small frame buffer to decdoe thumbnail
890     E_VDEC_EX_USER_CMD_FORCE_8BIT_DEC_MODE,             //Param: force 8bit decode mode, 0: disable, 1: enable
891     E_VDEC_EX_USER_CMD_MFCODEC_MODE,                    //Param: VDEC_EX_MFCodec_mode
892     E_VDEC_EX_USER_CMD_VDEC_FEATURE,                 //AP control VDEC features
893     E_VDEC_EX_USER_CMD_DYNAMIC_CMA_MODE,             //enable dynamic cma features
894     //Group4:System Postset Control command======================
895     E_VDEC_EX_USER_CMD_SYSTEM_POSTSET_CONTROL_BASE  = 0x3000,
896     E_VDEC_EX_USER_CMD_SYSTEM_POSTSET_CLEAR_PROCESS_RELATED,
897 
898 } VDEC_EX_User_Cmd;
899 
900 //VDEC FW TYPE
901 typedef enum
902 {
903     E_VDEC_EX_FW_TYPE_MVD = 0,
904     E_VDEC_EX_FW_TYPE_HVD,
905 } VDEC_EX_FwType;
906 
907 /// DecodeMode for f/w tasks
908 typedef enum
909 {
910     E_VDEC_EX_DEC_MODE_DUAL_INDIE = 0,                     ///< Two independent tasks
911     E_VDEC_EX_DEC_MODE_DUAL_3D,                        ///< Two dependent tasks for 3D
912     E_VDEC_EX_DEC_MODE_SINGLE,                         ///< One task use the whole SRAM
913     E_VDEC_EX_DEC_MODE_MVC = E_VDEC_EX_DEC_MODE_SINGLE,
914 } VDEC_EX_DEC_MODE;
915 
916 typedef struct
917 {
918     VDEC_EX_Stream    eStream;
919     VDEC_EX_CodecType eCodecType;
920 } VDEC_EX_CodecInfo;
921 
922 /// Configurations of f/w decode mode
923 typedef struct
924 {
925     VDEC_EX_DEC_MODE    eDecMod;
926     VDEC_EX_CodecInfo   pstCodecInfo[VDEC_MAX_DEC_NUM];
927     MS_U8  u8CodecCnt;
928     MS_U8  u8ArgSize;
929     MS_U32 u32Arg;  //ref VDEC_EX_DEC_MODE_ARG enum
930 } VDEC_EX_DecModCfg;
931 
932 typedef struct
933 {
934     MS_BOOL bEnable;      // 0 : disable   ,  1:enable
935     MS_U8   u8DisplayTop; // 0: display top,  1: display bottom
936 }VDEC_EX_Field_Polarity;
937 
938 /// argument of DecodeMode structure for f/w tasks
939 typedef enum
940 {
941     //Group1:Set Korea3DTV mode
942     E_VDEC_EX_DEC_KR3D_MODE_BASE  = 0x0000,
943     E_VDEC_EX_DEC_KR3D_INTERLACE_MODE = E_VDEC_EX_DEC_KR3D_MODE_BASE,
944     E_VDEC_EX_DEC_KR3D_FORCE_P_MODE,
945     E_VDEC_EX_DEC_KR3D_INTERLACE_TWO_PITCH,
946     E_VDEC_EX_DEC_KR3D_FORCE_P_TWO_PITCH,
947 
948     //Group2:Set PIP mode
949     E_VDEC_EX_DEC_PIP_MODE_BASE = 0x1000,
950     E_VDEC_EX_DEC_PIP_SYNC_INDIE = E_VDEC_EX_DEC_PIP_MODE_BASE,
951     E_VDEC_EX_DEC_PIP_SYNC_MAIN_STC,
952     E_VDEC_EX_DEC_PIP_SYNC_SWITCH
953 } VDEC_EX_DEC_MODE_ARG;
954 
955 typedef enum
956 {
957     E_VDEC_EX_DIU_DRAM = 0,  //MCU mode
958     E_VDEC_EX_DIU_HVD = 1,
959     E_VDEC_EX_DIU_MVD  = 2,
960     E_VDEC_EX_DIU_HVD_3DLR = 3,  //MVC
961     E_VDEC_EX_DIU_MVD_3DLR = 4,  //Korea3D, WMV3D
962     E_VDEC_EX_DIU_UNKNOWN = -1
963 } VDEC_EX_DIU;
964 
965 typedef struct
966 {
967     MS_U32 u32version;
968     MS_U32 u32size;
969 } VDEC_EX_VerCtl;
970 
971 /// Data structure of CC Configuration
972 typedef struct
973 {
974     VDEC_EX_CCFormat eFormat;
975     VDEC_EX_CCType   eType;
976     MS_VIRT      u32BufStAdd;
977     MS_U32       u32BufSize;
978 } VDEC_EX_CCCfg;
979 
980 /// information for display setting
981 typedef struct
982 {
983     ///bitstream horizontal size
984     MS_U16 u16HorSize;
985     ///bitstream vertical size
986     MS_U16 u16VerSize;
987     ///frame rate
988     MS_U32 u32FrameRate;
989     ///interlace flag
990     MS_U8 u8Interlace;
991     ///active frame code
992     MS_U8 u8AFD;
993     ///Sample aspect rate width
994     MS_U16 u16SarWidth;
995     ///Sample aspect rate height
996     MS_U16 u16SarHeight;
997     ///right cropping
998     MS_U16 u16CropRight;
999     ///left cropping
1000     MS_U16 u16CropLeft;
1001     ///bottom cropping
1002     MS_U16 u16CropBottom;
1003     ///top cropping
1004     MS_U16 u16CropTop;
1005     ///pitch
1006     MS_U16 u16Pitch;
1007     ///interval of PTS
1008     MS_U16 u16PTSInterval;
1009     ///MPEG1 flag
1010     MS_U8 u8MPEG1;
1011     ///play mode (fixme)
1012     MS_U8 u8PlayMode;
1013     ///FRC mode
1014     MS_U8 u8FrcMode;
1015     ///aspect ratio code
1016     MS_U8 u8AspectRate;
1017     ///if FALSE, set VOP as mono mode (only for H264)
1018     MS_BOOL bWithChroma;
1019     /// if true, color space is xvYCC (Y from 16 to 235 and Cb , Cr from 16 to 240).
1020     /// if false, color space is BT.601/709 (Y from  0 to 255 and Cb , Cr from  0 to 255).
1021     /// only MPEG might be with BT.601/709
1022     MS_BOOL bColorInXVYCC;
1023     ///Dynamic scaling buffer address
1024     MS_VIRT u32DynScalingAddr;
1025     ///Dynamic scaling buffer size
1026     MS_U32 u32DynScalingSize;
1027     ///Dynamic scaling depth
1028     MS_U8 u8DynScalingDepth;
1029     ///Dynamic scaling DS buffer on miu1 or miu0
1030     MS_BOOL bEnableMIUSel;
1031     ///Display width
1032     MS_U32 u32AspectWidth;
1033     ///Display height
1034     MS_U32 u32AspectHeight;
1035 } VDEC_EX_DispInfo;
1036 
1037 /// system configuration
1038 typedef struct
1039 {
1040     ///FW binary start address
1041     MS_PHY u32FWBinaryAddr;
1042     ///FW binary size
1043     MS_SIZE u32FWBinarySize;
1044     ///FW code buffer start address
1045     MS_PHY u32CodeBufAddr;
1046     ///FW code buffer size
1047     MS_SIZE u32CodeBufSize;
1048     ///frame buffer start address
1049     MS_PHY u32FrameBufAddr;
1050     ///frame buffer size
1051     MS_SIZE u32FrameBufSize;
1052     ///bitstream buffer start address
1053     MS_PHY u32BitstreamBufAddr;
1054     ///bitstream buffer size
1055     MS_SIZE u32BitstreamBufSize;
1056     ///driver process buffer start address
1057     MS_PHY u32DrvProcBufAddr;
1058     ///driver process buffer size
1059     MS_SIZE u32DrvProcBufSize;
1060     ///vlc table Binary address (RM only)
1061     MS_PHY u32VlcBinarySrcAddr;
1062     ///vld table Binary size
1063     MS_SIZE u32VlcTabBinarySize;
1064     ///debug level setting
1065     VDEC_EX_DbgLevel eDbgMsgLevel;
1066     ///debug level setting
1067     VDEC_EX_FWSourceType eFWSourceType;
1068 } VDEC_EX_SysCfg;
1069 
1070 /// video information
1071 typedef struct
1072 {
1073     ///input source mode
1074     VDEC_EX_SrcMode   eSrcMode;
1075     /// timestamp type of command queue
1076     VDEC_EX_TimeStampType      eTimeStampType;
1077     ///MJPEG scale factor
1078     VDEC_EX_MJpegScaleFactor   eMJpegScaleFactor;
1079     /// should be TRUE when codec type is H264 and container is MKV and MP4(MOV)
1080     MS_BOOL bWithoutNalStCode;
1081     /// needness when CodecType is MJPEG and divx311
1082     //MS_U16  u16FrameRate;
1083     MS_U32 u32FrameRate;
1084     MS_U32 u32FrameRateBase;
1085     /// if divx311; use u16Width[0]; only need other elements when RV8
1086     MS_U16  u16Width[8];
1087     /// if divx311; use u16Height[0]; only need other elements when RV8
1088     MS_U16  u16Height[8];
1089     /// video number sizes (for RM)
1090     MS_U16  u16NumSizes;
1091 } VDEC_EX_VideoInfo;
1092 
1093 /// frame information
1094 typedef struct
1095 {
1096     /// frame buffer base + the start offset of current displayed luma data. Unit: byte.
1097     MS_PHY u32LumaAddr;
1098     /// frame buffer base + the start offset of current displayed chroma data. Unit: byte.
1099     MS_PHY u32ChromaAddr;
1100     /// Time stamp(DTS, PTS) of current displayed frame. Unit: ms (todo: 90khz)
1101     MS_U32 u32TimeStamp;
1102     /// low part of ID number
1103     MS_U32 u32ID_L;
1104     /// high part of ID number
1105     MS_U32 u32ID_H;
1106     /// pitch
1107     MS_U16 u16Pitch;
1108     /// width
1109     MS_U16 u16Width;
1110     /// hight
1111     MS_U16 u16Height;
1112     ///< Frame type: I, P, B frame
1113     VDEC_EX_FrameType eFrameType;
1114     ///< Field type: Top, Bottom, Both
1115     VDEC_EX_FieldType eFieldType;
1116 } VDEC_EX_FrameInfo;
1117 
1118 typedef struct
1119 {
1120     VDEC_EX_FrameInfo sFrameInfo;
1121 
1122     MS_PHY u32LumaAddr_2bit;
1123     MS_PHY u32ChromaAddr_2bit;
1124     MS_U8 u8LumaBitdepth;
1125     MS_U8 u8ChromaBitdepth;
1126     MS_U16 u16Pitch_2bit;
1127 
1128     MS_U8 u8Reserved[64];
1129 } VDEC_EX_FrameInfoEX;
1130 
1131 //Extension of frame info(VDEC_EX_FrameInfoEX)
1132 typedef struct
1133 {
1134     VDEC_EX_VerCtl  stVerCtl;   /// version : 0,
1135     VDEC_EX_FrameInfo sFrameInfo;
1136     MS_PHY u32LumaAddr_2bit;
1137     MS_PHY u32ChromaAddr_2bit;
1138     MS_PHY u32LumaAddrI;
1139     MS_PHY u32LumaAddrI_2bit;
1140     MS_PHY u32ChromaAddrI;
1141     MS_PHY u32ChromaAddrI_2bit;
1142     MS_U32 u32MFCodecInfo;
1143     MS_U32 u32LumaMFCbitlen;
1144     MS_U32 u32ChromaMFCbitlen;
1145     MS_U16 u16Pitch_2bit;
1146     MS_U8 u8LumaBitdepth;
1147     MS_U8 u8ChromaBitdepth;
1148 #ifdef VDEC_CAP_HEVC_HDR
1149     ////HVD_MasteringDisplayColourVolume//
1150     MS_U32 maxLuminance;
1151     MS_U32 minLuminance;
1152     MS_U16 primaries[3][2];
1153     MS_U16 whitePoint[2];
1154     MS_U8 Frm_Info_Ext_avail; ///bit[1]: SEI_Enabled,  bit[0]: colur_description_present_flag
1155     //colour_description start//
1156     MS_U8 colour_primaries;                            // u(8)
1157     MS_U8 transfer_characteristics;                    // u(8)
1158     MS_U8 matrix_coefficients;                         // u(8)
1159     //colour_description end//
1160 #endif
1161 } VDEC_EX_FrameInfoExt;
1162 
1163 typedef struct
1164 {
1165     MS_BOOL bUsed;
1166     MS_BOOL bColourVolumeSEIEnabled;
1167     MS_U32  u32MaxLuminance;
1168     MS_U32  u32MinLuminance;
1169     MS_U16  u16Primaries[3][2];
1170     MS_U16  u16WhitePoint[2];
1171 }VDEC_EX_DisplayColourVolume_SEI;
1172 
1173 #ifdef VDEC_CAP_HEVC_HDR_V2
1174 typedef struct
1175 {
1176     VDEC_EX_FrameInfoExt sFrameInfoExt;
1177     ////HVD_MasteringDisplayColourVolume//
1178     VDEC_EX_DisplayColourVolume_SEI sDisplay_colour_volume;
1179     MS_U8 u8Frm_Info_Ext_avail; ///bit[1]: SEI_Enabled,  bit[0]: colur_description_present_flag
1180     ////colour_description////////////
1181     MS_U8 u8Colour_primaries;                            // u(8)
1182     MS_U8 u8Transfer_characteristics;                    // u(8)
1183     MS_U8 u8Matrix_coefficients;                         // u(8)
1184 } VDEC_EX_FrameInfoExt_v2;
1185 #endif
1186 
1187 /// Extension display information
1188 typedef struct
1189 {
1190     /// vertical size from sequene_display_extension
1191     MS_U16 u16VSize;
1192     /// horizontal size from sequene_display_extension
1193     MS_U16 u16HSize;
1194     /// vertical offset from picture_display_extension
1195     MS_S16 s16VOffset;
1196     /// horizontal offset from picture_display_extension
1197     MS_S16 s16HOffset;
1198 } VDEC_EX_ExtDispInfo;
1199 
1200 /// display frame information
1201 typedef struct
1202 {
1203     ///< frame information
1204     VDEC_EX_FrameInfo stFrmInfo;
1205     ///< firmware private data
1206     MS_U32 u32PriData;
1207     ///< index used by apiVDEC to manage VDEC_DispQ[][]
1208     MS_U32 u32Idx;
1209 } VDEC_EX_DispFrame;
1210 
1211 /// time code structure
1212 typedef struct
1213 {
1214     ///  time_code_hours
1215     MS_U8   u8TimeCodeHr;
1216     ///  time_code_minutes
1217     MS_U8   u8TimeCodeMin;
1218     ///  time_code_seconds
1219     MS_U8   u8TimeCodeSec;
1220     ///  time_code_pictures
1221     MS_U8   u8TimeCodePic;
1222     ///  drop_frame_flag
1223     MS_U8   u8DropFrmFlag;
1224     ///  reserved fields for 4-byte alignment
1225     MS_U8   u8Reserved[3];
1226 } VDEC_EX_TimeCode;
1227 
1228 /// vdec frame buffer reduction
1229 typedef struct
1230 {
1231     VDEC_EX_FBReductionType eLumaFBReduction;
1232     VDEC_EX_FBReductionType eChromaFBReduction;
1233     MS_BOOL              bEnableAutoMode;   /// 0: Disable, 1: Enable
1234 } VDEC_EX_FBReduction;
1235 
1236 /// Initial parameter
1237 typedef struct
1238 {
1239     /// init param version : 0
1240     MS_U32          u32Version;
1241     /// codec type
1242     VDEC_EX_CodecType   eCodecType;
1243     /// system configuration
1244     VDEC_EX_SysCfg      SysConfig;
1245     /// video information from container
1246     VDEC_EX_VideoInfo   VideoInfo;
1247     /// dynamic scaling control bit
1248     MS_BOOL             EnableDynaScale;
1249     /// switch for display decode error frame or not
1250     MS_BOOL             bDisableDropErrFrame;
1251     /// switch for error concealment
1252     MS_BOOL             bDisableErrConceal;
1253     /// enable repeat last field when repeat happened at interlace stream
1254     MS_BOOL             bRepeatLastField;
1255     /// threshold to judge error frame
1256     MS_U8               u8ErrThreshold;
1257     /// dynamic scaling virtual box Width
1258     MS_U32              u32DSVirtualBoxWidth;
1259     /// dynamic scaling virtual box Height
1260     MS_U32              u32DSVirtualBoxHeight;
1261     /// vdec frame buffer reduction setting
1262     VDEC_EX_FBReduction stFBReduction;
1263 } VDEC_EX_InitParam;
1264 
1265 /// Decode Command
1266 typedef struct
1267 {
1268     /// ID (high 4-bytes)
1269     MS_U32  u32ID_H;
1270     /// ID (low 4-bytes)
1271     MS_U32  u32ID_L;
1272     /// start address of payload
1273     MS_VIRT  u32StAddr;
1274     /// size of payload
1275     MS_U32  u32Size;
1276     /// timestamp of payload
1277     MS_U32  u32Timestamp;
1278 } VDEC_EX_DecCmd;
1279 
1280 /// Display Command
1281 typedef struct
1282 {
1283     /// ID (high 4-bytes)
1284     MS_U32  u32ID_H;
1285     /// ID (low 4-bytes)
1286     MS_U32  u32ID_L;
1287     /// action of command
1288     VDEC_EX_DispCmdAction  eAction;
1289 } VDEC_EX_DispCmd;
1290 
1291 typedef struct
1292 {
1293     MS_U32                  u32Version;
1294     /// top, bottom or frame
1295     VDEC_EX_PicStructure    u8PicStructure;
1296     MS_U8                   u8TopFieldFirst;
1297     MS_U16                  u16TempRef;
1298     MS_U32                  u32Pts;
1299     /// address of cc data
1300     MS_U32                  u32UserDataBuf;
1301     /// size of cc data
1302     MS_U32                  u32UserDataSize;
1303     ///< Frame type: I, P, B frame
1304     VDEC_EX_FrameType eFrameType;
1305 } VDEC_EX_CC_Info;
1306 
1307 ///CC input parameters for mstar proprietary CC library
1308 typedef struct
1309 {
1310     MS_U32 u32Ver;      ///version of this structure
1311     MS_VIRT u32Val;
1312 } VDEC_EX_CC_InputPara;
1313 
1314 typedef struct
1315 {
1316     MS_U32      u32OutputFrameRate; ///< output frame rate, unit:vsync count
1317     MS_U8       u8Interlace;        ///< output scan:0:progress, 1:interlace
1318 } VDEC_EX_FRC_OutputParam;
1319 
1320 typedef struct
1321 {
1322     MS_U32 u32Version;
1323     MS_U32 u32Id;
1324 } VDEC_StreamId;
1325 
1326 typedef void (*VDEC_EX_EventCb)(MS_U32 eFlag, void *param);
1327 
1328 typedef struct
1329 {
1330     MS_U8   u8Frm_packing_arr_cnl_flag;
1331     MS_U8   u8Frm_packing_arr_type;
1332     MS_U8   u8content_interpretation_type;
1333     MS_U8   u1Quincunx_sampling_flag;
1334 
1335     MS_U8   u1Spatial_flipping_flag;
1336     MS_U8   u1Frame0_flipping_flag;
1337     MS_U8   u1Field_views_flag;
1338     MS_U8   u1Current_frame_is_frame0_flag;
1339 
1340     MS_U8   u1Frame0_self_contained_flag;
1341     MS_U8   u1Frame1_self_contained_flag;
1342     MS_U8   u4Frame0_grid_position_x;
1343     MS_U8   u4Frame0_grid_position_y;
1344 
1345     MS_U8   u4Frame1_grid_position_x;
1346     MS_U8   u4Frame1_grid_position_y;
1347     MS_U8   u8Reserved01;
1348     MS_U8   u8Reserved02;
1349 }VDEC_EX_Frame_packing_SEI;
1350 
1351 typedef struct
1352 {
1353     VDEC_EX_VerCtl  stVerCtl;   /// version : 0,
1354                                 /// size : sizeof(VDEC_EX_Frame_packing_SEI_EX)
1355     MS_BOOL bIsCropInfo;
1356     MS_BOOL bValid;
1357     MS_BOOL bUsed;
1358     MS_U8   u8Frm_packing_arr_cnl_flag;
1359     MS_U8   u8Frm_packing_arr_type;
1360     MS_U8   u8content_interpretation_type;
1361     MS_U8   u1Quincunx_sampling_flag;
1362     MS_U8   u1Spatial_flipping_flag;
1363     MS_U8   u1Frame0_flipping_flag;
1364     MS_U8   u1Field_views_flag;
1365     MS_U8   u1Current_frame_is_frame0_flag;
1366     MS_U8   u1Frame0_self_contained_flag;
1367     MS_U8   u1Frame1_self_contained_flag;
1368     MS_U8   u4Frame0_grid_position_x;
1369     MS_U8   u4Frame0_grid_position_y;
1370     MS_U8   u4Frame1_grid_position_x;
1371     MS_U8   u4Frame1_grid_position_y;
1372     MS_U32  u32DataBuff;
1373     MS_U32  u32DataSize;
1374     MS_U32  left;
1375     MS_U32  right;
1376     MS_U32  top;
1377     MS_U32  bottom;
1378 } VDEC_EX_Frame_packing_SEI_EX;
1379 
1380 typedef struct
1381 {
1382     MS_BOOL bAspect_ratio_info_present_flag;            // u(1)
1383     MS_U8   u8Aspect_ratio_idc;                            // u(8)
1384     MS_U16  u16Sar_width;                                  // u(16)
1385     MS_U16  u16Sar_height;                                 // u(16)
1386     MS_BOOL bOverscan_info_present_flag;                // u(1)
1387     MS_BOOL bOverscan_appropriate_flag;                 // u(1)
1388     MS_BOOL bVideo_signal_type_present_flag;            // u(1)
1389     MS_U8   u8Video_format;                                // u(3)
1390     MS_BOOL bVideo_full_range_flag;                     // u(1)
1391     MS_BOOL bColour_description_present_flag;           // u(1)
1392     MS_U8   u8Colour_primaries;                            // u(8)
1393     MS_U8   u8Transfer_characteristics;                    // u(8)
1394     MS_U8   u8Matrix_coefficients;                         // u(8)
1395     MS_BOOL bChroma_location_info_present_flag;         // u(1)
1396     MS_U8   u8Chroma_sample_loc_type_top_field;            // ue(v) 0~5
1397     MS_U8   u8Chroma_sample_loc_type_bottom_field;         // ue(v) 0~5
1398     MS_BOOL bTiming_info_present_flag;                  // u(1)
1399     MS_BOOL bFixed_frame_rate_flag;                     // u(1)
1400     MS_U32  u32Num_units_in_tick;                          // u(32)
1401     MS_U32  u32Time_scale;                                 // u(32)
1402 } VDEC_EX_AVC_VUI_DISP_INFO;
1403 
1404 //CRC value
1405 typedef struct
1406 {
1407     MS_U32 u32HorSize;
1408     MS_U32 u32VerSize;
1409     MS_U32 u32Strip;
1410     MS_VIRT u32LumaStartAddr;
1411     MS_VIRT u32ChromaStartAddr;
1412 }VDEC_EX_CrcIn;
1413 
1414 typedef struct
1415 {
1416     MS_U32 u32LumaCRC;
1417     MS_U32 u32ChromaCRC;
1418 }VDEC_EX_CrcOut;
1419 
1420 typedef struct
1421 {
1422     VDEC_EX_CrcIn stCrcIn;
1423     VDEC_EX_CrcOut stCrcOut;
1424 }VDEC_EX_CrcValue;
1425 
1426 typedef struct
1427 {
1428     MS_VIRT  u32DSBufAddr;       // Buffer Address
1429     MS_U32  u32DSBufSize;       // Buffer Size
1430 }VDEC_EX_EXTERNAL_DS_BUFFER;
1431 
1432 typedef struct
1433 {
1434     MS_BOOL  bEnable;           // Enable/Disable
1435     MS_U32  u32Timeout;       // Timeout value, unit : ms
1436 }VDEC_EX_Decode_Timeout_Param;
1437 
1438 
1439 
1440 typedef struct
1441 {
1442   MS_BOOL bEnable;
1443   MS_PHY u32IapGnBufAddr;
1444   MS_U32 u32IapGnBufSize;
1445 } VDEC_EX_IapGnBufShareBWMode;
1446 
1447 typedef struct
1448 {
1449   MS_BOOL bEnableFramebufferCtrl;
1450   MS_PHY u32FramebufferAddress;  // physical address
1451   MS_U32 u32FramebufferTotalsize; // unit is byte
1452 } VDEC_Framebuffer_Ctrl;
1453 
1454 
1455 #define API_HWCAP_VERSION 1
1456 
1457 typedef struct
1458 {
1459     MS_U32  u32ApiHW_Version;   //<Version of current structure>
1460     MS_U16  u16ApiHW_Length;    //<Length of this structure>
1461 
1462     MS_U8   u8Cap_Support_Decoder_Num;
1463 
1464     MS_BOOL bCap_Support_MPEG2;
1465     MS_BOOL bCap_Support_H263;
1466     MS_BOOL bCap_Support_MPEG4;
1467     MS_BOOL bCap_Support_DIVX311;
1468     MS_BOOL bCap_Support_DIVX412;
1469     MS_BOOL bCap_Support_FLV;
1470     MS_BOOL bCap_Support_VC1ADV;
1471     MS_BOOL bCap_Support_VC1MAIN;
1472 
1473     MS_BOOL bCap_Support_RV8;
1474     MS_BOOL bCap_Support_RV9;
1475     MS_BOOL bCap_Support_H264;
1476     MS_BOOL bCap_Support_AVS;
1477     MS_BOOL bCap_Support_AVS_PLUS;
1478     MS_BOOL bCap_Support_MJPEG;
1479     MS_BOOL bCap_Support_MVC;
1480     MS_BOOL bCap_Support_VP8;
1481     MS_BOOL bCap_Support_VP9;
1482     MS_BOOL bCap_Support_HEVC;
1483 
1484     /*New HW Cap and Feature add in struct at the end*/
1485 }VDEC_HwCap;
1486 
1487 
1488 typedef struct
1489 {
1490     MS_U32  u32Version;
1491     MS_U32  u32Addr;
1492     MS_U32  u32Size;
1493     MS_U8   reserved[32];
1494 } VDEC_FRAMEBuff;
1495 
1496 //-------------------------------------------------------------------------------------------------
1497 //  Function and Variable
1498 //-------------------------------------------------------------------------------------------------
1499 //------------------------------------------------------------------------------
1500 /// Get VDEC version
1501 /// @ingroup Get_information
1502 /// @param eStream \b IN : stream type
1503 /// @return VDEC_EX_Result
1504 //------------------------------------------------------------------------------
1505 VDEC_EX_Result MApi_VDEC_EX_GetLibVer(const MSIF_Version **ppVersion);
1506 //------------------------------------------------------------------------------
1507 /// Get VDEC info
1508 /// @ingroup Get_information
1509 /// @param eStream \b IN : stream type
1510 /// @return VDEC_EX_Result
1511 //------------------------------------------------------------------------------
1512 VDEC_EX_Result MApi_VDEC_EX_GetInfo(const VDEC_EX_Info **ppInfo);
1513 //------------------------------------------------------------------------------
1514 /// Get VDEC status
1515 /// @ingroup Get_information
1516 /// @param eStream \b IN : stream type
1517 /// @param pStatus \b OUT : vdec status
1518 /// @return VDEC_EX_Result
1519 //------------------------------------------------------------------------------
1520 MS_BOOL MApi_VDEC_EX_GetStatus(VDEC_StreamId *pStreamId, VDEC_EX_Status *pStatus);
1521 //------------------------------------------------------------------------------
1522 /// Enable turbo mode for VDEC
1523 /// @ingroup VDEC_Enhanced
1524 /// @param bEnable \b IN : enable turbo mode
1525 /// @return VDEC_EX_Result
1526 //------------------------------------------------------------------------------
1527 VDEC_EX_Result MApi_VDEC_EX_EnableTurboMode(MS_BOOL bEnable);
1528 //------------------------------------------------------------------------------
1529 /// Check VDEC capbility
1530 /// @ingroup Get_information
1531 /// @param eStream \b IN : stream type
1532 /// @param eCodecType \b OUT : vdec codec type
1533 /// @return VDEC_EX_Result
1534 MS_BOOL MApi_VDEC_EX_CheckCaps(VDEC_StreamId *pStreamId, VDEC_EX_CodecType eCodecType);
1535 
1536 //used for decoder speed up when single decode
1537 //------------------------------------------------------------------------------
1538 /// Set single decode mode to not create controller task in FW
1539 /// @ingroup VDEC_Enhanced
1540 /// @param bEnable \b IN : enable single decode mode
1541 /// @return VDEC_EX_Result
1542 //------------------------------------------------------------------------------
1543 VDEC_EX_Result MApi_VDEC_EX_SetSingleDecode(MS_BOOL bEnable);
1544 //used for init
1545 //-------------------------------------------------------------------------------------------------
1546 /// Get Stream ID from VDEC.
1547 /// @ingroup VDEC_Init
1548 /// @param pInfo \b IN : pointer to VDEC_StreamId
1549 /// @param u32Size \b IN : size of VDEC_StreamId
1550 /// @param eStream \b IN : stream type
1551 /// @param eCodecType \b IN : codec type
1552 /// @return VDEC_EX_Result
1553 ///     - E_VDEC_EX_OK: success
1554 ///     - E_VDEC_EX_FAIL: failed
1555 ///     - E_VDEC_EX_RET_NOT_EXIT: not ext after last initialization
1556 ///     - E_VDEC_EX_RET_INVALID_PARAM: input parameter is invalid
1557 //-------------------------------------------------------------------------------------------------
1558 VDEC_EX_Result MApi_VDEC_EX_GetFreeStream(void *pInfo, MS_U32 u32Size, VDEC_EX_Stream eStreamType, VDEC_EX_CodecType eCodecType);
1559 //-------------------------------------------------------------------------------------------------
1560 /// Initial VDEC.
1561 /// @ingroup VDEC_Init
1562 /// @param pStreamId \b IN : the pointer to stream ID
1563 /// @param pInitParam \b IN : pointer to initial parameter
1564 /// @return VDEC_EX_Result
1565 ///     - E_VDEC_EX_OK: success
1566 ///     - E_VDEC_EX_FAIL: failed
1567 ///     - E_VDEC_EX_RET_NOT_EXIT: not ext after last initialization
1568 ///     - E_VDEC_EX_RET_INVALID_PARAM: input parameter is invalid
1569 //-------------------------------------------------------------------------------------------------
1570 VDEC_EX_Result MApi_VDEC_EX_Init(VDEC_StreamId *eStreamId, VDEC_EX_InitParam *pInitParam);
1571 //-------------------------------------------------------------------------------------------------
1572 /// Reset VDEC.
1573 /// @ingroup VDEC_Init
1574 /// @param pStreamId \b IN : the pointer to stream ID
1575 /// @return VDEC_EX_Result
1576 //-------------------------------------------------------------------------------------------------
1577 VDEC_EX_Result MApi_VDEC_EX_Rst(VDEC_StreamId *pStreamId);
1578 //-------------------------------------------------------------------------------------------------
1579 /// Exit VDEC.
1580 /// @ingroup VDEC_Init
1581 /// @param pStreamId \b IN : the pointer to stream ID
1582 /// @return VDEC_EX_Result
1583 //-------------------------------------------------------------------------------------------------
1584 VDEC_EX_Result MApi_VDEC_EX_Exit(VDEC_StreamId *pStreamId);
1585 //-------------------------------------------------------------------------------------------------
1586 /// Check if information for display setting is ready or not
1587 /// @ingroup VDEC_Init
1588 /// @param pStreamId \b IN : the pointer to stream ID
1589 /// @return VDEC_EX_Result
1590 //-------------------------------------------------------------------------------------------------
1591 VDEC_EX_Result MApi_VDEC_EX_CheckDispInfoRdy(VDEC_StreamId *pStreamId);
1592 //-------------------------------------------------------------------------------------------------
1593 /// Set up frame rate conversion mode
1594 /// @ingroup VDEC_Normal_decode
1595 /// @param pStreamId \b IN : the pointer to stream ID
1596 /// @param eFrcMode \b IN : frame rate conversion mode
1597 /// @return VDEC_EX_Result
1598 //-------------------------------------------------------------------------------------------------
1599 VDEC_EX_Result MApi_VDEC_EX_SetFrcMode(VDEC_StreamId *pStreamId, VDEC_EX_FrcMode eFrcMode);
1600 //------------------------------------------------------------------------------
1601 /// Set up some parameters about dynamic scaling in FW
1602 /// @ingroup VDEC_DS
1603 /// @param eStream \b IN : stream type
1604 /// @param u32Addr \b IN : the physical start address of parameter set
1605 /// @param u32Size \b IN : the size of parameter set
1606 /// @return VDEC_EX_Result
1607 //------------------------------------------------------------------------------
1608 VDEC_EX_Result MApi_VDEC_EX_SetDynScalingParams(VDEC_StreamId *pStreamId, MS_PHY u32Addr, MS_U32 u32Size);
1609 //Used for debug
1610 //------------------------------------------------------------------------------
1611 /// Set up debug message level
1612 /// @param eStream \b IN : stream type
1613 /// @param eDbgLevel \b IN : message level
1614 /// @ingroup VdecDebug
1615 /// @return VDEC_EX_Result
1616 ///     - E_VDEC_EX_OK: Success
1617 ///     - E_VDEC_EX_FAIL: Failed
1618 //------------------------------------------------------------------------------
1619 VDEC_EX_Result MApi_VDEC_EX_SetDbgLevel(VDEC_StreamId *pStreamId, VDEC_EX_DbgLevel eDbgLevel);
1620 
1621 //-------------------------------------------------------------------------------------------------
1622 /// Start playback
1623 /// @ingroup Decode
1624 /// @param pStreamId \b IN : the pointer to stream ID
1625 /// @return return VDEC_EX_Result
1626 //-------------------------------------------------------------------------------------------------
1627 VDEC_EX_Result MApi_VDEC_EX_Play(VDEC_StreamId *pStreamId);
1628 //-------------------------------------------------------------------------------------------------
1629 /// Pause decode and display
1630 /// @ingroup Decode
1631 /// @param pStreamId \b IN : the pointer to stream ID
1632 /// @return return VDEC_EX_Result
1633 //-------------------------------------------------------------------------------------------------
1634 VDEC_EX_Result MApi_VDEC_EX_Pause(VDEC_StreamId *pStreamId);
1635 //-------------------------------------------------------------------------------------------------
1636 /// Resume decode and display
1637 /// @ingroup Decode
1638 /// @param pStreamId \b IN : the pointer to stream ID
1639 /// @return return VDEC_EX_Result
1640 //-------------------------------------------------------------------------------------------------
1641 VDEC_EX_Result MApi_VDEC_EX_Resume(VDEC_StreamId *pStreamId);
1642 //-------------------------------------------------------------------------------------------------
1643 /// Trigger to display one frame (background may still decoding)
1644 /// @ingroup Decode
1645 /// @param pStreamId \b IN : the pointer to stream ID
1646 /// @return return VDEC_EX_Result
1647 //-------------------------------------------------------------------------------------------------
1648 VDEC_EX_Result MApi_VDEC_EX_StepDisp(VDEC_StreamId *pStreamId);
1649 //-------------------------------------------------------------------------------------------------
1650 /// Check if step play done or not
1651 /// @ingroup Decode
1652 /// @param pStreamId \b IN : the pointer to stream ID
1653 /// @return return VDEC_EX_Result
1654 ///     - E_VDEC_EX_OK: step display done
1655 ///     - E_VDEC_EX_FAIL: not yet
1656 ///     - E_VDEC_EX_RET_NOT_INIT: not initial yet
1657 ///     - E_VDEC_EX_RET_UNSUPPORTED: not supported with current decoder configuration
1658 //-------------------------------------------------------------------------------------------------
1659 VDEC_EX_Result MApi_VDEC_EX_IsStepDispDone(VDEC_StreamId *pStreamId);
1660 //-------------------------------------------------------------------------------------------------
1661 /// Trigger VDEC to decode one frame
1662 /// @ingroup Decode
1663 /// @param pStreamId \b IN : the pointer to stream ID
1664 /// @return return VDEC_EX_Result
1665 //-------------------------------------------------------------------------------------------------
1666 VDEC_EX_Result MApi_VDEC_EX_StepDecode(VDEC_StreamId *pStreamId);
1667 //-------------------------------------------------------------------------------------------------
1668 /// Check if step decode done or not
1669 /// @ingroup Decode
1670 /// @param pStreamId \b IN : the pointer to stream ID
1671 /// @return return VDEC_EX_Result
1672 ///     - E_VDEC_EX_OK: step decode done
1673 ///     - E_VDEC_EX_FAIL: not yet
1674 ///     - E_VDEC_EX_RET_NOT_INIT: not initial yet
1675 ///     - E_VDEC_EX_RET_UNSUPPORTED: not supported with current decoder configuration
1676 //-------------------------------------------------------------------------------------------------
1677 VDEC_EX_Result MApi_VDEC_EX_IsStepDecodeDone(VDEC_StreamId *pStreamId);
1678 //-------------------------------------------------------------------------------------------------
1679 /// Set up trick decode mode for decode I, decode IP and decode all.
1680 /// @ingroup Decode
1681 /// @param pStreamId \b IN : the pointer to stream ID
1682 /// @param eTrickDec \b IN : trick decode mode
1683 /// @return return VDEC_EX_Result
1684 //-------------------------------------------------------------------------------------------------
1685 VDEC_EX_Result MApi_VDEC_EX_SetTrickMode(VDEC_StreamId *pStreamId, VDEC_EX_TrickDec eTrickDec);
1686 //-------------------------------------------------------------------------------------------------
1687 /// Push decode command queue
1688 /// @ingroup Decode
1689 /// @param pStreamId \b IN : the pointer to stream ID
1690 /// @param pCmd \b IN : the pointer to decode command
1691 /// @return return VDEC_EX_Result
1692 //-------------------------------------------------------------------------------------------------
1693 VDEC_EX_Result MApi_VDEC_EX_PushDecQ(VDEC_StreamId *pStreamId, VDEC_EX_DecCmd *pCmd);
1694 //-------------------------------------------------------------------------------------------------
1695 /// Flush command queue and internal data of decoder
1696 /// @ingroup Decode
1697 /// @param pStreamId \b IN : the pointer to stream ID
1698 /// @return return VDEC_EX_Result
1699 //-------------------------------------------------------------------------------------------------
1700 VDEC_EX_Result MApi_VDEC_EX_Flush(VDEC_StreamId *pStreamId, VDEC_EX_FreezePicSelect eFreezePic);
1701 //-------------------------------------------------------------------------------------------------
1702 /// Enable to let decoder force to display all decoded frame when out of input data
1703 /// @ingroup Decode
1704 /// @param pStreamId \b IN : the pointer to stream ID
1705 /// @param bEnable \b IN : TRUE - enable; FALSE - disable
1706 /// @return return VDEC_EX_Result
1707 //-------------------------------------------------------------------------------------------------
1708 VDEC_EX_Result MApi_VDEC_EX_EnableLastFrameShow(VDEC_StreamId *pStreamId, MS_BOOL bEnable);
1709 //-------------------------------------------------------------------------------------------------
1710 /// Set up display speed
1711 /// @ingroup Decode
1712 /// @param pStreamId \b IN : the pointer to stream ID
1713 /// @param eSpeedType \b IN : display speed type
1714 /// @param eSpeed \b IN : multiple
1715 /// @return return VDEC_EX_Result
1716 //-------------------------------------------------------------------------------------------------
1717 VDEC_EX_Result MApi_VDEC_EX_SetSpeed(VDEC_StreamId *pStreamId, VDEC_EX_SpeedType eSpeedType, VDEC_EX_DispSpeed eSpeed);
1718 //-------------------------------------------------------------------------------------------------
1719 /// Let FW stop updating frames when vsync, but decoding process is still going.
1720 /// @ingroup Decode
1721 /// @param pStreamId \b IN : the pointer to stream ID
1722 /// @param bEnable \b IN : Enable/Disable
1723 /// @return -The result of command freeze image.
1724 //-------------------------------------------------------------------------------------------------
1725 VDEC_EX_Result MApi_VDEC_EX_SetFreezeDisp(VDEC_StreamId *pStreamId, MS_BOOL bEnable);
1726 //-------------------------------------------------------------------------------------------------
1727 /// Set blue screen on/off
1728 /// @ingroup Decode
1729 /// @param pStreamId \b IN : the pointer to stream ID
1730 /// @param bOn \b IN : turn on / off blue screen
1731 /// @return VDEC_EX_Result
1732 //-------------------------------------------------------------------------------------------------
1733 VDEC_EX_Result MApi_VDEC_EX_SetBlueScreen(VDEC_StreamId *pStreamId, MS_BOOL bOn);
1734 //-------------------------------------------------------------------------------------------------
1735 /// Reset PTS
1736 /// @ingroup Decode
1737 /// @param pStreamId \b IN : the pointer to stream ID
1738 /// @param u32PtsBase \b IN : new PTS base value
1739 /// @return VDEC_EX_Result
1740 //-------------------------------------------------------------------------------------------------
1741 VDEC_EX_Result MApi_VDEC_EX_ResetPTS(VDEC_StreamId *pStreamId, MS_U32 u32PtsBase);
1742 //-------------------------------------------------------------------------------------------------
1743 /// Switch AV sync on/off
1744 /// @ingroup Decode
1745 /// @param pStreamId \b IN : the pointer to stream ID
1746 /// @param bOn \b IN : on/off
1747 /// @param u32SyncDelay \b IN : delay value
1748 /// @param u16SyncTolerance \b IN : tolerance value
1749 /// @return VDEC_EX_Result
1750 //-------------------------------------------------------------------------------------------------
1751 VDEC_EX_Result MApi_VDEC_EX_AVSyncOn(VDEC_StreamId *pStreamId, MS_BOOL bOn, MS_U32 u32SyncDelay, MS_U16 u16SyncTolerance);
1752 //-------------------------------------------------------------------------------------------------
1753 /// Switch AV sync free run threshold
1754 /// @ingroup Decode
1755 /// @param pStreamId \b IN : the pointer to stream ID
1756 /// @param u32Threshold \b IN : threshold value
1757 /// @return VDEC_EX_Result
1758 //-------------------------------------------------------------------------------------------------
1759 VDEC_EX_Result MApi_VDEC_EX_SetAVSyncFreerunThreshold(VDEC_StreamId *pStreamId, MS_U32 u32Threshold );
1760 
1761 //------------------------------------------------------------------------------
1762 /// Get display information
1763 /// @ingroup Get_information
1764 /// @param eStream \b IN : stream type
1765 /// @param pDispinfo \b OUT : pointer to display setting information
1766 /// @return VDEC_EX_Result
1767 //------------------------------------------------------------------------------
1768 VDEC_EX_Result MApi_VDEC_EX_GetDispInfo(VDEC_StreamId *pStreamId, VDEC_EX_DispInfo *pDispinfo);
1769 /// Get video av sync on/off status
1770 /// @ingroup Get_information
1771 /// @param eStream \b IN : stream type
1772 /// @return VDEC_EX_Result
1773 //------------------------------------------------------------------------------
1774 VDEC_EX_Result MApi_VDEC_EX_IsAVSyncOn(VDEC_StreamId *pStreamId);
1775 //------------------------------------------------------------------------------
1776 /// Get video valid stream flag
1777 /// @ingroup Get_information
1778 /// @param eStream \b IN : stream type
1779 /// @return VDEC_EX_Result
1780 //------------------------------------------------------------------------------
1781 VDEC_EX_Result MApi_VDEC_EX_IsWithValidStream(VDEC_StreamId *pStreamId);
1782 //------------------------------------------------------------------------------
1783 /// Get video display finish status
1784 /// @ingroup Get_information
1785 /// @param eStream \b IN : stream type
1786 /// @return VDEC_EX_Result
1787 //------------------------------------------------------------------------------
1788 VDEC_EX_Result MApi_VDEC_EX_IsDispFinish(VDEC_StreamId *pStreamId);
1789 //------------------------------------------------------------------------------
1790 /// Get video frame ready status
1791 /// @ingroup Get_information
1792 /// @param eStream \b IN : stream type
1793 /// @return VDEC_EX_Result
1794 //------------------------------------------------------------------------------
1795 VDEC_EX_Result MApi_VDEC_EX_IsFrameRdy(VDEC_StreamId *pStreamId);
1796 //------------------------------------------------------------------------------
1797 /// Get I frame found status
1798 /// @ingroup Get_information
1799 /// @param eStream \b IN : stream type
1800 /// @return VDEC_EX_Result
1801 //------------------------------------------------------------------------------
1802 VDEC_EX_Result MApi_VDEC_EX_IsIFrameFound(VDEC_StreamId *pStreamId);
1803 //------------------------------------------------------------------------------
1804 /// Get video sequence change status
1805 /// @ingroup Get_information
1806 /// @param eStream \b IN : stream type
1807 /// @return VDEC_EX_Result
1808 //------------------------------------------------------------------------------
1809 VDEC_EX_Result MApi_VDEC_EX_IsSeqChg(VDEC_StreamId *pStreamId);
1810 //------------------------------------------------------------------------------
1811 /// Get video reach sync status
1812 /// @ingroup Get_information
1813 /// @param eStream \b IN : stream type
1814 /// @return VDEC_EX_Result
1815 //------------------------------------------------------------------------------
1816 VDEC_EX_Result MApi_VDEC_EX_IsReachSync(VDEC_StreamId *pStreamId);
1817 //------------------------------------------------------------------------------
1818 /// Get video start sync status
1819 /// @ingroup Get_information
1820 /// @param eStream \b IN : stream type
1821 /// @return VDEC_EX_Result
1822 //------------------------------------------------------------------------------
1823 VDEC_EX_Result MApi_VDEC_EX_IsStartSync(VDEC_StreamId *pStreamId);
1824 //------------------------------------------------------------------------------
1825 /// Get video free run status
1826 /// @ingroup Get_information
1827 /// @param eStream \b IN : stream type
1828 /// @return VDEC_EX_Result
1829 //------------------------------------------------------------------------------
1830 VDEC_EX_Result MApi_VDEC_EX_IsFreerun(VDEC_StreamId *pStreamId);
1831 //------------------------------------------------------------------------------
1832 /// Get video low delay status
1833 /// @ingroup Get_information
1834 /// @param eStream \b IN : stream type
1835 /// @return VDEC_EX_Result
1836 //------------------------------------------------------------------------------
1837 VDEC_EX_Result MApi_VDEC_EX_IsWithLowDelay(VDEC_StreamId *pStreamId);
1838 //------------------------------------------------------------------------------
1839 /// Get video all buffer empty status
1840 /// @ingroup Get_information
1841 /// @param eStream \b IN : stream type
1842 /// @return VDEC_EX_Result
1843 //------------------------------------------------------------------------------
1844 VDEC_EX_Result MApi_VDEC_EX_IsAllBufferEmpty(VDEC_StreamId *pStreamId);
1845 //------------------------------------------------------------------------------
1846 /// Get the extension information of decoded frame.
1847 /// @ingroup Get_information
1848 /// @param eStream \b IN : stream type
1849 /// @param pExtDispinfo \b IN : the extension information of decoded frame.
1850 /// @return VDEC_EX_Result
1851 //------------------------------------------------------------------------------
1852 VDEC_EX_Result MApi_VDEC_EX_GetExtDispInfo(VDEC_StreamId *pStreamId, VDEC_EX_ExtDispInfo *pExtDispinfo);
1853 //------------------------------------------------------------------------------
1854 /// Get the information of the latest decoded frame.
1855 /// @ingroup Get_information
1856 /// @param eStream \b IN : stream type
1857 /// @param pFrmInfo \b IN : the information of the latest decoded frame
1858 /// @return VDEC_EX_Result
1859 //------------------------------------------------------------------------------
1860 VDEC_EX_Result MApi_VDEC_EX_GetDecFrameInfo(VDEC_StreamId *pStreamId, VDEC_EX_FrameInfo *pFrmInfo);
1861 //------------------------------------------------------------------------------
1862 /// Get the information of current displaying frame.
1863 /// @ingroup Get_information
1864 /// @param eStream \b IN : stream type
1865 /// @param pFrmInfo \b IN : the information of displaying frame
1866 /// @return VDEC_EX_Result
1867 //------------------------------------------------------------------------------
1868 VDEC_EX_Result MApi_VDEC_EX_GetDispFrameInfo(VDEC_StreamId *pStreamId, VDEC_EX_FrameInfo *pFrmInfo);
1869 //------------------------------------------------------------------------------
1870 /// Get the time_code of the latest decoded frame.
1871 /// @ingroup Get_information
1872 /// @param eStream \b IN : stream type
1873 /// @param pTimeCode \b IN : the time_code of the latest decoded frame
1874 /// @return VDEC_EX_Result
1875 //------------------------------------------------------------------------------
1876 VDEC_EX_Result MApi_VDEC_EX_GetDecTimeCode(VDEC_StreamId *pStreamId, VDEC_EX_TimeCode* pTimeCode);
1877 //------------------------------------------------------------------------------
1878 /// Get the time_code of the latest displayed frame.
1879 /// @ingroup Get_information
1880 /// @param eStream \b IN : stream type
1881 /// @param pTimeCode \b IN : the time_code of the latest displayed frame
1882 /// @return VDEC_EX_Result
1883 //------------------------------------------------------------------------------
1884 VDEC_EX_Result MApi_VDEC_EX_GetDispTimeCode(VDEC_StreamId *pStreamId, VDEC_EX_TimeCode* pTimeCode);
1885 //Event Group
1886 //-------------------------------------------------------------------------------------------------
1887 /// Set decoder event and register it's callback function
1888 /// @param eStream \b IN : stream type
1889 /// @param u32EventFlag \b In : the events want to be turned on/off
1890 /// @param pfn \b In : callback function
1891 /// @param param \b In : parameter for callback function
1892 /// @ingroup VdecEventGroup
1893 /// @return -VDEC_EX_Result
1894 //-------------------------------------------------------------------------------------------------
1895 VDEC_EX_Result MApi_VDEC_EX_SetEvent(VDEC_StreamId *pStreamId, MS_U32 u32EventFlag, VDEC_EX_EventCb pfn, void* param);
1896 //-------------------------------------------------------------------------------------------------
1897 /// MApi_VDEC_EX_UnsetEvent
1898 /// @ingroup VdecEventGroup
1899 /// @return None
1900 //-------------------------------------------------------------------------------------------------
1901 VDEC_EX_Result MApi_VDEC_EX_UnsetEvent(VDEC_StreamId *pStreamId, MS_U32 u32EventFlag);
1902 //-------------------------------------------------------------------------------------------------
1903 /// Set decoder event and register it's callback function
1904 /// @param eStream \b IN : stream type
1905 /// @param u32EventFlag \b In : the events want to be turned on/off
1906 /// @param pfn \b In : callback function
1907 /// @param param \b In : parameter for callback function
1908 /// @ingroup VdecEventGroup
1909 /// @return -VDEC_EX_Result
1910 //-------------------------------------------------------------------------------------------------
1911 VDEC_EX_Result MApi_VDEC_EX_SetEvent_MultiCallback(VDEC_StreamId *pStreamId, VDEC_EX_CB_TYPE cb_type, MS_U32 u32EventFlag, VDEC_EX_EventCb pfn, void *param);
1912 //-------------------------------------------------------------------------------------------------
1913 /// MApi_VDEC_EX_UnsetEvent_MultiCallback
1914 /// @ingroup VdecEventGroup
1915 /// @return VDEC_EX_Result
1916 //-------------------------------------------------------------------------------------------------
1917 VDEC_EX_Result MApi_VDEC_EX_UnsetEvent_MultiCallback(VDEC_StreamId *pStreamId, VDEC_EX_CB_TYPE cb_type, MS_U32 u32EventFlag);
1918 //-------------------------------------------------------------------------------------------------
1919 /// Get ISR event status
1920 /// @param eStream \b IN : stream type
1921 /// @param u32EventFlag \b OUT : vdec event bitmap
1922 /// @ingroup VdecEventGroup
1923 /// @return status
1924 //-------------------------------------------------------------------------------------------------
1925 VDEC_EX_Result MApi_VDEC_EX_GetEventInfo(VDEC_StreamId *pStreamId, MS_U32* u32EventFlag);
1926 //-------------------------------------------------------------------------------------------------
1927 /// Fire the decode command which be pushed since last fired
1928 /// @ingroup Decode
1929 /// @param pStreamId \b IN : the pointer to stream ID
1930 /// @return VDEC_EX_Result
1931 //-------------------------------------------------------------------------------------------------
1932 VDEC_EX_Result MApi_VDEC_EX_FireDecCmd(VDEC_StreamId *pStreamId);
1933 //-------------------------------------------------------------------------------------------------
1934 /// Decoder will start decode with full  speed until target PTS is reached (equal or larger) then pause.
1935 /// @ingroup Decode
1936 /// @param pStreamId \b IN : the pointer to stream ID
1937 /// @param u32PTS \b IN : target PTS
1938 /// @return VDEC_EX_Result
1939 //-------------------------------------------------------------------------------------------------
1940 VDEC_EX_Result MApi_VDEC_EX_SeekToPTS(VDEC_StreamId *pStreamId, MS_U32 u32PTS);
1941 //-------------------------------------------------------------------------------------------------
1942 /// Decoder will skip all frames before target PTS, and start decode with full  speed after target PTS is reached.
1943 /// @ingroup Decode
1944 /// @param pStreamId \b IN : the pointer to stream ID
1945 /// @param u32PTS \b IN : target PTS
1946 /// @return VDEC_EX_Result
1947 //-------------------------------------------------------------------------------------------------
1948 VDEC_EX_Result MApi_VDEC_EX_SkipToPTS(VDEC_StreamId *pStreamId, MS_U32 u32PTS);
1949 
1950 // Advanced Settings / Mode
1951 //------------------------------------------------------------------------------
1952 /// Set deblocking process on/off
1953 /// @ingroup VDEC_Hardware
1954 /// @param eStream \b IN : stream type
1955 /// @param bOn \b IN : turn on / off deblocking process
1956 /// @return VDEC_EX_Result
1957 //------------------------------------------------------------------------------
1958 VDEC_EX_Result MApi_VDEC_EX_DisableDeblocking(VDEC_StreamId *pStreamId, MS_BOOL bDisable);
1959 
1960 
1961 //------------------------------------------------------------------------------
1962 /// Set Quarter Pixel process on/off
1963 /// @ingroup VDEC_Hardware
1964 /// @param eStream \b IN : stream type
1965 /// @param bOn \b IN : turn on / off Quarter Pixel process
1966 /// @return VDEC_EX_Result
1967 //------------------------------------------------------------------------------
1968 VDEC_EX_Result MApi_VDEC_EX_DisableQuarterPixel(VDEC_StreamId *pStreamId, MS_BOOL bDisable);
1969 
1970 
1971 //------------------------------------------------------------------------------
1972 /// Turn on/off Auto Remove Last Zero Byte process
1973 /// @ingroup VDEC_Enhanced
1974 /// @param eStream \b IN : stream type
1975 /// @param bOn \b IN : turn on / off Auto Remove Last Zero Byte process
1976 /// @return VDEC_EX_Result
1977 //------------------------------------------------------------------------------
1978 VDEC_EX_Result MApi_VDEC_EX_SetAutoRmLstZeroByte(VDEC_StreamId *pStreamId, MS_BOOL bOn);
1979 //------------------------------------------------------------------------------
1980 /// Set the parameters of Balancing BW
1981 /// @ingroup VDEC_Hardware
1982 /// @param eStream \b IN : stream type
1983 /// @param u8QuarPixelTH \b IN : set Quarter pixel threshold
1984 /// @param u8DeBlockingTH \b IN : set deblocking threshold
1985 /// @param u8UpperBound \b IN : set upper boundary of BW control counter
1986 /// @param u8SafeCoef \b IN : set safety coeffecient of average MB tick.
1987 /// @return VDEC_EX_Result
1988 //------------------------------------------------------------------------------
1989 VDEC_EX_Result MApi_VDEC_EX_SetBalanceBW(VDEC_StreamId *pStreamId,
1990                                         MS_U8 u8QuarPixelTH, MS_U8 u8DeBlockingTH, MS_U8 u8UpperBound, MS_U8 u8SafeCoef);
1991 //------------------------------------------------------------------------------
1992 /// Get stream active format which decoder retrieved
1993 /// @ingroup Get_information
1994 /// @param eStream \b IN : stream type
1995 /// @return active format ID
1996 //------------------------------------------------------------------------------
1997 MS_U8 MApi_VDEC_EX_GetActiveFormat(VDEC_StreamId *pStreamId);
1998 //------------------------------------------------------------------------------
1999 /// Get stream colour primaries
2000 /// @ingroup Get_information
2001 /// @param eStream \b IN : stream type
2002 /// @return stream colour primaries
2003 //------------------------------------------------------------------------------
2004 MS_U8 MApi_VDEC_EX_GetColourPrimaries(VDEC_StreamId *pStreamId);
2005 //------------------------------------------------------------------------------
2006 /// Get VDEC fw version
2007 /// @ingroup Get_information
2008 /// @param eStream \b IN : stream type
2009 /// @param eFwType \b OUT : vdec fw type
2010 /// @return VDEC_EX_Result
2011 //------------------------------------------------------------------------------
2012 MS_U32 MApi_VDEC_EX_GetFwVersion(VDEC_StreamId *pStreamId, VDEC_EX_FwType eFwType);
2013 //------------------------------------------------------------------------------
2014 /// Get picture counter of current GOP
2015 /// @ingroup Get_information
2016 /// @param eStream \b IN : stream type
2017 /// @return picture counter
2018 //------------------------------------------------------------------------------
2019 MS_U8 MApi_VDEC_EX_GetGOPCnt(VDEC_StreamId *pStreamId);
2020 //Get Decoder status
2021 //------------------------------------------------------------------------------
2022 /// Get ES Buffer Write pointer
2023 /// @ingroup Get_information
2024 /// @param eStream \b IN : stream type
2025 /// @return ES Buffer write pointer
2026 //------------------------------------------------------------------------------
2027 MS_U32 MApi_VDEC_EX_GetESWritePtr(VDEC_StreamId *pStreamId);
2028 //------------------------------------------------------------------------------
2029 /// Get ES Buffer Read pointer
2030 /// @ingroup Get_information
2031 /// @param eStream \b IN : stream type
2032 /// @return ES Buffer read pointer
2033 //------------------------------------------------------------------------------
2034 MS_U32 MApi_VDEC_EX_GetESReadPtr(VDEC_StreamId *pStreamId);
2035 //------------------------------------------------------------------------------
2036 /// Get the PTS of current displayed frame
2037 /// @ingroup Get_information
2038 /// @param eStream \b IN : stream type
2039 /// @return PTS
2040 //------------------------------------------------------------------------------
2041 MS_U32 MApi_VDEC_EX_GetPTS(VDEC_StreamId *pStreamId);
2042 //------------------------------------------------------------------------------
2043 /// Get the PTS of next displayed frame
2044 /// @ingroup Get_information
2045 /// @param eStream \b IN : stream type
2046 /// @return next PTS (unit:ms)
2047 //------------------------------------------------------------------------------
2048 MS_U32 MApi_VDEC_EX_GetNextPTS(VDEC_StreamId *pStreamId);
2049 //------------------------------------------------------------------------------
2050 /// Get Video Delta of Video PTS and STC
2051 /// @ingroup Get_information
2052 /// @param eStream \b IN : stream type
2053 /// @return the value of PTS - STC for video
2054 //------------------------------------------------------------------------------
2055 MS_S64 MApi_VDEC_EX_GetVideoPtsStcDelta(VDEC_StreamId *pStreamId);
2056 //------------------------------------------------------------------------------
2057 /// Get Video Error code
2058 /// @ingroup Get_information
2059 /// @param eStream \b IN : stream type
2060 /// @return error code
2061 //------------------------------------------------------------------------------
2062 MS_U32 MApi_VDEC_EX_GetErrCode(VDEC_StreamId *pStreamId);
2063 //------------------------------------------------------------------------------
2064 /// Get Video decode frame error count
2065 /// @ingroup Get_information
2066 /// @param eStream \b IN : stream type
2067 /// @return Video decode frame error count
2068 //------------------------------------------------------------------------------
2069 MS_U32 MApi_VDEC_EX_GetErrCnt(VDEC_StreamId *pStreamId);
2070 //------------------------------------------------------------------------------
2071 /// Get bitrate which decoder retrieved from stream
2072 /// @ingroup Get_information
2073 /// @param eStream \b IN : stream type
2074 /// @return bitrate
2075 //------------------------------------------------------------------------------
2076 MS_U32 MApi_VDEC_EX_GetBitsRate(VDEC_StreamId *pStreamId);
2077 //------------------------------------------------------------------------------
2078 /// Get Video decode frame count
2079 /// @ingroup Get_information
2080 /// @param eStream \b IN : stream type
2081 /// @return Video decode frame count
2082 //------------------------------------------------------------------------------
2083 MS_U32 MApi_VDEC_EX_GetFrameCnt(VDEC_StreamId *pStreamId);
2084 //------------------------------------------------------------------------------
2085 /// Get Video decode frame skip count
2086 /// @ingroup Get_information
2087 /// @param eStream \b IN : stream type
2088 /// @return Video decode frame skip count
2089 //------------------------------------------------------------------------------
2090 MS_U32 MApi_VDEC_EX_GetSkipCnt(VDEC_StreamId *pStreamId);
2091 //------------------------------------------------------------------------------
2092 /// Get Video decode frame drop count
2093 /// @ingroup Get_information
2094 /// @param eStream \b IN : stream type
2095 /// @return Video decode frame drop count
2096 //------------------------------------------------------------------------------
2097 MS_U32 MApi_VDEC_EX_GetDropCnt(VDEC_StreamId *pStreamId);
2098 //------------------------------------------------------------------------------
2099 /// Get Video decode frame display count
2100 /// @ingroup Get_information
2101 /// @param eStream \b IN : stream type
2102 /// @return Video decode frame display count
2103 //------------------------------------------------------------------------------
2104 MS_U32 MApi_VDEC_EX_GetDispCnt(VDEC_StreamId *pStreamId);
2105 //------------------------------------------------------------------------------
2106 /// Get vacancy of BBU/SLQ entry table
2107 /// @ingroup Get_information
2108 /// @param eStream \b IN : stream type
2109 /// @return vacancy number
2110 //------------------------------------------------------------------------------
2111 MS_U32 MApi_VDEC_EX_GetDecQVacancy(VDEC_StreamId *pStreamId);
2112 //------------------------------------------------------------------------------
2113 /// Get video 3:2 pulldown flag
2114 /// @ingroup Get_information
2115 /// @param eStream \b IN : stream type
2116 /// @return TRUE/FALSE
2117 //------------------------------------------------------------------------------
2118 MS_BOOL MApi_VDEC_EX_Is32PullDown(VDEC_StreamId *pStreamId);
2119 //------------------------------------------------------------------------------
2120 /// Get video alive status
2121 /// @ingroup Get_information
2122 /// @param eStream \b IN : stream type
2123 /// @return VDEC_EX_Result
2124 //------------------------------------------------------------------------------
2125 VDEC_EX_Result MApi_VDEC_EX_IsAlive(VDEC_StreamId *pStreamId);
2126 //close caption
2127 //-------------------------------------------------------------------------------------------------
2128 /// Check cc is available.
2129 /// @param eStream \b IN : stream type
2130 /// @ingroup VdecCloseCaption
2131 /// @return VDEC_EX_Result: TRUE or NOT
2132 //-------------------------------------------------------------------------------------------------
2133 MS_BOOL MApi_VDEC_EX_IsCCAvailable(VDEC_StreamId *pStreamId);
2134 //-------------------------------------------------------------------------------------------------
2135 /// Get cc info.
2136 /// @param eStream \b IN : stream type
2137 /// @ingroup VdecCloseCaption
2138 /// @return VDEC_EX_Result:
2139 //-------------------------------------------------------------------------------------------------
2140 VDEC_EX_Result MApi_VDEC_EX_GetCCInfo(VDEC_StreamId *pStreamId, void *pInfo, MS_U32 u32Size);
2141 //------------------------------------------------------------------------------
2142 /// Get video trick mode status
2143 /// @ingroup Get_information
2144 /// @param eStream \b IN : stream type
2145 /// @return VDEC_EX_TrickDec
2146 //------------------------------------------------------------------------------
2147 VDEC_EX_TrickDec MApi_VDEC_EX_GetTrickMode(VDEC_StreamId *pStreamId);
2148 //------------------------------------------------------------------------------
2149 /// Get active codec type
2150 /// @ingroup Get_information
2151 /// @param eStream \b IN : stream type
2152 /// @return VDEC_EX_Result
2153 //------------------------------------------------------------------------------
2154 VDEC_EX_CodecType MApi_VDEC_EX_GetActiveCodecType(VDEC_StreamId *pStreamId);
2155 //-------------------------------------------------------------------------------------------------
2156 /// Generate a special pattern to work with specific functions
2157 /// @ingroup VDEC_Flush_pattern
2158 /// @param eStream \b IN : stream type
2159 /// @param ePatternType \b IN : Pattern type
2160 /// @param u32Addr \b IN : Pattern buffer physical start address
2161 /// @param u32Size \b IN,OUT : Pattern buffer size
2162 ///                             IN: Pattern buffer size
2163 ///                             OUT: Used Pattern buffer size
2164 /// @return VDEC_EX_Result
2165 //-------------------------------------------------------------------------------------------------
2166 VDEC_EX_Result MApi_VDEC_EX_GenPattern(VDEC_StreamId *pStreamId,
2167                                     VDEC_EX_PatternType ePatternType,
2168                                     MS_PHY u32Addr,
2169                                     MS_U32* u32Size);
2170 //-------------------------------------------------------------------------------------------------
2171 /// Get the information of the least length of pattern used for specific function
2172 /// @ingroup VDEC_Flush_pattern
2173 /// @param eStream \b IN : stream type
2174 /// @param pFrmInfo \b IN : the information of the least length of pattern used for specific function
2175 /// @return VDEC_EX_Result
2176 //-------------------------------------------------------------------------------------------------
2177 MS_U32 MApi_VDEC_EX_GetPatternLeastLength(VDEC_StreamId *pStreamId, VDEC_EX_PatternType ePatternType);
2178 //Used for MHEG Decode iI frame
2179 //-------------------------------------------------------------------------------------------------
2180 /// For MHEG5 MW, decode one I frame
2181 /// @ingroup VDEC_MHEG_DECODE_I_Frame
2182 /// @param eStream \b IN : stream type
2183 /// @param u32FrameBufAddr \b IN : output buffer address
2184 /// @param u32SrcSt \b IN : source start address
2185 /// @param u32SrcEnd \b IN : source end address
2186 /// @return VDEC_EX_Result
2187 //-------------------------------------------------------------------------------------------------
2188 VDEC_EX_Result MApi_VDEC_EX_MHEG_DecodeIFrame(VDEC_StreamId *pStreamId,
2189                                             MS_PHY u32FrameBufAddr,
2190                                             MS_PHY u32SrcSt,
2191                                             MS_PHY u32SrcEnd);
2192 
2193 //-------------------------------------------------------------------------------------------------
2194 /// For MHEG5 MW, check if I frame decode done
2195 /// @ingroup VDEC_MHEG_DECODE_I_Frame
2196 /// @param eStream \b IN : stream type
2197 /// @return VDEC_EX_Result
2198 ///     - E_VDEC_EX_OK: decode done
2199 ///     - E_VDEC_EX_FAIL: not yet
2200 ///     - E_VDEC_EX_RET_NOT_INIT: not initial yet
2201 ///     - E_VDEC_EX_RET_UNSUPPORTED: not supported with current decoder configuration
2202 //-------------------------------------------------------------------------------------------------
2203 VDEC_EX_Result MApi_VDEC_EX_MHEG_IsIFrameDecoding(VDEC_StreamId *pStreamId);
2204 //-------------------------------------------------------------------------------------------------
2205 /// For MHEG5 MW, reset decoder after I frame decode done
2206 /// @ingroup VDEC_MHEG_DECODE_I_Frame
2207 /// @param eStream \b IN : stream type
2208 /// @return VDEC_EX_Result
2209 //-------------------------------------------------------------------------------------------------
2210 VDEC_EX_Result MApi_VDEC_EX_MHEG_RstIFrameDec(VDEC_StreamId *pStreamId);
2211 
2212 //ATSC Closed Caption control
2213 //------------------------------------------------------------------------------
2214 /// [Obsolete] Start CC data parsing.
2215 /// @param eStream \b IN : stream type
2216 /// @param pCCParam \b IN : CC configuration
2217 /// @ingroup VdecCloseCaption
2218 /// @return -VDEC_EX_Result
2219 //------------------------------------------------------------------------------
2220 VDEC_EX_Result MApi_VDEC_EX_CC_StartParsing(VDEC_StreamId *pStreamId, VDEC_EX_CCCfg *pCCParam);
2221 //------------------------------------------------------------------------------
2222 /// [Obsolete] Stop CC data parsing.
2223 /// @param eStream \b IN : stream type
2224 /// @ingroup VdecCloseCaption
2225 /// @return -VDEC_EX_Result
2226 //------------------------------------------------------------------------------
2227 VDEC_EX_Result MApi_VDEC_EX_CC_StopParsing(VDEC_StreamId *pStreamId);
2228 //------------------------------------------------------------------------------
2229 /// [Obsolete] Get write pointer of CC data buffer.
2230 /// @param eStream \b IN : stream type
2231 /// @param pu32Write \b OUT : current write pointer
2232 /// @ingroup VdecCloseCaption
2233 /// @return -VDEC_EX_Result
2234 //------------------------------------------------------------------------------
2235 VDEC_EX_Result MApi_VDEC_EX_CC_GetWritePtr(VDEC_StreamId *pStreamId, MS_U32 *pu32Write);
2236 //------------------------------------------------------------------------------
2237 /// [Obsolete] Get the read pointer of CC data buffer.
2238 /// @param eStream \b IN : stream type
2239 /// @param pu32Read \b OUT : current read pointer
2240 /// @ingroup VdecCloseCaption
2241 /// @return -VDEC_EX_Result
2242 //------------------------------------------------------------------------------
2243 VDEC_EX_Result MApi_VDEC_EX_CC_GetReadPtr(VDEC_StreamId *pStreamId, MS_U32 *pu32Read);
2244 //------------------------------------------------------------------------------
2245 /// [Obsolete] Update the read pointer of CC data buffer.
2246 /// @param eStream \b IN : stream type
2247 /// @param u32EachPacketSize \b IN : new read pointer
2248 /// @ingroup VdecCloseCaption
2249 /// @return -VDEC_EX_Result
2250 //------------------------------------------------------------------------------
2251 VDEC_EX_Result MApi_VDEC_EX_CC_UpdateReadPtr(VDEC_StreamId *pStreamId, MS_U32 u32EachPacketSize);
2252 //------------------------------------------------------------------------------
2253 /// [Obsolete] Get if CC data buffer is overflow.
2254 /// @param eStream \b IN : stream type
2255 /// @param pbOverflow \b OUT : overflow flag
2256 /// @ingroup VdecCloseCaption
2257 /// @return -VDEC_EX_Result
2258 //------------------------------------------------------------------------------
2259 VDEC_EX_Result MApi_VDEC_EX_CC_GetIsOverflow(VDEC_StreamId *pStreamId, MS_BOOL *pbOverflow);
2260 //------------------------------------------------------------------------------
2261 /// Set up debug command
2262 /// @param eStream \b IN : stream type
2263 /// @param u8Cmd \b IN : debug command
2264 /// @param u32CmdArg \b IN : command arg
2265 /// @ingroup VdecDebug
2266 /// @return VDEC_EX_Result
2267 ///     - E_VDEC_EX_OK: Success
2268 ///     - E_VDEC_EX_FAIL: Failed
2269 //------------------------------------------------------------------------------
2270 VDEC_EX_Result MApi_VDEC_EX_DbgCmd(VDEC_StreamId *pStreamId, MS_U32 u8Cmd, MS_U32 u32CmdArg);
2271 //------------------------------------------------------------------------------
2272 /// Set debug data
2273 /// @param eStream \b IN : stream type
2274 /// @param u32Addr \b IN : data addr
2275 /// @param u32Data \b IN : data
2276 /// @ingroup VdecDebug
2277 /// @return VDEC_EX_Result
2278 ///     - E_VDEC_EX_OK: Success
2279 ///     - E_VDEC_EX_FAIL: Failed
2280 //------------------------------------------------------------------------------
2281 VDEC_EX_Result MApi_VDEC_EX_DbgSetData(VDEC_StreamId *pStreamId, MS_VIRT u32Addr, MS_U32 u32Data);
2282 //------------------------------------------------------------------------------
2283 /// Get debug data
2284 /// @param eStream \b IN : stream type
2285 /// @param u32Addr \b IN : data addr
2286 /// @param u32Data \b IN : data
2287 /// @ingroup VdecDebug
2288 /// @return VDEC_EX_Result
2289 ///     - E_VDEC_EX_OK: Success
2290 ///     - E_VDEC_EX_FAIL: Failed
2291 //------------------------------------------------------------------------------
2292 VDEC_EX_Result MApi_VDEC_EX_DbgGetData(VDEC_StreamId *pStreamId, MS_VIRT u32Addr, MS_U32 *u32Data);
2293 //-------------------------------------------------------------------------------------------------
2294 /// Set command to decode
2295 /// @ingroup Decode
2296 /// @param eStream \b IN : stream type
2297 /// @param cmd_id \b IN : command id
2298 /// @param param \b IN : parameter
2299 /// @return VDEC_EX_Result
2300 //-------------------------------------------------------------------------------------------------
2301 VDEC_EX_Result MApi_VDEC_EX_SetControl(VDEC_StreamId *pStreamId, VDEC_EX_User_Cmd cmd_id, MS_VIRT param);
2302 //-------------------------------------------------------------------------------------------------
2303 /// Set command to decode
2304 /// @ingroup Decode
2305 /// @param eStream \b IN : stream type
2306 /// @param cmd_id \b IN : command id
2307 /// @param param \b OUT : get current status/parameters
2308 /// @return VDEC_EX_Result
2309 //-------------------------------------------------------------------------------------------------
2310 VDEC_EX_Result MApi_VDEC_EX_GetControl(VDEC_StreamId *pStreamId, VDEC_EX_User_Cmd cmd_id, MS_U32 *param);
2311 
2312 //------------------------------------------------------------------------------
2313 /// ycpan : No corresponding functino body, we should remove it
2314 //------------------------------------------------------------------------------
2315 // VDEC_EX_Result MApi_VDEC_EX_EnableDispOneField(VDEC_StreamId *pStreamId, MS_BOOL bEnable);
2316 //------------------------------------------------------------------------------
2317 /// Get VDEC HW key
2318 /// @ingroup Get_information
2319 /// @param eStream \b IN : stream type
2320 /// @param pu8Key \b OUT : HW key
2321 /// @return VDEC_EX_Result
2322 //------------------------------------------------------------------------------
2323 VDEC_EX_Result MApi_VDEC_EX_GetHWKey(VDEC_StreamId *pStreamId, MS_U8 *pu8Key);
2324 //------------------------------------------------------------------------------
2325 /// Dump debug status
2326 /// @param eStream \b IN : stream type
2327 /// @ingroup VdecDebug
2328 /// @return VDEC_EX_Result
2329 ///     - E_VDEC_EX_OK: Success
2330 ///     - E_VDEC_EX_FAIL: Failed
2331 //------------------------------------------------------------------------------
2332 void MApi_VDEC_EX_DbgDumpStatus(VDEC_StreamId *pStreamId);
2333 //------------------------------------------------------------------------------
2334 /// Get program count
2335 /// @ingroup VdecDebug
2336 /// @return VDEC_EX_Result
2337 ///     - E_VDEC_EX_OK: Success
2338 ///     - E_VDEC_EX_FAIL: Failed
2339 //------------------------------------------------------------------------------
2340 MS_U32 MApi_VDEC_EX_DbgGetProgCnt(void);
2341 
2342 //-------------------------------------------------------------------------------------------------
2343 /// Enable Display Queue controller(Gstreamer,Uniplayer)
2344 /// @ingroup VDEC_Display_Q_Control
2345 /// @param eStream \b IN : stream type
2346 /// @param bEnable \b IN : enable/disable
2347 /// @return VDEC_EX_Result
2348 //-------------------------------------------------------------------------------------------------
2349 VDEC_EX_Result MApi_VDEC_EX_SetBlockDisplay(VDEC_StreamId *pStreamId, MS_BOOL bEnable);
2350 
2351 //-------------------------------------------------------------------------------------------------
2352 /// Enable Es buffer memory allocate
2353 /// @ingroup VDEC_ES_buffer_manage
2354 /// @param eStream \b IN : stream type
2355 /// @param bEnable \b IN : enable/disable
2356 /// @return VDEC_EX_Result
2357 //-------------------------------------------------------------------------------------------------
2358 VDEC_EX_Result MApi_VDEC_EX_EnableESBuffMalloc(VDEC_StreamId *pStreamId, MS_BOOL bEnable);
2359 //-------------------------------------------------------------------------------------------------
2360 /// Get difference between ES buffer read/write pointer
2361 /// @ingroup VDEC_ES_buffer_manage
2362 /// @param eStream \b IN : stream type
2363 /// @param pData \b OUT : vacancy
2364 /// @return VDEC_EX_Result
2365 //-------------------------------------------------------------------------------------------------
2366 MS_U32 MApi_VDEC_EX_GetESBuffVacancy(VDEC_StreamId *pStreamId, void *pData);
2367 //-------------------------------------------------------------------------------------------------
2368 /// Get ES buffer to put data
2369 /// @ingroup VDEC_ES_buffer_manage
2370 /// @param eStream \b IN : stream type
2371 /// @param u32ReqSize \b IN : request size
2372 /// @param u32AvailSize \b IN :available size
2373 /// @param u32Addr \b IN : address of ES buffer space
2374 /// @return VDEC_EX_Result
2375 //-------------------------------------------------------------------------------------------------
2376 VDEC_EX_Result  MApi_VDEC_EX_GetESBuff(VDEC_StreamId *pStreamId, MS_U32 u32ReqSize, MS_U32 *u32AvailSize, MS_PHY *u32Addr);
2377 //-------------------------------------------------------------------------------------------------
2378 /// Get next display frame
2379 /// @ingroup VDEC_Display_Q_Control
2380 /// @param eStream \b IN : stream type
2381 /// @param ppDispFrm \b OUT : display frame
2382 /// @return VDEC_EX_Result
2383 //-------------------------------------------------------------------------------------------------
2384 VDEC_EX_Result  MApi_VDEC_EX_GetNextDispFrame(VDEC_StreamId *pStreamId, VDEC_EX_DispFrame **ppDispFrm);
2385 //-------------------------------------------------------------------------------------------------
2386 /// Show display frame
2387 /// @ingroup VDEC_Display_Q_Control
2388 /// @param eStream \b IN : stream type
2389 /// @param pDispFrm \b IN : display frame
2390 /// @return VDEC_EX_Result
2391 //-------------------------------------------------------------------------------------------------
2392 VDEC_EX_Result  MApi_VDEC_EX_DisplayFrame(VDEC_StreamId *pStreamId, VDEC_EX_DispFrame *pDispFrm);
2393 //-------------------------------------------------------------------------------------------------
2394 /// Release display frame
2395 /// @ingroup VDEC_Display_Q_Control
2396 /// @param eStream \b IN : stream type
2397 /// @param pDispFrm \b IN : display frame
2398 /// @return VDEC_EX_Result
2399 //-------------------------------------------------------------------------------------------------
2400 VDEC_EX_Result  MApi_VDEC_EX_ReleaseFrame(VDEC_StreamId *pStreamId, VDEC_EX_DispFrame *pDispFrm);
2401 //-------------------------------------------------------------------------------------------------
2402 /// Capture display frame
2403 /// @ingroup VDEC_Display_Q_Control
2404 /// @param eStream \b IN : stream type
2405 /// @param u32FrmPriData \b IN : specify the freezed frame index
2406 /// @param bEnable \b IN : enable/disable the freeze function
2407 /// @return VDEC_EX_Result
2408 //-------------------------------------------------------------------------------------------------
2409 VDEC_EX_Result  MApi_VDEC_EX_CaptureFrame(VDEC_StreamId *pStreamId, MS_U32 u32FrmPriData, MS_BOOL bEnable);
2410 
2411 //used for mstar close caption group
2412 //------------------------------------------------------------------------------
2413 /// Init mstar CC
2414 /// @param eStream \b IN : stream type
2415 /// @ingroup VdecCloseCaption
2416 /// @return VDEC_EX_Result
2417 ///     - E_VDEC_EX_OK: Success
2418 ///     - E_VDEC_EX_FAIL: Failed
2419 //------------------------------------------------------------------------------
2420 VDEC_EX_Result MApi_VDEC_EX_CC_Init(VDEC_StreamId *pStreamId, MS_U32 *pIn);
2421 //------------------------------------------------------------------------------
2422 /// Set mstar CC config
2423 /// @param eStream \b IN : stream type
2424 /// @param eFmt \b IN : cc format
2425 /// @param eType \b IN : cc type
2426 /// @ingroup VdecCloseCaption
2427 /// @return VDEC_EX_Result
2428 ///     - E_VDEC_EX_OK: Success
2429 ///     - E_VDEC_EX_FAIL: Failed
2430 //------------------------------------------------------------------------------
2431 VDEC_EX_Result MApi_VDEC_EX_CC_SetCfg(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt, VDEC_EX_CCType eType, MS_U32 *pIn);
2432 //------------------------------------------------------------------------------
2433 /// Set mstar CC start addr
2434 /// @param eStream \b IN : stream type
2435 /// @param eFmt \b IN : cc format
2436 /// @ingroup VdecCloseCaption
2437 /// @return VDEC_EX_Result
2438 ///     - E_VDEC_EX_OK: Success
2439 ///     - E_VDEC_EX_FAIL: Failed
2440 //------------------------------------------------------------------------------
2441 VDEC_EX_Result MApi_VDEC_EX_CC_SetBuffStartAdd(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt, MS_U32 *pIn);
2442 //------------------------------------------------------------------------------
2443 /// Update mstar CC write addr
2444 /// @param eStream \b IN : stream type
2445 /// @param eFmt \b IN : cc format
2446 /// @ingroup VdecCloseCaption
2447 /// @return VDEC_EX_Result
2448 ///     - E_VDEC_EX_OK: Success
2449 ///     - E_VDEC_EX_FAIL: Failed
2450 //------------------------------------------------------------------------------
2451 VDEC_EX_Result MApi_VDEC_EX_CC_UpdateWriteAdd(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt, MS_U32 *pIn);
2452 //------------------------------------------------------------------------------
2453 /// Update mstar CC read addr
2454 /// @param eStream \b IN : stream type
2455 /// @param eFmt \b IN : cc format
2456 /// @ingroup VdecCloseCaption
2457 /// @return VDEC_EX_Result
2458 ///     - E_VDEC_EX_OK: Success
2459 ///     - E_VDEC_EX_FAIL: Failed
2460 //------------------------------------------------------------------------------
2461 VDEC_EX_Result MApi_VDEC_EX_CC_UpdateReadAdd(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt, MS_U32 *pIn);
2462 //------------------------------------------------------------------------------
2463 /// Disable mstar CC parsing
2464 /// @param eStream \b IN : stream type
2465 /// @param eFmt \b IN : cc format
2466 /// @ingroup VdecCloseCaption
2467 /// @return VDEC_EX_Result
2468 ///     - E_VDEC_EX_OK: Success
2469 ///     - E_VDEC_EX_FAIL: Failed
2470 //------------------------------------------------------------------------------
2471 VDEC_EX_Result MApi_VDEC_EX_CC_DisableParsing(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt);
2472 //------------------------------------------------------------------------------
2473 /// Get mstar CC info
2474 /// @param eStream \b IN : stream type
2475 /// @param eFmt \b IN : cc format
2476 /// @ingroup VdecCloseCaption
2477 /// @return VDEC_EX_Result
2478 ///     - E_VDEC_EX_OK: Success
2479 ///     - E_VDEC_EX_FAIL: Failed
2480 //------------------------------------------------------------------------------
2481 VDEC_EX_Result MApi_VDEC_EX_CC_GetInfo(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt, VDEC_EX_CCInfoCmd eCmd, MS_U32 *pOut);
2482 //------------------------------------------------------------------------------
2483 /// Check mstar CC is RST done
2484 /// @param eStream \b IN : stream type
2485 /// @param eFmt \b IN : cc format
2486 /// @ingroup VdecCloseCaption
2487 /// @return VDEC_EX_Result
2488 ///     - E_VDEC_EX_OK: Success
2489 ///     - E_VDEC_EX_FAIL: Failed
2490 //------------------------------------------------------------------------------
2491 VDEC_EX_Result MApi_VDEC_EX_CC_GetIsRstDone(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt);
2492 //------------------------------------------------------------------------------
2493 /// Check mstar CC is overflow
2494 /// @param eStream \b IN : stream type
2495 /// @param eFmt \b IN : cc format
2496 /// @ingroup VdecCloseCaption
2497 /// @return VDEC_EX_Result
2498 ///     - E_VDEC_EX_OK: Success
2499 ///     - E_VDEC_EX_FAIL: Failed
2500 //------------------------------------------------------------------------------
2501 VDEC_EX_Result MApi_VDEC_EX_CC_GetIsBuffOverflow(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt);
2502 //------------------------------------------------------------------------------
2503 /// Get mstar CC write addr
2504 /// @param eStream \b IN : stream type
2505 /// @param eFmt \b IN : cc format
2506 /// @ingroup VdecCloseCaption
2507 /// @return VDEC_EX_Result
2508 ///     - E_VDEC_EX_OK: Success
2509 ///     - E_VDEC_EX_FAIL: Failed
2510 //------------------------------------------------------------------------------
2511 MS_PHY MApi_VDEC_EX_CC_GetWriteAdd(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt);
2512 //------------------------------------------------------------------------------
2513 /// Get mstar CC read addr
2514 /// @param eStream \b IN : stream type
2515 /// @param eFmt \b IN : cc format
2516 /// @ingroup VdecCloseCaption
2517 /// @return VDEC_EX_Result
2518 ///     - E_VDEC_EX_OK: Success
2519 ///     - E_VDEC_EX_FAIL: Failed
2520 //------------------------------------------------------------------------------
2521 MS_PHY MApi_VDEC_EX_CC_GetReadAdd(VDEC_StreamId *pStreamId, VDEC_EX_CCFormat eFmt);
2522 
2523 //System preseting function, it should be called when system init.
2524 VDEC_EX_Result MApi_VDEC_EX_SystemPreSetControl(VDEC_EX_User_Cmd cmd_id, void *pParam);
2525 // VDEC_EX_Result MApi_VDEC_EX_SystemPostSetControl(VDEC_EX_User_Cmd cmd_id, void *pParam);
2526 VDEC_EX_Result MApi_VDEC_EX_PreSetControl(VDEC_StreamId *pStreamId, VDEC_EX_User_Cmd cmd_id, MS_U32 param);
2527 #else
2528 
2529 #define PROTECTBUFFER_MAX_NUM  3
2530 typedef struct
2531 {
2532     MS_PHY u32Addr;    // PA
2533     MS_U32 u32Size;    // unit : byte
2534 
2535 } VDEC_EX_TEE_ProtectBufferInfo;
2536 
2537 
2538 typedef struct
2539 {
2540     MS_U32  u32VPUStartAddr;    // PA
2541     MS_U32  u32VPUCodeSize;     // unit : byte
2542     MS_U32  u32FrameBuffertartAddrMain;    // PA
2543     MS_U32  u32FrameBufferSizeMain;     // unit : byte
2544     MS_U32  u32BitstreamStartAddrMain; // PA
2545     MS_U32  u32BitstreamSizeMain;     // unit : byte
2546     MS_U32  u32FrameBuffertartAddrSub;    // PA
2547     MS_U32  u32FrameBufferSizeSub;     // unit : byte
2548     MS_U32  u32BitstreamStartAddrSub; // PA
2549     MS_U32  u32BitstreamSizeSub;     // unit : byte
2550 
2551     MS_U32  u32VPUSHMAddr;    // PA
2552     MS_U32  u32VPUSHMSize;    // unit : byte
2553     MS_U32  u32MIU1StartAddr; // PA
2554 
2555     MS_U32  u32ProtectNum;
2556     VDEC_EX_TEE_ProtectBufferInfo ProtectInfo[PROTECTBUFFER_MAX_NUM];
2557 } VDEC_EX_TEE_VPU_Param;
2558 
2559 typedef enum
2560 {
2561     E_VDEC_EX_SET_VPU_SETTING,
2562     E_VDEC_EX_GET_VPU_PROTECT_START_ADDR
2563 } VDEC_EX_TEE_USER_CMD;
2564 
2565 //Used for TEE
2566 //------------------------------------------------------------------------------
2567 /// GetControl for TEE
2568 /// @ingroup VDEC_TEE
2569 /// @param cmd \b IN : TEE user cmd
2570 /// @param param \b IN : TEE VPU parameters
2571 /// @return MS_BOOL
2572 //------------------------------------------------------------------------------
2573 MS_BOOL MApi_VDEC_EX_TEE_GetControl(VDEC_EX_TEE_USER_CMD cmd,void* param);
2574 
2575 
2576 //------------------------------------------------------------------------------
2577 /// SetControl for TEE
2578 /// @ingroup VDEC_TEE
2579 /// @param cmd \b IN : TEE user cmd
2580 /// @param param \b IN : TEE VPU parameters
2581 /// @return MS_BOOL
2582 //------------------------------------------------------------------------------
2583 MS_BOOL MApi_VDEC_EX_TEE_SetControl(VDEC_EX_TEE_USER_CMD cmd,void* param);
2584 
2585 
2586 //------------------------------------------------------------------------------
2587 /// GetControl for TEE
2588 /// @ingroup VDEC_TEE
2589 /// @return MS_BOOL
2590 //------------------------------------------------------------------------------
2591 MS_BOOL MApi_VDEC_EX_Create_Tee_System(void);
2592 
2593 #endif
2594 
2595 #ifdef __cplusplus
2596 }
2597 #endif
2598 
2599 
2600 #endif // _API_VDEC_EX_H_
2601 
2602