www.pudn.com > ActiveH263_V1.00.rar > H263lib.h
// H263lib.h: interface for the H263lib class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_H263LIB_H__D55F178C_2A73_4A6F_9857_82A2904D751E__INCLUDED_) #define AFX_H263LIB_H__D55F178C_2A73_4A6F_9857_82A2904D751E__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include#include "Queue.h" // Added by ClassView //宏定义 #define PSC_LENGTH 17 #define SE_CODE 31 #define SF_SQCIF 1 /* 001 */ #define SF_QCIF 2 /* 010 */ #define SF_CIF 3 /* 011 */ #define SF_4CIF 4 /* 100 */ #define SF_16CIF 5 /* 101 */ #define T_YUV 0 #define T_SIF 1 #define T_TGA 2 #define T_PPM 3 #define T_X11 4 #define T_YUV_CONC 5 #define T_WIN 6 #define PI 3.14159265358979323846 #define MBR 72 #define MBC 88 #define NO_VEC 999 #define MODE_INTRA 3 #define MODE_INTRA_Q 4 #define PSC 1 #define PCT_INTER 1 #define PCT_INTRA 0 #define PBMODE_CBPB_MVDB 2 #define MODE_INTER4V 2 #define MODE_INTER_Q 1 #define MODE_INTER 0 #define PBMODE_MVDB 1 #define ESCAPE 7167 #define ESCAPE_INDEX 102 #define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */ #define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */ #define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */ #define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */ #define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */ #define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */ #define OBFRSIZE 4096 #define q1 16384 #define q2 32768 #define q3 49152 #define top 65535 #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) //结构体声明 typedef struct { char run, level, len; } DCTtab; typedef struct { int val, len; } VLCtabI; typedef struct { int val, run, sign; } RunCoef; typedef struct { int val, len; } VLCtab; typedef struct { /* bit input */ int infile; unsigned char rdbfr[2051]; unsigned char *rdptr; unsigned char inbfr[16]; int incnt; int bitcnt; /* block data */ short block[12][64]; } myld; typedef struct { HANDLE hThread; HANDLE hEvent; // HWND hWnd; MSG msg; WNDCLASS wc; // HDRAWDIB hDrawDib; HDC hDC; BITMAPINFOHEADER biHeader; char lpszAppName[15]; DWORD dwThreadID; BOOL imageIsReady; unsigned char *bufRGB; RECT rect; unsigned char *src[3]; int width, height; int zoom, oldzoom; int windowDismissed; } T_VDWINDOW; //码表定义 static long low, high, code_value, bit, length, sacindex, cum, zerorun=0; class H263lib { public: Queue q; short block00[12][64]; void startcodeheader(void); FILE *writefp; DWORD dwTF1; DWORD dwTF2; char *Tdebugfile; int cbu_tab[256]; int tab_76309[256]; int cgv_tab[256]; int cgu_tab[256]; int crv_tab[256]; void init_dither_tab(void); void drawpicdib(void); HWND mainhWnd; void ConvertYUVtoRGB( unsigned char *src0, unsigned char *src1, unsigned char *src2, unsigned char *dst_ori, int width, int height ); T_VDWINDOW vdWindow; int displayImage (unsigned char *lum, unsigned char *Cr, unsigned char *Cb); char *h263file; void testdisplay(); myld *ld; myld base; VLCtabI DCT3Dtab2[121]; VLCtabI DCT3Dtab1[96]; VLCtabI DCT3Dtab0[112]; int roundtab[16]; VLCtab TMNMVtab2[123]; VLCtab TMNMVtab1[96]; VLCtab TMNMVtab0[14]; VLCtab CBPYtab[48]; VLCtab MCBPCtab[256]; int convmat[8][4]; int OM[5][8][8]; int bquant_tab[4]; unsigned char zig_zag_scan[64]; void putword (int w); void putbyte (int c); unsigned char obfr[OBFRSIZE]; void conv422to444 (unsigned char *src, unsigned char *dst); unsigned char *optr; char errortext[256]; int outfile; void conv420to422 (unsigned char *src, unsigned char *dst); void store_yuv1 (char *name, unsigned char *src, int offset, int incr, int width, int height, int append); int signtab[2]; int cumf_SIGN[3]; int leveltab[254]; int cumf_LEVEL[255]; int cumf_LEVEL_intra[255]; int runtab[64]; int cumf_RUN[65]; int cumf_RUN_intra[65]; int lasttab[2]; int cumf_LAST[3]; int last_intratab[2]; int cumf_LAST_intra[3]; int cumf_TCOEFr[104]; int cumf_TCOEFr_intra[104]; int cumf_TCOEF3[104]; int cumf_TCOEF3_intra[104]; int cumf_TCOEF2[104]; int cumf_TCOEF2_intra[104]; int cumf_TCOEF1[104]; int cumf_TCOEF1_intra[104]; void rec4c (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void rec4 (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void rech (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void rechc (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void recvc (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void recv (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void recc (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void rec (unsigned char *s, unsigned char *d, int lx, int lx2, int h); void rec4o (unsigned char *s, int *d, int lx, int lx2, int addflag,int c, int xa, int xb, int ya, int yb); void recho (unsigned char *s, int *d, int lx, int lx2, int addflag,int c, int xa, int xb, int ya, int yb); void recvo (unsigned char *s, int *d, int lx, int lx2, int addflag,int c, int xa, int xb, int ya, int yb); void reco (unsigned char *s, int *d, int lx, int lx2, int addflag,int c, int xa, int xb, int ya, int yb); void store_ppm_tga (char *outname, unsigned char *src[], int offset, int incr, int height, int tgaflag); void store_sif (char *outname, unsigned char *src[], int offset, int incr, int height); void store_yuv_append (char *outname, unsigned char *src[], int offset, int incr, int height); void store_yuv (char *outname, unsigned char *src[], int offset, int incr, int height); RunCoef vlc_word_decode (int symbol_word, int *last); int tcoeftab[103]; RunCoef Decode_Escape_Char (int intra, int *last); int DecodeTCoef (int position, int intra); void find_bidir_chroma_limits (int vec, int *start, int*stop); void find_bidir_limits (int vec, int *start, int*stop, int nhv); void idctcol (short *blk); void idctrow (short *blk); void recon_comp (unsigned char *src, unsigned char *dst, int lx, int lx2, int w, int h, int x, int y, int dx, int dy, int flag); void recon_comp_obmc (unsigned char *src, unsigned char *dst,int lx,int lx2,int comp,int w,int h,int x,int y); unsigned int getbits1 (void); VLCtab MCBPCtabintra[32]; void store_one (char *outname, unsigned char *src[], int offset, int incr, int height); void get_sac_block (int comp, int ptype); void getblock (int comp, int mode); int intradctab[254]; int cumf_INTRADC[255]; void clearblock (int comp); void reconblock_b (int comp,int bx,int by,int mode,int bdx, int bdy); void addblock(int comp, int bx, int by,int addflag); void idct (short *block); //void idctref (short *block); void idctref(short *inblock,short *outblock); void reconstruct (int bx, int by, int P, int bdx, int bdy); int motion_decode(int vec,int pmv); int find_pmv (int x, int y, int block, int comp); int getTMNMV(void); int mvdtab[64]; int cumf_MVD[65]; void printbits (int code, int bits, int len); int dquanttab[4]; int cumf_DQUANT[5]; int getCBPY(void); int cbpytab[16]; int cumf_CBPY[17]; int cbpy_intratab[16]; int cumf_CBPY_intra[17]; int uvcbpb_tab[2]; int cumf_UVCBPB[3]; int ycbpb_tab[2]; int cumf_YCBPB[3]; int getMODB(void); int modb_tab[3]; int cumf_MODB[4]; int getMCBPC(void); int getMCBPCintra(void); int mcbpc_intratab[9]; int cumf_MCBPC_intra[10]; int mcbpctab[21]; int cumf_MCBPC[22]; int codtab[2]; int cumf_COD[3]; int decode_a_symbol (int cumul_freq[ ]); int fault; int modemap[MBR+1][MBC+2]; int MV[2][5][MBR+1][MBC+2]; int newgob; void storeframe(unsigned char *src[], int frame); void interpolate_image(unsigned char *in, unsigned char *out, int width, int height); void getMBs (int framenum); void make_edge_image(unsigned char *src, unsigned char *dst, int width, int height, int edge); unsigned char *newframe[3]; void getpicture(int *framenum); int loopflag; unsigned int msk[33]; void fillbfr(void); short iclip[1024]; short *iclp; double c[8][8]; int trace; long bit; void bit_out_psc_layer(void); // long top; long high; long low; long code_value; long zerorun; int verbose; int bquant; int trb; int quant; int pb_frame; int adv_pred_mode; int long_vectors; int mv_outside_frame; int pict_type; int quiet; int trd; int prev_temp_ref; void flushbits(int n); int showbits(int n); void init_idct(void); void init_idctref(void); int refidct; int outtype; int expand; unsigned char *exnewframe[3]; unsigned char *edgeframe[3]; unsigned char *edgeframeorig[3]; unsigned char *bframe[3]; unsigned char *oldrefframe[3]; unsigned char *refframe[3]; int blk_cnt; int chrom_height; int chrom_width; int coded_picture_height; int coded_picture_width; int mb_height; int mb_width; int vertical_size; int horizontal_size; int source_format; int matrix_coefficients; void error (char *text); unsigned char *clp; void decoder_reset(void); int syntax_arith_coding; void getpicturehdr(void); int getbits(int); void startcode(void); void initdecoder(void); int getheader(void); int temp_ref; void initbits(void); void main(void); char *outputname; int framenum; int first; H263lib(); virtual ~H263lib(); }; #endif // !defined(AFX_H263LIB_H__D55F178C_2A73_4A6F_9857_82A2904D751E__INCLUDED_)