Commit graph

13 commits

Author SHA1 Message Date
Philipp Zabel e3b64b6e76 tests: use enum weston_renderer_type
Now that enum weston_renderer_type is public, there is no need for a
local enum renderer_type in the tests.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
2023-01-18 14:16:41 +01:00
Pekka Paalanen 142ec0f477 tests: add output_icc_decorations
Here are more tests for output decorations drawing, this time through
the color-lcms plugin. This is the only practical way to exercise the
input-to-output category of color transformations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-12-02 13:36:25 +00:00
Pekka Paalanen 9b7084cfca tests: change shot argument type in verify_image()
Only the 'image' field of struct buffer is ever used here, so just
pass pixman_image_t instead of struct buffer.

This allows a future test to mangle a screenshot (e.g. convert pixel
format) before feeding it in.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-12-02 13:36:25 +00:00
Vitaly Prosyak 52e6052f32 tests/color-icc-output: replace dump file name
Not a functional change. The replacement of const
dump file to use suffix of appropriate sub tests
(sRGB->sRGB, sRGB->adobeRGB, etc).

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
2022-09-28 10:28:28 +00:00
Pekka Paalanen aa4f7d3a63 tests/color-icc-output: add blending test
This is adding basically a copy of alpha-blending-test.c. The difference
is that here we use ICC files to set up the output color profile, and
then test light-linear blending only. BLOCK_WIDTH is set to 1 to fit
inside the output size used by the fixture setup, which is smaller than
in the original, but does not change the results.

The test is aimed at testing how color-lcms module succeeds in
linearizing the output of different ICC output profiles. Incorrect
linearization should cause changes in blending results.

The tolerance is taken from the currently achieved error statistics
(1.40908) and rounded up a little to achieve a suitable margin.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-07-01 07:46:02 +00:00
Pekka Paalanen b5467ba258 tests/color-icc-output: use two-norm tolerance
Switch from per-channel max error tolerance to max two-norm (Euclidean
distance) error. Geometrically this means that previously the accepted
volume was a +/- tolerance cube around the reference point, and now it
is a sphere with tolerance radius.

The real benefit is simplifying the code.

The error tolerance are also changed to float. Integers cannot represent
values between 1 and 2, and the jump from 1 to 2 would have been too
much. AdobeRGB tolerance gets relaxed a bit, while BT2020 tolerance
becomes stricter. The new tolerance values are the reported achieved
two-norm max errors plus a bit of margin.

Surprisingly the sRGB case tolerances remain strictly at zero, and
that's no bug in the test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-30 09:08:32 +00:00
Pekka Paalanen 3acb1c4793 tests/color-icc-output: compare_float() to rgb_diff_stat
compare_float() was an ad hoc max error logger with optional debug
logging.

Now that we have rgb_diff_stat, we can get the same statistics and more
with less code. It looks like we would lose the pixel index x, but that
can be recovered from the dump file line number.

This patch takes care to keep the test condition exactly the same as it
was before. The statistics print-out has more details now.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-30 09:08:32 +00:00
Pekka Paalanen 3f60542405 tests/color_util: make rgb_diff_stat pos explicit
The recently introduced rgb_diff_stat value dumping feature logs the
"position" where the value or error was measured. The reference value
was used as the position, but the problem with the reference value is
that it is an output value and not an input value. Therefore mapping
that back to which input values promoted the error is not easy.

Fix that problem by passing the position explicitly into
rgb_diff_stat_update(), just like it is already passed in to
scalar_stat_update().

Currently the only user simply passes the reference value as position,
because there the input value is also the reference value. This is not
true for future uses of rgb_diff_stat.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-30 09:08:32 +00:00
Pekka Paalanen 9026293bff tests: change rgb_diff_stat printing
Seems it will be common to print all four min/max/avg sets of errors, so
move the printing code into a shared place.

While 0.0-1.0 is the natural range for color values, people are often
accustomed to working with 8-bit or even 10-bit pixel values. An error
of +/- 1 in 8-bit is more intuitive than +/- 0.004 in floating-point.
Hence 'scaling_bits' is added so the caller can determine the value
scaling. This will scale both the reported error numbers, and the
recorded error positions (rgb-tuples), so they are all comparable.

I'm happy to get rid of those two macros as well.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-06-30 09:08:32 +00:00
Pekka Paalanen 9b82bfae9e tests/color-icc-output: extract image-iter.h
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>
2022-06-16 08:52:12 +00:00
Pekka Paalanen 731a2fd45b tests/color-icc-output: move gen_ramp_rgb() in the file
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>
2022-06-10 10:49:47 +00:00
Pekka Paalanen cb38c9c84d tests: rename shaper_matrix_and_cLUT to opaque_pixel_conversion
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>
2022-06-10 10:49:47 +00:00
Pekka Paalanen 6393e43357 tests: rename color-shaper-matrix-test.c to color-icc-output-test.c
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>
2022-06-10 10:49:47 +00:00
Renamed from tests/color-shaper-matrix-test.c (Browse further)