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

AVIF color grid without alpha grid looses alpha when decoded #1203

Closed
y-guyon opened this issue Nov 10, 2022 · 0 comments
Closed

AVIF color grid without alpha grid looses alpha when decoded #1203

y-guyon opened this issue Nov 10, 2022 · 0 comments

Comments

@y-guyon
Copy link
Collaborator

y-guyon commented Nov 10, 2022

This is an image encoded with avifenc --grid 1x2 (at cd03eef using ext/aom):

colorgrid_alphagrid avif
(extension is .jpg but it is an actual AVIF file)

The pattern is the following:

[primary item grid]
   ^       ^     ^
   |dimg   |dimg |
   |       |     |auxl
[color] [color]  |
                 |
   [alpha aux grid]
      ^       ^
      |dimg   |dimg
      |       |
   [alpha] [alpha]

Here is the same image manually edited to match the following pattern:

colorgrid_alpha_alpha avif

[primary item grid]
   ^       ^
   |dimg   |dimg
   |       |
[color] [color]
   ^       ^
   |auxl   |auxl
   |       |
[alpha] [alpha]

I did not find anything in ISOBMFF, HEIF and MIAF specifications regarding the invalidity of this pattern. Compliance Warden does not report more errors than for the image generated only with avifenc (even fewer errors actually because there is one less grid to complain about construction_method=-1 on a derived image item).

avifdec (at cd03eef using ext/aom) leads to the wrongly opaque following PNG:

colorgrid_alpha_alpha_libavif

There is the same issue with libheif: strukturag/libheif#708

0xC0000054 added a commit to 0xC0000054/pdn-avif that referenced this issue Nov 10, 2022
It is possible for a color image grid to associate the alpha images
with the individual grid items instead of using an alpha image grid.

Related to AOMediaCodec/libavif#1203
vigneshvg added a commit that referenced this issue May 17, 2023
Allows images of the following form to be decoded as images with
alpha channel (since the spec does not disallow these):

[primary item grid]
   ^       ^
   |dimg   |dimg
   |       |
[color] [color]
   ^       ^
   |auxl   |auxl
   |       |
[alpha] [alpha]

Fixes Issue #1203.

I have tested this commit with the image attached in issue #1203
and it decodes as intended with the alpha plane.
vigneshvg added a commit that referenced this issue May 22, 2023
Add a unit test to make sure that decoding the test file from
issue #1203 results in a decoded file with alpha channel.
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

2 participants