Revision 4235c98e

View differences:

libavcodec/rawdec.c
47 47

  
48 48
static const PixelFormatTag pixelFormatBpsMOV[] = {
49 49
    { PIX_FMT_MONOWHITE, 1 },
50
    { PIX_FMT_PAL8,      2 },
50 51
    { PIX_FMT_PAL8,      4 },
51 52
    { PIX_FMT_PAL8,      8 },
52 53
    // FIXME swscale does not support 16 bit in .mov, sample 16bit.mov
......
115 116
    frame->top_field_first = avctx->coded_frame->top_field_first;
116 117

  
117 118
    //4bpp raw in avi and mov (yes this is ugly ...)
118
    if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
119
    if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
120
       avctx->pix_fmt==PIX_FMT_PAL8 &&
119 121
       (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
120 122
        int i;
121 123
        uint8_t *dst = context->buffer + 256*4;
122 124
        buf_size = context->length - 256*4;
125
        if (avctx->bits_per_coded_sample == 4){
123 126
        for(i=0; 2*i+1 < buf_size; i++){
124 127
            dst[2*i+0]= buf[i]>>4;
125 128
            dst[2*i+1]= buf[i]&15;
126 129
        }
130
        } else
131
            for(i=0; 4*i+3 < buf_size; i++){
132
                dst[4*i+0]= buf[i]>>6;
133
                dst[4*i+1]= buf[i]>>4&3;
134
                dst[4*i+2]= buf[i]>>2&3;
135
                dst[4*i+3]= buf[i]   &3;
136
            }
127 137
        buf= dst;
128 138
    }
129 139

  

Also available in: Unified diff