summaryrefslogtreecommitdiff
path: root/lib/jxl/preview_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jxl/preview_test.cc')
-rw-r--r--lib/jxl/preview_test.cc33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/jxl/preview_test.cc b/lib/jxl/preview_test.cc
index 35ec70b..7e88f51 100644
--- a/lib/jxl/preview_test.cc
+++ b/lib/jxl/preview_test.cc
@@ -3,38 +3,38 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#include <stddef.h>
+#include <jxl/cms.h>
+#include <cstddef>
+#include <cstdint>
#include <string>
+#include <vector>
-#include "gtest/gtest.h"
#include "lib/extras/codec.h"
-#include "lib/jxl/aux_out.h"
#include "lib/jxl/base/compiler_specific.h"
#include "lib/jxl/base/data_parallel.h"
#include "lib/jxl/base/override.h"
-#include "lib/jxl/base/padded_bytes.h"
+#include "lib/jxl/base/span.h"
#include "lib/jxl/codec_in_out.h"
#include "lib/jxl/color_encoding_internal.h"
#include "lib/jxl/enc_butteraugli_comparator.h"
#include "lib/jxl/enc_cache.h"
-#include "lib/jxl/enc_file.h"
#include "lib/jxl/enc_params.h"
#include "lib/jxl/headers.h"
#include "lib/jxl/image_bundle.h"
#include "lib/jxl/test_utils.h"
-#include "lib/jxl/testdata.h"
+#include "lib/jxl/testing.h"
namespace jxl {
namespace {
+using test::ReadTestData;
using test::Roundtrip;
TEST(PreviewTest, RoundtripGivenPreview) {
- ThreadPool* pool = nullptr;
- const PaddedBytes orig =
+ const std::vector<uint8_t> orig =
ReadTestData("external/wesaturate/500px/u76c0g_bliznaca_srgb8.png");
CodecInOut io;
- ASSERT_TRUE(SetFromBytes(Span<const uint8_t>(orig), &io, pool));
+ ASSERT_TRUE(SetFromBytes(Bytes(orig), &io));
io.ShrinkTo(io.xsize() / 8, io.ysize() / 8);
// Same as main image
io.preview_frame = io.Main().Copy();
@@ -48,22 +48,23 @@ TEST(PreviewTest, RoundtripGivenPreview) {
CompressParams cparams;
cparams.butteraugli_distance = 2.0;
cparams.speed_tier = SpeedTier::kSquirrel;
+ cparams.SetCms(*JxlGetDefaultCms());
CodecInOut io2;
- Roundtrip(&io, cparams, {}, pool, &io2);
+ JXL_EXPECT_OK(Roundtrip(&io, cparams, {}, &io2, _));
EXPECT_EQ(preview_xsize, io2.metadata.m.preview_size.xsize());
EXPECT_EQ(preview_ysize, io2.metadata.m.preview_size.ysize());
EXPECT_EQ(preview_xsize, io2.preview_frame.xsize());
EXPECT_EQ(preview_ysize, io2.preview_frame.ysize());
EXPECT_LE(ButteraugliDistance(io.preview_frame, io2.preview_frame,
- cparams.ba_params, GetJxlCms(),
- /*distmap=*/nullptr, pool),
+ ButteraugliParams(), *JxlGetDefaultCms(),
+ /*distmap=*/nullptr),
+ 2.5);
+ EXPECT_LE(ButteraugliDistance(io.Main(), io2.Main(), ButteraugliParams(),
+ *JxlGetDefaultCms(),
+ /*distmap=*/nullptr),
2.5);
- EXPECT_LE(
- ButteraugliDistance(io.Main(), io2.Main(), cparams.ba_params, GetJxlCms(),
- /*distmap=*/nullptr, pool),
- 2.5);
}
} // namespace