RESOLVED CONFIGURATION CHANGED236428
Support AVIF images natively
https://bugs.webkit.org/show_bug.cgi?id=236428
Summary Support AVIF images natively
Said Abou-Hallawa
Reported 2022-02-09 20:53:21 PST
This will import libavif, dav1d and nasm projects to WebKit.
Attachments
Patch (11.81 MB, patch)
2022-02-09 21:06 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.81 MB, patch)
2022-02-16 16:16 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.81 MB, patch)
2022-02-16 22:07 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.81 MB, patch)
2022-02-16 23:49 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.81 MB, patch)
2022-02-17 15:04 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.69 MB, patch)
2022-02-21 04:30 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.69 MB, patch)
2022-02-21 13:14 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.69 MB, patch)
2022-02-21 22:06 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.69 MB, patch)
2022-02-21 22:41 PST, Said Abou-Hallawa
no flags
Patch (11.69 MB, patch)
2022-02-22 02:52 PST, Said Abou-Hallawa
no flags
Patch (11.65 MB, patch)
2022-02-22 19:46 PST, Said Abou-Hallawa
no flags
Patch (251.81 KB, patch)
2022-02-22 20:06 PST, Said Abou-Hallawa
ews-feeder: commit-queue-
Patch (11.65 MB, patch)
2022-02-22 23:10 PST, Said Abou-Hallawa
no flags
Patch (Frameworks source excluded) (250.26 KB, patch)
2022-02-22 23:21 PST, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2022-02-09 21:06:41 PST
Said Abou-Hallawa
Comment 2 2022-02-16 16:16:36 PST
Radar WebKit Bug Importer
Comment 3 2022-02-16 20:54:25 PST
Said Abou-Hallawa
Comment 4 2022-02-16 22:07:36 PST
Said Abou-Hallawa
Comment 5 2022-02-16 23:49:55 PST
Said Abou-Hallawa
Comment 6 2022-02-17 15:04:11 PST
Aakash Jain
Comment 7 2022-02-18 04:19:02 PST
Cancelled https://ews-build.webkit.org/#/builders/70/builds/624 to speed up mac-wk2 queue, it already run layout-tests and the failure seemed pre-existing.
Said Abou-Hallawa
Comment 8 2022-02-21 04:30:26 PST
Said Abou-Hallawa
Comment 9 2022-02-21 13:14:17 PST
Said Abou-Hallawa
Comment 10 2022-02-21 22:06:58 PST
Said Abou-Hallawa
Comment 11 2022-02-21 22:41:06 PST
Said Abou-Hallawa
Comment 12 2022-02-22 02:52:18 PST
Tim Horton
Comment 13 2022-02-22 10:28:49 PST
I would elide the massive and useless list of changed symbols. `WK_LIBAVIF_LDFLAGS` seems sorted wrong. It seems important to note in the changelog that you've disabled this on Apple Silicon. That will confuse people for sure. `NASM_HEADER_SEARCH_PATHS` and `HEADER_SEARCH_PATHS` should probably be defined in an xcconfig, not the xcodeproj (also, all of the other properties set in the xcodeproj, there are a bunch). Search for `XCBuildConfiguration` in the patch. Should be nearly empty, getting everything from xcconfigs. There's a bunch of seemingly-generated code. Is it right that we're checking that in, or should we be generating it? (I have no idea).
Said Abou-Hallawa
Comment 14 2022-02-22 19:46:38 PST
Said Abou-Hallawa
Comment 15 2022-02-22 20:06:57 PST
Created attachment 452934 [details] Patch Excluding frameworks
Tim Horton
Comment 16 2022-02-22 20:27:24 PST
Comment on attachment 452934 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452934&action=review > Source/ThirdParty/ChangeLog:25 > + -- nasm is used to compile the assembly sources in dava1d. spelling: "dava1d" > Source/ThirdParty/libavif/Configurations/dav1d.xcconfig:59 > +EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*] = $(EXCLUDED_SOURCE_FILE_NAMES_x86); > +EXCLUDED_SOURCE_FILE_NAMES[sdk=iphonesimulator*] = $(EXCLUDED_SOURCE_FILE_NAMES_arm); > +EXCLUDED_SOURCE_FILE_NAMES[sdk=iphonesimulator*][arch=arm64*] = $(EXCLUDED_SOURCE_FILE_NAMES_x86); > +EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = $(EXCLUDED_SOURCE_FILE_NAMES_arm); > +EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*][arch=arm64*] = $(EXCLUDED_SOURCE_FILE_NAMES_x86); Does this all have to be so complicated? Is it not just an architecture conditional in the end? > Source/ThirdParty/libavif/Configurations/libavif.xcconfig:55 > +EXCLUDED_SOURCE_FILE_NAMES[sdk=iphonesimulator*] = codec_aom.c codec_libgav1.c codec_rav1e.c codec_svt.c; > +EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*] = codec_aom.c codec_libgav1.c codec_rav1e.c codec_svt.c; > +EXCLUDED_SOURCE_FILE_NAMES[sdk=macos*] = codec_aom.c codec_libgav1.c codec_rav1e.c codec_svt.c; Are these intentionally included only in the watchOS and tvOS builds? If you meant to exclude them everywhere, why not list them only once? Or better, remove them from the project? > Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:110 > + humanReadableName: "Avif image decoding" > + humanReadableDescription: "Enable Avif image decoding and rendering" As far as I can tell both of these should be all-capital "AVIF" > Source/WebCore/loader/cache/CachedImage.cpp:512 > + else > +#endif > + // Have the image update its data from its internal buffer. Decoding the image data > + // will be delayed until info (like size or specific image frames) are queried which > + // usually happens when the observers are repainted. > + encodedDataStatus = updateImageData(false); Multi-line statement after an else with no braces separated by a preprocessor directive is a recipe for a future mistake; can you reorganize this to avoid that? (I'd go with adding some braces, but there are many options)
Said Abou-Hallawa
Comment 17 2022-02-22 23:10:47 PST
Said Abou-Hallawa
Comment 18 2022-02-22 23:21:28 PST
Created attachment 452941 [details] Patch (Frameworks source excluded)
Said Abou-Hallawa
Comment 19 2022-02-22 23:23:21 PST
Comment on attachment 452934 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=452934&action=review >> Source/ThirdParty/ChangeLog:25 >> + -- nasm is used to compile the assembly sources in dava1d. > > spelling: "dava1d" Fixed >> Source/ThirdParty/libavif/Configurations/dav1d.xcconfig:59 >> +EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*][arch=arm64*] = $(EXCLUDED_SOURCE_FILE_NAMES_x86); > > Does this all have to be so complicated? Is it not just an architecture conditional in the end? This setting was simplified. >> Source/ThirdParty/libavif/Configurations/libavif.xcconfig:55 >> +EXCLUDED_SOURCE_FILE_NAMES[sdk=macos*] = codec_aom.c codec_libgav1.c codec_rav1e.c codec_svt.c; > > Are these intentionally included only in the watchOS and tvOS builds? If you meant to exclude them everywhere, why not list them only once? Or better, remove them from the project? This setting was removed and the files were removed. >> Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:110 >> + humanReadableDescription: "Enable Avif image decoding and rendering" > > As far as I can tell both of these should be all-capital "AVIF" Fixed. >> Source/WebCore/loader/cache/CachedImage.cpp:512 >> + encodedDataStatus = updateImageData(false); > > Multi-line statement after an else with no braces separated by a preprocessor directive is a recipe for a future mistake; can you reorganize this to avoid that? (I'd go with adding some braces, but there are many options) Fixed.
Adam Silverstein
Comment 20 2022-05-17 12:14:12 PDT
Hi Said, Excited to see this ticket opened to add AVIF support to WebKit! I am a WordPress media component maintainer and I've been working with the core Performance team to help add modern image format support. AVIF looks like a promising improvement for WordPress and the web at scale and having support in WebKit would potentially unblock adding support for AVIF directly in WordPress core. I noticed you haven't updated this ticket recently, is this something you are still planning to work on?
Myles C. Maxfield
Comment 21 2022-08-18 11:39:54 PDT
AVIF images are supported in the betas of macOS Ventura and iOS 16. This Bugzilla bug is about supporting AVIF images in previous versions of macOS (before Ventura).
Note You need to log in before you can comment on or make changes to this bug.