[Webkit-unassigned] [Bug 186272] [GTK][WPE] Support JPEG 2000 images

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 23 03:06:24 PST 2019


--- Comment #20 from Carlos Garcia Campos <cgarcia at igalia.com> ---
Comment on attachment 359745
  --> https://bugs.webkit.org/attachment.cgi?id=359745

View in context: https://bugs.webkit.org/attachment.cgi?id=359745&action=review

>> Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:57
>> +    *b = std::max(0, std::min(upb, y + static_cast<int>(1.772 * static_cast<float>(cb))));
> Why not use matrix coefficients wholly, like it's done in the color_esycc_to_rgb() function in openjpeg?
> Instead of std::min/std::max, you could consider using clampTo<>(), but keeping all of calculation in float.
> So for r value, you'd have:
>     r = static_cast<int>(clampTo<float>(y - 0.0000368 + 1.40199 * cr, 0, upb));

I have no idea, this code is copied from OpenJPEG. I just used min/max instead of the ifs in the original code. I'll use clamp as you suggest.

>> Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:68
>> +    size_t max = maxw * maxh;
> Any way to impose sane limits on these sizes, and/or to protect from overflow?

Ditto. I guess we could use CheckedArithmetic.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190123/6f65e2fa/attachment.html>

More information about the webkit-unassigned mailing list