From 8bc3faebc66b92805f7309fa7a2f46a66e5cc5c9 Mon Sep 17 00:00:00 2001 From: Kimball Thurston Date: Wed, 1 Jan 2025 17:48:38 +1300 Subject: [PATCH] add checks to avoid using optimizations when inappropriate The fast unpack routines for 3 and 4 channels were not designed to handle sub-sampled images, but need to appear before other fallback disablement in the choice logic. Until that choice logic can be simplified, add additional checks to avoid heading to that branch Signed-off-by: Kimball Thurston --- src/lib/OpenEXRCore/unpack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/OpenEXRCore/unpack.c b/src/lib/OpenEXRCore/unpack.c index 3f1db05cbb..51103e416b 100644 --- a/src/lib/OpenEXRCore/unpack.c +++ b/src/lib/OpenEXRCore/unpack.c @@ -1437,7 +1437,9 @@ internal_exr_match_decode ( /* other optimizations would not be difficult, but this will * be the common one (where on encode / pack we want to do the * opposite) */ - if (sametype == (int) EXR_PIXEL_HALF && + if (!hassampling && + chanstofill == decode->channel_count && + sametype == (int) EXR_PIXEL_HALF && sameouttype == (int) EXR_PIXEL_FLOAT) { if (simpinterleave > 0)