diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/jpeg-xl/lib/jxl/passes_state.cc | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/passes_state.cc')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/passes_state.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/passes_state.cc b/third_party/jpeg-xl/lib/jxl/passes_state.cc index 12cc6a0c93..5da731b48e 100644 --- a/third_party/jpeg-xl/lib/jxl/passes_state.cc +++ b/third_party/jpeg-xl/lib/jxl/passes_state.cc @@ -5,6 +5,7 @@ #include "lib/jxl/passes_state.h" +#include "lib/jxl/base/status.h" #include "lib/jxl/chroma_from_luma.h" #include "lib/jxl/coeff_order.h" #include "lib/jxl/frame_dimensions.h" @@ -21,13 +22,17 @@ Status InitializePassesSharedState(const FrameHeader& frame_header, const FrameDimensions& frame_dim = shared->frame_dim; - shared->ac_strategy = - AcStrategyImage(frame_dim.xsize_blocks, frame_dim.ysize_blocks); - shared->raw_quant_field = - ImageI(frame_dim.xsize_blocks, frame_dim.ysize_blocks); - shared->epf_sharpness = - ImageB(frame_dim.xsize_blocks, frame_dim.ysize_blocks); - shared->cmap = ColorCorrelationMap(frame_dim.xsize, frame_dim.ysize); + JXL_ASSIGN_OR_RETURN( + shared->ac_strategy, + AcStrategyImage::Create(frame_dim.xsize_blocks, frame_dim.ysize_blocks)); + JXL_ASSIGN_OR_RETURN( + shared->raw_quant_field, + ImageI::Create(frame_dim.xsize_blocks, frame_dim.ysize_blocks)); + JXL_ASSIGN_OR_RETURN( + shared->epf_sharpness, + ImageB::Create(frame_dim.xsize_blocks, frame_dim.ysize_blocks)); + JXL_ASSIGN_OR_RETURN(shared->cmap, ColorCorrelationMap::Create( + frame_dim.xsize, frame_dim.ysize)); // In the decoder, we allocate coeff orders afterwards, when we know how many // we will actually need. @@ -40,9 +45,11 @@ Status InitializePassesSharedState(const FrameHeader& frame_header, kCoeffOrderMaxSize); } - shared->quant_dc = ImageB(frame_dim.xsize_blocks, frame_dim.ysize_blocks); + JXL_ASSIGN_OR_RETURN( + shared->quant_dc, + ImageB::Create(frame_dim.xsize_blocks, frame_dim.ysize_blocks)); - bool use_dc_frame = !!(frame_header.flags & FrameHeader::kUseDcFrame); + bool use_dc_frame = ((frame_header.flags & FrameHeader::kUseDcFrame) != 0u); if (!encoder && use_dc_frame) { if (frame_header.dc_level == 4) { return JXL_FAILURE("Invalid DC level for kUseDcFrame: %u", @@ -58,8 +65,9 @@ Status InitializePassesSharedState(const FrameHeader& frame_header, } ZeroFillImage(&shared->quant_dc); } else { - shared->dc_storage = - Image3F(frame_dim.xsize_blocks, frame_dim.ysize_blocks); + JXL_ASSIGN_OR_RETURN( + shared->dc_storage, + Image3F::Create(frame_dim.xsize_blocks, frame_dim.ysize_blocks)); shared->dc = &shared->dc_storage; } |