-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
Default to chroma=444
/matrix_coefficients=0
in lossless mode
#1039
Conversation
And if encoding goes in YCbCr mode, why should be matrix_coefficients set to 0 automatically? |
d61b1da
to
d3cf7ae
Compare
chroma=444
/matrix_coefficients=0
in lossless modechroma=444
/matrix_coefficients=0
in lossless mode
I'm not entirely familiar with these pixel formats. The latest revision of this PR makes For reference, |
|
We have to differentiate two things here. From the codec side of view (h265 or av1), the codec can be switched to lossless no matter what input color space. I.e. we could have YCbCr 4:2:0 and encode that lossless from the view of the codec. That's what is switched on with the lossless flag(s) in This PR is mixing the two concepts. I would like to avoid this. However, I'm fine to redefine the parameters such that "-p lossless=true" is the codec setting, but "--lossless" is not a mere shortcut for that, but also sets chroma and matrix as noted at the bottom of the help:
However, that could be handled in the |
…rnative implementation to #1039)
I've implemented this differently in |
I've improved this further in 94c3b21. When the input is YCbCr, |
wow, that's really cool |
Thanks for the explanation! Indeed, this logic should probably not be included at library level. I'll abandon this PR in favor of the commits mentioned above. 👍 libvips always encodes in Note that Line 797 in 94c3b21
Since it's conditionally excluded here: Lines 845 to 846 in 94c3b21
Reproducer: # heif-enc
$ curl -LO https://wsrv.nl/transparency_demo.png
$ heif-enc -L transparency_demo.png -o x.avif
$ heif-convert x.avif output.png
File contains 1 image
Written to output.png
$ vips subtract transparency_demo.png output.png x.v
$ vips abs x.v x2.v
$ vips max x2.v
1.000000
# vips
# subsample_mode=off is not needed after PR https://github.com/libvips/libvips/pull/3760
$ vips copy transparency_demo.png x.avif[lossless,subsample_mode=off]
$ vips copy x.avif output.png
$ vips subtract transparency_demo.png output.png x.v
$ vips abs x.v x2.v
$ vips max x2.v
1.000000 |
@kleisauke Yes, the bug for RGB input is a regression from the second commit. Thanks for reporting this. Should be fixed now. |
Resolves: #62.