From ac19b288e06e4c3773c6d64bc7833a4e125ad62f Mon Sep 17 00:00:00 2001 From: Eugene Kliuchnikov Date: Fri, 20 Dec 2024 21:47:36 +0100 Subject: [PATCH] Fix build for platforms with scalable vectors (#4025) (cherry picked from commit 24e12baf0e8e697fdde84a5250b2df32f18cf40b) --- lib/extras/jpegli_test.cc | 6 ++++-- lib/extras/metrics.cc | 7 ++++--- lib/extras/metrics.h | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/extras/jpegli_test.cc b/lib/extras/jpegli_test.cc index 7bac5228..cc3d9425 100644 --- a/lib/extras/jpegli_test.cc +++ b/lib/extras/jpegli_test.cc @@ -384,8 +384,10 @@ TEST_P(JpegliColorQuantTestParam, JpegliColorQuantizeTest) { dparams2.dither_mode = config.dither; ASSERT_TRUE(DecodeJpeg(compressed, dparams2, nullptr, &ppf2)); - double dist1 = Butteraugli3Norm(memory_manager, ppf0, ppf1); - double dist2 = Butteraugli3Norm(memory_manager, ppf0, ppf2); + JXL_TEST_ASSIGN_OR_DIE(double dist1, + Butteraugli3Norm(memory_manager, ppf0, ppf1)); + JXL_TEST_ASSIGN_OR_DIE(double dist2, + Butteraugli3Norm(memory_manager, ppf0, ppf2)); printf("distance: %f vs %f\n", dist2, dist1); if (config.passes == 1) { if (config.num_colors == 16 && config.dither == 2) { diff --git a/lib/extras/metrics.cc b/lib/extras/metrics.cc index 5813a1bc..7ddf50b0 100644 --- a/lib/extras/metrics.cc +++ b/lib/extras/metrics.cc @@ -306,9 +306,10 @@ StatusOr ComputeDistanceP(const ImageF& distmap, return HWY_DYNAMIC_DISPATCH(ComputeDistanceP)(distmap, params, p); } -float Butteraugli3Norm(JxlMemoryManager* memory_manager, - const extras::PackedPixelFile& a, - const extras::PackedPixelFile& b, ThreadPool* pool) { +StatusOr Butteraugli3Norm(JxlMemoryManager* memory_manager, + const extras::PackedPixelFile& a, + const extras::PackedPixelFile& b, + ThreadPool* pool) { ButteraugliParams params; ImageF distmap; ButteraugliDistance(memory_manager, a, b, params, &distmap, pool); diff --git a/lib/extras/metrics.h b/lib/extras/metrics.h index a5ca0b05..3f53a403 100644 --- a/lib/extras/metrics.h +++ b/lib/extras/metrics.h @@ -31,10 +31,10 @@ float ButteraugliDistance(JxlMemoryManager* memory_manager, StatusOr ComputeDistanceP(const ImageF& distmap, const ButteraugliParams& params, double p); -float Butteraugli3Norm(JxlMemoryManager* memory_manager, - const extras::PackedPixelFile& a, - const extras::PackedPixelFile& b, - ThreadPool* pool = nullptr); +StatusOr Butteraugli3Norm(JxlMemoryManager* memory_manager, + const extras::PackedPixelFile& a, + const extras::PackedPixelFile& b, + ThreadPool* pool = nullptr); double ComputePSNR(JxlMemoryManager* memory_manager, const extras::PackedPixelFile& a,