kinf.h
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:10k
- //
- // FILE
- // kinf.h
- //
- // DESCRIPTION
- // This file is to provide an interface between kernel programs
- // and upper software. Don't place anything other than kernel
- // definitions.
- // Also always make sure this file is coherent with the kernel
- // program.
- //
- #ifndef __KINF_H
- #define __KINF_H
- #include "types.h"
- #include "cpu.h"
- #include "framebuf.h"
- #include "viddec.h"
- extern const UINT8 KernelVersion[];
- // NAV
- extern UINT8 new_cell;
- // DIP
- extern UINT8 dip_sel;
- extern UINT8 dip_enable;
- // MB22
- extern UINT8 mb22_en;
- // hardware clock gating
- extern UINT8 kernel_clock_gating;
- // error concealment
- extern UINT32 kernel_error_counter;
- extern UINT8 kernel_error_concealment;
- extern UINT8 kernel_error_mb_threshold;
- // for portable
- extern UINT8 kernel_portable_bonding;
- // system-layer
- extern UINT8 kiPckType;
- #define KI_PCKTYPE_VOB 0
- #define KI_PCKTYPE_AOB 1
- #define KI_IS_VOB_PCK() (KI_PCKTYPE_VOB == kiPckType)
- #define KI_IS_AOB_PCK() (KI_PCKTYPE_AOB == kiPckType)
- extern UINT8 kiAuStream;
- extern UINT8 kiAuStreamNum;
- #define KI_AU_STREAM_PCM 0xa0
- #define KI_AU_STREAM_AC3 0x80
- #define KI_AU_STREAM_DTS 0x88
- #define KI_AU_STREAM_MPG 0xc0
- #define KI_AU_TYPE_MASK 0xf8
- #define KI_AU_MPG_MASK 0xe0
- #define KI_AU_STREAM_MASK 0x07
- #define AUDIO_TIME_STAMP 0
- #define VIDEO_TIME_STAMP 1
- #define SUPIC_TIME_STAMP 2
- #define TIME_TYPE_DTS PIC_CHK_DTS
- #define TIME_TYPE_PTS PIC_CHK_PTS
- #define IS_DTS_TIME_STAMP(type) (((type)&TIME_TYPE_DTS) == TIME_TYPE_DTS)
- #define IS_PTS_TIME_STAMP(type) (((type)&TIME_TYPE_PTS) == TIME_TYPE_PTS)
- #define IS_SRC_MPEG1(opt) ((opt&(PIC_MPEG2|PIC_MPEG4)) == 0)
- #define IS_SRC_MPEG2(opt) (opt&PIC_MPEG2)
- #define IS_SRC_MPEG4(opt) (opt&PIC_MPEG4)
- // buffer control function and defines
- void set_av_time_stamp(UINT32 media, UINT32 type, INT64 time_stamp);
- void av_check_buf_full(int avflg, UINT32 mode);
- #define DVD_SYNC_MODE 0x0
- #define SIMPLE_SYNC_MODE 0x1
- #define AUDIO_FULL 0x0
- #define VIDEO_FULL 0x1
- #define SUPIC_FULL 0x2
- // video decode option
- #define VID_NORMAL_DEC 0
- #define VID_SKIP_B (1 << 0)
- #define VID_FLD_DEC (1 << 1)
- #define VID_PEND_DEC (1 << 2)
- #define VID_SKIP_P (1 << 3)
- #define VID_DISABLE_AVSYNC (1 << 4)
- #define VID_VFULL_DEC (1 << 5)
- #define IS_VID_NORMAL_DEC() (video_dec_opt == VID_NORMAL_DEC)
- #define IS_VID_SKIP_B() ((video_dec_opt&VID_SKIP_B) > 0)
- #define IS_VID_SKIP_P() ((video_dec_opt&VID_SKIP_P) > 0)
- #define IS_VID_FLD_DEC() ((video_dec_opt&VID_FLD_DEC) > 0)
- #define IS_VID_PEND_DEC() ((video_dec_opt&VID_PEND_DEC) > 0)
- #define IS_VID_DIS_AVSYNC() ((video_dec_opt&VID_DISABLE_AVSYNC) > 0)
- #define IS_VID_VFULL_DEC() ((video_dec_opt&VID_VFULL_DEC) > 0)
- #define SET_VIDDEC_OPT(x) (video_dec_opt = (x))
- #define GET_VIDDEC_OPT() (video_dec_opt)
- extern void set_avsync_option(UINT32 option);
- // frame rate control
- void frctl_clear_count();
- void frctl_set_display_rate();
- void frctl_set_frame_rate(int rate, int scale);
- UINT64 frctl_frame_to_stc(UINT32 frame);
- UINT32 frctl_frame_to_time(UINT32 frame);
- UINT32 frctl_time_to_frame(UINT32 time);
- //#ifdef SUPPORT_MP4
- extern int (*intr_decode_mp4_video)(int will_be_top_field, int decode_synced);
- extern int (*intr_dec_avi_sup)(int will_be_top_field);
- extern int (*calc_accm_audio_fPTS)();
- // get_mp4_video_codec()
- #define MPEG4_ISO 0
- #define MPEG4_SHORT_HEADER 1
- #define MPEG4_DIVX_311 2
- #define MPEG4_DIVX_412 3
- #define MPEG4_DIVX_5 4
- // video_property_flag
- extern UINT32 video_property_flag;
- #define MPEG4_TYPE_FLAG (1 << 0) // MPEG-4
- #define MPEG4_INTERLACED_FLAG (1 << 1) // Interlaced
- #define MPEG4_SHORT_FLAG (1 << 2) // Short Header
- #define MPEG4_GMC_FLAG (1 << 3) // Global Motion Compensation
- #define MPEG4_QPEL_FLAG (1 << 4) // Quarter Pixel
- #define IS_MPEG4_INTERLACED() ((video_property_flag&MPEG4_INTERLACED_FLAG) > 0)
- #define IS_MPEG4_SHORT_HEADER() ((video_property_flag&MPEG4_SHORT_FLAG) > 0)
- #define IS_MPEG4_GMC() ((video_property_flag&MPEG4_GMC_FLAG) > 0)
- #define IS_MPEG4_QPEL() ((video_property_flag&MPEG4_QPEL_FLAG) > 0)
- // mp4vid_status
- // set by video parser, and cleared by file parser
- extern UINT8 mp4vid_status;
- #define MPEG4_STATUS_NEED_DATA 0 // need more data
- #define MPEG4_STATUS_ERROR_UNSUPPORTED 1 // error of unsupported options
- #define MPEG4_STATUS_ERROR_SEQUENCE 2 // error of parsing the sequence header
- #define MPEG4_STATUS_ERROR_PICTURE 3 // error of parsing the picture
- #define MPEG4_STATUS_OK MPEG4_STATUS_NEED_DATA
- void set_mp4_frame(UINT32 frame);
- #define GET_MP4_FRAME() (decoded_frame)
- #define GET_MP4_TIME() frctl_frame_to_time(decoded_frame) // in seconds
- #define GET_MP4_STC() frctl_frame_to_stc(decoded_frame)
- // Initialization for each MPEG-4 file
- int mp4vid_init(int width, int height, UINT32, UINT32);
- // Initialization of an AVI chunk of MPEG-4.
- inline void mp4vid_chunk_initialize();
- void restart_mp4_video_engine();
- // GOTO request. If 0 is returned, the GOTO request can not be performed.
- int mp4vid_goto(int skip_vop_number);
- void mp4_avfilled(int avflg);
- inline UINT32 get_mp4_video_codec();
- //#endif // SUPPORT_MP4
- extern INT8 R_skip; /* used to skip REF pictures */
- extern INT16 B_skip; /* used to skip B picture */
- extern INT8 P_frame; // play P_frame and stop, if (P_frame==0) normal play
- // if (P_frame<0) stop
- extern INT8 P_vobu; // play P_vobu and stop, if (P_vobu==0) normal play
- // if (P_vobu<0) stop
- //
- extern UINT8 vobu_DSI_valid;
- extern UINT8 nav_pck_cntr;
- extern BYTE sequence_start;
- extern UINT32 play_finish_time;
- extern INT64 scr_current;
- extern INT64 PTS_audio;
- extern INT64 PTS_video;
- extern UINT8 picture_parsing_entry;
- extern UINT8 picture_parsed_entry;
- extern UINT8 picture_decoding_entry;
- extern UINT8 picture_coding_type;
- extern UINT16 pic_coding_ext0;
- extern INT16 vbv_y;
- extern INT16 vbv_x;
- extern INT16 vbv_by;
- extern INT16 vbv_bx;
- #define video_parsing_barrier vbv_by
- /*
- ** STREAM ID
- */
- extern UINT8 stream_video;
- extern UINT8 stream_audio;
- extern UINT8 stream_audio_table[8];
- extern UINT8 stream_sup_table[15];
- extern UINT8 sub_stream_id_sup;
- extern UINT8 sub_stream_id_sup_2;
- /*
- */
- extern UINT8 audio_filled;
- extern UINT8 video_filled;
- extern UINT8 avbuf_filled;
- extern UINT8 video_slow_wait;
- extern UINT8 forward_ref_option;
- extern INT8 dis_pic_id_saved_0;
- extern INT8 dis_field_cntr;
- extern INT8 dec_field_cntr;
- extern UINT32 decoded_pic;
- extern UINT32 decoded_frame;
- extern UINT32 video_dec_opt;
- #define get_decoded_pic() (decoded_pic)
- extern UINT8 frame_rate;
- extern UINT8 chk_first_B;
- //
- #define DECODE_FORMAT_525 0
- #define DECODE_FORMAT_625 1
- #define DECODE_FORMAT_OTHER 2
- extern UINT8 viddec_format;
- #define get_decode_format() (viddec_format)
- #define set_decode_format(f) (viddec_format=(f))
- extern UINT8 viddec_nodecode;
- //
- // FRAMEBUF
- // framebuf_mb_width macroblock-mode
- // framebuf_line_width
- extern UINT16 framebuf_mb_width;
- extern UINT16 framebuf_line_width;
- static inline void set_video_stream_id(unsigned id)
- {
- stream_video = id;
- }
- static inline void set_audio_stream_id(unsigned id)
- {
- stream_audio = id;
- }
- static inline void set_sub_stream_id_sup(unsigned id)
- {
- sub_stream_id_sup = id;
- }
- static inline void set_sub_stream_id_sup_2(unsigned id)
- {
- sub_stream_id_sup_2 = id;
- }
- static inline void set_framebuf_mb_mode_width(unsigned v)
- {
- framebuf_mb_width=v;
- }
- static inline void set_framebuf_linear_mode_width(unsigned v)
- {
- framebuf_line_width=v;
- }
- static inline int get_framebuf_linear_mode_width()
- {
- return framebuf_line_width;
- }
- //
- // kernel interface
- //
- extern void init_video_decoder(void);
- extern void resync_av(void);
- extern void resync_video(void);
- extern void resync_audio(void);
- extern void resync_video_bitstream(void);
- extern void resync_audio_bitstream(void);
- extern void clear_video_decoder();
- extern int do_system_layer(void);
- extern UINT32 ki_get_vbv_kused();
- extern UINT32 ki_get_vbv_kfree();
- extern UINT32 ki_get_video_bitrate();
- extern void dsi_update_kernel(void);
- extern void ki_set_pck_type(UINT8);
- extern void ki_set_au_stream(UINT8);
- /*
- ** WATCHDOGWATCHDOG
- */
- void watchdog_renew(int n);
- void watchdog_onoff(int n);
- /*
- ** SUP SUP SUP SUP SUP SUP SUP
- */
- #include "supfunc.h"
- extern void set_sup_hwbuf(unsigned ya, unsigned ye);
- extern void set_sup_hwbuf2(unsigned ya, unsigned ye);
- /*
- ** VPP VPP VPP VPP VPP VPP VPP
- */
- // Pixel Aspect Ratio
- #define VPP_PAR_MP_FORCE_SQUARE (1<<0)
- #define VPP_PAR_MP4_FORCE_SQUARE (1<<1)
- #define VPP_PAR_MP4_GUESS_43TV (1<<2)
- #define VPP_PAR_MP4_REVERSE_169TV (1<<3)
- extern void setup_vpp_par_mode(int flag);
- extern void setup_vpp_mapping(int mapping, int sdram_reorder);
- extern int get_vpp_mapping(void);
- extern void vpp_set_bg_color(int y, int cb_cr);
- /*
- ** ENCODE
- */
- extern int mpeg_encode(int id, int w, int h, int qscale, UINT8 *temp, UINT8 *output);
- extern void mpeg_encode_target(int bits);
- /*
- ** TEST TEST TEST TEST TEST TEST TEST
- */
- extern UINT8 sys_test_reg_00;
- extern UINT8 sys_test_reg_01;
- extern UINT8 sys_test_reg_02;
- extern UINT8 sys_test_reg_03;
- #endif/*__KINF_H*/