Skip to content

vpx: support decoding of alpha channels in some WebM/Matroska files

Steve Lhomme requested to merge robUx4/vlc:vp89-alpha into master

VP8/VP9 supports an alpha channel encoded as a separate bitstream. In WebM/Matroska each frame has an extra block that contains the matching alpha frame to decode. It's basically an VP8/VP9 bistream which just the Y plane usable (still outputting 4:2:0 planes).

This MR adds support for handling the WebM/Matroska parts, selecting a decoder for the alpha channel (via a pseudo decoder that combines the opaque and alpha parts with the same PTS).

The alpha bitstream is attached as ancillary data attached to the opaque block. The demuxer outputs a special ES that signals it's not a regular VP8/VP9 stream, that ES is handled by the pseudo-decoder. The alpha bitstream have a different ES fourcc as well since they are not guaranteed to be decoded by a regular VP8/VP9 decoder (at least lavc doesn't handle VP8 alpha bitstreams).

For now only software decoding is supported (HW decoding via libavcodec is coming next). The two I420 output are combined into a VLC_CODEC_YUV420A output.

There's also a new vpx-threads option to select the amount of threads per decoder (but it ends up being the same for the opaque and alpha channels).

Edited by Steve Lhomme

Merge request reports

Loading