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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 23 01:50:28 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=186272

Zan Dobersek <zan at falconsigh.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zan at falconsigh.net

--- Comment #19 from Zan Dobersek <zan at falconsigh.net> ---
Comment on attachment 359745
  --> https://bugs.webkit.org/attachment.cgi?id=359745
Patch

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

> Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:57
> +    *r = std::max(0, std::min(upb, y + static_cast<int>(1.402 * static_cast<float>(cr))));
> +    *g = std::max(0, std::min(upb, y - static_cast<int>(0.344 * static_cast<float>(cb) + 0.714 * static_cast<float>(cr))));
> +    *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));

> Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:68
> +    size_t maxw = static_cast<size_t>(img->comps[0].w);
> +    size_t maxh = static_cast<size_t>(img->comps[0].h);
> +    size_t max = maxw * maxh;

Any way to impose sane limits on these sizes, and/or to protect from overflow?

-- 
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/500546f6/attachment.html>


More information about the webkit-unassigned mailing list