diff options
author | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2010-01-05 00:41:29 +0000 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at> | 2010-01-05 00:41:29 +0000 |
commit | 0a1e15109ad77716a8a6a511e713eded95c7f130 (patch) | |
tree | a4e083443e5db2700297bfe06f477b432a20ebdf /libavcodec/rawdec.c | |
parent | 7b1312fa55d5f3d413319b53996efecc5b86d014 (diff) | |
download | ffmpeg-0a1e15109ad77716a8a6a511e713eded95c7f130.tar.gz |
Improve readability of 4bpp raw decoder and prepare for supporting 2bpp.
Originally committed as revision 21026 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rawdec.c')
-rw-r--r-- | libavcodec/rawdec.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 46a5de4918..1629602e6a 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -118,12 +118,13 @@ static int raw_decode(AVCodecContext *avctx, 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)) |