Skip to content

Support libavif v0.60 and set proper color space as possible. #13

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

Merged

Conversation

ledyba-z
Copy link
Collaborator

@ledyba-z ledyba-z commented Mar 9, 2020

Hi.

In this PR, set proper color profile values to CGImage (if possible).

This PR and AOMediaCodec/libavif#98 may resolve #12 .

Please take a look!

@codecov
Copy link

codecov bot commented Mar 9, 2020

Codecov Report

Merging #13 into master will decrease coverage by 9.84%.
The diff coverage is 32.7%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
- Coverage   77.02%   67.17%   -9.85%     
==========================================
  Files           4        4              
  Lines        1014     1496     +482     
==========================================
+ Hits          781     1005     +224     
- Misses        233      491     +258
Impacted Files Coverage Δ
SDWebImageAVIFCoder/Classes/SDImageAVIFCoder.m 66.94% <32.7%> (-11.24%) ⬇️
Example/SDWebImageAVIFCoder/SDViewController.m 88.88% <0%> (+40.74%) ⬆️

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 ab2fde9...9da58e8. Read the comment docs.

return;
}

*ref = CreateColorSpaceRGB(colorPrimaries, transferCharacteristics);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the fallback case for CGColorSpace which does not supported ?

Copy link
Collaborator Author

@ledyba-z ledyba-z Mar 9, 2020

Choose a reason for hiding this comment

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

This branch is for when there is no corresponding built-in color space in CGColorSpace.h, like kCGColorSpaceSRGB. It creates new CGColorSpaceRef.
If there is better way to create color spaces, please tell me.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK. Seems we need to refactory soon....There are so many calc code and utils C function right now :). Don't need to do this right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK. I removed the code that creates CGColorSpace using vImage, and left a TODO comment about it.

Yeah, I also felt we need refactoring.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I mis-understand your message. I reverted 71ecfa1 .

@ledyba-z ledyba-z force-pushed the fix/set-correct-color-space-as-possible branch 2 times, most recently from 77fd1af to 4f6e324 Compare March 9, 2020 11:38
@dreampiggy
Copy link
Collaborator

😅 Seems you still trying some changes. If you find it's ready to merge, @ me again.

And, can CI test image been passed after this color space support changes ?

@ledyba-z
Copy link
Collaborator Author

ledyba-z commented Mar 9, 2020

@dreampiggy Sorry! I've done!

And, can CI test image been passed after this color space support changes ?

Unfortunatelly, AOMediaCodec/libavif#98 should also be merged to libavif, and we have to wait the new version release of libavif to fix CI tests.

@ledyba-z ledyba-z force-pushed the fix/set-correct-color-space-as-possible branch from 7d48bdc to 9da58e8 Compare March 13, 2020 02:10
@ledyba-z ledyba-z changed the title Set proper color space as possible. Support libavif v0.60 and set proper color space as possible. Mar 13, 2020
@ledyba-z
Copy link
Collaborator Author

@dreampiggy Hi! Now libavif v0.6.0 is supported, and all end-to-end tests (Github Actions) have finally passed!
Could you take a look?

Copy link
Collaborator

@dreampiggy dreampiggy left a comment

Choose a reason for hiding this comment

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

LGTM...Actually the color profile check code is OK and we can use test case to ensure the correctness

@dreampiggy dreampiggy merged commit adc8bdf into SDWebImage:master Mar 13, 2020
@ledyba-z
Copy link
Collaborator Author

Thank you!

@ledyba-z ledyba-z deleted the fix/set-correct-color-space-as-possible branch March 13, 2020 03:01
@ledyba-z ledyba-z mentioned this pull request Mar 13, 2020
@ledyba-z
Copy link
Collaborator Author

I tested the new alpha channel codes with plum-blossom-large.profile0.8bpc.yuv420.avif

iPhone 6

v0.5.2 : 2.0247561931610107 sec
master: 1.7678682804107666 sec

It runs faster about 13%

iPhone 8

v0.5.2: 0.7256550788879395 sec
master: 0.5414080619812012 sec

It runs faster about 25%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix end-to-end test(Github actions)
2 participants