Added patch to avoid extra conversion step BGR->RGB when converting 32bpp BGRA to 24bpp RGB.

This commit is contained in:
Sebastian Lackner 2016-08-31 15:39:12 +02:00
parent 6b709dc505
commit 6b3228a788
4 changed files with 102 additions and 11 deletions

View File

@ -351,6 +351,7 @@ patch_enable_all ()
enable_windowscodecs_32bppGrayFloat="$1"
enable_windowscodecs_IMILBitmapSource="$1"
enable_windowscodecs_WICCreateBitmapFromSection="$1"
enable_windowscodecs_copypixels_to_24bppRGB="$1"
enable_wine_inf_Directory_ContextMenuHandlers="$1"
enable_wine_inf_Dummy_CA_Certificate="$1"
enable_wine_inf_Performance="$1"
@ -1231,6 +1232,9 @@ patch_enable ()
windowscodecs-WICCreateBitmapFromSection)
enable_windowscodecs_WICCreateBitmapFromSection="$2"
;;
windowscodecs-copypixels_to_24bppRGB)
enable_windowscodecs_copypixels_to_24bppRGB="$2"
;;
wine.inf-Directory_ContextMenuHandlers)
enable_wine_inf_Directory_ContextMenuHandlers="$2"
;;
@ -2028,6 +2032,13 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
enable_wined3d_Silence_FIXMEs=1
fi
if test "$enable_windowscodecs_32bppGrayFloat" -eq 1; then
if test "$enable_windowscodecs_copypixels_to_24bppRGB" -gt 1; then
abort "Patchset windowscodecs-copypixels_to_24bppRGB disabled, but windowscodecs-32bppGrayFloat depends on that."
fi
enable_windowscodecs_copypixels_to_24bppRGB=1
fi
if test "$enable_uxtheme_GTK_Theming" -eq 1; then
if test "$enable_ntdll_DllRedirects" -gt 1; then
abort "Patchset ntdll-DllRedirects disabled, but uxtheme-GTK_Theming depends on that."
@ -7134,8 +7145,23 @@ if test "$enable_wbemdisp_Printer" -eq 1; then
) >> "$patchlist"
fi
# Patchset windowscodecs-copypixels_to_24bppRGB
# |
# | Modified files:
# | * dlls/windowscodecs/converter.c, dlls/windowscodecs/tests/converter.c
# |
if test "$enable_windowscodecs_copypixels_to_24bppRGB" -eq 1; then
patch_apply windowscodecs-copypixels_to_24bppRGB/0001-windowscodecs-Avoid-extra-conversion-step-BGR-RGB-wh.patch
(
echo '+ { "Dmitry Timoshkov", "windowscodecs: Avoid extra conversion step BGR->RGB when converting 32bpp BGRA to 24bpp RGB.", 1 },';
) >> "$patchlist"
fi
# Patchset windowscodecs-32bppGrayFloat
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * windowscodecs-copypixels_to_24bppRGB
# |
# | This patchset fixes the following Wine bugs:
# | * [#36517] Implement support for WICPixelFormat32bppGrayFloat
# |

View File

