Skip to content
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

Chroma downsampling and upsampling algorithms dont't work with heif_chroma_422 #936

Closed
homm opened this issue Jul 28, 2023 · 8 comments
Closed

Comments

@homm
Copy link
Contributor

homm commented Jul 28, 2023

Expected

heif_chroma_422 is one of the downsampling options for RGBYCbCr conversion. Like heif_chroma_420, it also removes data from CbCr channels. So there are should be a way to enable the average downsampling and upsampling.

Actual result

$ heif-enc ./cat.png -o ./cat.ss1.avg.avif -q 89 -p chroma=422 -p speed=6 -C average
Could not encode HEIF/AVIF file: Unsupported feature: Unsupported color conversion

Additional

Combining with #935 this leads to that there is no way to decode the image with bilinear algorithm. If you set only_use_preferred_chroma_algorithm, it will breaks on heif_chroma_422 images and there is not way to find actual subsampling of the image before calling heif_decode_image, just as there is no way to set preferred_chroma_downsampling_algorithm after calling heif_decode_image. If you woudn't set only_use_preferred_chroma_algorithm, the preferred_chroma_downsampling_algorithm will be ignored.

@homm
Copy link
Contributor Author

homm commented Oct 11, 2023

@farindk Are you aware of the problem? Does it seem meaningful to you?

@farindk
Copy link
Contributor

farindk commented Oct 11, 2023

Yes, we don't have a 4:2:2 to 4:4:4 bilinear upsampling algorithm implemented. I thought that was low priority because 4:2:2 is basically never used for images. It was meant for interlaced video, but is pretty useless for still images.

Usually only_use_preferred_chroma_algorithm=false should be the safe option to use. I'll have a closer look at #935 whether there is a problem when choosing the upsampling algorithm.

I could add a 4:2:2 to 4:4:4 bilinear implementation, just in case.

@homm
Copy link
Contributor Author

homm commented Oct 11, 2023

I thought that was low priority because 4:2:2 is basically never used for images.

Why do you think so? It reduces amount of data a lot with moderate impact on visual quality. We use it for most our saved images.

@farindk
Copy link
Contributor

farindk commented Oct 11, 2023

Seems that we need a 4:2:2 to 4:4:4 implementation to be able to set use only_use_preferred_chroma_algorithm=true. I'll add that.

@farindk
Copy link
Contributor

farindk commented Oct 11, 2023

Please also check that these conversions work as expected. Especially at the image borders and images with odd width.
These are special cases.

@homm
Copy link
Contributor Author

homm commented Oct 11, 2023

@farindk Thanks! I will try to do this within the day

@shaiksuhel1999
Copy link

@farindk is gpu hardware accelerators supports for chroma subsampling 422 files?

@farindk
Copy link
Contributor

farindk commented Dec 4, 2023

@farindk is gpu hardware accelerators supports for chroma subsampling 422 files?

No. There is no GPU acceleration for any chroma format yet.

@farindk farindk closed this as completed Dec 4, 2023
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

No branches or pull requests

3 participants