Merge some cases for reading raw data with different bit depths in BMP
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 27 Mar 2009 16:31:47 +0000 (16:31 +0000)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 27 Mar 2009 16:31:47 +0000 (16:31 +0000)
Originally committed as revision 18202 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/bmp.c

index 14c070d..5de1c46 100644 (file)
@@ -244,6 +244,8 @@ static int bmp_decode_frame(AVCodecContext *avctx,
     }else{
         switch(depth){
         case 1:
     }else{
         switch(depth){
         case 1:
+        case 8:
+        case 24:
             for(i = 0; i < avctx->height; i++){
                 memcpy(ptr, buf, n);
                 buf += n;
             for(i = 0; i < avctx->height; i++){
                 memcpy(ptr, buf, n);
                 buf += n;
@@ -261,20 +263,6 @@ static int bmp_decode_frame(AVCodecContext *avctx,
                 ptr += linesize;
             }
             break;
                 ptr += linesize;
             }
             break;
-        case 8:
-            for(i = 0; i < avctx->height; i++){
-                memcpy(ptr, buf, avctx->width);
-                buf += n;
-                ptr += linesize;
-            }
-            break;
-        case 24:
-            for(i = 0; i < avctx->height; i++){
-                memcpy(ptr, buf, avctx->width*(depth>>3));
-                buf += n;
-                ptr += linesize;
-            }
-            break;
         case 16:
             for(i = 0; i < avctx->height; i++){
                 const uint16_t *src = (const uint16_t *) buf;
         case 16:
             for(i = 0; i < avctx->height; i++){
                 const uint16_t *src = (const uint16_t *) buf;