New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
color tests failing on s390x: QuantumType is "float_t" for HDRI=1 and can be float or double depending on arch and compiler #504
Comments
Is there a way for ctypes to identify this use-case? I would guess What's the output of... from ctypes import *
print('pointer', sizeof(c_void_p))
print('float', sizeof(c_float))
print('double', sizeof(c_double)) I'm also wondering if |
Essentially, we just need to resolve the following preprocessor #if MAGICKCORE_SIZEOF_FLOAT_T == 0
typedef float MagickFloatType;
#elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_FLOAT)
typedef float MagickFloatType;
#elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_DOUBLE)
typedef double MagickFloatType;
#elif (MAGICKCORE_SIZEOF_FLOAT_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
typedef double MagickFloatType;
#else
#error Your MagickFloatType type is neither a float, nor a double, nor a long double
#endif
#if MAGICKCORE_SIZEOF_DOUBLE_T == 0
typedef double MagickDoubleType;
#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE)
typedef double MagickDoubleType;
#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE)
typedef double MagickDoubleType;
#else
#error Your MagickDoubleType type is neither a float, nor a double, nor a long double
#endif |
Unfortunately, your snippet
produces
Compare to C:
The part of the header that you quoted needs additional input from
|
The Linux distributions I looked at do not ship that header file only in the "development" packages for ImageMagick's libraries, not in the normal binary-only library packages. So, that would mean more dependencies when parsing at run-time. |
Hmm.. Thanks for post this. The best thing I can think of is testing |
@mhillenbrand please review pull request #505. If you're able to run & confirm fix on hardware, I should be able to include the patch with Wand 0.6.4 release. |
Thanks for preparing that patch. I did test on hardware and could verify that it addresses the issue. Found a typo that needs fixing + minor suggestion in PR. |
Closing this issue. Thanks for reporting this & following up with testing! |
Cool, thanks for fixing! |
When using an Imagemagick compiled with HDRI=1, many color-related test cases fail.
The root cause is that python-wand assumes that QuantumType would be float or double when using an HDRI variant of the ImageMagick libraries, see
wand/wand/cdefs/pixel_wand.py
Line 62 in e91776b
However, with HDRI=1 ImageMagick derives QuantumType from float_t (for 8-bit and 16-bit color depths) and double_t (above that). Those types can differ from float and double, depending on your architecture and compiler settings. For example, on 32-bit x86, float_t would become double when compiling with
-ffp-math=x87
; on s390x, float_t today is defined as double. Thus, the binary librariesdouble
values don't match python-wand'sfloat
.When I modify
pixel_wand.py
to setQuantumType = c_float
, these tests pass.The text was updated successfully, but these errors were encountered: