Closed pmsoftware78 closed 1 year ago
I probably has another 2 questions:
heif_colorspace_YCbCr
when heif_colorspace_undefined + heif_chroma_undefined passed to heif_decode_image
function?heif_chroma_444
even when I saved image with chroma=422
and open it after? (with heif_colorspace_undefined + heif_chroma_undefined)The reason that it always outputs images in 4:4:4 is that the image transformations are also handled in the library and there are a lot of corner cases. Like, the encoded image could be 4:2:2 and rotated by 90 degrees. Then, there is no chroma format that could describe this. Or it could be cropped by one pixel on the left side which would shift the 4:2:0 chroma samples (recent, this has been disallowed for images conforming to MIAF, but it is allowed for general HEIF).
Finally, output is always in RGB because the library also handles the nclx color profiles for you (different color conversion coefficients).
I plan to add low-level access, but then all of these things have to be handled on client side.
I am totally fine that there is only heif_chroma_444
and heif_chroma_monochrome
returned when I pass heif_chroma_undefined to heif_decode_image
.
Can I suggest that this behaviour will not change in future and write code according to this?
If you set it to chroma_undefined
, anything can happen. I do not want to restrict this in any way. If you want a specific chroma format, you have to specify this in heif_decode_image()
.
I understand your point that you do not know beforehand whether to use 444 or monochrome. But the solution to that will probably be that we add an API function to ask for the coded image chroma. How this will look like still needs some thoughts.
Thanks for clarifying
Looks like the question(s) got answered. Is anything more required on this?
Closing. Tracking the todo in a separate issue.
Not a real issue, but just curious to understand why in haif_context.cc (function decode_image_planar) the image is always converted to RGB
if (!alphaImage && target_colorspace == heif_colorspace_YCbCr) { target_colorspace = heif_colorspace_RGB; }
instead provide YUV + NCLX information. Thanks