BMP problem solves : BMP-Images with dimension multiple of 4 presented problems
authorYannick Verschueren <unknown@unknown>
Mon, 15 Mar 2004 10:42:29 +0000 (10:42 +0000)
committerYannick Verschueren <unknown@unknown>
Mon, 15 Mar 2004 10:42:29 +0000 (10:42 +0000)
codec/convert.c

index 48b9d18a55f647b0493eae23ce2debfb168f6518..4697ed818889acd925e256e124731e361b8e6491 100644 (file)
@@ -203,7 +203,10 @@ int bmptoimage(char *filename, j2k_image_t * img, int subsampling_dx, int subsam
                        W = Info_h.biWidth;
                        H = Info_h.biHeight;
 
-                       PAD = 4 - (3 * W) % 4;
+                       // PAD = 4 - (3 * W) % 4;
+                       // PAD = (PAD == 4) ? 0 : PAD;
+                       PAD = (3 * W) % 4 ? 4 - (3 * W) % 4 : 0;
+
                        
                        RGB = (unsigned char *) malloc((3 * W + PAD) * H * sizeof(unsigned char));