[FFmpeg-devel] [PATCH] Make decoding alpha option for some codecs.
Michael Niedermayer
michaelni at gmx.at
Tue Sep 17 21:36:02 CEST 2013
On Tue, Sep 17, 2013 at 09:31:07PM +0200, Reimar Döffinger wrote:
> For codecs where decoding of a whole plane can simply
> be skipped, we should offer applications to not decode
> alpha for better performance.
> It also means applications do not need to implement support
> (even if it is rather simple) for YUVA formats in order to be
> able to play these files.
> Unfortunately a good way to test this via FFmpeg only is missing,
> suggestions welcome.
>
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
> libavcodec/ffv1dec.c | 15 ++++++++++++---
> libavcodec/proresdec2.c | 8 +++++++-
> libavcodec/proresdec_lgpl.c | 14 +++++++++++++-
> libavcodec/vp56.c | 12 ++++++++----
> 4 files changed, 40 insertions(+), 9 deletions(-)
>
> diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> index 5455660..75e26bc 100644
> --- a/libavcodec/ffv1dec.c
> +++ b/libavcodec/ffv1dec.c
> @@ -659,14 +659,23 @@ static int read_header(FFV1Context *f)
> return AVERROR(ENOSYS);
> }
> } else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency) {
> + static const enum AVPixelFormat alpha_fmts[][3] = {
> + {AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_NONE},
> + {AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE},
> + {AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE}
> + };
> switch(16*f->chroma_h_shift + f->chroma_v_shift) {
> - case 0x00: f->avctx->pix_fmt = AV_PIX_FMT_YUVA444P; break;
> - case 0x10: f->avctx->pix_fmt = AV_PIX_FMT_YUVA422P; break;
> - case 0x11: f->avctx->pix_fmt = AV_PIX_FMT_YUVA420P; break;
> + case 0x00: f->avctx->pix_fmt = f->avctx->get_format(f->avctx, alpha_fmts[0]); break;
> + case 0x10: f->avctx->pix_fmt = f->avctx->get_format(f->avctx, alpha_fmts[1]); break;
> + case 0x11: f->avctx->pix_fmt = f->avctx->get_format(f->avctx, alpha_fmts[2]); break;
> default:
> av_log(f->avctx, AV_LOG_ERROR, "format not supported\n");
> return AVERROR(ENOSYS);
> }
> + if (f->avctx->pix_fmt != AV_PIX_FMT_YUVA444P &&
> + f->avctx->pix_fmt != AV_PIX_FMT_YUVA422P &&
> + f->avctx->pix_fmt != AV_PIX_FMT_YUVA420P)
> + f->transparency = 0;
> } else if (f->avctx->bits_per_raw_sample == 9) {
> f->packed_at_lsb = 1;
> switch(16 * f->chroma_h_shift + f->chroma_v_shift) {
LGTM if tested
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130917/fcb1f88a/attachment.asc>
More information about the ffmpeg-devel
mailing list