Bug 233545 - Support Animated JPEG-XL images
Summary: Support Animated JPEG-XL images
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yoshiaki Jitsukawa
URL:
Keywords: InRadar
Depends on:
Blocks: 208235
  Show dependency treegraph
 
Reported: 2021-11-28 17:09 PST by Yoshiaki Jitsukawa
Modified: 2021-12-07 16:23 PST (History)
3 users (show)

See Also:


Attachments
Patch (23.96 KB, patch)
2021-11-30 01:38 PST, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff
Patch (23.61 KB, patch)
2021-11-30 01:40 PST, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff
Patch (25.91 KB, patch)
2021-12-07 04:17 PST, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff
Patch (25.91 KB, patch)
2021-12-07 04:28 PST, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff
Patch (26.14 KB, patch)
2021-12-07 15:24 PST, Yoshiaki Jitsukawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yoshiaki Jitsukawa 2021-11-28 17:09:24 PST
JPEG-XL can have animations but currently the decoder decodes only the first frame.
Comment 1 Yoshiaki Jitsukawa 2021-11-30 01:38:33 PST
Created attachment 445396 [details]
Patch
Comment 2 Yoshiaki Jitsukawa 2021-11-30 01:40:59 PST
Created attachment 445397 [details]
Patch
Comment 3 Radar WebKit Bug Importer 2021-12-05 17:10:20 PST
<rdar://problem/86077143>
Comment 4 Said Abou-Hallawa 2021-12-06 14:02:53 PST
Comment on attachment 445397 [details]
Patch

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

> LayoutTests/platform/wincairo/TestExpectations:278
> +fast/images/animated-jpegxl-loop-count.html [ Skip ]

Since the test is skipped globally, where is it un-skipped? I expect it see marked [Pass] here.

I see the comment "# JPEG XL is disabled until WebKitRequirements is released with libjxl" now. But what is the point in adding the test without enabling libjxl? Can't we just have a feature flag or a internal flag to enable it for layout tests only?

> Source/WebCore/platform/image-decoders/jpegxl/JPEGXLImageDecoder.cpp:94
> +        if (!i->isInvalid() && !i->isPartial()) // We don't clear the frame we're currently decoding.

This condition and the comment are confusing. Why do you want to keep the isInvalid() frame? And what does "we're currently decoding" mean? Do we run the decoding on a separate thread?
Comment 5 Yoshiaki Jitsukawa 2021-12-07 04:17:49 PST
Created attachment 446154 [details]
Patch
Comment 6 Yoshiaki Jitsukawa 2021-12-07 04:28:13 PST
Created attachment 446157 [details]
Patch
Comment 7 Yoshiaki Jitsukawa 2021-12-07 04:38:53 PST
(In reply to Said Abou-Hallawa from comment #4)
Thank you for the review!

> Since the test is skipped globally, where is it un-skipped? I expect it see
> marked [Pass] here.
> 
> I see the comment "# JPEG XL is disabled until WebKitRequirements is
> released with libjxl" now. But what is the point in adding the test without
> enabling libjxl? Can't we just have a feature flag or a internal flag to
> enable it for layout tests only?

I've marked the wincairo expectations as [Pass]. Also I changed the comment to simply "JPEG-XL tests" because now we have libjxl in the latest WebKitRequirements.

> 
> > Source/WebCore/platform/image-decoders/jpegxl/JPEGXLImageDecoder.cpp:94
> > +        if (!i->isInvalid() && !i->isPartial()) // We don't clear the frame we're currently decoding.
> 
> This condition and the comment are confusing. Why do you want to keep the
> isInvalid() frame? And what does "we're currently decoding" mean? Do we run
> the decoding on a separate thread?

I fixed it to clear invalid frames in case where it has a valid backing store. 

"we're currently decoding" means that the current frame decoding is interrupted due to input starvation. I clarified the relation between the isPartial() and   "currently decoding".
Comment 8 Don Olmstead 2021-12-07 14:28:14 PST
Comment on attachment 446157 [details]
Patch

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

r=me with nit

> Source/WebCore/platform/image-decoders/jpegxl/JPEGXLImageDecoder.cpp:154
> +        if (query == Query::FrameCount)
> +            return false; // Continue counting frames.
> +        return true; // In this case the decoder has reached the EOF and needs rewind.

Just do

return query != Query::FrameCount

and add any behavior documentation above it.
Comment 9 Yoshiaki Jitsukawa 2021-12-07 15:24:39 PST
Created attachment 446244 [details]
Patch
Comment 10 Yoshiaki Jitsukawa 2021-12-07 15:28:41 PST
(In reply to Don Olmstead from comment #8)
> Just do
> 
> return query != Query::FrameCount
> 
> and add any behavior documentation above it.

Thank you! I addressed the point.
(Also updated the comment in clearFrameBufferCache())
Comment 11 EWS 2021-12-07 16:23:51 PST
Committed r286628 (244941@main): <https://commits.webkit.org/244941@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446244 [details].