MP4_VARS.H
资源名称:VC++视频传输.rar [点击查看]
上传用户:hxb_1234
上传日期:2010-03-30
资源大小:8328k
文件大小:4k
源码类别:
VC书籍
开发平台:
Visual C++
- #include "portab.h"
- #include "decore.h"
- #include "mp4_header.h"
- #include "mp4_vld.h"
- #include "postprocess.h"
- //宏定义
- #define mmax(a, b) ((a) > (b) ? (a) : (b))
- #define mmin(a, b) ((a) < (b) ? (a) : (b))
- #define mnint(a) ((a) < 0 ? (int)(a - 0.5) : (int)(a + 0.5))
- #define sign(a) ((a) < 0 ? -1 : 1)
- #define abs(a) ((a)>0 ? (a) : -(a))
- #define sign(a) ((a) < 0 ? -1 : 1)
- #define mnint(a) ((a) < 0 ? (int)(a - 0.5) : (int)(a + 0.5))
- #define _div_div(a, b) (a>0) ? (a+(b>>1))/b : (a-(b>>1))/b
- //解码器数据结构的定义
- // mpeg4流的数据结构定义
- typedef struct
- {
- // 位输入
- int infile;
- unsigned char rdbfr[2051];
- unsigned char *rdptr;
- unsigned char inbfr[16];
- int incnt;
- int bitcnt;
- int length;
- // 块数据
- short block[64];
- } MP4_STREAM;
- // AC/DC预测的数据结构定义
- typedef struct _ac_dc
- {
- int dc_store_lum[2*DEC_MBR+1][2*DEC_MBC+1];
- int ac_left_lum[2*DEC_MBR+1][2*DEC_MBC+1][7];
- int ac_top_lum[2*DEC_MBR+1][2*DEC_MBC+1][7];
- int dc_store_chr[2][DEC_MBR+1][DEC_MBC+1];
- int ac_left_chr[2][DEC_MBR+1][DEC_MBC+1][7];
- int ac_top_chr[2][DEC_MBR+1][DEC_MBC+1][7];
- int predict_dir;
- } ac_dc;
- typedef void (* pfun_convert_yuv)(unsigned char *puc_y, int stride_y,
- unsigned char *puc_u, unsigned char *puc_v, int stride_uv,
- unsigned char *bmp, int width_y, int height_y,
- unsigned int stride_out);
- //mpeg4状态的数据结构定义
- typedef struct _MP4_STATE_
- {
- mp4_header hdr;
- int modemap[DEC_MBR+1][DEC_MBC+2];
- int quant_store[DEC_MBR+1][DEC_MBC+1];
- int MV[2][6][DEC_MBR+1][DEC_MBC+2];
- ac_dc coeff_pred;
- short iclp_data[1024];
- short *iclp;
- unsigned char clp_data[1024];
- unsigned char *clp;
- pfun_convert_yuv convert_yuv;
- int flag_invert;
- int horizontal_size;
- int vertical_size;
- int mb_width;
- int mb_height;
- int juice_hor;
- int juice_ver;
- int coded_picture_width;
- int coded_picture_height;
- int chrom_width;
- int chrom_height;
- int juice_flag;
- int post_flag;
- int pp_options;
- #ifndef _DECORE
- char *infilename;
- char * outputname;
- int output_flag;
- #endif
- }
- MP4_STATE;
- // mpeg4表的数据结构定义
- typedef struct _MP4_TABLES_
- {
- unsigned int zig_zag_scan[64];
- unsigned int alternate_vertical_scan[64];
- unsigned int alternate_horizontal_scan[64];
- unsigned int intra_quant_matrix[64];
- unsigned int nonintra_quant_matrix[64];
- unsigned int msk[33];
- int roundtab[16];
- int saiAcLeftIndex[8];
- int DQtab[4];
- tab_type MCBPCtabIntra[32];
- tab_type MCBPCtabInter[256];
- tab_type CBPYtab[48];
- tab_type MVtab0[14];
- tab_type MVtab1[96];
- tab_type MVtab2[124];
- tab_type tableB16_1[112];
- tab_type tableB16_2[96];
- tab_type tableB16_3[120];
- tab_type tableB17_1[112];
- tab_type tableB17_2[96];
- tab_type tableB17_3[120];
- }
- MP4_TABLES;
- //全局的变量
- extern unsigned char *edged_ref[3],
- *edged_for[3],
- *frame_ref[3],
- *frame_for[3],
- *display_frame[3];
- extern MP4_STATE *mp4_state;
- extern MP4_TABLES *mp4_tables;
- extern MP4_STREAM *ld;
- //全局函数的原型
- int decore_init (int hor_size, int ver_size, int output_format, int time_incr, DEC_BUFFERS buffers);
- int decore_frame (unsigned char *stream, int length, unsigned char *bmp, unsigned int stride, int render_flag);
- int decore_release ();
- int decore_setoutput (int output_format);
- void closedecoder ();
- void initdecoder (DEC_BUFFERS buffers);
- void save_tables (MP4_TABLES * tables);
- void idct (short *block);
- void reconstruct (int bx, int by, int mode);
- void get_mp4picture (unsigned char *bmp, unsigned int stride, int render_flag);
- void PictureDisplay (unsigned char *bmp, unsigned int stride, int render_flag);