summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/passes_test.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/jpeg-xl/lib/jxl/passes_test.cc47
1 files changed, 24 insertions, 23 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/passes_test.cc b/third_party/jpeg-xl/lib/jxl/passes_test.cc
index cb9164706f..e7a7547a0c 100644
--- a/third_party/jpeg-xl/lib/jxl/passes_test.cc
+++ b/third_party/jpeg-xl/lib/jxl/passes_test.cc
@@ -80,7 +80,7 @@ TEST(PassesTest, RoundtripMultiGroupPasses) {
CodecInOut io;
{
ThreadPoolForTests pool(4);
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, pool.get()));
}
io.ShrinkTo(600, 1024); // partial X, full Y group
@@ -92,11 +92,11 @@ TEST(PassesTest, RoundtripMultiGroupPasses) {
cparams.SetCms(*JxlGetDefaultCms());
CodecInOut io2;
JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _,
- /* compressed_size */ nullptr, &pool));
+ /* compressed_size */ nullptr, pool.get()));
EXPECT_SLIGHTLY_BELOW(
ButteraugliDistance(io.frames, io2.frames, ButteraugliParams(),
*JxlGetDefaultCms(),
- /*distmap=*/nullptr, &pool),
+ /*distmap=*/nullptr, pool.get()),
target_distance + threshold);
};
@@ -108,7 +108,7 @@ TEST(PassesTest, RoundtripLargeFastPasses) {
ThreadPoolForTests pool(8);
const std::vector<uint8_t> orig = ReadTestData("jxl/flower/flower.png");
CodecInOut io;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, pool.get()));
CompressParams cparams;
cparams.speed_tier = SpeedTier::kSquirrel;
@@ -117,7 +117,7 @@ TEST(PassesTest, RoundtripLargeFastPasses) {
CodecInOut io2;
JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _,
- /* compressed_size */ nullptr, &pool));
+ /* compressed_size */ nullptr, pool.get()));
}
// Checks for differing size/distance in two consecutive runs of distance 2,
@@ -127,7 +127,7 @@ TEST(PassesTest, RoundtripProgressiveConsistent) {
ThreadPoolForTests pool(8);
const std::vector<uint8_t> orig = ReadTestData("jxl/flower/flower.png");
CodecInOut io;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, pool.get()));
CompressParams cparams;
cparams.speed_tier = SpeedTier::kSquirrel;
@@ -141,11 +141,11 @@ TEST(PassesTest, RoundtripProgressiveConsistent) {
CodecInOut io2;
size_t size2;
- JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _, &size2, &pool));
+ JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _, &size2, pool.get()));
CodecInOut io3;
size_t size3;
- JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io3, _, &size3, &pool));
+ JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io3, _, &size3, pool.get()));
// Exact same compressed size.
EXPECT_EQ(size2, size3);
@@ -153,10 +153,10 @@ TEST(PassesTest, RoundtripProgressiveConsistent) {
// Exact same distance.
const float dist2 = ButteraugliDistance(
io.frames, io2.frames, ButteraugliParams(), *JxlGetDefaultCms(),
- /*distmap=*/nullptr, &pool);
+ /*distmap=*/nullptr, pool.get());
const float dist3 = ButteraugliDistance(
io.frames, io3.frames, ButteraugliParams(), *JxlGetDefaultCms(),
- /*distmap=*/nullptr, &pool);
+ /*distmap=*/nullptr, pool.get());
EXPECT_EQ(dist2, dist3);
}
}
@@ -166,7 +166,7 @@ TEST(PassesTest, AllDownsampleFeasible) {
const std::vector<uint8_t> orig =
ReadTestData("external/wesaturate/500px/u76c0g_bliznaca_srgb8.png");
CodecInOut io;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, pool.get()));
std::vector<uint8_t> compressed;
@@ -174,7 +174,7 @@ TEST(PassesTest, AllDownsampleFeasible) {
cparams.speed_tier = SpeedTier::kSquirrel;
cparams.progressive_mode = Override::kOn;
cparams.butteraugli_distance = 1.0;
- ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool));
+ ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, pool.get()));
EXPECT_LE(compressed.size(), 240000u);
float target_butteraugli[9] = {};
@@ -202,7 +202,7 @@ TEST(PassesTest, AllDownsampleFeasible) {
target_butteraugli[downsampling])
<< "downsampling: " << downsampling;
};
- EXPECT_TRUE(RunOnPool(&pool, 0, downsamplings.size(), ThreadPool::NoInit,
+ EXPECT_TRUE(RunOnPool(pool.get(), 0, downsamplings.size(), ThreadPool::NoInit,
check, "TestDownsampling"));
}
@@ -211,7 +211,7 @@ TEST(PassesTest, AllDownsampleFeasibleQProgressive) {
const std::vector<uint8_t> orig =
ReadTestData("external/wesaturate/500px/u76c0g_bliznaca_srgb8.png");
CodecInOut io;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, pool.get()));
std::vector<uint8_t> compressed;
@@ -219,7 +219,7 @@ TEST(PassesTest, AllDownsampleFeasibleQProgressive) {
cparams.speed_tier = SpeedTier::kSquirrel;
cparams.qprogressive_mode = Override::kOn;
cparams.butteraugli_distance = 1.0;
- ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool));
+ ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, pool.get()));
EXPECT_LE(compressed.size(), 220000u);
@@ -247,7 +247,7 @@ TEST(PassesTest, AllDownsampleFeasibleQProgressive) {
target_butteraugli[downsampling])
<< "downsampling: " << downsampling;
};
- EXPECT_TRUE(RunOnPool(&pool, 0, downsamplings.size(), ThreadPool::NoInit,
+ EXPECT_TRUE(RunOnPool(pool.get(), 0, downsamplings.size(), ThreadPool::NoInit,
check, "TestQProgressive"));
}
@@ -256,7 +256,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectlyGrayscale) {
const std::vector<uint8_t> orig = ReadTestData(
"external/wesaturate/500px/cvo9xd_keong_macan_grayscale.png");
CodecInOut io_orig;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io_orig, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io_orig, pool.get()));
Rect rect(0, 0, io_orig.xsize(), 128);
// need 2 DC groups for the DC frame to actually be progressive.
JXL_ASSIGN_OR_DIE(Image3F large, Image3F::Create(4242, rect.ysize()));
@@ -274,7 +274,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectlyGrayscale) {
cparams.responsive = JXL_TRUE;
cparams.qprogressive_mode = Override::kOn;
cparams.butteraugli_distance = 1.0;
- ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool));
+ ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, pool.get()));
EXPECT_LE(compressed.size(), 10000u);
@@ -300,7 +300,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectly) {
ThreadPoolForTests pool(8);
const std::vector<uint8_t> orig = ReadTestData("jxl/flower/flower.png");
CodecInOut io_orig;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io_orig, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io_orig, pool.get()));
Rect rect(0, 0, io_orig.xsize(), 128);
// need 2 DC groups for the DC frame to actually be progressive.
JXL_ASSIGN_OR_DIE(Image3F large, Image3F::Create(4242, rect.ysize()));
@@ -317,7 +317,7 @@ TEST(PassesTest, ProgressiveDownsample2DegradesCorrectly) {
cparams.responsive = JXL_TRUE;
cparams.qprogressive_mode = Override::kOn;
cparams.butteraugli_distance = 1.0;
- ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool));
+ ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, pool.get()));
EXPECT_LE(compressed.size(), 220000u);
@@ -343,7 +343,7 @@ TEST(PassesTest, NonProgressiveDCImage) {
ThreadPoolForTests pool(8);
const std::vector<uint8_t> orig = ReadTestData("jxl/flower/flower.png");
CodecInOut io;
- ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, &pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io, pool.get()));
std::vector<uint8_t> compressed;
@@ -351,14 +351,15 @@ TEST(PassesTest, NonProgressiveDCImage) {
cparams.speed_tier = SpeedTier::kSquirrel;
cparams.progressive_mode = Override::kOff;
cparams.butteraugli_distance = 2.0;
- ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, &pool));
+ ASSERT_TRUE(test::EncodeFile(cparams, &io, &compressed, pool.get()));
// Even in non-progressive mode, it should be possible to return a DC-only
// image.
extras::JXLDecompressParams dparams;
dparams.max_downsampling = 100;
CodecInOut output;
- ASSERT_TRUE(test::DecodeFile(dparams, Bytes(compressed), &output, &pool));
+ ASSERT_TRUE(
+ test::DecodeFile(dparams, Bytes(compressed), &output, pool.get()));
EXPECT_EQ(output.xsize(), io.xsize());
EXPECT_EQ(output.ysize(), io.ysize());
}