Move the struct image_header and get_image_prop() into a header where we
can share these useful helpers between more test code. While doing that,
drop the unused field 'depth', rename into image_header_from(), and
introduce a helper to get u32 pointer to the beginning of a row. These
helpers should make pixel iterating code easier to read and safer (less
room for mistakes in address computations, and asserts).
Use the shared 'struct image_header' instead of the local one. The
intention is to make the code easier to read by using the same helpers
everywhere.
Width, height and stride use type 'int' because Pixman API uses that
too.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Move gen_ramp_rgb() down in the file where the TEST() specific code
begins. This way we first have a big block of fixture setup code which
creates an ICC profile, and the next big block is the actual test client
code. gen_ramp_rgb() belongs with the latter.
This makes the file structure slightly more logical.
This is a pure code move, no changes at all.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This name describes better what this test does. In the future another
TEST() for alpha blending will be added. Both of them will be using
matrix-shaper and cLUT output profiles.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
The new name better matches the contents of the test.
Currently the test creates output ICC profiles with matrix-shaper and
cLUT forms, and tests that basic color conversion from input to output
color space is correct.
The common theme in this test program is to create ICC profiles to be
used as output profiles. In the future this can include more kinds of
testing, e.g. linear blending. OTOH, this test program will always be
limited to SDR because HDR testing probably will not use ICC files.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Added cLUT profile creation to validate linearization algorithm
for DToB3 tag (direction dev to PCS). The 3DLUT is
built by using raw matrix conversion from dev to XYZ and reverse
(XYZ to device).
The test uses floating point pipeline, known as unbounded mode of LCMS.
The details are described in ICCSpecRevision_02_11_06_Float.pdf
The purpose of these new test cases is to keep the GL-renderer 3D LUT
path tested even after color-lcms and GL-renderer start using
specialized matrix-shaper paths.
These also exercise build_eotf_from_clut_profile() in color-lcms, but do
not actually verify it. These cases only test that the recovered EOTF
and its inverse produce an identity mapping together.
BT.2020 is not used in these tests, because the RGB-XYZ conversion
matrix does not stay inside [0.0, 1.0] in either direction, which would
be a problem for the 3D LUT element in the multiProcessingElement
pipelines. Handling that would have been possible, but testing with
AdobeRGB color space should suffice while keeping the test code from
being even more complicated.
roundtrip_verification() tests that we succeed in creating cms
pipelines correctly in both directions so that the resulting ICC file is
better behaved. The Weston test itself only cares about the BToD
direction.
Credits to:
Vladimir Lachine <vladimir.lachine@amd.com>
Graeme Gill <graeme@argyllcms.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
We will want to run the same color spaces with different types of ICC
profiles. To help with that:
1. Let struct lcms_pipeline define the test color space and
transformations and move the tolerance into a new per test case
structure.
2. Added profile type: PTYPE_MATRIX_SHAPER, PTYPE_CLUT.
PTYPE_MATRIX_SHAPER is the previously implemented type.
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Iterate over rgb[] array instead of repeating the code for .r, .g and
.b.
Also in process_pipeline_comparison() f_max_err variable is dropped
since it was not used much.
This should make the code easier to read.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Individual struct fields are inconvenient to index into, yet most
operations on a color just repeat the same for each of RGB channel.
Being able to index into RGB avoids repeating the same code for each
channel.
Alpha channel is left as separate, since it is almost never handled the
same as RGB.
The union keeps the old .r, .g and .b addressing working. The static
asserts ensure the aliasing is correct.
For demonstration, two simple functions in color_util.c are converted.
Unfortunately initializers need to be corrected everywhere. Field .a is
not explicitly initialized because it is unused in these cases.
This change should make code easier to read.
This change requires gnu99 or c11 standard. gnu99 is already the default
in top-level meson.build.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
1. Use fixture_setup to set the generated by LCMS output profile based on
given chromaticities and white points. The following list of well known
chromaticities:
- sRGB
- adobe RGB
- bt2020
and white point is D65. Use INTENT_ABSOLUTE_COLORIMETRIC to avoid BPC.
Input profile is always sRGB and it is used internally by Weston as
stock profile.
2. Use these hardcoded matrixes as part of pipeline 1DLUT->3x3->1DLUT.
The diagnostic code to retrieve the transform matrix is availble into
test in the comments. The conversion matrixes generated for the
following cases:
- sRGB to sRGB (unity)
- sRGB to adobeRGB
- sRGB to BT2020
3. Compare GPU shaders(gl texture3D) vs manual pipeline calculation
Use different max tolerable error per transform.
There are comments how number of points in 3DLUT is related to tolerance.
Tolerance depends more on the 1D LUT used for the inv EOTF than
the tested 3D LUT size: 9x9x9, 17x17x17, 33x33x33, 127x127x127.
4. Enable build matrix-shaper test if color-management-lcms is enabled.
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>