engine
engine copied to clipboard
WIP: Add Animated PNG demuxer
Adds a multiframe image decoder that demuxes APNG streams into regular PNG-compliant streams. The actual color decoding is done by Skia's existing PNG decoder.
A single lazy pass is performed over the full stream as the frames are decoded for the first time.
Resolves https://github.com/flutter/flutter/issues/37247.
At this point, we have pretty reasonable coverage of the spec. Both blending ops and 2/3 of the dispose ops are supported (APNG_DISPOSE_OP_PREVIOUS is the one that's missing at the moment). I think the vast majority of real world APNGs display correctly now.
https://user-images.githubusercontent.com/919017/153082672-de73c293-0d3a-40c0-ac88-9f348045c305.mov
Known issues:
- There's a multiframecodec bug where stopped animations always advance by 1 frame when off-screen images reappear.
- APNG_DISPOSE_OP_PREVIOUS behaves like APNG_DISPOSE_OP_BACKGROUND.
- Ancillary chunks that can possibly transform frame regions are ignored -- I think these cases are somewhat pathological in practice and so I consider it out of scope for now.
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.
@bdero So happy to hear that you are doing for APNG, and what is the progress now?
What's the status on this?
@bdero Is this still on your plate?
Yeah, this should be good to go as-is. Just need to swing around and add tests. The remaining validation TODOs aren't essential.
@bdero Super excited to see this come together! Is there anything else required besides a suite of tests to get this into the engine? I'd be more than willing to add tests once you're happy with the implementation
Closing this as stale and there are conflicts. Please re-open if progress can be made.
Gold has detected about 247 new digest(s) on patchset 12. View them at https://flutter-engine-gold.skia.org/cl/github/31098
I haven't added tests for this yet, but the implementation for this is ready for review.
Since the last time this was closed/reopened, Skia made the internal software rasterizing utilities private, so I had to reimplement this for frame compositing. Certain frame formats like greyscale textures are no longer supported because of that, but we can easily add those corner cases back in later.
Oh, and this also fixes https://github.com/flutter/flutter/issues/61150.
@bdero will this PR help to adress this feature?
Ping @jason-simmons
Ping @bdero. Think this is really close to landing.
Gonna rebase this today to get it over the line.
@jason-simmons I think you need to explicitly approve instead of adding an LGTM comment to make the presubs pass. I believe all the comments have been addressed. PTAL.
@bdero, this looks good to go. Can we land this? @toneyzeng has an open question though.