summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc')
-rw-r--r--third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc b/third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc
index 426f08ecb0..0d173c5eb8 100644
--- a/third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc
+++ b/third_party/jpeg-xl/lib/jxl/enc_gaborish_test.cc
@@ -5,6 +5,8 @@
#include "lib/jxl/enc_gaborish.h"
+#include <jxl/types.h>
+
#include <hwy/base.h>
#include "lib/jxl/base/compiler_specific.h"
@@ -40,7 +42,7 @@ void ConvolveGaborish(const ImageF& in, float weight1, float weight2,
}
void TestRoundTrip(const Image3F& in, float max_l1) {
- Image3F fwd(in.xsize(), in.ysize());
+ JXL_ASSIGN_OR_DIE(Image3F fwd, Image3F::Create(in.xsize(), in.ysize()));
ThreadPool* null_pool = nullptr;
ConvolveGaborish(in.Plane(0), 0, 0, null_pool, &fwd.Plane(0));
ConvolveGaborish(in.Plane(1), 0, 0, null_pool, &fwd.Plane(1));
@@ -51,20 +53,20 @@ void TestRoundTrip(const Image3F& in, float max_l1) {
w,
w,
};
- GaborishInverse(&fwd, Rect(fwd), weights, null_pool);
+ JXL_CHECK(GaborishInverse(&fwd, Rect(fwd), weights, null_pool));
JXL_ASSERT_OK(VerifyRelativeError(in, fwd, max_l1, 1E-4f, _));
}
TEST(GaborishTest, TestZero) {
- Image3F in(20, 20);
+ JXL_ASSIGN_OR_DIE(Image3F in, Image3F::Create(20, 20));
ZeroFillImage(&in);
TestRoundTrip(in, 0.0f);
}
// Disabled: large difference.
-#if 0
+#if JXL_FALSE
TEST(GaborishTest, TestDirac) {
- Image3F in(20, 20);
+ JXL_ASSIGN_OR_DIE(Image3F in, Image3F::Create(20, 20));
ZeroFillImage(&in);
in.PlaneRow(1, 10)[10] = 10.0f;
TestRoundTrip(in, 0.26f);
@@ -72,7 +74,7 @@ TEST(GaborishTest, TestDirac) {
#endif
TEST(GaborishTest, TestFlat) {
- Image3F in(20, 20);
+ JXL_ASSIGN_OR_DIE(Image3F in, Image3F::Create(20, 20));
FillImage(1.0f, &in);
TestRoundTrip(in, 1E-5f);
}