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/enc_group.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/enc_group.cc')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/enc_group.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/enc_group.cc b/third_party/jpeg-xl/lib/jxl/enc_group.cc index 09bab534c9..1967fdaba9 100644 --- a/third_party/jpeg-xl/lib/jxl/enc_group.cc +++ b/third_party/jpeg-xl/lib/jxl/enc_group.cc @@ -286,10 +286,11 @@ void AdjustQuantBlockAC(const Quantizer& quantizer, size_t c, { // Reduce quant in highly active areas. int32_t div = (xsize * ysize); - int32_t activity = (hfNonZeros[0] + div / 2) / div; + int32_t activity = (static_cast<int32_t>(hfNonZeros[0]) + div / 2) / div; int32_t orig_qp_limit = std::max(4, *quant / 2); for (int i = 1; i < 4; ++i) { - activity = std::min<int32_t>(activity, (hfNonZeros[i] + div / 2) / div); + activity = std::min( + activity, (static_cast<int32_t>(hfNonZeros[i]) + div / 2) / div); } if (activity >= 15) { activity = 15; @@ -316,7 +317,7 @@ void QuantizeRoundtripYBlockAC(PassesEncoderState* enc_state, const size_t size, float* JXL_RESTRICT inout, int32_t* JXL_RESTRICT quantized) { float thres_y[4] = {0.58f, 0.64f, 0.64f, 0.64f}; - { + if (enc_state->cparams.speed_tier <= SpeedTier::kHare) { int32_t max_quant = 0; int quant_orig = *quant; float val[3] = {enc_state->x_qm_multiplier, 1.0f, @@ -337,6 +338,11 @@ void QuantizeRoundtripYBlockAC(PassesEncoderState* enc_state, const size_t size, max_quant = std::max(*quant, max_quant); } *quant = max_quant; + } else { + thres_y[0] = 0.56; + thres_y[1] = 0.62; + thres_y[2] = 0.62; + thres_y[3] = 0.62; } QuantizeBlockAC(quantizer, error_diffusion, 1, 1.0f, quant_kind, xsize, ysize, @@ -507,8 +513,8 @@ namespace jxl { HWY_EXPORT(ComputeCoefficients); void ComputeCoefficients(size_t group_idx, PassesEncoderState* enc_state, const Image3F& opsin, const Rect& rect, Image3F* dc) { - return HWY_DYNAMIC_DISPATCH(ComputeCoefficients)(group_idx, enc_state, opsin, - rect, dc); + HWY_DYNAMIC_DISPATCH(ComputeCoefficients) + (group_idx, enc_state, opsin, rect, dc); } Status EncodeGroupTokenizedCoefficients(size_t group_idx, size_t pass_idx, |