00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 typedef struct
00033 {
00034 unsigned char code;
00035 char len;
00036 } VLCtable;
00037
00038
00039 typedef struct
00040 {
00041 unsigned short code;
00042 char len;
00043 } sVLCtable;
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 const static VLCtable addrinctab[33]=
00055 {
00056 {0x01,1}, {0x03,3}, {0x02,3}, {0x03,4},
00057 {0x02,4}, {0x03,5}, {0x02,5}, {0x07,7},
00058 {0x06,7}, {0x0b,8}, {0x0a,8}, {0x09,8},
00059 {0x08,8}, {0x07,8}, {0x06,8}, {0x17,10},
00060 {0x16,10}, {0x15,10}, {0x14,10}, {0x13,10},
00061 {0x12,10}, {0x23,11}, {0x22,11}, {0x21,11},
00062 {0x20,11}, {0x1f,11}, {0x1e,11}, {0x1d,11},
00063 {0x1c,11}, {0x1b,11}, {0x1a,11}, {0x19,11},
00064 {0x18,11}
00065 };
00066
00067
00068
00069
00070
00071
00072
00073 const static VLCtable mbtypetab[3][32]=
00074 {
00075
00076 {
00077 {0,0}, {1,1}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
00078 {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
00079 {0,0}, {1,2}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
00080 {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}
00081 },
00082
00083 {
00084 {0,0}, {3,5}, {1,2}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
00085 {1,3}, {0,0}, {1,1}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
00086 {0,0}, {1,6}, {1,5}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
00087 {0,0}, {0,0}, {2,5}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}
00088 },
00089
00090 {
00091 {0,0}, {3,5}, {0,0}, {0,0}, {2,3}, {0,0}, {3,3}, {0,0},
00092 {2,4}, {0,0}, {3,4}, {0,0}, {2,2}, {0,0}, {3,2}, {0,0},
00093 {0,0}, {1,6}, {0,0}, {0,0}, {0,0}, {0,0}, {2,6}, {0,0},
00094 {0,0}, {0,0}, {3,6}, {0,0}, {0,0}, {0,0}, {2,5}, {0,0}
00095 }
00096 };
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 const static VLCtable cbptable[64]=
00111 {
00112 {0x01,9}, {0x0b,5}, {0x09,5}, {0x0d,6},
00113 {0x0d,4}, {0x17,7}, {0x13,7}, {0x1f,8},
00114 {0x0c,4}, {0x16,7}, {0x12,7}, {0x1e,8},
00115 {0x13,5}, {0x1b,8}, {0x17,8}, {0x13,8},
00116 {0x0b,4}, {0x15,7}, {0x11,7}, {0x1d,8},
00117 {0x11,5}, {0x19,8}, {0x15,8}, {0x11,8},
00118 {0x0f,6}, {0x0f,8}, {0x0d,8}, {0x03,9},
00119 {0x0f,5}, {0x0b,8}, {0x07,8}, {0x07,9},
00120 {0x0a,4}, {0x14,7}, {0x10,7}, {0x1c,8},
00121 {0x0e,6}, {0x0e,8}, {0x0c,8}, {0x02,9},
00122 {0x10,5}, {0x18,8}, {0x14,8}, {0x10,8},
00123 {0x0e,5}, {0x0a,8}, {0x06,8}, {0x06,9},
00124 {0x12,5}, {0x1a,8}, {0x16,8}, {0x12,8},
00125 {0x0d,5}, {0x09,8}, {0x05,8}, {0x05,9},
00126 {0x0c,5}, {0x08,8}, {0x04,8}, {0x04,9},
00127 {0x07,3}, {0x0a,5}, {0x08,5}, {0x0c,6}
00128 };
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 const static VLCtable dct_code_tab1[2][40]=
00140 {
00141
00142 {
00143 {0x03, 2}, {0x04, 4}, {0x05, 5}, {0x06, 7},
00144 {0x26, 8}, {0x21, 8}, {0x0a,10}, {0x1d,12},
00145 {0x18,12}, {0x13,12}, {0x10,12}, {0x1a,13},
00146 {0x19,13}, {0x18,13}, {0x17,13}, {0x1f,14},
00147 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
00148 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
00149 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
00150 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
00151 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
00152 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}
00153 },
00154
00155 {
00156 {0x03, 3}, {0x06, 6}, {0x25, 8}, {0x0c,10},
00157 {0x1b,12}, {0x16,13}, {0x15,13}, {0x1f,15},
00158 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
00159 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
00160 {0x11,16}, {0x10,16}, {0x00, 0}, {0x00, 0},
00161 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00162 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00163 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00164 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00165 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00166 }
00167 };
00168
00169 const static VLCtable dct_code_tab2[30][5]=
00170 {
00171
00172 {{0x05, 4}, {0x04, 7}, {0x0b,10}, {0x14,12}, {0x14,13}},
00173 {{0x07, 5}, {0x24, 8}, {0x1c,12}, {0x13,13}, {0x00, 0}},
00174 {{0x06, 5}, {0x0f,10}, {0x12,12}, {0x00, 0}, {0x00, 0}},
00175 {{0x07, 6}, {0x09,10}, {0x12,13}, {0x00, 0}, {0x00, 0}},
00176 {{0x05, 6}, {0x1e,12}, {0x14,16}, {0x00, 0}, {0x00, 0}},
00177 {{0x04, 6}, {0x15,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00178 {{0x07, 7}, {0x11,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00179 {{0x05, 7}, {0x11,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00180 {{0x27, 8}, {0x10,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00181 {{0x23, 8}, {0x1a,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00182 {{0x22, 8}, {0x19,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00183 {{0x20, 8}, {0x18,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00184 {{0x0e,10}, {0x17,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00185 {{0x0d,10}, {0x16,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00186 {{0x08,10}, {0x15,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00187 {{0x1f,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00188 {{0x1a,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00189 {{0x19,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00190 {{0x17,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00191 {{0x16,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00192 {{0x1f,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00193 {{0x1e,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00194 {{0x1d,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00195 {{0x1c,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00196 {{0x1b,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00197 {{0x1f,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00198 {{0x1e,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00199 {{0x1d,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00200 {{0x1c,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00201 {{0x1b,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}}
00202 };
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213 const static VLCtable dct_code_tab1a[2][40]=
00214 {
00215
00216 {
00217 {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5},
00218 {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7},
00219 {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8},
00220 {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14},
00221 {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14},
00222 {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14},
00223 {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14},
00224 {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15},
00225 {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15},
00226 {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}
00227 },
00228
00229 {
00230 {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8},
00231 {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15},
00232 {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15},
00233 {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16},
00234 {0x11,16}, {0x10,16}, {0x00, 0}, {0x00, 0},
00235 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00236 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00237 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00238 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0},
00239 {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}
00240 }
00241 };
00242
00243 const static VLCtable dct_code_tab2a[30][5]=
00244 {
00245
00246 {{0x05, 5}, {0x07, 7}, {0xfc, 8}, {0x0c,10}, {0x14,13}},
00247 {{0x07, 5}, {0x26, 8}, {0x1c,12}, {0x13,13}, {0x00, 0}},
00248 {{0x06, 6}, {0xfd, 8}, {0x12,12}, {0x00, 0}, {0x00, 0}},
00249 {{0x07, 6}, {0x04, 9}, {0x12,13}, {0x00, 0}, {0x00, 0}},
00250 {{0x06, 7}, {0x1e,12}, {0x14,16}, {0x00, 0}, {0x00, 0}},
00251 {{0x04, 7}, {0x15,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00252 {{0x05, 7}, {0x11,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00253 {{0x78, 7}, {0x11,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00254 {{0x7a, 7}, {0x10,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00255 {{0x21, 8}, {0x1a,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00256 {{0x25, 8}, {0x19,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00257 {{0x24, 8}, {0x18,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00258 {{0x05, 9}, {0x17,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00259 {{0x07, 9}, {0x16,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00260 {{0x0d,10}, {0x15,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00261 {{0x1f,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00262 {{0x1a,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00263 {{0x19,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00264 {{0x17,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00265 {{0x16,12}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00266 {{0x1f,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00267 {{0x1e,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00268 {{0x1d,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00269 {{0x1c,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00270 {{0x1b,13}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00271 {{0x1f,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00272 {{0x1e,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00273 {{0x1d,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00274 {{0x1c,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}},
00275 {{0x1b,16}, {0x00, 0}, {0x00, 0}, {0x00, 0}, {0x00, 0}}
00276 };
00277
00278
00279 static const uint8_t mpeg4_default_intra_matrix[64] = {
00280 8, 17, 18, 19, 21, 23, 25, 27,
00281 17, 18, 19, 21, 23, 25, 27, 28,
00282 20, 21, 22, 23, 24, 26, 28, 30,
00283 21, 22, 23, 24, 26, 28, 30, 32,
00284 22, 23, 24, 26, 28, 30, 32, 35,
00285 23, 24, 26, 28, 30, 32, 35, 38,
00286 25, 26, 28, 30, 32, 35, 38, 41,
00287 27, 28, 30, 32, 35, 38, 41, 45,
00288 };
00289
00290 static const uint8_t mpeg4_default_non_intra_matrix[64] = {
00291 16, 17, 18, 19, 20, 21, 22, 23,
00292 17, 18, 19, 20, 21, 22, 23, 24,
00293 18, 19, 20, 21, 22, 23, 24, 25,
00294 19, 20, 21, 22, 23, 24, 26, 27,
00295 20, 21, 22, 23, 25, 26, 27, 28,
00296 21, 22, 23, 24, 26, 27, 28, 30,
00297 22, 23, 24, 26, 27, 28, 30, 31,
00298 23, 24, 25, 27, 28, 30, 31, 33,
00299 };
00300