Mercurial > libavcodec.hg
comparison indeo5.c @ 11872:238cfd740f10 libavcodec
Move indeo5-specific quant table selection to decode_gop_hdr.
author | maxim |
---|---|
date | Fri, 11 Jun 2010 09:49:06 +0000 |
parents | b42f18b5c479 |
children | fdafbcef52f5 |
comparison
equal
deleted
inserted
replaced
11871:1fccba2858dd | 11872:238cfd740f10 |
---|---|
88 * @param avctx [in] ptr to the AVCodecContext | 88 * @param avctx [in] ptr to the AVCodecContext |
89 * @return result code: 0 = OK, -1 = error | 89 * @return result code: 0 = OK, -1 = error |
90 */ | 90 */ |
91 static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx) | 91 static int decode_gop_header(IVI5DecContext *ctx, AVCodecContext *avctx) |
92 { | 92 { |
93 int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, blk_size_changed = 0; | 93 int result, i, p, tile_size, pic_size_indx, mb_size, blk_size; |
94 int quant_mat, blk_size_changed = 0; | |
94 IVIBandDesc *band, *band1, *band2; | 95 IVIBandDesc *band, *band1, *band2; |
95 IVIPicConfig pic_conf; | 96 IVIPicConfig pic_conf; |
96 | 97 |
97 ctx->gop_flags = get_bits(&ctx->gb, 8); | 98 ctx->gop_flags = get_bits(&ctx->gb, 8); |
98 | 99 |
210 band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 || | 211 band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 || |
211 band->inv_transform == ff_ivi_inverse_slant_4x4; | 212 band->inv_transform == ff_ivi_inverse_slant_4x4; |
212 | 213 |
213 /* select dequant matrix according to plane and band number */ | 214 /* select dequant matrix according to plane and band number */ |
214 if (!p) { | 215 if (!p) { |
215 band->quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0; | 216 quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0; |
216 } else { | 217 } else { |
217 band->quant_mat = 5; | 218 quant_mat = 5; |
219 } | |
220 | |
221 if (band->blk_size == 8) { | |
222 band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0]; | |
223 band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0]; | |
224 band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0]; | |
225 band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0]; | |
226 } else { | |
227 band->intra_base = ivi5_base_quant_4x4_intra; | |
228 band->inter_base = ivi5_base_quant_4x4_inter; | |
229 band->intra_scale = ivi5_scale_quant_4x4_intra; | |
230 band->inter_scale = ivi5_scale_quant_4x4_inter; | |
218 } | 231 } |
219 | 232 |
220 if (get_bits(&ctx->gb, 2)) { | 233 if (get_bits(&ctx->gb, 2)) { |
221 av_log(avctx, AV_LOG_ERROR, "End marker missing!\n"); | 234 av_log(avctx, AV_LOG_ERROR, "End marker missing!\n"); |
222 return -1; | 235 return -1; |
232 band2->width = band1->width; | 245 band2->width = band1->width; |
233 band2->height = band1->height; | 246 band2->height = band1->height; |
234 band2->mb_size = band1->mb_size; | 247 band2->mb_size = band1->mb_size; |
235 band2->blk_size = band1->blk_size; | 248 band2->blk_size = band1->blk_size; |
236 band2->is_halfpel = band1->is_halfpel; | 249 band2->is_halfpel = band1->is_halfpel; |
237 band2->quant_mat = band1->quant_mat; | 250 band2->intra_base = band1->intra_base; |
251 band2->inter_base = band1->inter_base; | |
252 band2->intra_scale = band1->intra_scale; | |
253 band2->inter_scale = band1->inter_scale; | |
238 band2->scan = band1->scan; | 254 band2->scan = band1->scan; |
239 band2->inv_transform = band1->inv_transform; | 255 band2->inv_transform = band1->inv_transform; |
240 band2->dc_transform = band1->dc_transform; | 256 band2->dc_transform = band1->dc_transform; |
241 band2->is_2d_trans = band1->is_2d_trans; | 257 band2->is_2d_trans = band1->is_2d_trans; |
242 } | 258 } |
568 if (band->is_empty) { | 584 if (band->is_empty) { |
569 av_log(avctx, AV_LOG_ERROR, "Empty band encountered!\n"); | 585 av_log(avctx, AV_LOG_ERROR, "Empty band encountered!\n"); |
570 return -1; | 586 return -1; |
571 } | 587 } |
572 | 588 |
573 if (band->blk_size == 8) { | |
574 band->intra_base = &ivi5_base_quant_8x8_intra[band->quant_mat][0]; | |
575 band->inter_base = &ivi5_base_quant_8x8_inter[band->quant_mat][0]; | |
576 band->intra_scale = &ivi5_scale_quant_8x8_intra[band->quant_mat][0]; | |
577 band->inter_scale = &ivi5_scale_quant_8x8_inter[band->quant_mat][0]; | |
578 } else { | |
579 band->intra_base = ivi5_base_quant_4x4_intra; | |
580 band->inter_base = ivi5_base_quant_4x4_inter; | |
581 band->intra_scale = ivi5_scale_quant_4x4_intra; | |
582 band->inter_scale = ivi5_scale_quant_4x4_inter; | |
583 } | |
584 | |
585 band->rv_map = &ctx->rvmap_tabs[band->rvmap_sel]; | 589 band->rv_map = &ctx->rvmap_tabs[band->rvmap_sel]; |
586 | 590 |
587 /* apply corrections to the selected rvmap table if present */ | 591 /* apply corrections to the selected rvmap table if present */ |
588 for (i = 0; i < band->num_corr; i++) { | 592 for (i = 0; i < band->num_corr; i++) { |
589 idx1 = band->corr[i*2]; | 593 idx1 = band->corr[i*2]; |