diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/jpeg-xl/lib/jxl/passes_test.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/passes_test.cc')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/passes_test.cc | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/passes_test.cc b/third_party/jpeg-xl/lib/jxl/passes_test.cc index a47134cd00..cb9164706f 100644 --- a/third_party/jpeg-xl/lib/jxl/passes_test.cc +++ b/third_party/jpeg-xl/lib/jxl/passes_test.cc @@ -17,7 +17,6 @@ #include "lib/jxl/base/data_parallel.h" #include "lib/jxl/base/override.h" #include "lib/jxl/base/span.h" -#include "lib/jxl/enc_butteraugli_comparator.h" #include "lib/jxl/enc_params.h" #include "lib/jxl/image.h" #include "lib/jxl/image_bundle.h" @@ -27,6 +26,7 @@ namespace jxl { +using test::ButteraugliDistance; using test::ReadTestData; using test::Roundtrip; using test::ThreadPoolForTests; @@ -47,10 +47,11 @@ TEST(PassesTest, RoundtripSmallPasses) { CodecInOut io2; JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _)); - EXPECT_THAT(ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), - *JxlGetDefaultCms(), - /*distmap=*/nullptr), - IsSlightlyBelow(0.8222)); + EXPECT_SLIGHTLY_BELOW( + ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), + *JxlGetDefaultCms(), + /*distmap=*/nullptr), + 0.8222); } TEST(PassesTest, RoundtripUnalignedPasses) { @@ -67,10 +68,11 @@ TEST(PassesTest, RoundtripUnalignedPasses) { CodecInOut io2; JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _)); - EXPECT_THAT(ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), - *JxlGetDefaultCms(), - /*distmap=*/nullptr), - IsSlightlyBelow(1.72)); + EXPECT_SLIGHTLY_BELOW( + ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), + *JxlGetDefaultCms(), + /*distmap=*/nullptr), + 1.72); } TEST(PassesTest, RoundtripMultiGroupPasses) { @@ -91,10 +93,11 @@ TEST(PassesTest, RoundtripMultiGroupPasses) { CodecInOut io2; JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _, /* compressed_size */ nullptr, &pool)); - EXPECT_THAT(ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), - *JxlGetDefaultCms(), - /*distmap=*/nullptr, &pool), - IsSlightlyBelow(target_distance + threshold)); + EXPECT_SLIGHTLY_BELOW( + ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), + *JxlGetDefaultCms(), + /*distmap=*/nullptr, &pool), + target_distance + threshold); }; auto run1 = std::async(std::launch::async, test, 1.0f, 0.15f); @@ -256,7 +259,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectlyGrayscale) { ASSERT_TRUE(SetFromBytes(Bytes(orig), &io_orig, &pool)); Rect rect(0, 0, io_orig.xsize(), 128); // need 2 DC groups for the DC frame to actually be progressive. - Image3F large(4242, rect.ysize()); + JXL_ASSIGN_OR_DIE(Image3F large, Image3F::Create(4242, rect.ysize())); ZeroFillImage(&large); CopyImageTo(rect, *io_orig.Main().color(), rect, &large); CodecInOut io; @@ -268,7 +271,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectlyGrayscale) { CompressParams cparams; cparams.speed_tier = SpeedTier::kSquirrel; cparams.progressive_dc = 1; - cparams.responsive = true; + cparams.responsive = JXL_TRUE; cparams.qprogressive_mode = Override::kOn; cparams.butteraugli_distance = 1.0; ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool)); @@ -300,7 +303,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectly) { ASSERT_TRUE(SetFromBytes(Bytes(orig), &io_orig, &pool)); Rect rect(0, 0, io_orig.xsize(), 128); // need 2 DC groups for the DC frame to actually be progressive. - Image3F large(4242, rect.ysize()); + JXL_ASSIGN_OR_DIE(Image3F large, Image3F::Create(4242, rect.ysize())); ZeroFillImage(&large); CopyImageTo(rect, *io_orig.Main().color(), rect, &large); CodecInOut io; @@ -311,7 +314,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectly) { CompressParams cparams; cparams.speed_tier = SpeedTier::kSquirrel; cparams.progressive_dc = 1; - cparams.responsive = true; + cparams.responsive = JXL_TRUE; cparams.qprogressive_mode = Override::kOn; cparams.butteraugli_distance = 1.0; ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool)); @@ -375,10 +378,11 @@ TEST(PassesTest, RoundtripSmallNoGaborishPasses) { CodecInOut io2; JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _)); - EXPECT_THAT(ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), - *JxlGetDefaultCms(), - /*distmap=*/nullptr), - IsSlightlyBelow(1.2)); + EXPECT_SLIGHTLY_BELOW( + ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(), + *JxlGetDefaultCms(), + /*distmap=*/nullptr), + 1.2); } } // namespace |