AVIF files should support alpha/transparency
Categories
(Core :: Graphics: ImageLib, defect, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox86 | --- | fixed |
People
(Reporter: TD-Linux, Assigned: chunmin)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
The attached AVIF should be transparent in the same places as the attached PNG.
Reporter | ||
Comment 1•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
•
|
||
To-do tasks for prototype:
- [x] Expose
alpha_item
andpremultiplied_alpha
- [x] Decode alpha plane with Dav1d (draft here)
- [x] Decode alpha plane with AOM
- We plan to delete the AOM decoder in the future so no worry to implement this.
- [x] Decode the primary item with the alpha item
- Decode relies on
gfx::ConvertYCbCrAToARGB
, which is a wrapper callinglibyuv
- But it only works if the image format is
I420
. It's just a wrapper callinglibyuv::I420AlphaToARGB
- For other formats, the plan is to convert the YCbCr to ARGB first then inject the alpha data manually. (draft here)
- Decode relies on
- [ ] Create/Update test page
- [x] for
I420
layout: https://jsfiddle.net/2q5excm4/ - [x] for
I444
layout: https://jsfiddle.net/f13p2dLu/ - [ ] Test for
I422
layout
- [x] for
Assignee | ||
Comment 3•3 years ago
|
||
This imports the change of https://github.com/mozilla/mp4parse-rust/pull/258
Once the above PR is merged in the upstream, it will be landed in the
gecko in a different bug maybe.
Assignee | ||
Comment 4•3 years ago
|
||
This patch implements the transparency support for AVIF image files, if
the decoder preference is Dav1d. We have a plan to drop AOM decoder in
the future so this patch doesn't implement the alpha support for AOM
decoder. An side-benefit is that we can flip the decoder preference to
see the images before and after blending the alpha data.
This patch creates a function to convert the decoded YCbCr and Alpha
data to RGBA by using the existing ConvertYCbCrToRGB function to convert
the YCbCr data into RGB data first and then insert the Alpha data to the
RGBA buffer, if the layout of the decode YCbCr data is not I420. If the
layout is I420, the YCbCr and Alpha data can be converted by using the
libyuv::I420AlphaToARGB directly. (To see the image that calls the
ConvertYCbCrToRGB only, you can set the decoder to AOM.)
On the other hand, this patch refactors the nsAVIFDecoder a bit to make
the lifetime of the parsed data and decoded image data clearer. They
won't live longer than Parser object and {Dav1d, AOM}Decoder object.
This should improve the code readability.
Depends on D98950
Comment 5•3 years ago
|
||
Comment on attachment 9191691 [details]
Bug 1654462 - Import mp4parse c api to get alpha item
Revision D98950 was moved to bug 1681811. Setting attachment 9191691 [details] to obsolete.
Pushed by cchang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c1478d03a451 Add alpha support in nsAVIFDecoder r=jbauman
Comment 7•3 years ago
|
||
bugherder |
Description
•