From e5106dd836a820b91402c1efd6640e0b7d0e763c Mon Sep 17 00:00:00 2001 From: Yannick Verschueren Date: Mon, 15 Mar 2004 10:42:29 +0000 Subject: [PATCH] BMP problem solves : BMP-Images with dimension multiple of 4 presented problems --- codec/convert.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codec/convert.c b/codec/convert.c index 48b9d18a..4697ed81 100644 --- a/codec/convert.c +++ b/codec/convert.c @@ -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));