engine icon indicating copy to clipboard operation
engine copied to clipboard

WIP: Add Animated PNG demuxer

Open bdero opened this issue 3 years ago • 7 comments

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.

bdero avatar Jan 27 '22 00:01 bdero

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

(Tests are this and this)

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.

bdero avatar Feb 08 '22 22:02 bdero

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.

flutter-dashboard[bot] avatar Mar 09 '22 20:03 flutter-dashboard[bot]

@bdero So happy to hear that you are doing for APNG, and what is the progress now?

toneyzeng avatar Mar 31 '22 06:03 toneyzeng

What's the status on this?

sveinbjornt avatar May 04 '22 19:05 sveinbjornt

@bdero Is this still on your plate?

chinmaygarde avatar May 19 '22 20:05 chinmaygarde

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 avatar May 24 '22 17:05 bdero

@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

everskies avatar Jul 26 '22 09:07 everskies

Closing this as stale and there are conflicts. Please re-open if progress can be made.

chinmaygarde avatar Oct 06 '22 20:10 chinmaygarde

Gold has detected about 247 new digest(s) on patchset 12. View them at https://flutter-engine-gold.skia.org/cl/github/31098

skia-gold avatar Oct 30 '22 05:10 skia-gold

I haven't added tests for this yet, but the implementation for this is ready for review.

bdero avatar Dec 01 '22 21:12 bdero

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.

bdero avatar Dec 01 '22 21:12 bdero

Oh, and this also fixes https://github.com/flutter/flutter/issues/61150.

bdero avatar Dec 01 '22 21:12 bdero

@bdero will this PR help to adress this feature?

eximius313 avatar Dec 30 '22 23:12 eximius313

Ping @jason-simmons

chinmaygarde avatar Jan 05 '23 21:01 chinmaygarde

Ping @bdero. Think this is really close to landing.

chinmaygarde avatar Jan 19 '23 21:01 chinmaygarde

Gonna rebase this today to get it over the line.

bdero avatar Jan 26 '23 20:01 bdero

@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.

chinmaygarde avatar Feb 04 '23 00:02 chinmaygarde

@bdero, this looks good to go. Can we land this? @toneyzeng has an open question though.

chinmaygarde avatar Feb 09 '23 21:02 chinmaygarde