summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/passes_test.cc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /third_party/jpeg-xl/lib/jxl/passes_test.cc
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 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.cc46
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