Build: Patch OpenEXR 3.3.2 for dwa bug
Upstream commit: https://github.com/AcademySoftwareFoundation/openexr/commit/df162955c613d17f966dd4d42a6c9582a3d57683 Ref #134802 Pull Request: https://projects.blender.org/blender/blender/pulls/135037
This commit is contained in:
committed by
Thomas Dinges
parent
e1bcd08f61
commit
dfb416b4c4
@@ -31,6 +31,10 @@ ExternalProject_Add(external_openexr
|
||||
CMAKE_GENERATOR ${PLATFORM_ALT_GENERATOR}
|
||||
PREFIX ${BUILD_DIR}/openexr
|
||||
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d
|
||||
${BUILD_DIR}/openexr/src/external_openexr <
|
||||
${PATCH_DIR}/openexr_1986.diff
|
||||
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${LIBDIR}/openexr
|
||||
${DEFAULT_CMAKE_FLAGS}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
commit df162955c613d17f966dd4d42a6c9582a3d57683
|
||||
Author: Kimball Thurston <kdt3rd@gmail.com>
|
||||
Date: Wed Feb 19 05:07:18 2025 +1300
|
||||
|
||||
Adjust the clamping on the dwa compression (#1986)
|
||||
|
||||
* Adjust the clamping on the dwa compression
|
||||
|
||||
The dwa compression is not truly a quality level like other things, so a
|
||||
maximal value is controlling quantization, not quality. A value of 0 is
|
||||
allowed, but negative is not.
|
||||
|
||||
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
|
||||
|
||||
* improve tests for dwa compression level set
|
||||
|
||||
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
|
||||
|
||||
---------
|
||||
|
||||
Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
|
||||
|
||||
diff --git a/src/lib/OpenEXRCore/part.c b/src/lib/OpenEXRCore/part.c
|
||||
index 6a51b3c7..814fd5ce 100644
|
||||
--- a/src/lib/OpenEXRCore/part.c
|
||||
+++ b/src/lib/OpenEXRCore/part.c
|
||||
@@ -609,7 +609,12 @@ exr_set_dwa_compression_level (exr_context_t ctxt, int part_index, float level)
|
||||
return EXR_UNLOCK_AND_RETURN (
|
||||
ctxt->standard_error (ctxt, EXR_ERR_NOT_OPEN_WRITE));
|
||||
|
||||
- if (level > 0.f && level <= 100.f)
|
||||
+ // avoid bad math (fp exceptions or whatever) by clamping here
|
||||
+ // there has always been a clamp to 0, but on the upper end, there
|
||||
+ // is a limit too, where you only get black images anyway, so that
|
||||
+ // is not particularly useful, not that any large value will
|
||||
+ // really be crushing the image
|
||||
+ if (level >= 0.f && level <= (65504.f*100000.f))
|
||||
{
|
||||
part->dwa_compression_level = level;
|
||||
rv = EXR_ERR_SUCCESS;
|
||||
diff --git a/src/test/OpenEXRCoreTest/write.cpp b/src/test/OpenEXRCoreTest/write.cpp
|
||||
index 7da03422..7f971c71 100644
|
||||
--- a/src/test/OpenEXRCoreTest/write.cpp
|
||||
+++ b/src/test/OpenEXRCoreTest/write.cpp
|
||||
@@ -435,10 +435,16 @@ testWriteBaseHeader (const std::string& tempdir)
|
||||
exr_set_dwa_compression_level (outf, 0, -2.f));
|
||||
EXRCORE_TEST_RVAL_FAIL (
|
||||
EXR_ERR_INVALID_ARGUMENT,
|
||||
- exr_set_dwa_compression_level (outf, 0, 420.f));
|
||||
+ exr_set_dwa_compression_level (outf, 0, INFINITY));
|
||||
+ EXRCORE_TEST_RVAL_FAIL (
|
||||
+ EXR_ERR_INVALID_ARGUMENT,
|
||||
+ exr_set_dwa_compression_level (outf, 0, NAN));
|
||||
EXRCORE_TEST_RVAL (exr_set_dwa_compression_level (outf, 0, 42.f));
|
||||
EXRCORE_TEST_RVAL (exr_get_dwa_compression_level (outf, 0, &dlev));
|
||||
EXRCORE_TEST (dlev == 42.f);
|
||||
+ EXRCORE_TEST_RVAL (exr_set_dwa_compression_level (outf, 0, 420.f));
|
||||
+ EXRCORE_TEST_RVAL (exr_get_dwa_compression_level (outf, 0, &dlev));
|
||||
+ EXRCORE_TEST (dlev == 420.f);
|
||||
|
||||
EXRCORE_TEST_RVAL (exr_finish (&outf));
|
||||
remove (outfn.c_str ());
|
||||
Reference in New Issue
Block a user