changeset 715:8b3ccabfce4a libavcodec

move scantable init from block-decode to header parser
author michaelni
date Tue, 01 Oct 2002 23:47:04 +0000
parents fd0e997616fe
children 2ec5bd9f7116
files mpeg12.c
diffstat 1 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg12.c	Tue Oct 01 23:11:40 2002 +0000
+++ b/mpeg12.c	Tue Oct 01 23:47:04 2002 +0000
@@ -1183,15 +1183,11 @@
 {
     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 @@
     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 @@
     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);