[FFmpeg-devel] libavcodec/hapdec : add support for HapAphaOnly decoding

Martin Vignali martin.vignali at gmail.com
Wed Sep 27 13:59:57 EEST 2017

> > +        ctx->tex_fun = ctx->dxtc.rgtc1u_block;
> > +        avctx->pix_fmt = AV_PIX_FMT_RGB0;
> The rgtc1u_block function places the single channel value in every channel
> except the alpha channel
> The pixel format you have chosen is one which disregards the alpha channel
> The output of this alpha-only decoder should be in the alpha channel of a
> pixel format which carries alpha. Probably other channels should have zero
> values.
Hi Tom,

After Carl answer, and thinking about that,
The goal of HapAlphaOnly, is to store alpha, but can also store gray only
(much better than HAP)
In fact, it can be call HAP Gray !
For example from my part, i would like to use this codec, for matte, but
also for gray only layer (use with color blending)

So i think, the best way to manage that, in the decoding and the encoding
part, is to
output GRAY8 in decoding
and encode from GRAY 8 only.

This approach is also more consistent, with other gray only
decoding/encoding of images files (like in tga, png, sgi...)

(For a future support of HAPQA encoding, the RGTC1 texture, will be use for
alpha, but we can consider that as a special case of rgtc1 encoding)

If a user want to compress a gray picture, it can be done using RGB to Gray
And if user want to compress only alpha or a specific channel, i think
ffmpeg have a filter for that (extractplanes (untested)),
so several encoding option, can be done, with simple command line, and can
adapt for several cases.


More information about the ffmpeg-devel mailing list