- Notifications
You must be signed in to change notification settings - Fork 15
use vImage framework to accelerate conversion from YUV to RGB(A) #7
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
use vImage framework to accelerate conversion from YUV to RGB(A) #7
Conversation
P.S. Monochrome images are also considered in this patch, however, libavif does not handle them correctly. I sent a pull request about this issue to libavif: |
Seems good... If the vImage can have a better performance, I'd like to replace that. |
Thank you! For example, there is no conversion API from 10bit/12bit YUV420 to RGB888. By the way, what should 10-bit/12-bit images be converted to?
How about converting them to 16bit RGB(A)? |
e889630
to ca147aa
Compare @dreampiggy Hi, I succeeded to support 10bit/12bit images.
10bit/12bit versions seems not strongly optimized than 8bit versions yet, but it makes about 5 times faster! By the way, test images in some format are not available at official repo:
So, I prepared some examples images by myself using cavif, so please use them to check: https://github.com/link-u/avif-sample-images Please take a look! |
I’ll test it soon. Thanks for your patient. I’m in China and on vacation in China’s lunar new year. If I have a time to check, I’ll merge and release a new version. |
Please merge the master branch again. I fixed the Travis-CI issue and support SwiftPM now. You can check whether this dev branch works on different compile case. (For example, SwiftPM/Carthage does not have dav1d or rav1e, always use libavif method and don’t directly use them) |
@ledyba-z libavif released new v0.5.4, does that fix the monochrome issue ? https://github.com/AOMediaCodec/libavif/blob/master/CHANGELOG.md |
@dreampiggy Thanks, please enjoy 春节! I merged master branch to this branch, so Circle CI will check it... |
Yeah, applied patch was the same I sent, so the monochrome issue shall be fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. I’ve already remove that bytesNormal
check. it’s time to merge now ? Anything else pending ?
@dreampiggy Thank you! |
@ledyba-z Hi. The 0.5.0 version is released, check: v0.5.0 changelog for details. Thanks for your support, you're actually the first contributor here, I've updated the Readme with this :) |
I'm decided to support thumbnail decoding for AVIF soon in v0.6.0 (mentioned in SDWebImage 5.5.0 new feature, which need each codec update to support). Like the similiar update to WebPCoder. If you have some better idea about this, please contact me, thanks. |
One possible issue I don't actually realized. The libavif 0.5.0 provide the API to grab the EXIF/XMP metadata (See AOMediaCodec/libavif#26). Does AVIF support EXIF orientation like JPEG ? If so, maybe we should update the code to provide a fix for the non-Up AVIF images. |
@dreampiggy Thank you, you are welcome!
MIAF, a file format for AVIF and HEIF, can hold thumbnail images (it's called However, there seems not to be any example files with thumbnails yet, and libavif might not support decoding thumbnail images yet.
YES, but it's not need to parse EXIF. AVIF supports orientation/mirroing/crop itself. And also, MIAF specifies that readers are not needed to parse exif metadata to rotate/mirror/crop (If you want to read other metadata, you still have to read exif). I prepared the test files, so please check our example files. Our encoder, cavif, and decoder, davif, supports those features. But libavif looks not support them at all. I will report an issue. |
Hi. I am working at Link-U, a company which publishes digital comics in Japan.
In this pull request, I added an optimized code path to speed up conversions from YUV to RGB(A) using vImage framework.
Unfortunately, it seems that vImage conversion API does not provide fully support for 10bit/12bit YUV image. Hence, in this patch, conversions from only 8bit YUV images are accelerated.
Benchmark result
All results are measured in iPhone 6, iOS 12.2.
Original version
Here is a branch with measuring code.
vImage version(this patch)
Here is a branch with measuring code.
This patch makes a conversion more than 24 times faster, in 8-bit image.
Please take a look!