@@ -42,7 +42,7 @@ mv lodepng.cpp lodepng.c ; gcc -I ./ lodepng.c examples/example_decode.c -pedant
4242
4343*) try lodepng_benchmark.cpp
4444g++ lodepng.cpp lodepng_benchmark.cpp -Wall -Wextra -pedantic -ansi -lSDL -O3 && ./a.out
45- g++ lodepng.cpp lodepng_benchmark.cpp -Wall -Wextra -pedantic -ansi -lSDL -O3 && ./a.out corpus/''*
45+ g++ lodepng.cpp lodepng_benchmark.cpp -Wall -Wextra -pedantic -ansi -lSDL -O3 && ./a.out testdata/ corpus/''*
4646
4747*) Check if all examples compile without warnings:
4848g++ -I ./ lodepng.cpp examples/''*.cpp -W -Wall -ansi -pedantic -O3 -c
@@ -82,7 +82,7 @@ g++ -DDISABLE_SLOW lodepng.cpp lodepng_util.cpp lodepng_unittest.cpp -Wall -Wext
8282clang++ -fsanitize=address lodepng.cpp lodepng_util.cpp lodepng_unittest.cpp -Wall -Wextra -Wshadow -pedantic -ansi -O3 && ASAN_OPTIONS=allocator_may_return_null=1 ./a.out
8383clang++ -fsanitize=address lodepng.cpp lodepng_util.cpp lodepng_unittest.cpp -Wall -Wextra -Wshadow -pedantic -ansi -g3 && ASAN_OPTIONS=allocator_may_return_null=1 ./a.out
8484
85- *) remove "#include <iostream>" from lodepng.cpp if it's still in there
85+ *) remove "#include <iostream>" from lodepng.cpp if it's still in there (some are legit)
8686cat lodepng.cpp lodepng_util.cpp | grep iostream
8787cat lodepng.cpp lodepng_util.cpp | grep stdio
8888cat lodepng.cpp lodepng_util.cpp | grep "#include"
@@ -2502,15 +2502,18 @@ void testXYZ() {
25022502
25032503 // Test sRGB -> XYZ -> sRGB roundtrip
25042504
2505+ unsigned rendering_intent = 3 ; // test with absolute for now
2506+
25052507 // 8-bit
25062508 {
25072509 // Default state, the conversions use 8-bit sRGB
25082510 lodepng::State state;
25092511 std::vector<float > f (w * h * 4 );
2510- assertNoError (lodepng::convertToXYZ (f.data (), v.data (), w, h, &state));
2512+ float whitepoint[3 ];
2513+ assertNoError (lodepng::convertToXYZ (f.data (), whitepoint, v.data (), w, h, &state));
25112514
25122515 std::vector<unsigned char > v2 (w * h * 4 );
2513- assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, &state));
2516+ assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, whitepoint, rendering_intent, &state));
25142517
25152518 for (size_t i = 0 ; i < v2.size (); i++) {
25162519 ASSERT_EQUALS (v[i], v2[i]);
@@ -2523,10 +2526,11 @@ void testXYZ() {
25232526 lodepng::State state;
25242527 state.info_raw .bitdepth = 16 ;
25252528 std::vector<float > f (w * h * 4 );
2526- assertNoError (lodepng::convertToXYZ (f.data (), v.data (), w, h, &state));
2529+ float whitepoint[3 ];
2530+ assertNoError (lodepng::convertToXYZ (f.data (), whitepoint, v.data (), w, h, &state));
25272531
25282532 std::vector<unsigned char > v2 (w * h * 8 );
2529- assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, &state));
2533+ assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, whitepoint, rendering_intent, &state));
25302534
25312535 for (size_t i = 0 ; i < v2.size (); i++) {
25322536 ASSERT_EQUALS (v[i], v2[i]);
@@ -2554,10 +2558,11 @@ void testXYZ() {
25542558 lodepng::State state;
25552559 lodepng_info_copy (&state.info_png , &info_custom);
25562560 std::vector<float > f (w * h * 4 );
2557- assertNoError (lodepng::convertToXYZ (f.data (), v.data (), w, h, &state));
2561+ float whitepoint[3 ];
2562+ assertNoError (lodepng::convertToXYZ (f.data (), whitepoint, v.data (), w, h, &state));
25582563
25592564 std::vector<unsigned char > v2 (w * h * 4 );
2560- assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, &state));
2565+ assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, whitepoint, rendering_intent, &state));
25612566
25622567 for (size_t i = 0 ; i < v2.size (); i++) {
25632568 // Allow near instead of exact due to numerical issues with low values,
@@ -2576,10 +2581,11 @@ void testXYZ() {
25762581 lodepng_info_copy (&state.info_png , &info_custom);
25772582 state.info_raw .bitdepth = 16 ;
25782583 std::vector<float > f (w * h * 4 );
2579- assertNoError (lodepng::convertToXYZ (f.data (), v.data (), w, h, &state));
2584+ float whitepoint[3 ];
2585+ assertNoError (lodepng::convertToXYZ (f.data (), whitepoint, v.data (), w, h, &state));
25802586
25812587 std::vector<unsigned char > v2 (w * h * 8 );
2582- assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, &state));
2588+ assertNoError (lodepng::convertFromXYZ (v2.data (), f.data (), w, h, whitepoint, rendering_intent, &state));
25832589
25842590 for (size_t i = 0 ; i < v2.size (); i += 2 ) {
25852591 unsigned a = v[i + 0 ] * 256u + v[i + 1 ];
0 commit comments