[FFmpeg-devel] [PATCH] Make decoding alpha optional for some codecs.
Michael Niedermayer
michaelni at gmx.at
Wed Sep 18 22:40:55 CEST 2013
On Wed, Sep 18, 2013 at 07:36:55PM +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 (ca. 30% less CPU usage
> and 40% reduced memory bandwidth).
> 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.
> Tested by manually hacking avcodec_default_get_format,
> suggestions for how to test in FATE welcome.
>
> Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> ---
> Changelog | 2 +
> libavcodec/avcodec.h | 1 +
> libavcodec/ffv1dec.c | 1 +
> libavcodec/options_table.h | 1 +
> libavcodec/proresdec2.c | 1 +
> libavcodec/proresdec_lgpl.c | 3 +-
> libavcodec/vp56.c | 7 +--
> tests/fate/prores.mak | 4 ++
> tests/fate/vpx.mak | 3 ++
> tests/ref/fate/prores-alpha_skip | 3 ++
> tests/ref/fate/prores-transparency_skip | 5 ++
> tests/ref/fate/vp6a-skip_alpha | 94 +++++++++++++++++++++++++++++++++
> 12 files changed, 121 insertions(+), 4 deletions(-)
> create mode 100644 tests/ref/fate/prores-alpha_skip
> create mode 100644 tests/ref/fate/prores-transparency_skip
> create mode 100644 tests/ref/fate/vp6a-skip_alpha
>
> diff --git a/Changelog b/Changelog
> index 3e4653b..4ffbc5a 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -25,6 +25,8 @@ version <next>
> more consistent with other muxers.
> - adelay filter
> - pullup filter ported from libmpcodecs
> +- make decoding alpha optional for prores, ffv1 and vp6 by setting
> + the skip_alpha flag.
>
>
> version 2.0:
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 23fba4f..505283b 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -720,6 +720,7 @@ typedef struct RcOverride{
>
> #define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries.
> #define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe
> +#define CODEC_FLAG2_SKIP_ALPHA 0x00800000 ///< Skip processing alpha if supported by codec
I suggest to use a field (int or whatever) in the context instead
of a flag. It reduces the chance of conflicts with additions from
forks
[...]
Thanks
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20130918/342243ff/attachment.asc>
More information about the ffmpeg-devel
mailing list