From acf44abb8cb7e09904081d4e74a6d7de18af5c27 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 1 Oct 2002 23:47:04 +0000 Subject: [PATCH] move scantable init from block-decode to header parser Originally committed as revision 990 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpeg12.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 89f24c4ee6..e43525e4e9 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1183,15 +1183,11 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, { int level, i, j, run; RLTable *rl = &rl_mpeg1; - UINT8 * scantable; + UINT8 * const scantable= s->intra_scantable.permutated; const UINT16 *quant_matrix; const int qscale= s->qscale; int mismatch; - if (s->alternate_scan) - scantable = s->intra_v_scantable.permutated; - else - scantable = s->intra_scantable.permutated; mismatch = 1; { @@ -1267,16 +1263,11 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, int level, dc, diff, i, j, run; int component; RLTable *rl; - UINT8 * scantable; + UINT8 * const scantable= s->intra_scantable.permutated; const UINT16 *quant_matrix; const int qscale= s->qscale; int mismatch; - if (s->alternate_scan) - scantable = s->intra_v_scantable.permutated; - else - scantable = s->intra_scantable.permutated; - /* DC coef */ if (n < 4){ quant_matrix = s->intra_matrix; @@ -1524,6 +1515,19 @@ static void mpeg_decode_picture_coding_extension(MpegEncContext *s) s->repeat_first_field = get_bits1(&s->gb); s->chroma_420_type = get_bits1(&s->gb); s->progressive_frame = get_bits1(&s->gb); + + if(s->alternate_scan){ + ff_init_scantable(s, &s->inter_scantable , ff_alternate_vertical_scan); + ff_init_scantable(s, &s->intra_scantable , ff_alternate_vertical_scan); + ff_init_scantable(s, &s->intra_h_scantable, ff_alternate_vertical_scan); + ff_init_scantable(s, &s->intra_v_scantable, ff_alternate_vertical_scan); + }else{ + ff_init_scantable(s, &s->inter_scantable , ff_zigzag_direct); + ff_init_scantable(s, &s->intra_scantable , ff_zigzag_direct); + ff_init_scantable(s, &s->intra_h_scantable, ff_alternate_horizontal_scan); + ff_init_scantable(s, &s->intra_v_scantable, ff_alternate_vertical_scan); + } + /* composite display not parsed */ dprintf("intra_dc_precision=%d\n", s->intra_dc_precision); dprintf("picture_structure=%d\n", s->picture_structure);