changeset 2374:b36811e1386a libavcodec

fix interlacing check in v1 huffyuv.
author lorenm
date Sun, 28 Nov 2004 19:19:39 +0000
parents f977a8871c2c
children 24d3a50d1b8b
files huffyuv.c
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/huffyuv.c	Sun Nov 28 18:29:38 2004 +0000
+++ b/huffyuv.c	Sun Nov 28 19:19:39 2004 +0000
@@ -360,6 +360,7 @@
     width= s->width= avctx->width;
     height= s->height= avctx->height;
     avctx->coded_frame= &s->picture;
+    s->interlaced= height > 288;
 
 s->bgr32=1;
     assert(width && height);
@@ -374,7 +375,7 @@
         s->version=0;
     
     if(s->version==2){
-        int method;
+        int method, interlace;
 
         method= ((uint8_t*)avctx->extradata)[0];
         s->decorrelate= method&64 ? 1 : 0;
@@ -382,6 +383,8 @@
         s->bitstream_bpp= ((uint8_t*)avctx->extradata)[1];
         if(s->bitstream_bpp==0) 
             s->bitstream_bpp= avctx->bits_per_sample&~7;
+        interlace= (((uint8_t*)avctx->extradata)[2] & 0x30) >> 4;
+        s->interlaced= (interlace==1) ? 1 : (interlace==2) ? 0 : s->interlaced;
         s->context= ((uint8_t*)avctx->extradata)[2] & 0x40 ? 1 : 0;
             
         if(read_huffman_tables(s, ((uint8_t*)avctx->extradata)+4, avctx->extradata_size) < 0)
@@ -416,11 +419,6 @@
             return -1;
     }
     
-    if(((uint8_t*)avctx->extradata)[2] & 0x20)
-	s->interlaced= ((uint8_t*)avctx->extradata)[2] & 0x10 ? 1 : 0;
-    else
-	s->interlaced= height > 288;
-    
     switch(s->bitstream_bpp){
     case 12:
         avctx->pix_fmt = PIX_FMT_YUV420P;
@@ -534,7 +532,7 @@
     
     ((uint8_t*)avctx->extradata)[0]= s->predictor;
     ((uint8_t*)avctx->extradata)[1]= s->bitstream_bpp;
-    ((uint8_t*)avctx->extradata)[2]= 0x20 | (s->interlaced ? 0x10 : 0);
+    ((uint8_t*)avctx->extradata)[2]= s->interlaced ? 0x10 : 0x20;
     if(s->context)
         ((uint8_t*)avctx->extradata)[2]|= 0x40;
     ((uint8_t*)avctx->extradata)[3]= 0;