Mercurial > libavcodec.hg
changeset 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 | 59be1a7be21f |
children | c76ee970d3bd |
files | rawdec.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/rawdec.c Mon Jan 04 19:26:08 2010 +0000 +++ b/rawdec.c Tue Jan 05 00:41:29 2010 +0000 @@ -118,12 +118,13 @@ if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ 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; + uint8_t *dst = context->buffer + 256*4; + buf_size = context->length - 256*4; + for(i=0; 2*i+1 < buf_size; i++){ + dst[2*i+0]= buf[i]>>4; + dst[2*i+1]= buf[i]&15; } - buf= context->buffer + 256*4; - buf_size= context->length - 256*4; + buf= dst; } if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0))