[FFmpeg-cvslog] r9828 - trunk/libavcodec/rawdec.c

michael subversion
Sun Jul 29 15:32:53 CEST 2007


Author: michael
Date: Sun Jul 29 15:32:53 2007
New Revision: 9828

Log:
support raw 4bpp avi
fixes dance1.avi
closes issue40


Modified:
   trunk/libavcodec/rawdec.c

Modified: trunk/libavcodec/rawdec.c
==============================================================================
--- trunk/libavcodec/rawdec.c	(original)
+++ trunk/libavcodec/rawdec.c	Sun Jul 29 15:32:53 2007
@@ -34,6 +34,7 @@ typedef struct RawVideoContext {
 } RawVideoContext;
 
 static const PixelFormatTag pixelFormatBpsAVI[] = {
+    { PIX_FMT_PAL8,    4 },
     { PIX_FMT_PAL8,    8 },
     { PIX_FMT_RGB555, 15 },
     { PIX_FMT_RGB555, 16 },
@@ -105,6 +106,17 @@ static int raw_decode(AVCodecContext *av
     frame->interlaced_frame = avctx->coded_frame->interlaced_frame;
     frame->top_field_first = avctx->coded_frame->top_field_first;
 
+    //4bpp raw in avi (yes this is ugly ...)
+    if(avctx->bits_per_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 && !avctx->codec_tag){
+        int i;
+        for(i=256*2; i+1 < context->length>>1; i++){
+            context->buffer[2*i+0]= buf[i-256*2]>>4;
+            context->buffer[2*i+1]= buf[i-256*2]&15;
+        }
+        buf= context->buffer + 256*4;
+        buf_size= context->length - 256*4;
+    }
+
     if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0))
         return -1;
 




More information about the ffmpeg-cvslog mailing list