Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS Monterey and Big Sur] Enable AVIF image decoding using libavif and dav1d #5690

Conversation

litherum
Copy link
Contributor

@litherum litherum commented Oct 24, 2022

5300e66

[macOS Monterey and Big Sur] Enable AVIF image decoding using libavif and dav1d
https://bugs.webkit.org/show_bug.cgi?id=246925
rdar://101481679

Reviewed by Said Abou-Hallawa.

We checked in libavif and dav1d sources in 494a012c9820b947bdad5b6b5ea95df04e5bb1fe.

This patch hooks up image decoding to use them, on macOS Monterey and Big Sur. It does
so by using the same glue code that non-Apple platforms use: ScalableImageDecoder and
AVIFImageDecoder. This patch includes those files in Sources.txt for all ports, and
refactors ScalableImageDecoder on Cocoa platforms to only support AVIF, as per
https://webkit.slack.com/archives/CU64U6FDW/p1666556573569359?thread_ts=1666555605.109619&;cid=CU64U6FDW.

This patch re-uses the same USE(AVIF) flag that the non-Apple ports have been using.
There are currently 2 AVIF flags:
- USE(AVIF) indicates that libavif will be used to decode AVIF images, using the
      ScalableImageDecoder infrastructure. This is enabled on the non-Apple ports,
      and on macOS Monterey and Big Sur.
- HAVE(AVIF) indicates that the platform can decode AVIF images directly. This is enabled
      on macOS Ventura and later (and other Cocoa ports).
These flags are mutually exclusive; no port has both enabled at the same time. The Apple
Windows port has neither of these flags enabled.

* Source/WTF/wtf/PlatformUse.h:
* Source/WebCore/Configurations/WebCore.xcconfig:
* Source/WebCore/PAL/libavif/Configurations/libavif.xcconfig:
* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/ImageDecoder.cpp:
(WebCore::ImageDecoder::create):
* Source/WebCore/platform/graphics/cg/ImageBackingStoreCG.cpp: Copied from Source/WebCore/platform/image-decoders/avif/AVIFImageDecoder.h.
(WebCore::ImageBackingStore::image const):
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoderCG::decodeUTI const):
(WebCore::ImageDecoderCG::decodeUTI):
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.h:
* Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::create):
* Source/WebCore/platform/image-decoders/avif/AVIFImageDecoder.h:
* Source/WebCore/platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::decodeFrame):

Canonical link: https://commits.webkit.org/255984@main

eb1134f

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style loading πŸ›  ios   πŸ›  mac   πŸ›  wpe   πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim   πŸ›  mac-debug βœ… πŸ›  gtk   πŸ›  wincairo
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios   πŸ§ͺ api-mac   πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ›  tv   πŸ§ͺ mac-wk1 βœ… πŸ›  jsc-armv7
βœ… πŸ›  tv-sim   πŸ§ͺ mac-wk2 βœ… πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch   πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ›  jsc-mips
βœ… πŸ›  watch-sim   πŸ§ͺ mac-wk2-stress βœ… πŸ§ͺ jsc-mips-tests

@litherum litherum self-assigned this Oct 24, 2022
@litherum litherum added Images For bugs in image handling. WebKit Nightly Build labels Oct 24, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
@litherum litherum removed the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
@litherum litherum force-pushed the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch from d412bd1 to 2b1efa8 Compare October 24, 2022 01:05
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
@litherum litherum removed the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
@litherum litherum force-pushed the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch from 2b1efa8 to 9934097 Compare October 24, 2022 03:07
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
Copy link
Contributor

@shallawa shallawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not all/some of the skipped AVIF tests be un-skipped with this change?

fast/images/avif-image-decoding.html [ Skip ]
fast/images/avif-as-image.html [ Skip ]
fast/images/avif-heif-container-as-image.html [ Skip ]
fast/images/animated-avif.html [ Skip ]
http/tests/images/avif-partial-load-crash.html [ Skip ]

