#ifndef _H261_VLC_H #define _H261_VLC_H #include #include "bitio.h" #define BITSTRING_BUFSIZE 4 #define NUM_MVDS 32 #define NUM_MBAADDRS 35 #define NUM_CBPS 64 #define NUM_MTYPES 10 #define NUM_TCOEFF 2 void compile_h261vlc(void); struct symbol_string { int symbol; char *string; }; struct symbol_code { u_char bitstring[BITSTRING_BUFSIZE]; int codelen; int symbol; int frequency; void operator = (symbol_string& s); void print(void); }; #define PSC_VAL 16 #define GBSC_VAL 1 #ifdef H261GLOBAL struct symbol_code psc; struct symbol_string psc_desc = { 0, "0000 0000 0000 0001 0000"}; struct symbol_code gbsc; struct symbol_string gbsc_desc = {0, "0000 0000 0000 0001"}; // struct symbol_code blk_eob; // struct symbol_string blk_eobdesc = {0, "10" }; struct tree_node tcoeff_root; struct symbol_code tcoeff[NUM_TCOEFF]; struct symbol_string tcoeff_desc[NUM_TCOEFF] = { { 0 ,"10" }, { 1 ,"0000 01" } }; struct tree_node mvd_root; struct symbol_code mvd[NUM_MVDS]; struct symbol_string mvd_desc[NUM_MVDS] = { { 0 ,"1" }, { 1 ,"010" }, { 2 ,"0010" }, { 3 ,"0001 0" }, { 4 ,"0000 110" }, { 5 ,"0000 1010" }, { 6 ,"0000 1000" }, { 7 ,"0000 0110" }, { 8 ,"0000 0101 10" }, { 9 ,"0000 0101 00" }, { 10 ,"0000 0100 10" }, { 11 ,"0000 0100 010"}, { 12 ,"0000 0100 000"}, { 13 ,"0000 0011 110"}, { 14 ,"0000 0011 100"}, { 15 ,"0000 0011 010"}, { 16 ,"0000 0011 001"}, { 17 ,"0000 0011 011"}, { 18 ,"0000 0011 101"}, { 19 ,"0000 0011 111"}, { 20 ,"0000 0100 001"}, { 21 ,"0000 0100 011"}, { 22 ,"0000 0100 11" }, { 23 ,"0000 0101 01" }, { 24 ,"0000 0101 11" }, { 25 ,"0000 0111" }, { 26 ,"0000 1001" }, { 27 ,"0000 1011" }, { 28 ,"0000 111" }, { 29 ,"0001 1" }, { 30 ,"0011" }, { 31 ,"011" } }; struct tree_node mba_addr_root; struct symbol_code mba_addr[NUM_MBAADDRS]; struct symbol_string mba_addrdesc[NUM_MBAADDRS] = { { 0 ,"0000 0000 0000 0001" }, /* MBA start code */ { 1 ,"1" }, { 2 ,"011" }, { 3 ,"010" }, { 4 ,"0011" }, { 5 ,"0010" }, { 6 ,"0001 1" }, { 7 ,"0001 0" }, { 8 ,"0000 111" }, { 9 ,"0000 110" }, { 10 ,"0000 1011" }, { 11 ,"0000 1010" }, { 12 ,"0000 1001" }, { 13 ,"0000 1000" }, { 14 ,"0000 0111" }, { 15 ,"0000 0110" }, { 16 ,"0000 0101 11" }, { 17 ,"0000 0101 10" }, { 18 ,"0000 0101 01" }, { 19 ,"0000 0101 00" }, { 20 ,"0000 0100 11" }, { 21 ,"0000 0100 10" }, { 22 ,"0000 0100 011" }, { 23 ,"0000 0100 010" }, { 24 ,"0000 0100 001" }, { 25 ,"0000 0100 000" }, { 26 ,"0000 0011 111" }, { 27 ,"0000 0011 110" }, { 28 ,"0000 0011 101" }, { 29 ,"0000 0011 100" }, { 30 ,"0000 0011 011" }, { 31 ,"0000 0011 010" }, { 32 ,"0000 0011 001" }, { 33 ,"0000 0011 000" }, { 34 ,"0000 0001 111" } /* MBA stuffing */ }; struct tree_node mtype_root; struct symbol_code mtype[NUM_MTYPES]; struct symbol_string mtype_desc[NUM_MTYPES] = { { 0 ,"0001" }, { 1 ,"0000 001" }, { 2 ,"1" }, { 3 ,"0000 1" }, { 4 ,"0000 0000 1" }, { 5 ,"0000 0001" }, { 6 ,"0000 0000 01" }, { 7 ,"001" }, { 8 ,"01" }, { 9 ,"0000 01" } }; struct tree_node cbp_root; struct symbol_code cbp[NUM_CBPS]; struct symbol_string cbp_desc[NUM_CBPS] = { { 0 ,"" }, { 1 ,"0101 1" }, { 2 ,"0100 1" }, { 3 ,"0011 10" }, { 4 ,"1101" }, { 5 ,"0010 111" }, { 6 ,"0010 011" }, { 7 ,"0001 1111" }, { 8 ,"1100" }, { 9 ,"0010 110" }, { 10 ,"0010 010" }, { 11 ,"0001 1110" }, { 12 ,"1001 1" }, { 13 ,"0001 1011" }, { 14 ,"0001 0111" }, { 15 ,"0001 0011" }, { 16 ,"1011" }, { 17 ,"0010 101" }, { 18 ,"0010 001" }, { 19 ,"0001 1101" }, { 20 ,"1000 0" }, { 21 ,"0001 1001" }, { 22 ,"0001 0101" }, { 23 ,"0001 0001" }, { 24 ,"0011 11" }, { 25 ,"0000 1111" }, { 26 ,"0000 1101" }, { 27 ,"0000 0001 1" }, { 28 ,"0111 1" }, { 29 ,"0000 1011" }, { 30 ,"0000 0111" }, { 31 ,"0000 0011 1" }, { 32 ,"1010" }, { 33 ,"0010 100" }, { 34 ,"0010 000" }, { 35 ,"0001 1100" }, { 36 ,"0011 10" }, { 37 ,"0000 1110" }, { 38 ,"0000 1100" }, { 39 ,"0000 0001 0" }, { 40 ,"1000 0" }, { 41 ,"0001 1000" }, { 42 ,"0001 0100" }, { 43 ,"0001 0000" }, { 44 ,"0111 0" }, { 45 ,"0000 1010" }, { 46 ,"0000 0110" }, { 47 ,"0000 0011 0" }, { 48 ,"1001 0" }, { 49 ,"0001 1010" }, { 50 ,"0001 0110" }, { 51 ,"0001 0010" }, { 52 ,"0110 1" }, { 53 ,"0000 1001" }, { 54 ,"0000 0101" }, { 55 ,"0000 0010 1" }, { 56 ,"0110 0" }, { 57 ,"0000 1000" }, { 58 ,"0000 0100" }, { 59 ,"0000 0010 0" }, { 60 ,"111" }, { 61 ,"0101 0" }, { 62 ,"0100 0" }, { 63 ,"0011 00" } }; #else extern struct tree_node tcoeff_root; extern struct tree_node mvd_root; extern struct tree_node mba_addr_root; extern struct tree_node mtype_root; extern struct tree_node cbp_root; extern struct symbol_code psc; extern struct symbol_string psc_desc; extern struct symbol_code gbsc; extern struct symbol_string gbsc_desc; // extern struct symbol_code blk_eob; // extern struct symbol_string blk_eobdesc; extern struct symbol_code tcoeff[NUM_TCOEFF]; extern struct symbol_string tcoeff_desc[NUM_TCOEFF]; extern struct symbol_code mvd[NUM_MVDS]; extern struct symbol_string mvd_desc[NUM_MVDS]; extern struct symbol_code mba_addr[NUM_MBAADDRS]; extern struct symbol_string mba_addrdesc[NUM_MBAADDRS]; extern struct symbol_code mtype[NUM_MTYPES]; extern struct symbol_string mtype_desc[NUM_MTYPES]; extern struct symbol_code cbp[NUM_CBPS]; extern struct symbol_string cbp_desc[NUM_CBPS]; #endif #endif