[FFmpeg-cvslog] r21026 - trunk/libavcodec/rawdec.c

cehoyos subversion
Tue Jan 5 01:41:29 CET 2010


Author: cehoyos
Date: Tue Jan  5 01:41:29 2010
New Revision: 21026

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

Modified:
   trunk/libavcodec/rawdec.c

Modified: trunk/libavcodec/rawdec.c
==============================================================================
--- trunk/libavcodec/rawdec.c	Mon Jan  4 23:59:43 2010	(r21025)
+++ trunk/libavcodec/rawdec.c	Tue Jan  5 01:41:29 2010	(r21026)
@@ -118,12 +118,13 @@ static int raw_decode(AVCodecContext *av
     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))



More information about the ffmpeg-cvslog mailing list