xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/apiVDEC.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.h
98 /// @brief  VDEC API
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _API_VDEC_H_
103 #define _API_VDEC_H_
104 
105 #include "MsDevice.h"
106 #include "MsTypes.h"
107 #ifdef __cplusplus
108 extern "C"
109 {
110 #endif
111 //-------------------------------------------------------------------------------------------------
112 //  Macro and Define
113 //-------------------------------------------------------------------------------------------------
114 #define MSIF_VDEC_LIB_CODE      {'V','D','E','C'}
115 #define MSIF_VDEC_LIBVER        {'0','E'}
116 #define MSIF_VDEC_BUILDNUM      {'0','2'}
117 #define MSIF_VDEC_CHANGELIST    {'0','0','6','8','9','1','8','8'}
118 
119 /// Version string.
120 #define VDEC_API_VERSION                /* Character String for DRV/API version             */  \
121     MSIF_TAG,                           /* 'MSIF'                                           */  \
122     MSIF_CLASS,                         /* '00'                                             */  \
123     MSIF_CUS,                           /* 0x0000                                           */  \
124     MSIF_MOD,                           /* 0x0000                                           */  \
125     MSIF_CHIP,                                                                                  \
126     MSIF_CPU,                                                                                   \
127     MSIF_VDEC_LIB_CODE,                 /* IP__                                             */  \
128     MSIF_VDEC_LIBVER,                   /* 0.0 ~ Z.Z                                        */  \
129     MSIF_VDEC_BUILDNUM,                 /* 00 ~ 99                                          */  \
130     MSIF_VDEC_CHANGELIST,               /* CL#                                              */  \
131     MSIF_OS
132 
133 #define VDEC_DEFAULT_DBG_MSG_LEVEL  E_VDEC_DBG_LEVEL_DBG
134 #define VDEC_RVD_BROKEN_BY_US   0x80000000
135 #define VDEC_MVD_PIC_START_FLAG 0x40000000
136 #define VDEC_BIT(_bit_)                  (1 << (_bit_))
137 
138 //-------------------------------------------------------------------------------------------------
139 //  Type and Structure
140 //-------------------------------------------------------------------------------------------------
141 
142 #define VDEC_FPA_TYPE_CHECKERBOARD_INTERLEAVING  0
143 #define VDEC_FPA_TYPE_COLUMN_INTERLEAVEING       1
144 #define VDEC_FPA_TYPE_ROW_INTERLEAVEING          2
145 #define VDEC_FPA_TYPE_SIDE_BY_SIDE_PACKING       3
146 #define VDEC_FPA_TYPE_TOP_BOTTOM_PACKING         4
147 #define VDEC_FPA_TYPE_TEMPORAL_INTERLEAVING_FRM  5
148 
149 /// Decoder event enumerator.
150 typedef enum
151 {
152     /// turn off all event
153     E_VDEC_EVENT_OFF                = 0x00,
154     /// display one frame/field
155     E_VDEC_EVENT_DISP_ONE           = VDEC_BIT(0),
156     /// repeat one frame/field
157     E_VDEC_EVENT_DISP_REPEAT        = VDEC_BIT(1),
158     /// one CC data should be displayed
159     E_VDEC_EVENT_DISP_WITH_CC       = VDEC_BIT(2),
160     /// decode one frame
161     E_VDEC_EVENT_DEC_ONE            = VDEC_BIT(3),
162     /// decode one I frame
163     E_VDEC_EVENT_DEC_I              = VDEC_BIT(4),
164     /// decode error
165     E_VDEC_EVENT_DEC_ERR            = VDEC_BIT(5),
166     /// display information is changed
167     E_VDEC_EVENT_DISP_INFO_CHG      = VDEC_BIT(6),
168     /// find user data
169     E_VDEC_EVENT_USER_DATA_FOUND    = VDEC_BIT(7),
170     /// display information ready after be changed
171     E_VDEC_EVENT_DISP_INFO_RDY      = VDEC_BIT(8),
172     /// first frame decoded
173     E_VDEC_EVENT_FIRST_FRAME        = VDEC_BIT(9),
174     /// first picture found
175     E_VDEC_EVENT_PIC_FOUND          = VDEC_BIT(10),
176     /// video is ready to display (no garbage and avsync done)
177     E_VDEC_EVENT_VIDEO_UNMUTE       = VDEC_BIT(11),
178     /// new sequence header found
179     E_VDEC_EVENT_SEQ_HDR_FOUND      = VDEC_BIT(12),
180     /// active format description found
181     E_VDEC_EVENT_AFD_FOUND          = VDEC_BIT(13),
182     // ES data invalid
183     E_VDEC_EVENT_ES_DATA_ERR        = VDEC_BIT(14),
184     /// speed up the un-mute screen on XC.
185     E_VDEC_EVENT_XC_LOW_DEALY       = VDEC_BIT(16)
186 } VDEC_EventFlag;
187 
188 //define VDEC CB type
189 typedef enum
190 {
191     E_VDEC_CB_MAIN  = 0,
192     E_VDEC_CB_SUB,
193 } VDEC_CB_TYPE;
194 
195 /// Codec type enumerator
196 typedef enum
197 {
198     ///Unsupported codec type
199     E_VDEC_CODEC_TYPE_NONE = 0,
200     ///MPEG-1 / MPEG-2
201     E_VDEC_CODEC_TYPE_MPEG2,
202     ///H263 (short video header)
203     E_VDEC_CODEC_TYPE_H263,
204     ///MPEG4 (default)
205     E_VDEC_CODEC_TYPE_MPEG4,
206     ///MPEG4 (Divx311)
207     E_VDEC_CODEC_TYPE_DIVX311,
208     ///MPEG4 (Divx412)
209     E_VDEC_CODEC_TYPE_DIVX412,
210     ///FLV
211     E_VDEC_CODEC_TYPE_FLV,
212     ///VC1 advanced profile (VC1)
213     E_VDEC_CODEC_TYPE_VC1_ADV,
214     ///VC1 main profile (RCV)
215     E_VDEC_CODEC_TYPE_VC1_MAIN,
216     ///Real Video version 8
217     E_VDEC_CODEC_TYPE_RV8,
218     ///Real Video version 9 and 10
219     E_VDEC_CODEC_TYPE_RV9,
220     ///H264
221     E_VDEC_CODEC_TYPE_H264,
222     ///AVS
223     E_VDEC_CODEC_TYPE_AVS,
224     ///MJPEG
225     E_VDEC_CODEC_TYPE_MJPEG,
226     ///MVC
227     E_VDEC_CODEC_TYPE_MVC,
228     ///VP8
229     E_VDEC_CODEC_TYPE_VP8,
230     ///HEVC
231     E_VDEC_CODEC_TYPE_HEVC,
232     ///VP9
233     E_VDEC_CODEC_TYPE_VP9
234 } VDEC_CodecType;
235 
236 /// Input source select enumerator
237 typedef enum
238 {
239     ///DTV mode
240     E_VDEC_SRC_MODE_DTV = 0,
241     ///TS file mode
242     E_VDEC_SRC_MODE_TS_FILE,
243     ///generic file mode
244     E_VDEC_SRC_MODE_FILE,
245     /// TS file and dual ES buffer mode
246     E_VDEC_SRC_MODE_TS_FILE_DUAL_ES,
247     ///generic file and dual ES buffer mode
248     E_VDEC_SRC_MODE_FILE_DUAL_ES,
249 } VDEC_SrcMode;
250 
251 /// Function return enumerator
252 typedef enum
253 {
254     ///failed
255     E_VDEC_FAIL = 0,
256     ///success
257     E_VDEC_OK,
258     ///invalid parameter
259     E_VDEC_RET_INVALID_PARAM,
260     ///access not allow
261     E_VDEC_RET_ILLEGAL_ACCESS,
262     ///hardware abnormal
263     E_VDEC_RET_HARDWARE_BREAKDOWN,
264      ///unsupported
265     E_VDEC_RET_UNSUPPORTED,
266      ///timeout
267     E_VDEC_RET_TIMEOUT,
268     ///not ready
269     E_VDEC_RET_NOT_READY,
270     ///not initial
271     E_VDEC_RET_NOT_INIT,
272     ///not exit after last initialization
273     E_VDEC_RET_NOT_EXIT,
274     ///not running, counter does not change
275     E_VDEC_RET_NOT_RUNNING,
276 } VDEC_Result;
277 
278 /// Action enumerator of display commands
279 typedef enum
280 {
281     /// Action- display frame
282     E_VDEC_DISP_ACTION_DISPLAY   = 1,
283     /// Action - release frame
284     E_VDEC_DISP_ACTION_RELEASE,
285 } VDEC_DispCmdAction;
286 
287 /// Freeze picture select after flush decoder
288 typedef enum
289 {
290     /// Freeze at current display picture
291     E_VDEC_FREEZE_AT_CUR_PIC = 1,
292     /// Freeze at the latest decode picture
293     E_VDEC_FREEZE_AT_LAST_PIC,
294 } VDEC_FreezePicSelect;
295 
296 /// Error code enumerator
297 typedef enum
298 {
299     E_VDEC_ERR_CODE_BASE = 0x01000000,
300     E_VDEC_ERR_CODE_NOT_SUPPORT,
301     E_VDEC_ERR_CODE_ILLEGAL_ACCESS,
302     E_VDEC_ERR_CODE_FRMRATE_NOT_SUPPORT,
303     E_VDEC_ERR_CODE_DIVX_PLUS_UNSUPPORTED,
304 
305     E_VDEC_MVD_ERR_CODE_BASE = 0x02000000,
306         E_VDEC_MVD_ERR_CODE_SHAPE              ,
307         E_VDEC_MVD_ERR_CODE_USED_SPRITE        ,
308         E_VDEC_MVD_ERR_CODE_NOT_8_BIT          ,   ///< error_status : bits per pixel
309         E_VDEC_MVD_ERR_CODE_NERPRED_ENABLE     ,
310         E_VDEC_MVD_ERR_CODE_REDUCED_RES_ENABLE ,
311         E_VDEC_MVD_ERR_CODE_SCALABILITY        ,
312         E_VDEC_MVD_ERR_CODE_OTHER              ,
313         E_VDEC_MVD_ERR_CODE_H263_ERROR         ,
314         E_VDEC_MVD_ERR_CODE_RES_NOT_SUPPORT    ,   ///< error_status : none
315         E_VDEC_MVD_ERR_CODE_MPEG4_NOT_SUPPORT  ,   ///< error_status : none
316         E_VDEC_MVD_ERR_CODE_PROFILE_NOT_SUPPORT  , ///< error_status : none
317         E_VDEC_MVD_ERR_CODE_RCV_ERROR_OCCUR    ,   ///< error_status : none
318         E_VDEC_MVD_ERR_CODE_VC1_NOT_SUPPORT    ,   ///< error_status : none
319         E_VDEC_MVD_ERR_CODE_UNKNOW_CODEC_NOT_SUPPORT  ,   ///< error_status : none
320         E_VDEC_MVD_ERR_CODE_SLQ_TBL_NOT_SUPPORT  , ///< error_status : none
321         E_VDEC_MVD_ERR_CODE_FRAME_BUF_NOT_ENOUGH , ///< error_status : none
322 
323     E_VDEC_HVD_ERR_CODE_BASE = 0x03000000,
324         E_VDEC_HVD_ERR_CODE_GENERAL_BASE = (0x0000|E_VDEC_HVD_ERR_CODE_BASE),
325         E_VDEC_HVD_ERR_CODE_OUT_OF_SPEC ,
326         E_VDEC_HVD_ERR_CODE_UNKNOW_ERR,
327         E_VDEC_HVD_ERR_CODE_HW_BREAK_DOWN,
328         E_VDEC_HVD_ERR_CODE_HW_DEC_TIMEOUT,
329         E_VDEC_HVD_ERR_CODE_OUT_OF_MEMORY,
330         E_VDEC_HVD_ERR_CODE_UNKNOWN_CODEC,
331         // AVC
332         E_VDEC_HVD_ERR_CODE_AVC_BASE = (0x1000|E_VDEC_HVD_ERR_CODE_BASE),
333         E_VDEC_HVD_ERR_CODE_AVC_SPS_BROKEN,
334         E_VDEC_HVD_ERR_CODE_AVC_SPS_NOT_IN_SPEC,
335         E_VDEC_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
336         E_VDEC_HVD_ERR_CODE_AVC_PPS_BROKEN,           ///< PPS is not valid
337         E_VDEC_HVD_ERR_CODE_AVC_REF_LIST,
338         E_VDEC_HVD_ERR_CODE_AVC_NO_REF,
339         E_VDEC_HVD_ERR_CODE_AVC_RES,
340         // AVS
341         E_VDEC_HVD_ERR_CODE_AVS_BASE = (0x2000|E_VDEC_HVD_ERR_CODE_BASE),
342         E_VDEC_HVD_ERR_CODE_AVS_RES,
343         // RM
344         E_VDEC_HVD_ERR_CODE_RM_BASE = (0x3000|E_VDEC_HVD_ERR_CODE_BASE),
345         E_VDEC_HVD_ERR_CODE_RM_PACKET_HEADER,
346         E_VDEC_HVD_ERR_CODE_RM_FRAME_HEADER,
347         E_VDEC_HVD_ERR_CODE_RM_SLICE_HEADER,
348         E_VDEC_HVD_ERR_CODE_RM_BYTE_CNT,
349         E_VDEC_HVD_ERR_CODE_RM_DISP_TIMEOUT,
350         E_VDEC_HVD_ERR_CODE_RM_NO_REF,
351         E_VDEC_HVD_ERR_CODE_RM_VLC,
352         E_VDEC_HVD_ERR_CODE_RM_SIZE,
353         E_VDEC_HVD_ERR_CODE_RM_RES,
354 
355     E_VDEC_RVD_ERR_CODE_BASE = 0x04000000,
356         E_VDEC_RVD_ERR_CODE_PACKET_HEADER,  ///< packet header version error
357         E_VDEC_RVD_ERR_CODE_FRAME_HEADER,   ///< frame type error
358         E_VDEC_RVD_ERR_CODE_SLICE_HEADER,   ///< slice header error
359         E_VDEC_RVD_ERR_CODE_DECODE_TIMEOUT, ///< decode MB timeout
360         E_VDEC_RVD_ERR_CODE_OUT_OF_MEMORY,  ///< frame buffer is out of memory
361         E_VDEC_RVD_ERR_CODE_BYTE_POS,       ///< can not find in ID table
362         E_VDEC_RVD_ERR_CODE_DISPLAY_TIMEOUT,///
363 
364     E_VDEC_MJPEG_ERR_CODE_BASE = 0x05000000,
365         E_VDEC_HVD_ERR_CODE_MJPEG_RES,
366 } VDEC_ErrCode;
367 
368 /// Frame rate conversion mode enumerator
369 typedef enum
370 {
371     /// Disable FRC mode.
372     E_VDEC_FRC_NORMAL = 0,
373     /// Output rate is twice of input rate (ex. 30p to 60p)
374     E_VDEC_FRC_DISP_TWICE,
375     /// 3:2 pulldown mode (ex. 24p to 60i or 60p)
376     E_VDEC_FRC_3_2_PULLDOWN,
377     /// PAL to NTSC conversion (50i to 60i)
378     E_VDEC_FRC_PAL_TO_NTSC,
379     /// NTSC to PAL conversion (60i to 50i)
380     E_VDEC_FRC_NTSC_TO_PAL,
381     /// Output rate 50P ->60P
382     E_VDEC_FRC_MODE_50P_60P,
383     /// Output rate 60P ->50P
384     E_VDEC_FRC_MODE_60P_50P,
385 } VDEC_FrcMode;
386 
387 /// Trick decode mode enumerator
388 typedef enum
389 {
390     /// decode all frame
391     E_VDEC_TRICK_DEC_ALL = 0,
392     /// decode all except of non-reference frame
393     E_VDEC_TRICK_DEC_IP,
394     /// only decode I frame
395     E_VDEC_TRICK_DEC_I,
396 } VDEC_TrickDec;
397 
398 /// Display speed setting enumerator
399 typedef enum
400 {
401     /// default speed type
402     E_VDEC_SPEED_DEFAULT = 0,
403     /// fast display
404     E_VDEC_SPEED_FAST,
405     /// slow display
406     E_VDEC_SPEED_SLOW,
407 } VDEC_SpeedType;
408 
409 /// The display speed enumerator
410 typedef enum
411 {
412     /// Normal display speed.
413     E_VDEC_DISP_SPEED_1X = 1,
414     /// 2X
415     E_VDEC_DISP_SPEED_2X = 2,
416     /// 4X
417     E_VDEC_DISP_SPEED_4X = 4,
418     /// 8X
419     E_VDEC_DISP_SPEED_8X = 8,
420     /// 16X
421     E_VDEC_DISP_SPEED_16X = 16,
422     /// 32X
423     E_VDEC_DISP_SPEED_32X = 32,
424 } VDEC_DispSpeed;
425 
426 /// Motion JPEG down scale factor enumerator
427 typedef enum
428 {
429     ///Original size
430     E_VDEC_MJPEG_SCALE_1to1 = 0,
431     ///Down scale to 1/2
432     E_VDEC_MJPEG_SCALE_2to1,
433     ///Down scale to 1/4
434     E_VDEC_MJPEG_SCALE_4to1,
435     ///Down scale to 1/8
436     E_VDEC_MJPEG_SCALE_8to1,
437 } VDEC_MJpegScaleFactor;
438 
439 /// Timestamp type of command queue
440 typedef enum
441 {
442     ///without timestamp information
443     E_VDEC_TIME_STAMP_NONE = 0,
444     ///PTS (Presentation Time Stamp)
445     E_VDEC_TIME_STAMP_PTS,
446     ///DTS (Decode Time Stamp)
447     E_VDEC_TIME_STAMP_DTS,
448     ///STS (Sorted Time Stamp)
449     E_VDEC_TIME_STAMP_STS,
450     ///PTS_RVU (Presentation Time Stamp)
451     E_VDEC_TIME_STAMP_PTS_MPEG_DIRECTV_SD,
452     ///DTS_RVU (Decode Time Stamp)
453     E_VDEC_TIME_STAMP_DTS_MPEG_DIRECTV_SD,
454 
455 } VDEC_TimeStampType;
456 
457 /// Debug level of VDEC
458 typedef enum
459 {
460     /// Disable all uart messages.
461     E_VDEC_DBG_LEVEL_NONE = 0,
462     /// Only output error messages
463     E_VDEC_DBG_LEVEL_ERR,
464     /// Output general messages, and above.
465     E_VDEC_DBG_LEVEL_INFO,
466     /// Output debug messages, and above.
467     E_VDEC_DBG_LEVEL_DBG,
468     /// Output function tracing messages, and above.
469     E_VDEC_DBG_LEVEL_TRACE,
470     /// Output FW messages.
471     E_VDEC_DBG_LEVEL_FW,
472 } VDEC_DbgLevel;
473 
474 /// Type of FW source
475 typedef enum
476 {
477     E_VDEC_FW_SOURCE_NONE,
478     E_VDEC_FW_SOURCE_DRAM,
479     E_VDEC_FW_SOURCE_FLASH,
480 }VDEC_FWSourceType;
481 
482 /// Format of CC (Closed Caption)
483 typedef enum
484 {
485     E_VDEC_CC_NONE       = 0x00,
486     E_VDEC_CC_608        = 0x01, //For CC608 or 157
487     E_VDEC_CC_708        = 0x02, //For CC708
488     E_VDEC_CC_UNPACKED   = 0x03,
489 } VDEC_CCFormat;
490 
491 /// Type of CC
492 typedef enum
493 {
494     E_VDEC_CC_TYPE_NONE = 0,
495     E_VDEC_CC_TYPE_NTSC_FIELD1 = 1,
496     E_VDEC_CC_TYPE_NTSC_FIELD2 = 2,
497     E_VDEC_CC_TYPE_DTVCC = 3,
498     E_VDEC_CC_TYPE_NTSC_TWOFIELD = 4,
499 } VDEC_CCType;
500 
501 typedef enum
502 {
503     E_VDEC_CC_GET_BUFF_START = 0x1,
504     E_VDEC_CC_GET_BUFF_SIZE,
505     E_VDEC_CC_GET_708_ENABLE
506 } VDEC_CCInfoCmd;
507 
508 typedef enum
509 {
510     E_VDEC_STAGE_STOP = 0,
511     E_VDEC_STAGE_INIT,
512     E_VDEC_STAGE_PLAY,
513     E_VDEC_STAGE_PAUSE,
514 } VDEC_Stage;
515 
516 
517 typedef enum
518 {
519     /// Used before MApi_VDEC_Flush().
520     E_VDEC_PATTERN_FLUSH = 0,
521     /// Used after MApi_VDEC_EnableLastFrameShow().
522     E_VDEC_PATTERN_FILEEND,
523 }VDEC_PatternType;
524 
525 typedef enum
526 {
527     E_VDEC_FW_STATUS_FLAG_NONE       = 0,
528     E_VDEC_FW_STATUS_FLAG_SEEK_TO_I  = VDEC_BIT(0),
529 }VDEC_FW_STATUS_FLAG;
530 
531 typedef struct
532 {
533     MS_BOOL bInit;
534     MS_BOOL bIdle;
535     VDEC_Stage  eStage;
536 } VDEC_Status;
537 
538 typedef struct
539 {
540     MS_U32 u32Tmp;
541 } VDEC_Info;
542 
543 typedef enum
544 {
545     E_VDEC_FRM_TYPE_I = 0,
546     E_VDEC_FRM_TYPE_P,
547     E_VDEC_FRM_TYPE_B,
548     E_VDEC_FRM_TYPE_OTHER,
549 } VDEC_FrameType;
550 
551 typedef enum
552 {
553     E_VDEC_FIELDTYPE_NONE,  ///< No field.
554     E_VDEC_FIELDTYPE_TOP,   ///< Top field only.
555     E_VDEC_FIELDTYPE_BOTTOM,///< Bottom field only.
556     E_VDEC_FIELDTYPE_BOTH,  ///< Both fields.
557 } VDEC_FieldType;
558 
559 typedef enum
560 {
561     E_VDEC_PATTERN_BEFORE_FRM = 0,
562     E_VDEC_PATTERN_AFTER_FRM,
563     E_VDEC_PATTERN_SKIP_DATA,
564 } VDEC_PatchPattern;
565 
566 typedef enum
567 {
568     E_VDEC_PIC_STRUCTURE_RSV = 0, //reserved
569     E_VDEC_PIC_STRUCTURE_TOP,
570     E_VDEC_PIC_STRUCTURE_BOT,
571     E_VDEC_PIC_STRCUTURE_FRM,
572 } VDEC_PicStructure;
573 
574 //VDEC set clock speed
575 typedef enum
576 {
577     E_VDEC_CLOCK_SPEED_NONE = 0,
578     E_VDEC_CLOCK_SPEED_HIGHEST,
579     E_VDEC_CLOCK_SPEED_HIGH,
580     E_VDEC_CLOCK_SPEED_MEDIUM,
581     E_VDEC_CLOCK_SPEED_LOW,
582     E_VDEC_CLOCK_SPEED_LOWEST,
583     E_VDEC_CLOCK_SPEED_DEFAULT,
584 } VDEC_ClockSpeed;
585 
586 //VDEC user command id
587 typedef enum
588 {
589     //Group1:Set Control command
590     VDEC_USER_CMD_SET_CONTROL_BASE = 0x0000,
591     VDEC_USER_CMD_REPEAT_LAST_FIELD,                // Param: 1(ON), 0(OFF)
592     VDEC_USER_CMD_AVSYNC_REPEAT_TH,                 // Param:0x01 ~ 0xFF(repeat times), 0xFF:always repeat when av is not sync
593     VDEC_USER_CMD_DISP_ONE_FIELD,                   // Param: 1(ON), 0(OFF)
594     VDEC_USER_CMD_FD_MASK_DELAY_COUNT,              // Param: unit is in vsync base for mute the fd_mask
595     VDEC_USER_CMD_FRC_OUTPUT,                       // Param: the address of VDEC_FRC_OutputParam
596     VDEC_USER_CMD_FRC_DROP_TYPE,                    // Param: 1(FRC_DROP_FIELD), 0(FRC_DROP_FRAME), default:0
597     VDEC_USER_CMD_FAST_DISPLAY,                     // Param: TRUE(Fast display), FALSE(Display until synced)
598     VDEC_USER_CMD_IGNORE_ERR_REF,                   // Param: TRUE(Ignore error reference), FALSE(Enable error reference handle)
599     VDEC_USER_CMD_FORCE_FOLLOW_DTV_SPEC,            // Param: 1(ON), 0(OFF)
600     VDEC_USER_CMD_AVC_MIN_FRM_GAP,                  // Param: Set the theshold of H264 frame gap, 0xFFFFFFFF don't care frame gap
601     VDEC_USER_CMD_DISABLE_SEQ_CHG,                  // Param: 1(Disable), 0(Enable)
602     VDEC_USER_CMD_AVC_DISABLE_ANTI_VDEAD,           // Param: 1(Disable), 0(Enable)
603     VDEC_USER_CMD_DTV_RESET_MVD_PARSER,             //
604     VDEC_USER_CMD_PVR_FLUSH_FRAME_BUFFER,           //
605     VDEC_USER_CMD_SET_DTV_USER_DATA_MODE,           // Param: 0(Support normal DVB CC, default case), 1(Support ATSC DirectTV CC), 2,3,4(Reserved)
606     VDEC_USER_CMD_SET_SINGLE_TASK_MODE,             // Param: 0(default case), 1(single task mode) for dual decoder
607     VDEC_USER_CMD_FORCE_INTERLACE_MODE,             // Param: 0(Disable), 1(Enable) DTV, TS-File mode force into interlace mode when framerate is 25 or 30
608     VDEC_USER_CMD_RELEASE_FD_MASK,
609     VDEC_USER_CMD_SET_DECODE_MODE,
610     VDEC_USER_CMD_SHOW_DECODE_ORDER,                // Param: 1(Disable), 0(Enable)
611     VDEC_USER_CMD_SUPPORT_AVC_TO_MVC,               // Param: 0(Do not support), 1(Support AVC to MVC)
612     VDEC_USER_CMD_3DLR_VIEW_EXCHANGE,               // Param: 0(Disable), 1(View L/R exhange)
613     VDEC_USER_CMD_FORCE_AUTO_MUTE,                  // param: 0(default case), 1(Enable)
614     VDEC_USER_CMD_SET_VSIZE_ALIGN,                  // Param: 0(Disable), 1(Enable)
615     VDEC_USER_CMD_AVC_DISP_IGNORE_CROP,             // Param: 0(Disable), 1(Enable)
616     VDEC_USER_CMD_SET_DISP_FINISH_MODE,             // Param: 0(Original), 1(Strict)
617     VDEC_USER_CMD_SET_AVSYNC_MODE,                  // Param: 0(Original), 1(Strict)
618     VDEC_USER_CMD_SET_CC608_INFO_ENHANCE_MODE,      // Param: 0(Disable), 1(Enable)
619     VDEC_USER_CMD_PUSH_DISPQ_WITH_REF_NUM,          // Param: 0(Disable), 1(Enable)
620     VDEC_USER_CMD_SET_IDCT_MODE,                    //Param: 0(Original), 1(new IDCT)
621     VDEC_USER_CMD_DROP_ERR_FRAME,                   // Param: 0(Disable), 1(Enable)
622     VDEC_USER_CMD_SHOW_FIRST_FRAME_DIRECT,          // Param: 0(Disable), 1(Enable), Push first frame to display queue directly..
623     VDEC_USER_CMD_SET_XC_LOW_DELAY_PARA,            // Param: arg0 for diff_field_number...
624     VDEC_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
625     VDEC_USER_CMD_SET_MIN_TSP_DATA_SIZE,            // Param: Resize HVD_FW_AVC_ES_MIN_TSP_DATA_SIZE
626     VDEC_USER_CMD_AVC_SUPPORT_REF_NUM_OVER_MAX_DPB_SIZE, // Param: 0(Disable), 1(Enable)
627     VDEC_USER_CMD_FRAMEBUFFER_AUTO_MODE,            // Param: 0(Disable), 1(Enable)
628     VDEC_USER_CMD_AUTO_DROP_DISPLAY_QUEUE,          // Param: 0(Disable), N = 1~16: Drop display queue when display queue above than N frames.
629     VDEC_USER_CMD_SET_PTS_US_MODE,                   //Param: 1(enable), 0(disable ) PTS output by micro second level,
630     VDEC_USER_CMD_FORCE_PROGRESSIVE_MODE,            // Param: 0(Disable), 1(Enable)
631     VDEC_USER_CMD_AVC_NEW_SLOW_MOTION,                 // Param: 0(Disable), 1(Enable)
632 
633     VDEC_USER_CMD_MVC_SET_CMD_BASE = 0x0800,
634     VDEC_USER_CMD_MVC_BBU2_PUSH_PACKET,             // Param: Packet Info.
635     VDEC_USER_CMD_MVC_BBU2_FIRE_DECCMD,             // Param: Non
636 
637     //Group2:Get Control command
638     VDEC_USER_CMD_GET_CONTROL_BASE = 0x1000,
639     VDEC_USER_CMD_GET_CHROMA_TYPE,
640     VDEC_USER_CMD_GET_REAL_FRAMERATE,               // Get Real FrameRate reported by decoder
641     VDEC_USER_CMD_GET_COLOR_MATRIX,                 // Get color matrix coefficients reported by decoder
642     VDEC_USER_CMD_GET_DYNSCALE_ENABLED,             // Get if DynamicScaling is enabled by firmware
643     VDEC_USER_CMD_GET_ORI_INTERLACE_MODE,
644     VDEC_USER_CMD_GET_FPA_SEI,                      // Get Frame Packing Arrangment information
645     VDEC_USER_CMD_GET_U64PTS,
646     VDEC_USER_CMD_GET_FB_USAGE_MEM,                 // Get FrameBuufer Size needed by decoder
647     VDEC_USER_CMD_GET_XC_LOW_DELAY_INT_STATE,       // Get xc_low_delay int state...
648     VDEC_USER_CMD_GET_FLUSH_PATTEN_ENTRY_NUM,        // Get Flush patten push based (unit : times)
649     VDEC_USER_CMD_GET_FW_STATUS_FLAG,
650     VDEC_USER_CMD_GET_DS_BUF_MIU_SEL,
651 
652     VDEC_USER_CMD_MVC_GET_CMD_BASE = 0x1800,
653     VDEC_USER_CMD_GET_MVC_SUB_FRAME_DISP_INFO,     // Param: VDEC_FrameInfo pointer.
654     VDEC_USER_CMD_GET_MVC_BBU2_DECQ_VACANCY,       // Param: BBU2 Dec Q Vacancy.
655     VDEC_USER_CMD_GET_MVC_ES2_READ_PTR,            // Param: ES2 read pointer.
656     VDEC_USER_CMD_GET_MVC_ES2_WRITE_PTR,           // Param: ES2 Write pointer.
657     VDEC_USER_CMD_GET_ES_QUANTITY,                 // Param: Get ES buffer Level.
658     VDEC_USER_CMD_GET_ES2_QUANTITY,                // Param: Get ES2 buffer Level.
659     VDEC_USER_CMD_GET_MAIN_STREAM_ID,              // Param: Get main stream ID.
660 
661     //Group3:System Preset Control command======================
662     //Group3-1:Common system Preset Control command
663     VDEC_USER_CMD_SYSTEM_PRESET_CONTROL_BASE    = 0x2000,
664     VDEC_USER_CMD_SYSTEM_PRESET_VPU_CLOCK,          //Param: VDEC_EX_ClockSpeed
665 
666     //Group3-2:HVD System Preset Control command
667     VDEC_USER_CMD_SYSTEM_PRESET_HVD_BASE        = 0x2100,
668     VDEC_USER_CMD_SYSTEM_PRESET_HVD_CLOCK,          //Param: VDEC_EX_ClockSpeed
669 
670     //Group3-3:MVD System Preset Control command
671     VDEC_USER_CMD_SYSTEM_PRESET_MVD_BASE        = 0x2200,
672     VDEC_USER_CMD_SYSTEM_PRESET_MVD_CLOCK,          //Param: VDEC_EX_ClockSpeed
673     VDEC_USER_CMD_VPU_SECURITY_MODE,               //Param: 0:disable,1:enable
674 
675     //Group4:Preset Control command=============================
676     VDEC_USER_CMD_PRESET_CONTROL_BASE           = 0x2300,
677     VDEC_USER_CMD_HVD_ONE_PENDING_BUFFER_MODE,  //Param: 0(Disable), 1(Enable), use only one pending buffer instead of two for HVD
678     VDEC_USER_CMD_MVD_HWBUFFER_REMAPPING_MODE,  //Param: 0(Disable), 1(Enable), Allcate HW buffer to start of frame buffer
679     VDEC_USER_CMD_FRAMERATE_HANDLING,           //Param: 1000~60000, Set frame rate when the sequence did not have frame rate info. The unit is (param/1000)fps, Ex: 30000 = 30.000 fps
680                                                     //Param: 0xFFFFFFFF, use default frame rate when no frame rate info in header
681     VDEC_USER_CMD_SET_SHAREMEMORY_BASE,
682     VDEC_USER_CMD_HVD_COL_BBU_MODE,                //Param: HVD use colocated BBU mode, 0: disable, 1: enable /*johnny.ko*/
683     VDEC_USER_CMD_HVD_IAPGN_BUF_SHARE_BW_MODE,   //Param: HVD IAP GN Buffer address,
684     VDEC_USER_CMD_DTV_DEBUG_MODE,
685     VDEC_USER_CMD_HVD_TS_IN_BBU_MODE,
686     VDEC_USER_CMD_AUTO_ARRANGE_FRAMEBUFFER_USAGE,
687     VDEC_USER_CMD_THUMBNAIL_MODE,
688     VDEC_USER_CMD_FORCE_8BIT_DEC_MODE,
689 } VDEC_User_Cmd;
690 
691 //VDEC FW TYPE
692 typedef enum
693 {
694     VDEC_FW_TYPE_MVD = 0,
695     VDEC_FW_TYPE_HVD,
696 } VDEC_FwType;
697 
698 //VDEC FB reduction type
699 typedef enum
700 {
701     VDEC_FB_REDUCTION_NONE = 0,
702     VDEC_FB_REDUCTION_1_2,
703     VDEC_FB_REDUCTION_1_4
704 } VDEC_FBReductionType;
705 
706 //VDEC XC_LOW_DELAY
707 typedef enum
708 {
709     // no any XC_LOW_DELAY event happened.
710     VDEC_XC_LOW_DELAY_NONE              = 0x00,
711     // XC_LOW_DELAY event for disable black screen.
712     VDEC_XC_DISABLE_BLACK_SCREEN        = VDEC_BIT(0),
713     // XC_LOW_DELAY event for release force_read_bank.
714     VDEC_XC_RELEASE_FORCE_READ_BANK     = VDEC_BIT(1),
715     // XC_LOW_DELAY event for release bob_mode.
716     VDEC_XC_RELEASE_BOB_MODE            = VDEC_BIT(2),
717 } VDEC_XcLowDelayType;
718 
719 /// Data structure of CC Configuration
720 typedef struct
721 {
722     /// 608 / 708
723     VDEC_CCFormat   eFormat;
724     /// CC type
725     VDEC_CCType     eType;
726     /// CC data start address
727     MS_VIRT          u32BufStAdd;
728     /// CC data size
729     MS_U32          u32BufSize;
730 } VDEC_CCCfg;
731 
732 /// Information for display setting
733 typedef struct
734 {
735     ///Bitstream horizontal size
736     MS_U16 u16HorSize;
737     ///Bitstream vertical size
738     MS_U16 u16VerSize;
739     ///Frame rate
740     MS_U32 u32FrameRate;
741     ///Interlace flag
742     MS_U8 u8Interlace;
743     ///Active format description
744     MS_U8 u8AFD;
745     ///Sample aspect rate width
746     MS_U16 u16SarWidth;
747     ///Sample aspect rate height
748     MS_U16 u16SarHeight;
749     ///Right cropping
750     MS_U16 u16CropRight;
751     ///Left cropping
752     MS_U16 u16CropLeft;
753     ///Bottom cropping
754     MS_U16 u16CropBottom;
755     ///Top cropping
756     MS_U16 u16CropTop;
757     ///Pitch
758     MS_U16 u16Pitch;
759     ///Interval of PTS
760     MS_U16 u16PTSInterval;
761     ///MPEG1 flag
762     MS_U8 u8MPEG1;
763     ///Play mode (fixme)
764     MS_U8 u8PlayMode;
765     ///FRC mode
766     MS_U8 u8FrcMode;
767     ///Aspect ratio code
768     MS_U8 u8AspectRate;
769     ///if FALSE, set VOP as mono mode (only for H264)
770     MS_BOOL bWithChroma;
771     /// if true, color space is xvYCC (Y from 16 to 235 and Cb , Cr from 16 to 240).
772     /// if false, color space is BT.601/709 (Y from  0 to 255 and Cb , Cr from  0 to 255).
773     /// only MPEG might be with BT.601/709
774     MS_BOOL bColorInXVYCC;
775     ///Dynamic scaling buffer address
776     MS_VIRT u32DynScalingAddr;
777     ///Dynamic scaling buffer size
778     MS_U32 u32DynScalingSize;
779     ///Dynamic scaling depth
780     MS_U8 u8DynScalingDepth;
781     ///Dynamic scaling DS buffer on miu1 or miu0
782     MS_BOOL bEnableMIUSel;
783     ///Display width
784     MS_U32 u32AspectWidth;
785     ///Display height
786     MS_U32 u32AspectHeight;
787 } VDEC_DispInfo;
788 
789 /// System configuration
790 typedef struct
791 {
792     ///FW binary start address
793     MS_PHY u32FWBinaryAddr;
794     ///FW binary size
795     MS_U32 u32FWBinarySize;
796     ///FW code buffer start address
797     MS_PHY u32CodeBufAddr;
798     ///FW code buffer size
799     MS_U32 u32CodeBufSize;
800     ///Frame buffer start address
801     MS_PHY u32FrameBufAddr;
802     ///Frame buffer size
803     MS_U32 u32FrameBufSize;
804     ///Bitstream buffer start address
805     MS_PHY u32BitstreamBufAddr;
806     ///Bitstream buffer size
807     MS_U32 u32BitstreamBufSize;
808     ///Driver process buffer start address
809     MS_PHY u32DrvProcBufAddr;
810     ///Driver process buffer size
811     MS_U32 u32DrvProcBufSize;
812     ///VLC table Binary address (RM only)
813     MS_PHY u32VlcBinarySrcAddr;
814     ///VLC table Binary size
815     MS_U32 u32VlcTabBinarySize;
816     ///Debug level setting
817     VDEC_DbgLevel eDbgMsgLevel;
818     ///FW source type seeting
819     VDEC_FWSourceType eFWSourceType;
820 } VDEC_SysCfg;
821 
822 /// Video information
823 typedef struct
824 {
825     ///input source mode
826     VDEC_SrcMode   eSrcMode;
827     /// timestamp type of command queue
828     VDEC_TimeStampType      eTimeStampType;
829     /// MJPEG scale factor
830     VDEC_MJpegScaleFactor   eMJpegScaleFactor;
831     /// should be TRUE when codec type is H264 and container is MKV and MP4(MOV)
832     MS_BOOL bWithoutNalStCode;
833     /// needless when CodecType is MJPEG and divx311
834     MS_U32 u32FrameRate;
835     MS_U32 u32FrameRateBase;
836     /// if divx311; use u16Width[0]; only need other elements when RV8
837     MS_U16  u16Width[8];
838     /// if divx311; use u16Height[0]; only need other elements when RV8
839     MS_U16  u16Height[8];
840     /// video number sizes (for RM)
841     MS_U16  u16NumSizes;
842 } VDEC_VideoInfo;
843 
844 /// Frame information
845 typedef struct
846 {
847     /// frame buffer base + the start offset of current displayed luma data. Unit: byte.
848     MS_PHY u32LumaAddr;
849     /// frame buffer base + the start offset of current displayed chroma data. Unit: byte.
850     MS_PHY u32ChromaAddr;
851     /// Time stamp(DTS, PTS) of current displayed frame. Unit: ms (todo: 90khz)
852     MS_U32 u32TimeStamp;
853     /// low part of ID number
854     MS_U32 u32ID_L;
855     /// high part of ID number or timestamp
856     MS_U32 u32ID_H;
857     /// pitch
858     MS_U16 u16Pitch;
859     /// width
860     MS_U16 u16Width;
861     /// height
862     MS_U16 u16Height;
863     ///< Frame type: I, P, B frame
864     VDEC_FrameType eFrameType;
865     ///< Field type: Top, Bottom, Both
866     VDEC_FieldType eFieldType;
867 } VDEC_FrameInfo;
868 
869 /// Extension display information
870 typedef struct
871 {
872     /// vertical size from sequene_display_extension
873     MS_U16 u16VSize;
874     /// horizontal size from sequene_display_extension
875     MS_U16 u16HSize;
876     /// vertical offset from picture_display_extension
877     MS_S16 s16VOffset;
878     /// horizontal offset from picture_display_extension
879     MS_S16 s16HOffset;
880 } VDEC_ExtDispInfo;
881 
882 /// Display frame information
883 typedef struct
884 {
885     ///< frame information
886     VDEC_FrameInfo stFrmInfo;
887     ///< firmware private data
888     MS_U32 u32PriData;
889     ///< index used by apiVDEC to manage VDEC_DispQ[][]
890     MS_U32 u32Idx;
891     ///< display information
892     VDEC_DispInfo stDispInfo;
893 } VDEC_DispFrame;
894 
895 /// Time code structure
896 typedef struct
897 {
898     ///  time_code_hours
899     MS_U8   u8TimeCodeHr;
900     ///  time_code_minutes
901     MS_U8   u8TimeCodeMin;
902     ///  time_code_seconds
903     MS_U8   u8TimeCodeSec;
904     ///  time_code_pictures
905     MS_U8   u8TimeCodePic;
906     ///  drop_frame_flag
907     MS_U8   u8DropFrmFlag;
908     ///  reserved fields for 4-byte alignment
909     MS_U8   u8Reserved[3];
910 } VDEC_TimeCode;
911 
912 /// VDEC frame buffer reduction
913 typedef struct
914 {
915     VDEC_FBReductionType eLumaFBReduction;
916     VDEC_FBReductionType eChromaFBReduction;
917     MS_BOOL              bEnableAutoMode;      /// 0: Disable, 1: Enable
918 } VDEC_FBReduction;
919 
920 /// Initial parameter
921 typedef struct
922 {
923     /// codec type
924     VDEC_CodecType  eCodecType;
925     /// system configuration
926     VDEC_SysCfg     SysConfig;
927     /// video information from container
928     VDEC_VideoInfo  VideoInfo;
929     /// dynamic scaling control bit
930     MS_BOOL         EnableDynaScale;
931     /// switch for display decode error frame or not
932     MS_BOOL         bDisableDropErrFrame;
933     /// switch for error concealment
934     MS_BOOL         bDisableErrConceal;
935     /// enable repeat last field when repeat happened at interlace stream
936     MS_BOOL         bRepeatLastField;
937     /// threshold to judge error frame
938     MS_U8           u8ErrThreshold;
939     /// dynamic scaling virtual box Width
940     MS_U32          u32DSVirtualBoxWidth;
941     /// dynamic scaling virtual box Height
942     MS_U32          u32DSVirtualBoxHeight;
943 } VDEC_InitParam;
944 
945 /// Initial parameter, version = 1
946 typedef struct
947 {
948     /// init param version : 1
949     MS_U32          u32Version;
950     /// codec type
951     VDEC_CodecType  eCodecType;
952     /// system configuration
953     VDEC_SysCfg     SysConfig;
954     /// video information from container
955     VDEC_VideoInfo  VideoInfo;
956     /// dynamic scaling control bit
957     MS_BOOL         EnableDynaScale;
958     /// switch for display decode error frame or not
959     MS_BOOL         bDisableDropErrFrame;
960     /// switch for error concealment
961     MS_BOOL         bDisableErrConceal;
962     /// enable repeat last field when repeat happened at interlace stream
963     MS_BOOL         bRepeatLastField;
964     /// threshold to judge error frame
965     MS_U8           u8ErrThreshold;
966     /// dynamic scaling virtual box Width
967     MS_U32          u32DSVirtualBoxWidth;
968     /// dynamic scaling virtual box Height
969     MS_U32          u32DSVirtualBoxHeight;
970     /// vdec frame buffer reduction setting
971     VDEC_FBReduction    stFBReduction;
972 } VDEC_InitParam_EX1;
973 
974 /// Decode Command
975 typedef struct
976 {
977     /// ID (high 4-bytes) or timestamp of payload (high byte)
978     MS_U32  u32ID_H;
979     /// ID (low 4-bytes)
980     MS_U32  u32ID_L;
981     /// start address of payload
982     MS_U32  u32StAddr;
983     /// size of payload
984     MS_U32  u32Size;
985     /// timestamp of payload
986     MS_U32  u32Timestamp;
987 } VDEC_DecCmd;
988 
989 /// Display Command
990 typedef struct
991 {
992     /// ID (high 4-bytes)
993     MS_U32  u32ID_H;
994     /// ID (low 4-bytes)
995     MS_U32  u32ID_L;
996     /// action of command
997     VDEC_DispCmdAction  eAction;
998 } VDEC_DispCmd;
999 
1000 typedef struct
1001 {
1002     MS_BOOL bEnable;
1003     MS_U32  u32Delay;
1004     MS_U16  u16Tolerance;
1005 } VDEC_AVSyncCfg;
1006 
1007 
1008 typedef void (*VDEC_EventCb)(MS_U32 eFlag, void *param);
1009 
1010 typedef struct
1011 {
1012     MS_U32              u32Version;
1013     /// top, bottom or frame
1014     VDEC_PicStructure   u8PicStructure;
1015     MS_U8               u8TopFieldFirst;
1016     MS_U16              u16TempRef;
1017     MS_U32              u32Pts;
1018     /// address of cc data
1019     MS_U32              u32UserDataBuf;
1020     /// size of cc data
1021     MS_U32              u32UserDataSize;
1022 } VDEC_CC_Info;
1023 
1024 ///CC input parameters for mstar proprietary CC library
1025 typedef struct
1026 {
1027     MS_U32 u32Ver;      ///version of this structure
1028     MS_U32 u32Val;
1029 } VDEC_CC_InputPara;
1030 
1031 typedef struct
1032 {
1033     MS_U32      u32OutputFrameRate; ///< output frame rate, unit:vsync count
1034     MS_U8       u8Interlace;        ///< output scan:0:progress, 1:interlace
1035 } VDEC_FRC_OutputParam;
1036 
1037 typedef struct
1038 {
1039     MS_U8   u8Frm_packing_arr_cnl_flag;
1040     MS_U8   u8Frm_packing_arr_type;
1041     MS_U8   u8content_interpretation_type;
1042     MS_U8   u1Quincunx_sampling_flag;
1043 
1044     MS_U8   u1Spatial_flipping_flag;
1045     MS_U8   u1Frame0_flipping_flag;
1046     MS_U8   u1Field_views_flag;
1047     MS_U8   u1Current_frame_is_frame0_flag;
1048 
1049     MS_U8   u1Frame0_self_contained_flag;
1050     MS_U8   u1Frame1_self_contained_flag;
1051     MS_U8   u4Frame0_grid_position_x;
1052     MS_U8   u4Frame0_grid_position_y;
1053 
1054     MS_U8   u4Frame1_grid_position_x;
1055     MS_U8   u4Frame1_grid_position_y;
1056     MS_U8   u8Reserved01;
1057     MS_U8   u8Reserved02;
1058 }VDEC_Frame_packing_SEI;
1059 
1060 
1061 //-------------------------------------------------------------------------------------------------
1062 //  Function and Variable
1063 //-------------------------------------------------------------------------------------------------
1064 // VDEC_Result MApi_VDEC_GetLibVer(const MSIF_Version **ppVersion);
1065 // VDEC_Result MApi_VDEC_GetInfo(const VDEC_Info **ppInfo);
1066 MS_BOOL     MApi_VDEC_GetStatus(VDEC_Status *pStatus);
1067 // MS_BOOL     MApi_VDEC_CheckCaps(VDEC_CodecType eCodecType);
1068 // VDEC_Result MApi_VDEC_EnableTurboMode(MS_BOOL bEnable);
1069 VDEC_Result MApi_VDEC_Init(VDEC_InitParam *pInitParam);
1070 // VDEC_Result MApi_VDEC_Init_EX(void *pInfo, MS_U32 u32Size);
1071 VDEC_Result MApi_VDEC_Rst(void);
1072 VDEC_Result MApi_VDEC_Exit(void);
1073 VDEC_Result MApi_VDEC_CheckDispInfoRdy(void);
1074 VDEC_Result MApi_VDEC_SetFrcMode(VDEC_FrcMode eFrcMode);
1075 VDEC_Result MApi_VDEC_SetDynScalingParams( MS_PHY u32Addr , MS_U32 u32Size);
1076 // VDEC_Result MApi_VDEC_SetDbgLevel(VDEC_DbgLevel eDbgLevel);
1077 
1078 
1079 VDEC_Result MApi_VDEC_Play(void);
1080 VDEC_Result MApi_VDEC_Pause(void);
1081 VDEC_Result MApi_VDEC_Resume(void);
1082 VDEC_Result MApi_VDEC_StepDisp(void);
1083 VDEC_Result MApi_VDEC_IsStepDispDone(void);
1084 VDEC_Result MApi_VDEC_StepDecode(void);
1085 VDEC_Result MApi_VDEC_IsStepDecodeDone(void);
1086 VDEC_Result MApi_VDEC_SetTrickMode(VDEC_TrickDec eTrickDec);
1087 VDEC_Result MApi_VDEC_SetBlockDisplay(MS_BOOL bEnable);
1088 
1089 VDEC_Result MApi_VDEC_EnableESBuffMalloc(MS_BOOL bEnable);
1090 MS_U32 MApi_VDEC_GetESBuffVacancy(void* pData);
1091 VDEC_Result MApi_VDEC_GetESBuff(MS_U32 u32ReqSize, MS_U32* u32AvailSize, MS_PHY* u32Addr);
1092 
1093 /*
1094 VDEC_Result MApi_VDEC_PushQueue(MS_U32 u32StAddr,
1095                                 MS_U32 u32Size,
1096                                 MS_U32 u32Timestamp,
1097                                 MS_U32 u32ID_H,
1098                                 MS_U32 u32ID_L);
1099 MS_U32      MApi_VDEC_GetQueueVacancy(void);
1100 VDEC_Result MApi_VDEC_FlushQueue(void);
1101 */
1102 
1103 VDEC_Result MApi_VDEC_PushDecQ(VDEC_DecCmd *pCmd);
1104 // VDEC_Result MApi_VDEC_PushDispQ(VDEC_DispCmd *pCmd);
1105 VDEC_Result MApi_VDEC_Flush(VDEC_FreezePicSelect eFreezePic);
1106 VDEC_Result MApi_VDEC_EnableLastFrameShow(MS_BOOL bEnable);
1107 VDEC_Result MApi_VDEC_SetSpeed(VDEC_SpeedType eSpeedType, VDEC_DispSpeed eSpeed);
1108 VDEC_Result MApi_VDEC_SetFreezeDisp(MS_BOOL bEnable);
1109 VDEC_Result MApi_VDEC_SetBlueScreen(MS_BOOL bOn);
1110 VDEC_Result MApi_VDEC_ResetPTS(MS_U32 u32PtsBase);
1111 VDEC_Result MApi_VDEC_AVSyncOn(MS_BOOL bOn, MS_U32 u32SyncDelay, MS_U16 u16SyncTolerance);
1112 VDEC_Result MApi_VDEC_SetAVSyncFreerunThreshold(MS_U32 u32Threshold );
1113 
1114 VDEC_Result MApi_VDEC_GetDispInfo(VDEC_DispInfo *pDispinfo);
1115 VDEC_Result MApi_VDEC_IsAVSyncOn(void);
1116 // VDEC_Result MApi_VDEC_IsWithValidStream(void);
1117 VDEC_Result MApi_VDEC_IsDispFinish(void);
1118 VDEC_Result MApi_VDEC_IsFrameRdy(void);
1119 VDEC_Result MApi_VDEC_IsIFrameFound(void);
1120 VDEC_Result MApi_VDEC_IsSeqChg(void);
1121 VDEC_Result MApi_VDEC_IsReachSync(void);
1122 // VDEC_Result MApi_VDEC_IsFreerun(void);
1123 // VDEC_Result MApi_VDEC_IsStartSync(void);
1124 // VDEC_Result MApi_VDEC_IsWithLowDelay(void);
1125 VDEC_Result MApi_VDEC_IsAllBufferEmpty(void);
1126 // VDEC_Result MApi_VDEC_GetExtDispInfo(VDEC_ExtDispInfo *pExtDispinfo);
1127 VDEC_Result MApi_VDEC_GetDecFrameInfo(VDEC_FrameInfo *pFrmInfo);
1128 VDEC_Result MApi_VDEC_GetDispFrameInfo(VDEC_FrameInfo *pFrmInfo);
1129 VDEC_Result MApi_VDEC_GetNextDispFrame(VDEC_DispFrame** ppDispFrm);
1130 VDEC_Result MApi_VDEC_DisplayFrame(VDEC_DispFrame *pDispFrm);
1131 VDEC_Result MApi_VDEC_ReleaseFrame(VDEC_DispFrame *pDispFrm);
1132 
1133 // VDEC_Result MApi_VDEC_GetDecTimeCode(VDEC_TimeCode* pTimeCode);
1134 // VDEC_Result MApi_VDEC_GetDispTimeCode(VDEC_TimeCode* pTimeCode);
1135 VDEC_Result MApi_VDEC_SetEvent(MS_U32 u32EnableEvent, VDEC_EventCb pfn, void* param);
1136 VDEC_Result MApi_VDEC_UnsetEvent(MS_U32 u32EnableEvent);
1137 // VDEC_Result MApi_VDEC_SetEvent_EX(VDEC_CB_TYPE cb_type, MS_U32 u32EnableEvent, VDEC_EventCb pfn, void* param);
1138 // VDEC_Result MApi_VDEC_UnsetEvent_EX(VDEC_CB_TYPE cb_type, MS_U32 u32EnableEvent);
1139 // VDEC_Result MApi_VDEC_GetEventInfo(MS_U32* u32EventFlag);
1140 // VDEC_Result MApi_VDEC_GetPatchPattern(VDEC_PatchPattern ePatternType, MS_U32 *pu32Staddr, MS_U32 *pu32Len);
1141 VDEC_Result MApi_VDEC_FireDecCmd(void);
1142 VDEC_Result MApi_VDEC_SeekToPTS(MS_U32 u32PTS);
1143 VDEC_Result MApi_VDEC_SkipToPTS(MS_U32 u32PTS);
1144 
1145 // Advanced Settings / Mode
1146 VDEC_Result MApi_VDEC_DisableDeblocking(MS_BOOL bDisable);
1147 // VDEC_Result MApi_VDEC_DisableQuarterPixel(MS_BOOL bDisable);
1148 // VDEC_Result MApi_VDEC_SetAutoRmLstZeroByte(MS_BOOL bOn);
1149 VDEC_Result MApi_VDEC_SetBalanceBW(MS_U8 u8QuarPixelTH, MS_U8 u8DeBlockingTH, MS_U8 u8UpperBound, MS_U8 u8SafeCoef);
1150 
1151 MS_U8       MApi_VDEC_GetActiveFormat(void);
1152 // MS_U8       MApi_VDEC_GetColourPrimaries(void);
1153 // MS_U8       MApi_VDEC_GetGOPCnt(void);
1154 MS_U32      MApi_VDEC_GetESWritePtr(void);
1155 MS_U32      MApi_VDEC_GetESReadPtr(void);
1156 MS_U32      MApi_VDEC_GetPTS(void);
1157 // MS_U32      MApi_VDEC_GetNextPTS(void);
1158 // MS_U32      MApi_VDEC_GetErrCode(void);
1159 MS_U32      MApi_VDEC_GetErrCnt(void);
1160 // MS_U32      MApi_VDEC_GetBitsRate(void);
1161 MS_U32      MApi_VDEC_GetFrameCnt(void);
1162 MS_U32      MApi_VDEC_GetSkipCnt(void);
1163 MS_U32      MApi_VDEC_GetDropCnt(void);
1164 MS_U32      MApi_VDEC_GetDecQVacancy(void);
1165 // MS_U32      MApi_VDEC_GetDispQVacancy(void);
1166 // MS_BOOL     MApi_VDEC_Is32PullDown(void);
1167 VDEC_Result MApi_VDEC_IsAlive(void);
1168 MS_S64      MApi_VDEC_GetVideoPtsStcDelta(void);
1169 // MS_BOOL     MApi_VDEC_IsCCAvailable(void);
1170 // VDEC_Result MApi_VDEC_GetCCInfo(void *pInfo, MS_U32 u32Size);
1171 
1172 // VDEC_TrickDec MApi_VDEC_GetTrickMode(void);
1173 VDEC_CodecType MApi_VDEC_GetActiveCodecType(void);
1174 
1175 // VDEC_Result MDrv_VDEC_GenPattern(VDEC_PatternType ePatternType ,  MS_PHY u32Addr , MS_U32* u32Size);
1176 VDEC_Result MApi_VDEC_GenPattern(VDEC_PatternType ePatternType, MS_PHY u32Addr, MS_U32 *pu32Size);
1177 MS_U32 MApi_VDEC_GetPatternLeastLength(VDEC_PatternType ePatternType );
1178 
1179 VDEC_Result MApi_VDEC_MHEG_DecodeIFrame(MS_PHY u32FrameBufAddr,
1180                                         MS_PHY u32SrcSt,
1181                                         MS_PHY u32SrcEnd);
1182 // VDEC_Result MApi_VDEC_MHEG_IsIFrameDecoding(void);
1183 // VDEC_Result MApi_VDEC_MHEG_RstIFrameDec(void);
1184 
1185 //ATSC Closed Caption control
1186 // VDEC_Result MApi_VDEC_CC_StartParsing(VDEC_CCCfg *pCCParam);
1187 // VDEC_Result MApi_VDEC_CC_StopParsing(void);
1188 // VDEC_Result MApi_VDEC_CC_GetWritePtr(MS_U32 *pWrite);
1189 // VDEC_Result MApi_VDEC_CC_GetReadPtr(MS_U32 *pRead);
1190 // VDEC_Result MApi_VDEC_CC_UpdateReadPtr(MS_U32 u32EachPacketSize);
1191 // VDEC_Result MApi_VDEC_CC_GetIsOverflow(MS_BOOL *pbOverflow);
1192 
1193 VDEC_Result MApi_VDEC_CC_Init(MS_U32 *pIn);
1194 VDEC_Result MApi_VDEC_CC_SetCfg(VDEC_CCFormat eFmt, VDEC_CCType eType, MS_U32 *pIn);
1195 VDEC_Result MApi_VDEC_CC_SetBuffStartAdd(VDEC_CCFormat eFmt, MS_U32 *pIn);
1196 VDEC_Result MApi_VDEC_CC_UpdateWriteAdd(VDEC_CCFormat eFmt, MS_U32 *pIn);
1197 VDEC_Result MApi_VDEC_CC_UpdateReadAdd(VDEC_CCFormat eFmt, MS_U32 *pIn);
1198 VDEC_Result MApi_VDEC_CC_DisableParsing(VDEC_CCFormat eFmt);
1199 VDEC_Result MApi_VDEC_CC_GetIsRstDone(VDEC_CCFormat eFmt);
1200 VDEC_Result MApi_VDEC_CC_GetIsBuffOverflow(VDEC_CCFormat eFmt);
1201 MS_PHY MApi_VDEC_CC_GetWriteAdd(VDEC_CCFormat eFmt);
1202 MS_PHY MApi_VDEC_CC_GetReadAdd(VDEC_CCFormat eFmt);
1203 
1204 // VDEC_Result MApi_VDEC_DbgCmd(MS_U32 u8Cmd, MS_U32 u32CmdArg);
1205 // VDEC_Result MApi_VDEC_DbgSetData(MS_VIRT u32Addr, MS_U32 u32Data);
1206 VDEC_Result MApi_VDEC_DbgGetData(MS_VIRT u32Addr, MS_U32 *u32Data);
1207 
1208 VDEC_Result MApi_VDEC_SetControl(VDEC_User_Cmd cmd_id, MS_VIRT param);
1209 VDEC_Result MApi_VDEC_PreSetControl(VDEC_User_Cmd cmd_id, MS_U32 param);
1210 
1211 MS_U32      MApi_VDEC_GetFwVersion(VDEC_FwType eFwType);
1212 
1213 MS_U32 MApi_VDEC_GetDispCnt(void);
1214 
1215 VDEC_Result MApi_VDEC_GetControl(VDEC_User_Cmd cmd_id, MS_U32 *param);
1216 // VDEC_Result MApi_VDEC_FlushPTSBuf(void);
1217 
1218 //System preseting function, it should be called when system init.
1219 // VDEC_Result MApi_VDEC_SystemPreSetControl(VDEC_User_Cmd cmd_id, void *pParam);
1220 
1221 
1222 // VDEC_Result MApi_VDEC_V2_SetPowerState(EN_POWER_MODE u16PowerState);
1223 
1224 // VDEC_Result MApi_VDEC_V2_GetLibVer(const MSIF_Version **ppVersion);
1225 // VDEC_Result MApi_VDEC_V2_GetInfo(const VDEC_Info **ppInfo);
1226 // MS_BOOL MApi_VDEC_V2_GetStatus(VDEC_Status *pStatus);
1227 // MS_BOOL MApi_VDEC_V2_CheckCaps(VDEC_CodecType eCodecType);
1228 // VDEC_Result MApi_VDEC_V2_EnableTurboMode(MS_BOOL bEnable);
1229 // VDEC_Result MApi_VDEC_V2_Init(VDEC_InitParam *pInitParam);
1230 // VDEC_Result MApi_VDEC_V2_Init_EX(void *pInfo, MS_U32 u32Size);
1231 // VDEC_Result MApi_VDEC_V2_Rst(void);
1232 // VDEC_Result MApi_VDEC_V2_Exit(MS_BOOL);
1233 // VDEC_Result MApi_VDEC_V2_CheckDispInfoRdy(void);
1234 // VDEC_Result MApi_VDEC_V2_SetFrcMode(VDEC_FrcMode eFrcMode);
1235 // VDEC_Result MApi_VDEC_V2_SetDynScalingParams( MS_PHY u32Addr , MS_U32 u32Size);
1236 // VDEC_Result MApi_VDEC_V2_Play(void);
1237 // VDEC_Result MApi_VDEC_V2_Pause(void);
1238 // VDEC_Result MApi_VDEC_V2_Resume(void);
1239 // VDEC_Result MApi_VDEC_V2_StepDisp(void);
1240 // VDEC_Result MApi_VDEC_V2_IsStepDispDone(void);
1241 // VDEC_Result MApi_VDEC_V2_SeekToPTS(MS_U32 u32PTS);
1242 // VDEC_Result MApi_VDEC_V2_SkipToPTS(MS_U32 u32PTS);
1243 // VDEC_Result MApi_VDEC_V2_StepDecode(void);
1244 // VDEC_Result MApi_VDEC_V2_IsStepDecodeDone(void);
1245 // VDEC_Result MApi_VDEC_V2_SetTrickMode(VDEC_TrickDec eTrickDec);
1246 // VDEC_Result MApi_VDEC_V2_PushDecQ(VDEC_DecCmd *pCmd);
1247 // VDEC_Result MApi_VDEC_V2_FireDecCmd(void);
1248 // MS_U32 MApi_VDEC_V2_GetDecQVacancy(void);
1249 // MS_BOOL MApi_VDEC_V2_IsCCAvailable(void);
1250 // VDEC_Result MApi_VDEC_V2_GetCCInfo(void *pInfo, MS_U32 u32Size);
1251 // VDEC_Result MApi_VDEC_V2_Flush(VDEC_FreezePicSelect eFreezePic);
1252 // MS_U32 MApi_VDEC_V2_GetESWritePtr(void);
1253 // MS_U32 MApi_VDEC_V2_GetESReadPtr(void);
1254 // VDEC_Result MApi_VDEC_V2_EnableLastFrameShow(MS_BOOL bEnable);
1255 // VDEC_Result MApi_VDEC_V2_IsDispFinish(void);
1256 // VDEC_Result MApi_VDEC_V2_SetSpeed(VDEC_SpeedType eSpeedType, VDEC_DispSpeed eSpeed);
1257 // VDEC_Result MApi_VDEC_V2_IsFrameRdy(void);
1258 // VDEC_Result MApi_VDEC_V2_SetFreezeDisp(MS_BOOL bEnable);
1259 // VDEC_Result MApi_VDEC_V2_SetBlueScreen(MS_BOOL bOn);
1260 // VDEC_Result MApi_VDEC_V2_ResetPTS(MS_U32 u32PtsBase);
1261 // VDEC_Result MApi_VDEC_V2_AVSyncOn(MS_BOOL bOn, MS_U32 u32SyncDelay, MS_U16 u16SyncTolerance);
1262 // VDEC_Result MApi_VDEC_V2_SetAVSyncFreerunThreshold(MS_U32 u32Threshold );
1263 // VDEC_Result MApi_VDEC_V2_IsAVSyncOn(void);
1264 // MS_U32 MApi_VDEC_V2_GetPTS(void);
1265 // MS_U32 MApi_VDEC_V2_GetNextPTS(void);
1266 // VDEC_Result MApi_VDEC_V2_IsStartSync(void);
1267 // VDEC_Result MApi_VDEC_V2_IsReachSync(void);
1268 // VDEC_Result MApi_VDEC_V2_IsFreerun(void);
1269 // VDEC_Result MApi_VDEC_V2_MHEG_DecodeIFrame(MS_PHY u32FrameBufAddr,
1270 //                                         MS_PHY u32SrcSt,
1271 //                                         MS_PHY u32SrcEnd);
1272 // VDEC_Result MApi_VDEC_V2_MHEG_IsIFrameDecoding(void);
1273 // VDEC_Result MApi_VDEC_V2_MHEG_RstIFrameDec(void);
1274 // MS_U32 MApi_VDEC_V2_GetErrCode(void);
1275 // MS_U32 MApi_VDEC_V2_GetErrCnt(void);
1276 // VDEC_CodecType MApi_VDEC_V2_GetActiveCodecType(void);
1277 // MS_U32 MApi_VDEC_V2_GetBitsRate(void);
1278 // MS_BOOL MApi_VDEC_V2_Is32PullDown(void);
1279 // VDEC_Result MApi_VDEC_V2_IsAlive(void);
1280 // MS_S64 MApi_VDEC_V2_GetVideoPtsStcDelta(void);
1281 // VDEC_Result MApi_VDEC_V2_IsWithValidStream(void);
1282 // VDEC_Result MApi_VDEC_V2_IsIFrameFound(void);
1283 // VDEC_Result MApi_VDEC_V2_IsWithLowDelay(void);
1284 // VDEC_Result MApi_VDEC_V2_IsAllBufferEmpty(void);
1285 // MS_U8 MApi_VDEC_V2_GetGOPCnt(void);
1286 // MS_U32 MApi_VDEC_V2_GetFrameCnt(void);
1287 // MS_U32 MApi_VDEC_V2_GetSkipCnt(void);
1288 // MS_U32 MApi_VDEC_V2_GetDropCnt(void);
1289 // VDEC_Result MApi_VDEC_V2_GetDispInfo(VDEC_DispInfo *pDispinfo);
1290 // VDEC_TrickDec MApi_VDEC_V2_GetTrickMode(void);
1291 // MS_U8 MApi_VDEC_V2_GetActiveFormat(void);
1292 // MS_U8 MApi_VDEC_V2_GetColourPrimaries(void);
1293 // VDEC_Result MApi_VDEC_V2_GetHWKey(MS_U8 *pu8Key);
1294 // VDEC_Result MApi_VDEC_V2_IsSeqChg(void);
1295 // VDEC_Result MApi_VDEC_V2_SetDbgLevel(VDEC_DbgLevel eDbgLevel);
1296 // VDEC_Result MApi_VDEC_V2_GetDecFrameInfo(VDEC_FrameInfo* pFrmInfo);
1297 // VDEC_Result MApi_VDEC_V2_GetDispFrameInfo(VDEC_FrameInfo *pFrmInfo);
1298 // VDEC_Result MApi_VDEC_V2_GetExtDispInfo(VDEC_ExtDispInfo *pExtDispinfo);
1299 // VDEC_Result MApi_VDEC_V2_GetDecTimeCode(VDEC_TimeCode* pTimeCode);
1300 // VDEC_Result MApi_VDEC_V2_GetDispTimeCode(VDEC_TimeCode* pTimeCode);
1301 // VDEC_Result MApi_VDEC_V2_CC_StartParsing(VDEC_CCCfg* pCCParam);
1302 // VDEC_Result MApi_VDEC_V2_CC_StopParsing(void);
1303 // VDEC_Result MApi_VDEC_V2_CC_GetWritePtr(MS_U32* pu32Write);
1304 // VDEC_Result MApi_VDEC_V2_CC_GetReadPtr(MS_U32* pu32Write);
1305 // VDEC_Result MApi_VDEC_V2_CC_UpdateReadPtr(MS_U32 u32EachPacketSize);
1306 // VDEC_Result MApi_VDEC_V2_CC_GetIsOverflow(MS_BOOL* pbOverflow);
1307 // VDEC_Result MApi_VDEC_V2_SetEvent(MS_U32 u32EnableEvent, VDEC_EventCb pfn, void* param);
1308 // VDEC_Result MApi_VDEC_V2_UnsetEvent(MS_U32 u32EnableEvent);
1309 // VDEC_Result MApi_VDEC_V2_SetEvent_EX(VDEC_CB_TYPE cb_type, MS_U32 u32EnableEvent, VDEC_EventCb pfn, void* param);
1310 // VDEC_Result MApi_VDEC_V2_UnsetEvent_EX(VDEC_CB_TYPE cb_type, MS_U32 u32EnableEvent);
1311 // VDEC_Result MApi_VDEC_V2_GetEventInfo(MS_U32* u32EventFlag);
1312 // VDEC_Result MApi_VDEC_V2_GenPattern(VDEC_PatternType ePatternType,    MS_PHY u32Addr, MS_U32 *pu32Size);
1313 // MS_U32 MApi_VDEC_V2_GetPatternLeastLength(VDEC_PatternType ePatternType );
1314 // VDEC_Result MApi_VDEC_V2_DisableDeblocking(MS_BOOL bDisable);
1315 // VDEC_Result MApi_VDEC_V2_DisableQuarterPixel(MS_BOOL bDisable);
1316 // VDEC_Result MApi_VDEC_V2_SetAutoRmLstZeroByte(MS_BOOL bOn);
1317 // VDEC_Result MApi_VDEC_V2_SetBalanceBW(MS_U8 u8QuarPixelTH, MS_U8 u8DeBlockingTH, MS_U8 u8UpperBound, MS_U8 u8SafeCoef);
1318 // VDEC_Result MApi_VDEC_V2_DbgDumpStatus(void);
1319 // VDEC_Result MApi_VDEC_V2_SetControl(VDEC_User_Cmd cmd_id, MS_U32 param);
1320 // VDEC_Result MApi_VDEC_V2_GetControl(VDEC_User_Cmd cmd_id, MS_U32 *param);
1321 // MS_U32 MApi_VDEC_V2_GetDispCnt(void);
1322 // MS_U32 MApi_VDEC_V2_GetFwVersion(VDEC_FwType eFwType);
1323 // VDEC_Result MApi_VDEC_V2_SetBlockDisplay(MS_BOOL bEnable);
1324 // VDEC_Result MApi_VDEC_V2_EnableESBuffMalloc(MS_BOOL bEnable);
1325 // MS_U32 MApi_VDEC_V2_GetESBuffVacancy(void* pData);
1326 // VDEC_Result MApi_VDEC_V2_GetESBuff(MS_U32 u32ReqSize, MS_U32* u32AvailSize, MS_PHY* u32Addr);
1327 // VDEC_Result MApi_VDEC_V2_GetNextDispFrame(VDEC_DispFrame** ppDispFrm);
1328 // VDEC_Result MApi_VDEC_V2_DisplayFrame(VDEC_DispFrame *pDispFrm);
1329 // VDEC_Result MApi_VDEC_V2_DisplayFrame(VDEC_DispFrame *pDispFrm);
1330 // VDEC_Result MApi_VDEC_V2_FlushPTSBuf(void);
1331 // VDEC_Result MApi_VDEC_V2_CaptureFrame(MS_U32 u32FrmPriData, MS_BOOL bEnable);
1332 // VDEC_Result MApi_VDEC_V2_CC_Init(MS_U32 *pIn);
1333 // VDEC_Result MApi_VDEC_V2_CC_SetCfg(VDEC_CCFormat eFmt, VDEC_CCType eType, MS_U32 *pIn);
1334 // VDEC_Result MApi_VDEC_V2_CC_SetBuffStartAdd(VDEC_CCFormat eFmt, MS_U32 *pIn);
1335 // VDEC_Result MApi_VDEC_V2_CC_UpdateWriteAdd(VDEC_CCFormat eFmt, MS_U32 *pIn);
1336 // VDEC_Result MApi_VDEC_V2_CC_UpdateReadAdd(VDEC_CCFormat eFmt, MS_U32 *pIn);
1337 // VDEC_Result MApi_VDEC_V2_CC_DisableParsing(VDEC_CCFormat eFmt);
1338 // VDEC_Result MApi_VDEC_V2_CC_GetInfo(VDEC_CCFormat eFmt, VDEC_CCInfoCmd eCmd, MS_U32 *pOut);
1339 // VDEC_Result MApi_VDEC_V2_CC_GetIsRstDone(VDEC_CCFormat eFmt);
1340 // VDEC_Result MApi_VDEC_V2_CC_GetIsBuffOverflow(VDEC_CCFormat eFmt);
1341 // MS_PHY MApi_VDEC_V2_CC_GetWriteAdd(VDEC_CCFormat eFmt);
1342 // MS_PHY MApi_VDEC_V2_CC_GetReadAdd(VDEC_CCFormat eFmt);
1343 // VDEC_Result MApi_VDEC_V2_CC_SystemPreSetControl(VDEC_User_Cmd cmd_id, void *pParam);
1344 // VDEC_Result MApi_VDEC_V2_CC_PreSetControl(VDEC_User_Cmd cmd_id, MS_U32 param);
1345 
1346 
1347 
1348 
1349 
1350 
1351 #ifdef __cplusplus
1352 }
1353 #endif
1354 
1355 #endif // _API_VDEC_H_
1356