@ -1,4 +1,4 @@
From 964980631537fea41619e05d09f1d14cf663755c Mon Sep 17 00:00:00 2001
From f81f47092ea27fc5dbe08e89a0daea1c7bcbc0c4 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Mon, 7 Mar 2016 15:38:19 +0800
Subject: windowscodecs: Add support for 32bppGrayFloat format.
@ -12,10 +12,10 @@ For bug 36517.
4 files changed, 94 insertions(+)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index 11f04d9..79b0a4b 100644
index efe78d8..21301cb 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -50,6 +50,7 @@ enum pixelformat {
@@ -49,6 +49,7 @@ enum pixelformat {
format_16bppBGRA5551,
format_24bppBGR,
format_24bppRGB,
@ -23,7 +23,7 @@ index 11f04d9..79b0a4b 100644
format_32bppBGR,
format_32bppBGRA,
format_32bppPBGRA,
@@ -994,6 +995,49 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
@@ -996,6 +997,49 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
}
}
@ -73,7 +73,7 @@ index 11f04d9..79b0a4b 100644
static const struct pixelformatinfo supported_formats[] = {
{format_1bppIndexed, &GUID_WICPixelFormat1bppIndexed, NULL},
{format_2bppIndexed, &GUID_WICPixelFormat2bppIndexed, NULL},
@@ -1009,6 +1053,7 @@ static const struct pixelformatinfo supported_formats[] = {
@@ -1011,6 +1055,7 @@ static const struct pixelformatinfo supported_formats[] = {
{format_16bppBGRA5551, &GUID_WICPixelFormat16bppBGRA5551, NULL},
{format_24bppBGR, &GUID_WICPixelFormat24bppBGR, copypixels_to_24bppBGR},
{format_24bppRGB, &GUID_WICPixelFormat24bppRGB, copypixels_to_24bppRGB},
@ -82,10 +82,10 @@ index 11f04d9..79b0a4b 100644
{format_32bppBGRA, &GUID_WICPixelFormat32bppBGRA, copypixels_to_32bppBGRA},
{format_32bppPBGRA, &GUID_WICPixelFormat32bppPBGRA, copypixels_to_32bppPBGRA},
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index ccb78b8..08aeb06 100644
index ff499e5..10a6c03 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1454,6 +1454,7 @@ static GUID const * const converter_formats[] = {
@@ -1452,6 +1452,7 @@ static GUID const * const converter_formats[] = {
&GUID_WICPixelFormat32bppBGR,
&GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat32bppPBGRA,
@ -94,7 +94,7 @@ index ccb78b8..08aeb06 100644
&GUID_WICPixelFormat64bppRGBA,
&GUID_WICPixelFormat32bppCMYK,
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 00ea483..6a5fc4f 100644
index c1599c5..1386a32 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -43,6 +43,11 @@ typedef struct BitmapTestSrc {
@ -176,9 +176,9 @@ index 00ea483..6a5fc4f 100644
static void test_conversion(const struct bitmap_data *src, const struct bitmap_data *dst, const char *name, BOOL todo)
{
BitmapTestSrc *src_obj;
@@ -734,6 +778,9 @@ START_TEST(converter)
test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
@@ -735,6 +779,9 @@ START_TEST(converter)
test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE);
+ test_conversion(&testdata_24bppRGB, &testdata_32bppGrayFloat, "24bppRGB -> 32bppGrayFloat", FALSE);
+ test_conversion(&testdata_32bppBGR, &testdata_32bppGrayFloat, "32bppBGR -> 32bppGrayFloat", FALSE);
@ -199,5 +199,5 @@ index 639d925..83daba8 100644
cpp_quote("DEFINE_GUID(GUID_WICPixelFormat48bppRGB, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x15);")
cpp_quote("DEFINE_GUID(GUID_WICPixelFormat64bppRGBA, 0x6fddc324,0x4e03,0x4bfe,0xb1,0x85,0x3d,0x77,0x76,0x8d,0xc9,0x16);")
--
2.7.1
2.9.0

View File

@ -1 +1,2 @@
Fixes: [36517] Implement support for WICPixelFormat32bppGrayFloat
Depends: windowscodecs-copypixels_to_24bppRGB

View File

@ -0,0 +1,64 @@
From ab3e666b4da856b468ac4eb56b0cd349894d7b50 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Mon, 29 Aug 2016 15:22:08 +0800
Subject: windowscodecs: Avoid extra conversion step BGR->RGB when converting
32bpp BGRA to 24bpp RGB.
This avoids double conversion and improves conversion time.
24bpp RGB to 32bpp BGRA already does it this way.
---
dlls/windowscodecs/converter.c | 13 ++++++++-----
dlls/windowscodecs/tests/converter.c | 1 +
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/windowscodecs/converter.c b/dlls/windowscodecs/converter.c
index e701f2a..efe78d8 100644
--- a/dlls/windowscodecs/converter.c
+++ b/dlls/windowscodecs/converter.c
@@ -953,6 +953,7 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
const BYTE *srcpixel;
BYTE *dstrow;
BYTE *dstpixel;
+ BYTE tmppixel[3];
srcstride = 4 * prc->Width;
srcdatasize = srcstride * prc->Height;
@@ -970,16 +971,18 @@ static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRec
srcpixel=srcrow;
dstpixel=dstrow;
for (x=0; x<prc->Width; x++) {
- *dstpixel++=*srcpixel++; /* blue */
- *dstpixel++=*srcpixel++; /* green */
- *dstpixel++=*srcpixel++; /* red */
+ tmppixel[0]=*srcpixel++; /* blue */
+ tmppixel[1]=*srcpixel++; /* green */
+ tmppixel[2]=*srcpixel++; /* red */
srcpixel++; /* alpha */
+
+ *dstpixel++=tmppixel[2]; /* red */
+ *dstpixel++=tmppixel[1]; /* green */
+ *dstpixel++=tmppixel[0]; /* blue */
}
srcrow += srcstride;
dstrow += cbStride;
}
-
- reverse_bgr8(3, pbBuffer, prc->Width, prc->Height, cbStride);
}
HeapFree(GetProcessHeap(), 0, srcdata);
diff --git a/dlls/windowscodecs/tests/converter.c b/dlls/windowscodecs/tests/converter.c
index 8c7a10f..c1599c5 100644
--- a/dlls/windowscodecs/tests/converter.c
+++ b/dlls/windowscodecs/tests/converter.c
@@ -733,6 +733,7 @@ START_TEST(converter)
test_conversion(&testdata_32bppBGR, &testdata_24bppRGB, "32bppBGR -> 24bppRGB", FALSE);
test_conversion(&testdata_24bppRGB, &testdata_32bppBGR, "24bppRGB -> 32bppBGR", FALSE);
+ test_conversion(&testdata_32bppBGRA, &testdata_24bppRGB, "32bppBGRA -> 24bppRGB", FALSE);
test_invalid_conversion();
test_default_converter();
--
2.9.0