Mercurial > libavcodec.hg
comparison indeo5.c @ 11246:b75449aaea3e libavcodec
Macroblock and block Huffman code sets are to be used by both Indeo 4 and
Indeo 5, so make them global and move their initialization to the common place
as well. And fix static VLC initialization, as ff_ivi_create_huff_from_desc()
used old way to do so.
author | kostya |
---|---|
date | Mon, 22 Feb 2010 13:51:32 +0000 |
parents | 384b6a615a92 |
children | f65b3f7186b5 |
comparison
equal
deleted
inserted
replaced
11245:1e9ff636c3db | 11246:b75449aaea3e |
---|---|
77 int is_scalable; | 77 int is_scalable; |
78 uint32_t lock_word; | 78 uint32_t lock_word; |
79 IVIPicConfig pic_conf; | 79 IVIPicConfig pic_conf; |
80 } IVI5DecContext; | 80 } IVI5DecContext; |
81 | 81 |
82 //! static vlc tables (initialized at startup) | |
83 static VLC mb_vlc_tabs [8]; | |
84 static VLC blk_vlc_tabs[8]; | |
85 | |
86 | 82 |
87 /** | 83 /** |
88 * Decodes Indeo5 GOP (Group of pictures) header. | 84 * Decodes Indeo5 GOP (Group of pictures) header. |
89 * This header is present in key frames only. | 85 * This header is present in key frames only. |
90 * It defines parameters for all frames in a GOP. | 86 * It defines parameters for all frames in a GOP. |
344 | 340 |
345 /* decode macroblock huffman codebook */ | 341 /* decode macroblock huffman codebook */ |
346 if (ctx->frame_flags & 0x40) { | 342 if (ctx->frame_flags & 0x40) { |
347 ctx->mb_huff_sel = ff_ivi_dec_huff_desc(&ctx->gb, &new_huff); | 343 ctx->mb_huff_sel = ff_ivi_dec_huff_desc(&ctx->gb, &new_huff); |
348 if (ctx->mb_huff_sel != 7) { | 344 if (ctx->mb_huff_sel != 7) { |
349 ctx->mb_vlc = &mb_vlc_tabs[ctx->mb_huff_sel]; | 345 ctx->mb_vlc = &ff_ivi_mb_vlc_tabs[ctx->mb_huff_sel]; |
350 } else { | 346 } else { |
351 if (ff_ivi_huff_desc_cmp(&new_huff, &ctx->mb_huff_desc)) { | 347 if (ff_ivi_huff_desc_cmp(&new_huff, &ctx->mb_huff_desc)) { |
352 ff_ivi_huff_desc_copy(&ctx->mb_huff_desc, &new_huff); | 348 ff_ivi_huff_desc_copy(&ctx->mb_huff_desc, &new_huff); |
353 | 349 |
354 if (ctx->mb_vlc_cust.table) | 350 if (ctx->mb_vlc_cust.table) |
361 } | 357 } |
362 } | 358 } |
363 ctx->mb_vlc = &ctx->mb_vlc_cust; | 359 ctx->mb_vlc = &ctx->mb_vlc_cust; |
364 } | 360 } |
365 } else { | 361 } else { |
366 ctx->mb_vlc = &mb_vlc_tabs[7]; /* select the default macroblock huffman table */ | 362 ctx->mb_vlc = &ff_ivi_mb_vlc_tabs[7]; /* select the default macroblock huffman table */ |
367 } | 363 } |
368 | 364 |
369 skip_bits(&ctx->gb, 3); /* FIXME: unknown meaning! */ | 365 skip_bits(&ctx->gb, 3); /* FIXME: unknown meaning! */ |
370 } | 366 } |
371 | 367 |
424 | 420 |
425 /* decode block huffman codebook */ | 421 /* decode block huffman codebook */ |
426 if (band_flags & 0x80) { | 422 if (band_flags & 0x80) { |
427 band->huff_sel = ff_ivi_dec_huff_desc(&ctx->gb, &new_huff); | 423 band->huff_sel = ff_ivi_dec_huff_desc(&ctx->gb, &new_huff); |
428 if (band->huff_sel != 7) { | 424 if (band->huff_sel != 7) { |
429 band->blk_vlc = &blk_vlc_tabs[band->huff_sel]; | 425 band->blk_vlc = &ff_ivi_blk_vlc_tabs[band->huff_sel]; |
430 } else { | 426 } else { |
431 if (ff_ivi_huff_desc_cmp(&new_huff, &band->huff_desc)) { | 427 if (ff_ivi_huff_desc_cmp(&new_huff, &band->huff_desc)) { |
432 ff_ivi_huff_desc_copy(&band->huff_desc, &new_huff); | 428 ff_ivi_huff_desc_copy(&band->huff_desc, &new_huff); |
433 | 429 |
434 if (band->blk_vlc_cust.table) | 430 if (band->blk_vlc_cust.table) |
441 } | 437 } |
442 } | 438 } |
443 band->blk_vlc = &band->blk_vlc_cust; | 439 band->blk_vlc = &band->blk_vlc_cust; |
444 } | 440 } |
445 } else { | 441 } else { |
446 band->blk_vlc = &blk_vlc_tabs[7]; /* select the default macroblock huffman table */ | 442 band->blk_vlc = &ff_ivi_blk_vlc_tabs[7]; /* select the default macroblock huffman table */ |
447 } | 443 } |
448 | 444 |
449 band->checksum_present = get_bits1(&ctx->gb); | 445 band->checksum_present = get_bits1(&ctx->gb); |
450 if (band->checksum_present) | 446 if (band->checksum_present) |
451 band->checksum = get_bits(&ctx->gb, 16); | 447 band->checksum = get_bits(&ctx->gb, 16); |
750 * Initializes Indeo5 decoder. | 746 * Initializes Indeo5 decoder. |
751 */ | 747 */ |
752 static av_cold int decode_init(AVCodecContext *avctx) | 748 static av_cold int decode_init(AVCodecContext *avctx) |
753 { | 749 { |
754 IVI5DecContext *ctx = avctx->priv_data; | 750 IVI5DecContext *ctx = avctx->priv_data; |
755 int i, result; | 751 int result; |
756 | 752 |
757 /* initialize static vlc tables for macroblock/block signals */ | 753 ff_ivi_init_static_vlc(); |
758 for (i = 0; i < 8; i++) { | |
759 ff_ivi_create_huff_from_desc(&ff_ivi_mb_huff_desc[i], &mb_vlc_tabs[i], 1); | |
760 ff_ivi_create_huff_from_desc(&ff_ivi_blk_huff_desc[i], &blk_vlc_tabs[i], 1); | |
761 } | |
762 | 754 |
763 /* copy rvmap tables in our context so we can apply changes to them */ | 755 /* copy rvmap tables in our context so we can apply changes to them */ |
764 memcpy(ctx->rvmap_tabs, ff_ivi_rvmap_tabs, sizeof(ff_ivi_rvmap_tabs)); | 756 memcpy(ctx->rvmap_tabs, ff_ivi_rvmap_tabs, sizeof(ff_ivi_rvmap_tabs)); |
765 | 757 |
766 /* set the initial picture layout according to the basic profile: | 758 /* set the initial picture layout according to the basic profile: |