[trunk] updated BMP format input support
authorMatthieu Darbois <mayeut@users.noreply.github.com>
Mon, 22 Dec 2014 14:40:31 +0000 (14:40 +0000)
committerMatthieu Darbois <mayeut@users.noreply.github.com>
Mon, 22 Dec 2014 14:40:31 +0000 (14:40 +0000)
Update  issue 203

src/bin/jp2/convertbmp.c
tests/nonregression/test_suite.ctest.in

index 5e6dcee05c1bd6c0a3d9559a713852677dc014ca..65f3763a29a8ef203f63aadffe06f5f4fee3b0ac 100644 (file)
@@ -661,7 +661,7 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
                }
        } else {
                numcmpts = 3U;
-               if (Info_h.biAlphaMask != 0U) {
+               if ((Info_h.biCompression == 3) && (Info_h.biAlphaMask != 0U)) {
                        numcmpts++;
                }
        }
@@ -745,10 +745,21 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
        else if (Info_h.biBitCount == 4 && Info_h.biCompression == 2) { /*RLE4*/
                bmp8toimage(IN, pData, stride, image, pLUT); /* RLE 4 gets decoded as 8 bits data for now */
        }
+       else if (Info_h.biBitCount == 32 && Info_h.biCompression == 0) { /* RGBX */
+               bmpmask32toimage(IN, pData, stride, image, 0x00FF0000U, 0x0000FF00U, 0x000000FFU, 0x00000000U);
+       }
        else if (Info_h.biBitCount == 32 && Info_h.biCompression == 3) { /* bitmask */
                bmpmask32toimage(IN, pData, stride, image, Info_h.biRedMask, Info_h.biGreenMask, Info_h.biBlueMask, Info_h.biAlphaMask);
        }
+       else if (Info_h.biBitCount == 16 && Info_h.biCompression == 0) { /* RGBX */
+               bmpmask16toimage(IN, pData, stride, image, 0x7C00U, 0x03E0U, 0x001FU, 0x0000U);
+       }
        else if (Info_h.biBitCount == 16 && Info_h.biCompression == 3) { /* bitmask */
+               if ((Info_h.biRedMask == 0U) && (Info_h.biGreenMask == 0U) && (Info_h.biBlueMask == 0U)) {
+                       Info_h.biRedMask   = 0xF800U;
+                       Info_h.biGreenMask = 0x07E0U;
+                       Info_h.biBlueMask  = 0x001FU;
+               }
                bmpmask16toimage(IN, pData, stride, image, Info_h.biRedMask, Info_h.biGreenMask, Info_h.biBlueMask, Info_h.biAlphaMask);
        }
        else {
index 72fe738b3d0e44d018229947939426e8c16789f0..7f5d6f085ff554198b5601c986cfa36d6cb75d2a 100644 (file)
@@ -71,6 +71,8 @@ opj_compress -i @INPUT_NR_PATH@/issue203-32x32-bgra16.bmp -o @TEMP_PATH@/issue20
 opj_compress -i @INPUT_NR_PATH@/issue203-33x33-bgra16.bmp -o @TEMP_PATH@/issue203-33x33-bgra16.bmp.jp2
 opj_compress -i @INPUT_NR_PATH@/issue203-32x32-bgrx16.bmp -o @TEMP_PATH@/issue203-32x32-bgrx16.bmp.jp2
 opj_compress -i @INPUT_NR_PATH@/issue203-33x33-bgrx16.bmp -o @TEMP_PATH@/issue203-33x33-bgrx16.bmp.jp2
+opj_compress -i @INPUT_NR_PATH@/issue203-127x64-bgr16.bmp -o @TEMP_PATH@/issue203-127x64-bgr16.bmp.jp2
+opj_compress -i @INPUT_NR_PATH@/issue203-127x64-bgrx.bmp -o @TEMP_PATH@/issue203-127x64-bgrx.bmp.jp2
 
 # DECODER TEST SUITE
 opj_decompress -i  @INPUT_NR_PATH@/Bretagne2.j2k -o @TEMP_PATH@/Bretagne2.j2k.pgx