Comments (8)
Thank you for the bug report. See #1421 for an open entry about the issue: avifdec
now writes CICP metadata (here 9/16/9) to PNG as a cHRM chunk, but JPEG does not support that.
The AVIF file has no ICC color profile by the way but I tried stuffing ITUR_2100_PQ_FULL.ICC into the output JPG using avifdec input.avif --icc colorprofile.icc output.jpg
(requires #2042):
It does not seem to be the correct ICC but it could be a working approach.
from libavif.
Btw, if
-d
is not specified, willavifdec
correctly choose PNG bit depth depending on input?
Yes.
from libavif.
Even if --icc
is not specified I still expect avifdec.exe input.avif output.jpg
to create an SDR JPG image looking close to the original.
One more alternative approach/idea: If input is HDR => Use JPEG XL jpegli to encode to JPEG with XYB colorspace, which supports HDR.
from libavif.
Even if
--icc
is not specified I still expectavifdec.exe input.avif output.jpg
to create an SDR JPG image looking close to the original.
Unfortunately libavif cannot handle all format and color space combinations, with workarounds for every situation. Detecting special cases such as common CICP combinations and outputting a matching ICC profile in JPG seems doable though.
If this is impossible for various reasons, or in the meantime, would an error or warning in avifdec
console output be better?
Have you tried other conversion tools than avifdec
for going from AVIF to JPG? Maybe there is some acceptable behavior we could match.
One more alternative approach/idea: If input is HDR => Use JPEG XL jpegli to encode to JPEG with XYB colorspace, which supports HDR.
So the input AVIF file would be in XYB colorspace?
If so, why not directly embed an HDR PQ ICC profile in the input AVIF file? It would be forwarded to the output JPG by avifdec
.
from libavif.
Error if input has CICP and output is set to JPG until this might get fixed in the future makes sense.
I'm no image expert, I might've gotten the XYB part of jpegli wrong.
I don't know of other tools that handle this scenario, no.
from libavif.
If so, why not directly embed an HDR PQ ICC profile in the input AVIF file? It would be forwarded to the output JPG by
avifdec
.
This not a good idea for 8-bit encoding like JPEG (I guess until, and if avifdec decides to support 12-bit JPEG as well).
IMHO, I think it should be enough detect anything other than sRGB/Rec709 (as either CICP or ICC), and throw a warning in the console that the image cannot really be preserved in a JPEG (or any other 8-bit container), unless the input was 8-bit to begin with of course.
I still expect avifdec.exe input.avif output.jpg to create an SDR JPG image looking close to the original.
Gamut and tone mapping should be left to a different abstraction level/library, as there are a few compromises and creative choices to be made there, it's not really a job of the codec library IMHO.
from libavif.
Btw, if -d
is not specified, will avifdec
correctly choose PNG bit depth depending on input?
from libavif.
Gamut and tone mapping should be left to a different abstraction level/library, as there are a few compromises and creative choices to be made there, it's not really a job of the codec library IMHO.
Completely agree. libavif could add the ITU-R recommended way of tone mapping from HDR to SDR as a convenience, but it doesn't necessarily produce great results.
from libavif.
Related Issues (20)
- How to build a dynamic library that statically links all dependencies? HOT 1
- Ignore and skip FullBoxes with an unrecognized version
- How to build the.A use of iOS platform? HOT 2
- Make libyuv package-friendly dependency HOT 2
- Roll YCgCo-R out HOT 1
- Add Homebrew install instructions and avifdec/avifenc examples to README HOT 6
- autoconf etc. HOT 1
- avifImageRGBToYUV should set color space to default values HOT 2
- Findrav1e.cmake ignores library dependencies listed in the generated pkgconfig file HOT 5
- [Function Request] avifenc supports svt and rav1e encoder options key-value HOT 2
- MSYS/MinGW32: Linking error, undefined references to Nt file functions HOT 2
- Noticeable color shift HOT 6
- Does CVE-2024-1580 affect libavif with dav1d decoder? HOT 1
- Static build issues on MSYS2 HOT 4
- sharpyuv conversion failed HOT 2
- libavif.a should not be a combined archive library HOT 6
- Not able to build static build on amazon linux 2023 HOT 9
- GIF encodes with wrong frame rate HOT 14
- Avif-alpha is working as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libavif.