summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-06-01 09:13:10 -0400
committerAndreas Kling <kling@serenityos.org>2023-06-01 17:36:20 +0200
commit2452cf6b55965b5c4dd8d9bbbdc6145aa7972ab4 (patch)
tree0bf29fd5ebffad3c468fcc73452c63f07ad2b8a2
parent661b2d394d600a7dc334691a05dce7a49699254f (diff)
downloadserenity-2452cf6b55965b5c4dd8d9bbbdc6145aa7972ab4.zip
WebP/Lossy: Allow negative values from segment adjustment too
The spec doesn't talk about this happening in the text, but `dequant_init()` in 20.4 processes segment adjustment and quantization index adjustment in the same variable `q` before clamping. Since we had to adjust the latter step in the previous commit, do it for the former step too. I haven't seen this happen in the wild yet (and now, I hopefully never will notice it if it happens).
-rw-r--r--Userland/Libraries/LibGfx/ImageFormats/WebPLoaderLossy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/ImageFormats/WebPLoaderLossy.cpp b/Userland/Libraries/LibGfx/ImageFormats/WebPLoaderLossy.cpp
index fe4c0a726f..ec05396cb3 100644
--- a/Userland/Libraries/LibGfx/ImageFormats/WebPLoaderLossy.cpp
+++ b/Userland/Libraries/LibGfx/ImageFormats/WebPLoaderLossy.cpp
@@ -613,7 +613,7 @@ i16 dequantize_value(i16 value, bool is_dc, QuantizationIndices const& quantizat
// * For uv, the dc_qlookup index is clamped to 117 (instead of 127 for everything else)
// (or, alternatively, the value is clamped to 132 at most)
- u8 y_ac_base = quantization_indices.y_ac;
+ int y_ac_base = quantization_indices.y_ac;
if (segmentation.update_macroblock_segmentation_map) {
if (segmentation.segment_feature_mode == SegmentFeatureMode::DeltaValueMode)
y_ac_base += segmentation.quantizer_update_value[segment_id];