Navigation Menu

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

Supports built-in WebP/AWebP codec from ImageIO for iOS 14/tvOS 14/macOS 11/watchOS 7 #3048

Merged
merged 7 commits into from Jul 15, 2020

Conversation

dreampiggy
Copy link
Contributor

@dreampiggy dreampiggy commented Jul 3, 2020

New Pull Request Checklist

  • I have read and understood the CONTRIBUTING guide

  • I have read the Documentation

  • I have searched for a similar pull request in the project and found none

  • I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)

  • I have added the required tests to prove the fix/feature I am adding

  • I have updated the documentation (if necessary)

  • I have run the tests and they pass

  • I have run the lint and it passes (pod lib lint)

This merge request fixes / refers to the following issues: #3041

Pull Request Description

This close #3041

Changes

Similiar to HEIC, iOS 14's new WebP codec can be implementes with the subclass of SDAnimatedImageIOCoder.

The kUTTypeWebP does not get defined by Apple's SDK (bugs?), but I found the raw string value for that is org.webmproject.webp, so we define one with macro

The UTI API is here: https://developer.apple.com/documentation/uniformtypeidentifiers/uttypewebp
However, we need to support Xcode 11 :) So we hardcode the raw value with macro.

For macOS, we can supports the NSImageView rendering with SDAnimatedImageRep as well.

Also, this PR changes one possible previouslly wrong design, now, the SDImageIOCoder as a default backup, does not check any format and always pass it to system and try to decode, no need hack for HEIC, or WebP.

Run result on iPhone Simulator with iOS 14:

image

@dreampiggy dreampiggy added WebP animated image ImageIO Anything related to Apple ImageIO codec labels Jul 3, 2020
@@ -112,7 +90,7 @@
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.carousel"
BundleIdentifier = "com.apple.Carousel"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This diff is caused by Xcode 12 update. And seems does not effect the user who use Xcode 11.

@dreampiggy
Copy link
Contributor Author

During test, seems Image/IO support does not supports encoding.

This is limited by Image/IO, hope future we can have built-in WebP encoding as well.

image

@dreampiggy
Copy link
Contributor Author

Fired Radar: FB7844481

image

@codecov
Copy link

codecov bot commented Jul 3, 2020

Codecov Report

Merging #3048 into master will decrease coverage by 0.26%.
The diff coverage is 39.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3048      +/-   ##
==========================================
- Coverage   83.51%   83.24%   -0.27%     
==========================================
  Files          69       70       +1     
  Lines        7589     7593       +4     
==========================================
- Hits         6338     6321      -17     
- Misses       1251     1272      +21     
Flag Coverage Δ
#ios 83.23% <40.84%> (-0.22%) ⬇️
#macos 83.29% <24.39%> (-0.20%) ⬇️
Impacted Files Coverage Δ
SDWebImage/Core/NSData+ImageContentType.m 79.09% <ø> (-0.19%) ⬇️
SDWebImage/Core/SDImageAWebPCoder.m 0.00% <0.00%> (ø)
SDWebImage/Core/SDAnimatedImageRep.m 80.51% <20.00%> (-9.04%) ⬇️
SDWebImage/Core/SDImageHEICCoder.m 81.13% <50.00%> (+1.33%) ⬆️
SDWebImage/Core/SDImageIOAnimatedCoder.m 85.74% <91.66%> (+0.35%) ⬆️
SDWebImage/Core/SDImageIOCoder.m 88.70% <100.00%> (-0.25%) ⬇️
...DWebImage/Private/SDImageIOAnimatedCoderInternal.h 100.00% <100.00%> (ø)
SDWebImage/Core/SDAnimatedImagePlayer.m 89.62% <0.00%> (+0.41%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f876da5...6fb20ce. Read the comment docs.

@dreampiggy dreampiggy added this to the 5.9.0 milestone Jul 3, 2020
@dreampiggy dreampiggy merged commit e7b8788 into SDWebImage:master Jul 15, 2020
@dreampiggy dreampiggy deleted the feature_webp_ios14 branch July 15, 2020 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
animated image ImageIO Anything related to Apple ImageIO codec WebP
Projects
None yet
2 participants