@litherum litherum removed the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
@litherum litherum force-pushed the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch from 9934097 to 7e2ec93 Compare October 24, 2022 18:45
@litherum litherum marked this pull request as draft October 24, 2022 19:47
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 24, 2022
@litherum litherum removed the merging-blocked Applied to prevent a change from being merged label Oct 25, 2022
@litherum litherum force-pushed the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch from 7e2ec93 to 3c88d48 Compare October 25, 2022 07:47
@litherum litherum marked this pull request as ready for review October 25, 2022 07:48
@litherum litherum added the merge-queue Applied to send a pull request to merge-queue label Oct 25, 2022
@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed merge-queue Applied to send a pull request to merge-queue labels Oct 25, 2022
@litherum litherum removed the merging-blocked Applied to prevent a change from being merged label Oct 25, 2022
@litherum litherum force-pushed the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch from 3c88d48 to eb1134f Compare October 25, 2022 18:05
@litherum litherum added the merge-queue Applied to send a pull request to merge-queue label Oct 25, 2022
… and dav1d

https://bugs.webkit.org/show_bug.cgi?id=246925
rdar://101481679

Reviewed by Said Abou-Hallawa.

We checked in libavif and dav1d sources in 494a012.

This patch hooks up image decoding to use them, on macOS Monterey and Big Sur. It does
so by using the same glue code that non-Apple platforms use: ScalableImageDecoder and
AVIFImageDecoder. This patch includes those files in Sources.txt for all ports, and
refactors ScalableImageDecoder on Cocoa platforms to only support AVIF, as per
https://webkit.slack.com/archives/CU64U6FDW/p1666556573569359?thread_ts=1666555605.109619&cid=CU64U6FDW.

This patch re-uses the same USE(AVIF) flag that the non-Apple ports have been using.
There are currently 2 AVIF flags:
- USE(AVIF) indicates that libavif will be used to decode AVIF images, using the
      ScalableImageDecoder infrastructure. This is enabled on the non-Apple ports,
      and on macOS Monterey and Big Sur.
- HAVE(AVIF) indicates that the platform can decode AVIF images directly. This is enabled
      on macOS Ventura and later (and other Cocoa ports).
These flags are mutually exclusive; no port has both enabled at the same time. The Apple
Windows port has neither of these flags enabled.

* Source/WTF/wtf/PlatformUse.h:
* Source/WebCore/Configurations/WebCore.xcconfig:
* Source/WebCore/PAL/libavif/Configurations/libavif.xcconfig:
* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/ImageDecoder.cpp:
(WebCore::ImageDecoder::create):
* Source/WebCore/platform/graphics/cg/ImageBackingStoreCG.cpp: Copied from Source/WebCore/platform/image-decoders/avif/AVIFImageDecoder.h.
(WebCore::ImageBackingStore::image const):
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoderCG::decodeUTI const):
(WebCore::ImageDecoderCG::decodeUTI):
* Source/WebCore/platform/graphics/cg/ImageDecoderCG.h:
* Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::create):
* Source/WebCore/platform/image-decoders/avif/AVIFImageDecoder.h:
* Source/WebCore/platform/image-decoders/avif/AVIFImageReader.cpp:
(WebCore::AVIFImageReader::decodeFrame):

Canonical link: https://commits.webkit.org/255984@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch from eb1134f to 5300e66 Compare October 25, 2022 21:37
@webkit-early-warning-system webkit-early-warning-system merged commit 5300e66 into WebKit:main Oct 25, 2022
@webkit-commit-queue
Copy link
Collaborator

Committed 255984@main (5300e66): https://commits.webkit.org/255984@main

Reviewed commits have been landed. Closing PR #5690 and removing active labels.

@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Oct 25, 2022
@litherum litherum deleted the eng/macOS-Monterey-and-Big-Sur-Enable-AVIF-image-decoding-using-libavif-and-dav1d branch October 26, 2022 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Images For bugs in image handling.
Projects
None yet
5 participants