aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/rawdec.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2010-01-05 01:11:45 +0000
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>2010-01-05 01:11:45 +0000
commit4235c98e57d5e8083b8dabf01180569855381ec4 (patch)
treef860dc0242e08faf3db64c5e863d8c28da41db43 /libavcodec/rawdec.c
parent0a1e15109ad77716a8a6a511e713eded95c7f130 (diff)
downloadffmpeg-4235c98e57d5e8083b8dabf01180569855381ec4.tar.gz
Support decoding raw 2bpp in mov, fixes issue 1528.
Originally committed as revision 21027 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r--libavcodec/rawdec.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 1629602e6a..8d97a75b15 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -47,6 +47,7 @@ static const PixelFormatTag pixelFormatBpsAVI[] = {
static const PixelFormatTag pixelFormatBpsMOV[] = {
{ PIX_FMT_MONOWHITE, 1 },
+ { PIX_FMT_PAL8, 2 },
{ PIX_FMT_PAL8, 4 },
{ PIX_FMT_PAL8, 8 },
// FIXME swscale does not support 16 bit in .mov, sample 16bit.mov
@@ -115,15 +116,24 @@ static int raw_decode(AVCodecContext *avctx,
frame->top_field_first = avctx->coded_frame->top_field_first;
//4bpp raw in avi and mov (yes this is ugly ...)
- if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
+ if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
+ avctx->pix_fmt==PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
int i;
uint8_t *dst = context->buffer + 256*4;
buf_size = context->length - 256*4;
+ if (avctx->bits_per_coded_sample == 4){
for(i=0; 2*i+1 < buf_size; i++){
dst[2*i+0]= buf[i]>>4;
dst[2*i+1]= buf[i]&15;
}
+ } else
+ for(i=0; 4*i+3 < buf_size; i++){
+ dst[4*i+0]= buf[i]>>6;
+ dst[4*i+1]= buf[i]>>4&3;
+ dst[4*i+2]= buf[i]>>2&3;
+ dst[4*i+3]= buf[i] &3;
+ }
buf= dst;
}