Dmitry Timoshkov : windowscodecs: Add support for 96bppRGBFloat and 128bppPRGBAFloat formats to TIFF decoder.

Alexandre Julliard julliard at winehq.org
Wed Apr 22 15:29:28 CDT 2020


Module: wine
Branch: master
Commit: a0b1f229c78d04ae600b498c6b160141c07e9712
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a0b1f229c78d04ae600b498c6b160141c07e9712

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Apr 22 17:40:57 2020 +0800

windowscodecs: Add support for 96bppRGBFloat and 128bppPRGBAFloat formats to TIFF decoder.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/windowscodecs/regsvr.c     | 29 +++++++++++++++++++++++++++++
 dlls/windowscodecs/tiffformat.c | 22 ++++++++++++++++------
 2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index 3329c2d811..4750ab8484 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1238,7 +1238,9 @@ static GUID const * const tiff_decode_formats[] = {
     &GUID_WICPixelFormat64bppPRGBA,
     &GUID_WICPixelFormat32bppCMYK,
     &GUID_WICPixelFormat64bppCMYK,
+    &GUID_WICPixelFormat96bppRGBFloat,
     &GUID_WICPixelFormat128bppRGBAFloat,
+    &GUID_WICPixelFormat128bppPRGBAFloat,
     NULL
 };
 
@@ -1769,6 +1771,10 @@ static BYTE const channel_mask_16bit4[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 
 static BYTE const channel_mask_32bit[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 };
 
+static BYTE const channel_mask_96bit1[] = { 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+static BYTE const channel_mask_96bit2[] = { 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00 };
+static BYTE const channel_mask_96bit3[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff };
+
 static BYTE const channel_mask_128bit1[] = { 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
 static BYTE const channel_mask_128bit2[] = { 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
 static BYTE const channel_mask_128bit3[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00 };
@@ -1791,6 +1797,7 @@ static BYTE const * const channel_masks_16bit[] = { channel_mask_16bit,
     channel_mask_16bit2, channel_mask_16bit3, channel_mask_16bit4};
 
 static BYTE const * const channel_masks_32bit[] = { channel_mask_32bit };
+static BYTE const * const channel_masks_96bit[] = { channel_mask_96bit1, channel_mask_96bit2, channel_mask_96bit3 };
 static BYTE const * const channel_masks_128bit[] = { channel_mask_128bit1, channel_mask_128bit2, channel_mask_128bit3, channel_mask_128bit4 };
 
 static BYTE const * const channel_masks_BGRA5551[] = { channel_mask_5bit,
@@ -2086,6 +2093,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
         WICPixelFormatNumericRepresentationUnsignedInteger,
         0
     },
+    {   &GUID_WICPixelFormat96bppRGBFloat,
+        "The Wine Project",
+        "96bpp RGBFloat",
+        NULL, /* no version */
+        &GUID_VendorMicrosoft,
+        96, /* bitsperpixel */
+        3, /* channel count */
+        channel_masks_96bit,
+        WICPixelFormatNumericRepresentationFloat,
+        0
+    },
     {   &GUID_WICPixelFormat128bppRGBAFloat,
         "The Wine Project",
         "128bpp RGBAFloat",
@@ -2097,6 +2115,17 @@ static struct regsvr_pixelformat const pixelformat_list[] = {
         WICPixelFormatNumericRepresentationFloat,
         1
     },
+    {   &GUID_WICPixelFormat128bppPRGBAFloat,
+        "The Wine Project",
+        "128bpp PRGBAFloat",
+        NULL, /* no version */
+        &GUID_VendorMicrosoft,
+        128, /* bitsperpixel */
+        4, /* channel count */
+        channel_masks_128bit,
+        WICPixelFormatNumericRepresentationFloat,
+        1
+    },
     { NULL }			/* list terminator */
 };
 
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 3d43c967d9..19cb0cf928 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -467,12 +467,22 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
                 }
             break;
         case 32:
-            if (samples != 4)
-            {
-                FIXME("unhandled 32bpp RGB sample count %u\n", samples);
-                return WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT;
-            }
-            decode_info->format = &GUID_WICPixelFormat128bppRGBAFloat;
+            if (samples == 3)
+                decode_info->format = &GUID_WICPixelFormat96bppRGBFloat;
+            else
+                switch(extra_samples[0])
+                {
+                case 1: /* Associated (pre-multiplied) alpha data */
+                    decode_info->format = &GUID_WICPixelFormat128bppPRGBAFloat;
+                    break;
+                case 0: /* Unspecified data */
+                case 2: /* Unassociated alpha data */
+                    decode_info->format = &GUID_WICPixelFormat128bppRGBAFloat;
+                    break;
+                default:
+                    FIXME("unhandled extra sample type %i\n", extra_samples[0]);
+                    return E_FAIL;
+                }
             break;
         default:
             WARN("unhandled RGB bit count %u\n", bps);




More information about the wine-cvs mailing list