Mercurial > libavcodec.hg
comparison rawdec.c @ 10771:cea7769a2b62 libavcodec
Improve readability of 4bpp raw decoder and prepare for supporting 2bpp.
author | cehoyos |
---|---|
date | Tue, 05 Jan 2010 00:41:29 +0000 |
parents | 9de8bd6b4ca4 |
children | c76ee970d3bd |
comparison
equal
deleted
inserted
replaced
10770:59be1a7be21f | 10771:cea7769a2b62 |
---|---|
116 | 116 |
117 //4bpp raw in avi and mov (yes this is ugly ...) | 117 //4bpp raw in avi and mov (yes this is ugly ...) |
118 if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 && | 118 if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 && |
119 (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ | 119 (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ |
120 int i; | 120 int i; |
121 for(i=256*2; i+1 < context->length>>1; i++){ | 121 uint8_t *dst = context->buffer + 256*4; |
122 context->buffer[2*i+0]= buf[i-256*2]>>4; | 122 buf_size = context->length - 256*4; |
123 context->buffer[2*i+1]= buf[i-256*2]&15; | 123 for(i=0; 2*i+1 < buf_size; i++){ |
124 dst[2*i+0]= buf[i]>>4; | |
125 dst[2*i+1]= buf[i]&15; | |
124 } | 126 } |
125 buf= context->buffer + 256*4; | 127 buf= dst; |
126 buf_size= context->length - 256*4; | |
127 } | 128 } |
128 | 129 |
129 if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0)) | 130 if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0)) |
130 return -1; | 131 return -1; |
131 | 132 |