⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpeg2_internal.h

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 H
字号:
/* * mpeg2_internal.h * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org> * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> * * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. * See http://libmpeg2.sourceforge.net/ for updates. * * mpeg2dec is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * mpeg2dec is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#ifndef _MPEG2_INTERNAL_H_#define _MPEG2_INTERNAL_H_#ifdef USE_CMODELIF/* C-Model is just emulated MAE Hardware */#ifndef MAE_HW#define MAE_HW#endif#endif#if !defined(MAE_HW) && !defined(REF_BUILD)/* default to C reference build if not defined */#define REF_BUILD#endif#ifdef REF_BUILD#define NO_PERF   /* HWG - enables much of the C-ref code */#undef  USE_MAE#undef  MAE_HW#undef  NEW_MAE_DRIVER#endif// $PP#include <stdio.h>/* macroblock modes */#define MACROBLOCK_INTRA 1#define MACROBLOCK_PATTERN 2#define MACROBLOCK_MOTION_BACKWARD 4#define MACROBLOCK_MOTION_FORWARD 8#define MACROBLOCK_QUANT 16#define DCT_TYPE_INTERLACED 32/* motion_type */#define MOTION_TYPE_SHIFT 6#define MC_FIELD 1#define MC_FRAME 2#define MC_16X8 2#define MC_DMV 3// $PP#define MC_ZERO 0#define MC_REUSE 4/* picture structure */#define TOP_FIELD 1#define BOTTOM_FIELD 2#define FRAME_PICTURE 3/* picture coding type */#define I_TYPE 1#define P_TYPE 2#define B_TYPE 3#define D_TYPE 4#define DUMP_FIELD 3#define MARK_FIELD_START 2#define MARK_START 1#define DUMP       0typedef void mpeg2_mc_fct (uint8_t *, const uint8_t *, int, int);typedef struct {  uint8_t * ref[2][3];  uint8_t ** ref2[2];  int pmv[2][2];  int f_code[2];} motion_t;typedef void motion_parser_t (mpeg2_decoder_t * decoder,                              motion_t * motion,                              mpeg2_mc_fct * const * table);enum{  ASPECT_RATIO_SQUARE_PIXEL,  ASPECT_RATIO_4_3,  ASPECT_RATIO_16_9,  ASPECT_RATIO_221_100,  ASPECT_RATIO_UNDEFINED};typedef struct{  unsigned int temp;    unsigned int encoded_picture_height;  unsigned int encoded_picture_width;    unsigned int aspect_ratio;    unsigned int display_timestamp;    unsigned int frame_rate;    unsigned int bit_rate;}video_info;typedef struct{  unsigned int uiFrameCount; // frame or field count  unsigned int uiFrameType;  // current frame/field coding type}mpeg2_status;#define FRAMEPERIOD_SCALE   2  /* HWG050505 - frame period fractional bits */struct mpeg2_decoder_s {  /* first, state that carries information from one macroblock to the */  /* next inside a slice, and is never used outside of mpeg2_slice() */  /* bit parsing stuff */  uint32_t bitstream_buf;		/* current 32 bit working set */  int bitstream_bits;			/* used bits in working set */  const uint8_t * bitstream_ptr;	/* buffer with stream data */    uint8_t * dest[3];    int offset;  int stride;  int uv_stride;  int slice_stride;  int slice_uv_stride;  int stride_frame;  unsigned int limit_x;  unsigned int limit_y_16;  unsigned int limit_y_8;  unsigned int limit_y;    /* Motion vectors */  /* The f_ and b_ correspond to the forward and backward motion */  /* predictors */  motion_t b_motion;  motion_t f_motion;  motion_parser_t * motion_parser[5];    int fwd_top_motion_vertical_field_select;  int fwd_bot_motion_vertical_field_select;  int bwd_top_motion_vertical_field_select;  int bwd_bot_motion_vertical_field_select;    /* predictor for DC coefficients in intra blocks */  int16_t dc_dct_pred[3];    /* DCT coefficients */  int16_t DCTblock[64] ATTR_ALIGN(64);    uint8_t * picture_dest[3];  void (* convert) (void * convert_id, uint8_t * const * src, unsigned int v_offset);  void * convert_id;    int dmv_offset;  unsigned int v_offset;    /* now non-slice-specific information */    /* sequence header stuff */  uint16_t * quantizer_matrix[4];  uint16_t (* chroma_quantizer[2])[64];  uint16_t quantizer_prescale[4][32][64];    // $PP  /* sequence header stuff */  uint8_t MAE_Quant_Matrix [4][64];    /* The width and height of the picture snapped to macroblock units */  int width;  int height;  int vertical_position_extension;  int chroma_format;  int aspect;    /* picture header stuff */    /* what type of picture this is (I, P, B, D) */  int coding_type;    /* picture coding extension stuff */    /* quantization factor for intra dc coefficients */  int intra_dc_precision;  // $PP  int intra_dc_mult;  int intra_dc_pred_reset_value;    /* top/bottom/both fields */  int picture_structure;  /* bool to indicate all predictions are frame based */  int frame_pred_frame_dct;  /* bool to indicate whether intra blocks have motion vectors */  /* (for concealment) */  int concealment_motion_vectors;  /* bool to use different vlc tables */  int intra_vlc_format;  /* used for DMV MC */  int top_field_first;    /* stuff derived from bitstream */    /* pointer to the zigzag scan we're supposed to be using */  const uint8_t * scan;    int second_field;    unsigned int uiIFramesProcessed;  unsigned int uiPFramesProcessed;  unsigned int uiBFramesProcessed;  int mpeg1;    // $PP  // flag to tell us if we are using C Model code  // set from command line argument '-m'  unsigned char *pYOut;  unsigned char *pCbOut;  unsigned char *pCrOut;  unsigned char *pYUVOut[3][3];   // Used only when DRV_ENABLED is turned on  unsigned char bAllocated;  unsigned char bUseMAE;  unsigned char bDumpFiles;  unsigned char bDumpFinal;  unsigned char bIntraMatrixChanged;  unsigned char bInterMatrixChanged;  int  iMBCount;  unsigned char scan_type;  int  iQuant_Scale;  int  iQuant_Scale_Type;  int  iMacroBlockModes;  int  iRefType; // forward or backward, needed for dumping intermediate files  int  other_x, other_y; // funky motion vectors used in DMV  int  other_x1, other_y1; // funky motion vectors used in DMV  unsigned int uiSkipFrameCount;   /* number of I frames to skip when falling behind, this defaults to 1, which means play all frames *   * set to 2 to play every other I Frame, 3 for every 3rd i frame, etc                              */  unsigned int uiSkipIFrames;   mpeg2_decode_mode_t uiDecodeMode; /* current decode mode */  unsigned int        uiSpeed; /* current decode speed */  unsigned int        bNewDecodeMode; /* New DecodeMode or Speed specified */  mpeg2_decode_mode_t uiNewDecodeMode; /* next requested decode mode */  unsigned int        uiNewSpeed; /* next requested decode speed */  unsigned int  bFlushing;  /* should the decode be flushing */  unsigned int  bDiscon;    /* Next frame is a discontinuity in data */  unsigned int  uiOkToDecode;  unsigned int  uiWaitForIFrame;  mpeg_time_t   tCurrentPTS;  unsigned int  uiTemporalOffset; /* running offset, used to maintain sequentially increasing uiTemporalNum */  unsigned int  uiTemporalNum;    /* MAE specific state variables */  unsigned long ulSpecial;  unsigned long ulOkToSubmit;  unsigned long ulSubmitCalled;  unsigned long ulDebugFlag;  unsigned long uiPrevTnum;  unsigned long ulInitDisplay;    /* HWG050505+ for improved PTS interpolation */  unsigned int  uiGOPCount;  unsigned int  uiMaxTemporal; /* max temporal value found in current GOP */  unsigned int  uiActualFramePeriod; /* FramePeriod adjusted by interpolation */    mpeg_time_t   tNewPTS;  unsigned char bNewPTS;  unsigned int  uiFramesSinceNewPTS;  int           iTemporalAtNewPTS;  int           iPTSDrift;  /* drift between interpolated and recieved PTS */    mpeg_time_t   tPTSLastSync;  unsigned int  bSyncedPTS;  int           iTemporalAtSyncPTS;  unsigned int  uiFramesSincePTSSync;  unsigned int  uiGOPsSincePTSSync;  /* HWG050505- */    uint8_t *pict_dest[3];};typedef struct {  mpeg2_fbuf_t fbuf;} fbuf_alloc_t;struct mpeg2dec_s {  mpeg2_decoder_t decoder;    mpeg2_info_t info;    uint32_t shift;  int is_display_initialized;  mpeg2_state_t (* action) (struct mpeg2dec_s * mpeg2dec);  mpeg2_state_t state;  uint32_t ext_state;    /* allocated in init - gcc has problems allocating such big structures */  uint8_t * chunk_buffer;  /* pointer to start of the current chunk */  uint8_t * chunk_start;  /* pointer to current position in chunk_buffer */  uint8_t * chunk_ptr;  /* last start code ? */  uint8_t code;    /* picture tags */  uint32_t tag_current, tag2_current, tag_previous, tag2_previous;  int num_tags;  int bytes_since_tag;    int first;  int alloc_index_user;  int alloc_index;  uint8_t first_decode_slice;  uint8_t nb_decode_slices;    unsigned int user_data_len;    mpeg2_sequence_t new_sequence;  mpeg2_sequence_t sequence;  mpeg2_gop_t new_gop;  mpeg2_gop_t gop;  mpeg2_picture_t new_picture;  mpeg2_picture_t pictures[4];  mpeg2_picture_t * picture;  /*const*/ mpeg2_fbuf_t * fbuf[3];	/* 0: current fbuf, 1-2: prediction fbufs */    fbuf_alloc_t fbuf_alloc[3];  int custom_fbuf;    uint8_t * yuv_buf[3][3];  int yuv_index;  mpeg2_convert_t * convert;  void * convert_arg;  unsigned int convert_id_size;  int convert_stride;  void (* convert_start) (void * id, const mpeg2_fbuf_t * fbuf,    const mpeg2_picture_t * picture, const mpeg2_gop_t * gop);    uint8_t * buf_start;  uint8_t * buf_end;    int16_t display_offset_x, display_offset_y;    int copy_matrix;  int8_t q_scale_type, scaled[4];  uint8_t quantizer_matrix[4][64];  uint8_t new_quantizer_matrix[4][64];  uint8_t MAE_New_Quant_Matrix[4][64];    // $PP  // flag to tell us if we are using C Model code  // set from command line argument '-m'  unsigned char bUseMAE;  unsigned char bDumpFiles;  unsigned char bDumpFinal;#ifdef MAE_RENDERER  unsigned long ulVideoOff;#endif};typedef struct {#ifdef ARCH_PPC  uint8_t regv[12*16];#endif  int dummy;} cpu_state_t;/* cpu_accel.c */uint32_t mpeg2_detect_accel (void);/* cpu_state.c */void mpeg2_cpu_state_init (uint32_t accel);/* decode.c */mpeg2_state_t mpeg2_seek_header (mpeg2dec_t * mpeg2dec);mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec);/* header.c */void mpeg2_header_state_init (mpeg2dec_t * mpeg2dec);void mpeg2_reset_info (mpeg2_info_t * info);int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec);int mpeg2_header_gop (mpeg2dec_t * mpeg2dec);mpeg2_state_t mpeg2_header_picture_start (mpeg2dec_t * mpeg2dec);int mpeg2_header_picture (mpeg2dec_t * mpeg2dec);int mpeg2_header_extension (mpeg2dec_t * mpeg2dec);int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec);void mpeg2_header_sequence_finalize (mpeg2dec_t * mpeg2dec);void mpeg2_header_gop_finalize (mpeg2dec_t * mpeg2dec);void mpeg2_header_picture_finalize (mpeg2dec_t * mpeg2dec, uint32_t accels);mpeg2_state_t mpeg2_header_slice_start (mpeg2dec_t * mpeg2dec);mpeg2_state_t mpeg2_header_end (mpeg2dec_t * mpeg2dec);void mpeg2_set_fbuf (mpeg2dec_t * mpeg2dec, int b_type);/* idct.c */void mpeg2_idct_init (uint32_t accel);/* idct_mmx.c */void mpeg2_idct_copy_mmxext (int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_add_mmxext (int last, int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_copy_mmx (int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_add_mmx (int last, int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_mmx_init (void);/* idct_altivec.c */void mpeg2_idct_copy_altivec (int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_add_altivec (int last, int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_altivec_init (void);/* idct_alpha.c */void mpeg2_idct_copy_mvi (int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_add_mvi (int last, int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_copy_alpha (int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_add_alpha (int last, int16_t * block, uint8_t * dest, int stride);void mpeg2_idct_alpha_init (void);/* motion_comp.c */void mpeg2_mc_init (uint32_t accel);typedef struct {    mpeg2_mc_fct * put [8];    mpeg2_mc_fct * avg [8];} mpeg2_mc_t;#define MPEG2_MC_EXTERN(x) mpeg2_mc_t mpeg2_mc_##x = {			  \    {MC_put_o_16_##x, MC_put_x_16_##x, MC_put_y_16_##x, MC_put_xy_16_##x, \     MC_put_o_8_##x,  MC_put_x_8_##x,  MC_put_y_8_##x,  MC_put_xy_8_##x}, \    {MC_avg_o_16_##x, MC_avg_x_16_##x, MC_avg_y_16_##x, MC_avg_xy_16_##x, \     MC_avg_o_8_##x,  MC_avg_x_8_##x,  MC_avg_y_8_##x,  MC_avg_xy_8_##x}  \};extern mpeg2_mc_t mpeg2_mc_c;extern mpeg2_mc_t mpeg2_mc_mmx;extern mpeg2_mc_t mpeg2_mc_mmxext;extern mpeg2_mc_t mpeg2_mc_3dnow;extern mpeg2_mc_t mpeg2_mc_altivec;extern mpeg2_mc_t mpeg2_mc_alpha;extern mpeg2_mc_t mpeg2_mc_vis;#endif /* _MPEG2_INTERNAL_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -