summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/enc_gaborish.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/enc_gaborish.cc')
-rw-r--r--third_party/jpeg-xl/lib/jxl/enc_gaborish.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/enc_gaborish.cc b/third_party/jpeg-xl/lib/jxl/enc_gaborish.cc
index 3f2ee32afd..7467a4d669 100644
--- a/third_party/jpeg-xl/lib/jxl/enc_gaborish.cc
+++ b/third_party/jpeg-xl/lib/jxl/enc_gaborish.cc
@@ -15,8 +15,8 @@
namespace jxl {
-void GaborishInverse(Image3F* in_out, const Rect& rect, float mul[3],
- ThreadPool* pool) {
+Status GaborishInverse(Image3F* in_out, const Rect& rect, const float mul[3],
+ ThreadPool* pool) {
WeightsSymmetric5 weights[3];
// Only an approximation. One or even two 3x3, and rank-1 (separable) 5x5
// are insufficient. The numbers here have been obtained by butteraugli
@@ -47,7 +47,9 @@ void GaborishInverse(Image3F* in_out, const Rect& rect, float mul[3],
// Note that we cannot *allocate* a plane, as doing so might cause Image3F to
// have planes of different stride. Instead, we copy one plane in a temporary
// image and reuse the existing planes of the in/out image.
- ImageF temp(in_out->Plane(2).xsize(), in_out->Plane(2).ysize());
+ ImageF temp;
+ JXL_ASSIGN_OR_RETURN(
+ temp, ImageF::Create(in_out->Plane(2).xsize(), in_out->Plane(2).ysize()));
CopyImageTo(in_out->Plane(2), &temp);
Rect xrect = rect.Extend(3, Rect(*in_out));
Symmetric5(in_out->Plane(0), xrect, weights[0], pool, &in_out->Plane(2),
@@ -59,6 +61,7 @@ void GaborishInverse(Image3F* in_out, const Rect& rect, float mul[3],
in_out->Plane(0).Swap(in_out->Plane(1));
// 2 1 0
in_out->Plane(0).Swap(in_out->Plane(2));
+ return true;
}
} // namespace jxl