[FFmpeg-devel] [PATCH]Fix linesize for pix_fmt pal8

Stefano Sabatini stefasab at gmail.com
Mon Jun 25 17:24:11 CEST 2012


On date Wednesday 2012-06-20 07:33:04 +0000, Carl Eugen Hoyos encoded:
> Stefano Sabatini <stefasab <at> gmail.com> writes:
> 
> > Check attached patch, it should fix the problem when coupled 
> > with the new imgutils functions.
> 
> The patch breaks decoding some of the samples from ticket #823.

Can you explain the following code from raw_decode()?

    //2bpp and 4bpp raw in avi and mov (yes this is ugly ...)
    if (context->buffer) {
        int i;
        uint8_t *dst = context->buffer;
        buf_size = context->length - 256*4;
        if (avctx->bits_per_coded_sample == 4){
            for(i=0; 2*i+1 < buf_size && i<avpkt->size; i++){
                dst[2*i+0]= buf[i]>>4;
                dst[2*i+1]= buf[i]&15;
            }
            linesize_align = 8;
        } else {
            for(i=0; 4*i+3 < buf_size && i<avpkt->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;
            }
            linesize_align = 16;
        }
        buf= dst;
    }
-- 
FFmpeg = Fanciful & Fabulous Majestic Peaceless Ephemeral Goblin


More information about the ffmpeg-devel mailing list