From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc') diff --git a/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc b/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc index 63d21cbb4b..69585c44cf 100644 --- a/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc +++ b/third_party/jpeg-xl/lib/jxl/chroma_from_luma.cc @@ -5,17 +5,25 @@ #include "lib/jxl/chroma_from_luma.h" +#include "lib/jxl/image_ops.h" + namespace jxl { -ColorCorrelationMap::ColorCorrelationMap(size_t xsize, size_t ysize, bool XYB) - : ytox_map(DivCeil(xsize, kColorTileDim), DivCeil(ysize, kColorTileDim)), - ytob_map(DivCeil(xsize, kColorTileDim), DivCeil(ysize, kColorTileDim)) { - ZeroFillImage(&ytox_map); - ZeroFillImage(&ytob_map); +StatusOr ColorCorrelationMap::Create(size_t xsize, + size_t ysize, + bool XYB) { + ColorCorrelationMap result; + size_t xblocks = DivCeil(xsize, kColorTileDim); + size_t yblocks = DivCeil(ysize, kColorTileDim); + JXL_ASSIGN_OR_RETURN(result.ytox_map, ImageSB::Create(xblocks, yblocks)); + JXL_ASSIGN_OR_RETURN(result.ytob_map, ImageSB::Create(xblocks, yblocks)); + ZeroFillImage(&result.ytox_map); + ZeroFillImage(&result.ytob_map); if (!XYB) { - base_correlation_b_ = 0; + result.base_correlation_b_ = 0; } - RecomputeDCFactors(); + result.RecomputeDCFactors(); + return result; } } // namespace jxl -- cgit v1.2.3