Skip to content
Snippets Groups Projects
Commit 0a1e1510 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos
Browse files

Improve readability of 4bpp raw decoder and prepare for supporting 2bpp.

Originally committed as revision 21026 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 7b1312fa
No related branches found
No related tags found
No related merge requests found
...@@ -118,12 +118,13 @@ static int raw_decode(AVCodecContext *avctx, ...@@ -118,12 +118,13 @@ static int raw_decode(AVCodecContext *avctx,
if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 && if(avctx->bits_per_coded_sample == 4 && avctx->pix_fmt==PIX_FMT_PAL8 &&
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){ (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
int i; int i;
for(i=256*2; i+1 < context->length>>1; i++){ uint8_t *dst = context->buffer + 256*4;
context->buffer[2*i+0]= buf[i-256*2]>>4; buf_size = context->length - 256*4;
context->buffer[2*i+1]= buf[i-256*2]&15; 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= dst;
buf_size= context->length - 256*4;
} }
if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0)) if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment