Libav 0.7.1
|
00001 00028 #include <stdlib.h> 00029 00030 #include "avcodec.h" 00031 #include "dsputil.h" 00032 #include "get_bits.h" 00033 #include "huffman.h" 00034 00035 #include "vp56.h" 00036 #include "vp56data.h" 00037 #include "vp6data.h" 00038 00039 #define VP6_MAX_HUFF_SIZE 12 00040 00041 static void vp6_parse_coeff(VP56Context *s); 00042 static void vp6_parse_coeff_huffman(VP56Context *s); 00043 00044 static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size, 00045 int *golden_frame) 00046 { 00047 VP56RangeCoder *c = &s->c; 00048 int parse_filter_info = 0; 00049 int coeff_offset = 0; 00050 int vrt_shift = 0; 00051 int sub_version; 00052 int rows, cols; 00053 int res = 1; 00054 int separated_coeff = buf[0] & 1; 00055 00056 s->framep[VP56_FRAME_CURRENT]->key_frame = !(buf[0] & 0x80); 00057 ff_vp56_init_dequant(s, (buf[0] >> 1) & 0x3F); 00058 00059 if (s->framep[VP56_FRAME_CURRENT]->key_frame) { 00060 sub_version = buf[1] >> 3; 00061 if (sub_version > 8) 00062 return 0; 00063 s->filter_header = buf[1] & 0x06; 00064 if (buf[1] & 1) { 00065 av_log(s->avctx, AV_LOG_ERROR, "interlacing not supported\n"); 00066 return 0; 00067 } 00068 if (separated_coeff || !s->filter_header) { 00069 coeff_offset = AV_RB16(buf+2) - 2; 00070 buf += 2; 00071 buf_size -= 2; 00072 } 00073 00074 rows = buf[2]; /* number of stored macroblock rows */ 00075 cols = buf[3]; /* number of stored macroblock cols */ 00076 /* buf[4] is number of displayed macroblock rows */ 00077 /* buf[5] is number of displayed macroblock cols */ 00078 if (!rows || !cols) { 00079 av_log(s->avctx, AV_LOG_ERROR, "Invalid size %dx%d\n", cols << 4, rows << 4); 00080 return 0; 00081 } 00082 00083 if (!s->macroblocks || /* first frame */ 00084 16*cols != s->avctx->coded_width || 00085 16*rows != s->avctx->coded_height) { 00086 avcodec_set_dimensions(s->avctx, 16*cols, 16*rows); 00087 if (s->avctx->extradata_size == 1) { 00088 s->avctx->width -= s->avctx->extradata[0] >> 4; 00089 s->avctx->height -= s->avctx->extradata[0] & 0x0F; 00090 } 00091 res = 2; 00092 } 00093 00094 ff_vp56_init_range_decoder(c, buf+6, buf_size-6); 00095 vp56_rac_gets(c, 2); 00096 00097 parse_filter_info = s->filter_header; 00098 if (sub_version < 8) 00099 vrt_shift = 5; 00100 s->sub_version = sub_version; 00101 } else { 00102 if (!s->sub_version || !s->avctx->coded_width || !s->avctx->coded_height) 00103 return 0; 00104 00105 if (separated_coeff || !s->filter_header) { 00106 coeff_offset = AV_RB16(buf+1) - 2; 00107 buf += 2; 00108 buf_size -= 2; 00109 } 00110 ff_vp56_init_range_decoder(c, buf+1, buf_size-1); 00111 00112 *golden_frame = vp56_rac_get(c); 00113 if (s->filter_header) { 00114 s->deblock_filtering = vp56_rac_get(c); 00115 if (s->deblock_filtering) 00116 vp56_rac_get(c); 00117 if (s->sub_version > 7) 00118 parse_filter_info = vp56_rac_get(c); 00119 } 00120 } 00121 00122 if (parse_filter_info) { 00123 if (vp56_rac_get(c)) { 00124 s->filter_mode = 2; 00125 s->sample_variance_threshold = vp56_rac_gets(c, 5) << vrt_shift; 00126 s->max_vector_length = 2 << vp56_rac_gets(c, 3); 00127 } else if (vp56_rac_get(c)) { 00128 s->filter_mode = 1; 00129 } else { 00130 s->filter_mode = 0; 00131 } 00132 if (s->sub_version > 7) 00133 s->filter_selection = vp56_rac_gets(c, 4); 00134 else 00135 s->filter_selection = 16; 00136 } 00137 00138 s->use_huffman = vp56_rac_get(c); 00139 00140 s->parse_coeff = vp6_parse_coeff; 00141 if (coeff_offset) { 00142 buf += coeff_offset; 00143 buf_size -= coeff_offset; 00144 if (buf_size < 0) { 00145 if (s->framep[VP56_FRAME_CURRENT]->key_frame) 00146 avcodec_set_dimensions(s->avctx, 0, 0); 00147 return 0; 00148 } 00149 if (s->use_huffman) { 00150 s->parse_coeff = vp6_parse_coeff_huffman; 00151 init_get_bits(&s->gb, buf, buf_size<<3); 00152 } else { 00153 ff_vp56_init_range_decoder(&s->cc, buf, buf_size); 00154 s->ccp = &s->cc; 00155 } 00156 } else { 00157 s->ccp = &s->c; 00158 } 00159 00160 return res; 00161 } 00162 00163 static void vp6_coeff_order_table_init(VP56Context *s) 00164 { 00165 int i, pos, idx = 1; 00166 00167 s->modelp->coeff_index_to_pos[0] = 0; 00168 for (i=0; i<16; i++) 00169 for (pos=1; pos<64; pos++) 00170 if (s->modelp->coeff_reorder[pos] == i) 00171 s->modelp->coeff_index_to_pos[idx++] = pos; 00172 } 00173 00174 static void vp6_default_models_init(VP56Context *s) 00175 { 00176 VP56Model *model = s->modelp; 00177 00178 model->vector_dct[0] = 0xA2; 00179 model->vector_dct[1] = 0xA4; 00180 model->vector_sig[0] = 0x80; 00181 model->vector_sig[1] = 0x80; 00182 00183 memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats)); 00184 memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv)); 00185 memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv)); 00186 memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv)); 00187 memcpy(model->coeff_reorder, vp6_def_coeff_reorder, sizeof(model->coeff_reorder)); 00188 00189 vp6_coeff_order_table_init(s); 00190 } 00191 00192 static void vp6_parse_vector_models(VP56Context *s) 00193 { 00194 VP56RangeCoder *c = &s->c; 00195 VP56Model *model = s->modelp; 00196 int comp, node; 00197 00198 for (comp=0; comp<2; comp++) { 00199 if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][0])) 00200 model->vector_dct[comp] = vp56_rac_gets_nn(c, 7); 00201 if (vp56_rac_get_prob(c, vp6_sig_dct_pct[comp][1])) 00202 model->vector_sig[comp] = vp56_rac_gets_nn(c, 7); 00203 } 00204 00205 for (comp=0; comp<2; comp++) 00206 for (node=0; node<7; node++) 00207 if (vp56_rac_get_prob(c, vp6_pdv_pct[comp][node])) 00208 model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7); 00209 00210 for (comp=0; comp<2; comp++) 00211 for (node=0; node<8; node++) 00212 if (vp56_rac_get_prob(c, vp6_fdv_pct[comp][node])) 00213 model->vector_fdv[comp][node] = vp56_rac_gets_nn(c, 7); 00214 } 00215 00216 /* nodes must ascend by count, but with descending symbol order */ 00217 static int vp6_huff_cmp(const void *va, const void *vb) 00218 { 00219 const Node *a = va, *b = vb; 00220 return (a->count - b->count)*16 + (b->sym - a->sym); 00221 } 00222 00223 static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[], 00224 const uint8_t *map, unsigned size, VLC *vlc) 00225 { 00226 Node nodes[2*VP6_MAX_HUFF_SIZE], *tmp = &nodes[size]; 00227 int a, b, i; 00228 00229 /* first compute probabilities from model */ 00230 tmp[0].count = 256; 00231 for (i=0; i<size-1; i++) { 00232 a = tmp[i].count * coeff_model[i] >> 8; 00233 b = tmp[i].count * (255 - coeff_model[i]) >> 8; 00234 nodes[map[2*i ]].count = a + !a; 00235 nodes[map[2*i+1]].count = b + !b; 00236 } 00237 00238 free_vlc(vlc); 00239 /* then build the huffman tree according to probabilities */ 00240 return ff_huff_build_tree(s->avctx, vlc, size, nodes, vp6_huff_cmp, 00241 FF_HUFFMAN_FLAG_HNODE_FIRST); 00242 } 00243 00244 static int vp6_parse_coeff_models(VP56Context *s) 00245 { 00246 VP56RangeCoder *c = &s->c; 00247 VP56Model *model = s->modelp; 00248 int def_prob[11]; 00249 int node, cg, ctx, pos; 00250 int ct; /* code type */ 00251 int pt; /* plane type (0 for Y, 1 for U or V) */ 00252 00253 memset(def_prob, 0x80, sizeof(def_prob)); 00254 00255 for (pt=0; pt<2; pt++) 00256 for (node=0; node<11; node++) 00257 if (vp56_rac_get_prob(c, vp6_dccv_pct[pt][node])) { 00258 def_prob[node] = vp56_rac_gets_nn(c, 7); 00259 model->coeff_dccv[pt][node] = def_prob[node]; 00260 } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) { 00261 model->coeff_dccv[pt][node] = def_prob[node]; 00262 } 00263 00264 if (vp56_rac_get(c)) { 00265 for (pos=1; pos<64; pos++) 00266 if (vp56_rac_get_prob(c, vp6_coeff_reorder_pct[pos])) 00267 model->coeff_reorder[pos] = vp56_rac_gets(c, 4); 00268 vp6_coeff_order_table_init(s); 00269 } 00270 00271 for (cg=0; cg<2; cg++) 00272 for (node=0; node<14; node++) 00273 if (vp56_rac_get_prob(c, vp6_runv_pct[cg][node])) 00274 model->coeff_runv[cg][node] = vp56_rac_gets_nn(c, 7); 00275 00276 for (ct=0; ct<3; ct++) 00277 for (pt=0; pt<2; pt++) 00278 for (cg=0; cg<6; cg++) 00279 for (node=0; node<11; node++) 00280 if (vp56_rac_get_prob(c, vp6_ract_pct[ct][pt][cg][node])) { 00281 def_prob[node] = vp56_rac_gets_nn(c, 7); 00282 model->coeff_ract[pt][ct][cg][node] = def_prob[node]; 00283 } else if (s->framep[VP56_FRAME_CURRENT]->key_frame) { 00284 model->coeff_ract[pt][ct][cg][node] = def_prob[node]; 00285 } 00286 00287 if (s->use_huffman) { 00288 for (pt=0; pt<2; pt++) { 00289 if (vp6_build_huff_tree(s, model->coeff_dccv[pt], 00290 vp6_huff_coeff_map, 12, &s->dccv_vlc[pt])) 00291 return -1; 00292 if (vp6_build_huff_tree(s, model->coeff_runv[pt], 00293 vp6_huff_run_map, 9, &s->runv_vlc[pt])) 00294 return -1; 00295 for (ct=0; ct<3; ct++) 00296 for (cg = 0; cg < 6; cg++) 00297 if (vp6_build_huff_tree(s, model->coeff_ract[pt][ct][cg], 00298 vp6_huff_coeff_map, 12, 00299 &s->ract_vlc[pt][ct][cg])) 00300 return -1; 00301 } 00302 memset(s->nb_null, 0, sizeof(s->nb_null)); 00303 } else { 00304 /* coeff_dcct is a linear combination of coeff_dccv */ 00305 for (pt=0; pt<2; pt++) 00306 for (ctx=0; ctx<3; ctx++) 00307 for (node=0; node<5; node++) 00308 model->coeff_dcct[pt][ctx][node] = av_clip(((model->coeff_dccv[pt][node] * vp6_dccv_lc[ctx][node][0] + 128) >> 8) + vp6_dccv_lc[ctx][node][1], 1, 255); 00309 } 00310 return 0; 00311 } 00312 00313 static void vp6_parse_vector_adjustment(VP56Context *s, VP56mv *vect) 00314 { 00315 VP56RangeCoder *c = &s->c; 00316 VP56Model *model = s->modelp; 00317 int comp; 00318 00319 *vect = (VP56mv) {0,0}; 00320 if (s->vector_candidate_pos < 2) 00321 *vect = s->vector_candidate[0]; 00322 00323 for (comp=0; comp<2; comp++) { 00324 int i, delta = 0; 00325 00326 if (vp56_rac_get_prob(c, model->vector_dct[comp])) { 00327 static const uint8_t prob_order[] = {0, 1, 2, 7, 6, 5, 4}; 00328 for (i=0; i<sizeof(prob_order); i++) { 00329 int j = prob_order[i]; 00330 delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][j])<<j; 00331 } 00332 if (delta & 0xF0) 00333 delta |= vp56_rac_get_prob(c, model->vector_fdv[comp][3])<<3; 00334 else 00335 delta |= 8; 00336 } else { 00337 delta = vp56_rac_get_tree(c, vp56_pva_tree, 00338 model->vector_pdv[comp]); 00339 } 00340 00341 if (delta && vp56_rac_get_prob(c, model->vector_sig[comp])) 00342 delta = -delta; 00343 00344 if (!comp) 00345 vect->x += delta; 00346 else 00347 vect->y += delta; 00348 } 00349 } 00350 00355 static unsigned vp6_get_nb_null(VP56Context *s) 00356 { 00357 unsigned val = get_bits(&s->gb, 2); 00358 if (val == 2) 00359 val += get_bits(&s->gb, 2); 00360 else if (val == 3) { 00361 val = get_bits1(&s->gb) << 2; 00362 val = 6+val + get_bits(&s->gb, 2+val); 00363 } 00364 return val; 00365 } 00366 00367 static void vp6_parse_coeff_huffman(VP56Context *s) 00368 { 00369 VP56Model *model = s->modelp; 00370 uint8_t *permute = s->scantable.permutated; 00371 VLC *vlc_coeff; 00372 int coeff, sign, coeff_idx; 00373 int b, cg, idx; 00374 int pt = 0; /* plane type (0 for Y, 1 for U or V) */ 00375 00376 for (b=0; b<6; b++) { 00377 int ct = 0; /* code type */ 00378 if (b > 3) pt = 1; 00379 vlc_coeff = &s->dccv_vlc[pt]; 00380 00381 for (coeff_idx = 0;;) { 00382 int run = 1; 00383 if (coeff_idx<2 && s->nb_null[coeff_idx][pt]) { 00384 s->nb_null[coeff_idx][pt]--; 00385 if (coeff_idx) 00386 break; 00387 } else { 00388 if (get_bits_count(&s->gb) >= s->gb.size_in_bits) 00389 return; 00390 coeff = get_vlc2(&s->gb, vlc_coeff->table, 9, 3); 00391 if (coeff == 0) { 00392 if (coeff_idx) { 00393 int pt = (coeff_idx >= 6); 00394 run += get_vlc2(&s->gb, s->runv_vlc[pt].table, 9, 3); 00395 if (run >= 9) 00396 run += get_bits(&s->gb, 6); 00397 } else 00398 s->nb_null[0][pt] = vp6_get_nb_null(s); 00399 ct = 0; 00400 } else if (coeff == 11) { /* end of block */ 00401 if (coeff_idx == 1) /* first AC coeff ? */ 00402 s->nb_null[1][pt] = vp6_get_nb_null(s); 00403 break; 00404 } else { 00405 int coeff2 = vp56_coeff_bias[coeff]; 00406 if (coeff > 4) 00407 coeff2 += get_bits(&s->gb, coeff <= 9 ? coeff - 4 : 11); 00408 ct = 1 + (coeff2 > 1); 00409 sign = get_bits1(&s->gb); 00410 coeff2 = (coeff2 ^ -sign) + sign; 00411 if (coeff_idx) 00412 coeff2 *= s->dequant_ac; 00413 idx = model->coeff_index_to_pos[coeff_idx]; 00414 s->block_coeff[b][permute[idx]] = coeff2; 00415 } 00416 } 00417 coeff_idx+=run; 00418 if (coeff_idx >= 64) 00419 break; 00420 cg = FFMIN(vp6_coeff_groups[coeff_idx], 3); 00421 vlc_coeff = &s->ract_vlc[pt][ct][cg]; 00422 } 00423 } 00424 } 00425 00426 static void vp6_parse_coeff(VP56Context *s) 00427 { 00428 VP56RangeCoder *c = s->ccp; 00429 VP56Model *model = s->modelp; 00430 uint8_t *permute = s->scantable.permutated; 00431 uint8_t *model1, *model2, *model3; 00432 int coeff, sign, coeff_idx; 00433 int b, i, cg, idx, ctx; 00434 int pt = 0; /* plane type (0 for Y, 1 for U or V) */ 00435 00436 for (b=0; b<6; b++) { 00437 int ct = 1; /* code type */ 00438 int run = 1; 00439 00440 if (b > 3) pt = 1; 00441 00442 ctx = s->left_block[vp56_b6to4[b]].not_null_dc 00443 + s->above_blocks[s->above_block_idx[b]].not_null_dc; 00444 model1 = model->coeff_dccv[pt]; 00445 model2 = model->coeff_dcct[pt][ctx]; 00446 00447 coeff_idx = 0; 00448 for (;;) { 00449 if ((coeff_idx>1 && ct==0) || vp56_rac_get_prob(c, model2[0])) { 00450 /* parse a coeff */ 00451 if (vp56_rac_get_prob(c, model2[2])) { 00452 if (vp56_rac_get_prob(c, model2[3])) { 00453 idx = vp56_rac_get_tree(c, vp56_pc_tree, model1); 00454 coeff = vp56_coeff_bias[idx+5]; 00455 for (i=vp56_coeff_bit_length[idx]; i>=0; i--) 00456 coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; 00457 } else { 00458 if (vp56_rac_get_prob(c, model2[4])) 00459 coeff = 3 + vp56_rac_get_prob(c, model1[5]); 00460 else 00461 coeff = 2; 00462 } 00463 ct = 2; 00464 } else { 00465 ct = 1; 00466 coeff = 1; 00467 } 00468 sign = vp56_rac_get(c); 00469 coeff = (coeff ^ -sign) + sign; 00470 if (coeff_idx) 00471 coeff *= s->dequant_ac; 00472 idx = model->coeff_index_to_pos[coeff_idx]; 00473 s->block_coeff[b][permute[idx]] = coeff; 00474 run = 1; 00475 } else { 00476 /* parse a run */ 00477 ct = 0; 00478 if (coeff_idx > 0) { 00479 if (!vp56_rac_get_prob(c, model2[1])) 00480 break; 00481 00482 model3 = model->coeff_runv[coeff_idx >= 6]; 00483 run = vp56_rac_get_tree(c, vp6_pcr_tree, model3); 00484 if (!run) 00485 for (run=9, i=0; i<6; i++) 00486 run += vp56_rac_get_prob(c, model3[i+8]) << i; 00487 } 00488 } 00489 coeff_idx += run; 00490 if (coeff_idx >= 64) 00491 break; 00492 cg = vp6_coeff_groups[coeff_idx]; 00493 model1 = model2 = model->coeff_ract[pt][ct][cg]; 00494 } 00495 00496 s->left_block[vp56_b6to4[b]].not_null_dc = 00497 s->above_blocks[s->above_block_idx[b]].not_null_dc = !!s->block_coeff[b][0]; 00498 } 00499 } 00500 00501 static int vp6_block_variance(uint8_t *src, int stride) 00502 { 00503 int sum = 0, square_sum = 0; 00504 int y, x; 00505 00506 for (y=0; y<8; y+=2) { 00507 for (x=0; x<8; x+=2) { 00508 sum += src[x]; 00509 square_sum += src[x]*src[x]; 00510 } 00511 src += 2*stride; 00512 } 00513 return (16*square_sum - sum*sum) >> 8; 00514 } 00515 00516 static void vp6_filter_hv4(uint8_t *dst, uint8_t *src, int stride, 00517 int delta, const int16_t *weights) 00518 { 00519 int x, y; 00520 00521 for (y=0; y<8; y++) { 00522 for (x=0; x<8; x++) { 00523 dst[x] = av_clip_uint8(( src[x-delta ] * weights[0] 00524 + src[x ] * weights[1] 00525 + src[x+delta ] * weights[2] 00526 + src[x+2*delta] * weights[3] + 64) >> 7); 00527 } 00528 src += stride; 00529 dst += stride; 00530 } 00531 } 00532 00533 static void vp6_filter_diag2(VP56Context *s, uint8_t *dst, uint8_t *src, 00534 int stride, int h_weight, int v_weight) 00535 { 00536 uint8_t *tmp = s->edge_emu_buffer+16; 00537 s->dsp.put_h264_chroma_pixels_tab[0](tmp, src, stride, 9, h_weight, 0); 00538 s->dsp.put_h264_chroma_pixels_tab[0](dst, tmp, stride, 8, 0, v_weight); 00539 } 00540 00541 static void vp6_filter(VP56Context *s, uint8_t *dst, uint8_t *src, 00542 int offset1, int offset2, int stride, 00543 VP56mv mv, int mask, int select, int luma) 00544 { 00545 int filter4 = 0; 00546 int x8 = mv.x & mask; 00547 int y8 = mv.y & mask; 00548 00549 if (luma) { 00550 x8 *= 2; 00551 y8 *= 2; 00552 filter4 = s->filter_mode; 00553 if (filter4 == 2) { 00554 if (s->max_vector_length && 00555 (FFABS(mv.x) > s->max_vector_length || 00556 FFABS(mv.y) > s->max_vector_length)) { 00557 filter4 = 0; 00558 } else if (s->sample_variance_threshold 00559 && (vp6_block_variance(src+offset1, stride) 00560 < s->sample_variance_threshold)) { 00561 filter4 = 0; 00562 } 00563 } 00564 } 00565 00566 if ((y8 && (offset2-offset1)*s->flip<0) || (!y8 && offset1 > offset2)) { 00567 offset1 = offset2; 00568 } 00569 00570 if (filter4) { 00571 if (!y8) { /* left or right combine */ 00572 vp6_filter_hv4(dst, src+offset1, stride, 1, 00573 vp6_block_copy_filter[select][x8]); 00574 } else if (!x8) { /* above or below combine */ 00575 vp6_filter_hv4(dst, src+offset1, stride, stride, 00576 vp6_block_copy_filter[select][y8]); 00577 } else { 00578 s->vp56dsp.vp6_filter_diag4(dst, src+offset1+((mv.x^mv.y)>>31), stride, 00579 vp6_block_copy_filter[select][x8], 00580 vp6_block_copy_filter[select][y8]); 00581 } 00582 } else { 00583 if (!x8 || !y8) { 00584 s->dsp.put_h264_chroma_pixels_tab[0](dst, src+offset1, stride, 8, x8, y8); 00585 } else { 00586 vp6_filter_diag2(s, dst, src+offset1 + ((mv.x^mv.y)>>31), stride, x8, y8); 00587 } 00588 } 00589 } 00590 00591 static av_cold int vp6_decode_init(AVCodecContext *avctx) 00592 { 00593 VP56Context *s = avctx->priv_data; 00594 00595 ff_vp56_init(avctx, avctx->codec->id == CODEC_ID_VP6, 00596 avctx->codec->id == CODEC_ID_VP6A); 00597 s->vp56_coord_div = vp6_coord_div; 00598 s->parse_vector_adjustment = vp6_parse_vector_adjustment; 00599 s->filter = vp6_filter; 00600 s->default_models_init = vp6_default_models_init; 00601 s->parse_vector_models = vp6_parse_vector_models; 00602 s->parse_coeff_models = vp6_parse_coeff_models; 00603 s->parse_header = vp6_parse_header; 00604 00605 return 0; 00606 } 00607 00608 static av_cold int vp6_decode_free(AVCodecContext *avctx) 00609 { 00610 VP56Context *s = avctx->priv_data; 00611 int pt, ct, cg; 00612 00613 ff_vp56_free(avctx); 00614 00615 for (pt=0; pt<2; pt++) { 00616 free_vlc(&s->dccv_vlc[pt]); 00617 free_vlc(&s->runv_vlc[pt]); 00618 for (ct=0; ct<3; ct++) 00619 for (cg=0; cg<6; cg++) 00620 free_vlc(&s->ract_vlc[pt][ct][cg]); 00621 } 00622 return 0; 00623 } 00624 00625 AVCodec ff_vp6_decoder = { 00626 "vp6", 00627 AVMEDIA_TYPE_VIDEO, 00628 CODEC_ID_VP6, 00629 sizeof(VP56Context), 00630 vp6_decode_init, 00631 NULL, 00632 vp6_decode_free, 00633 ff_vp56_decode_frame, 00634 CODEC_CAP_DR1, 00635 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"), 00636 }; 00637 00638 /* flash version, not flipped upside-down */ 00639 AVCodec ff_vp6f_decoder = { 00640 "vp6f", 00641 AVMEDIA_TYPE_VIDEO, 00642 CODEC_ID_VP6F, 00643 sizeof(VP56Context), 00644 vp6_decode_init, 00645 NULL, 00646 vp6_decode_free, 00647 ff_vp56_decode_frame, 00648 CODEC_CAP_DR1, 00649 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"), 00650 }; 00651 00652 /* flash version, not flipped upside-down, with alpha channel */ 00653 AVCodec ff_vp6a_decoder = { 00654 "vp6a", 00655 AVMEDIA_TYPE_VIDEO, 00656 CODEC_ID_VP6A, 00657 sizeof(VP56Context), 00658 vp6_decode_init, 00659 NULL, 00660 vp6_decode_free, 00661 ff_vp56_decode_frame, 00662 CODEC_CAP_DR1, 00663 .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"), 00664 };