summaryrefslogtreecommitdiff
path: root/libavcodec/rawdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-07-29 13:32:53 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-07-29 13:32:53 +0000
commit611e7bc41b58421af70e525e2a9debc30d68a2be (patch)
tree2e57efd46b041ba2d14a9d6f10a9ca5b3ad9b192 /libavcodec/rawdec.c
parent3bdc2fcea6d160adb1319c8b8a4328de948c97ba (diff)
downloadffmpeg-611e7bc41b58421af70e525e2a9debc30d68a2be.tar.gz
support raw 4bpp avi
fixes dance1.avi closes issue40 Originally committed as revision 9828 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 87fa295641..a92168e6e7 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -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 *avctx,
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;