[FFmpeg-devel] [PATCH]Save properties of the decoded stream

Michael Niedermayer michael at niedermayer.cc
Thu Jul 16 15:33:31 CEST 2015


On Thu, Jul 16, 2015 at 12:54:24PM +0200, wm4 wrote:
[...]
> > diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> > index 723a847..8caa6a2 100644
> > --- a/libavcodec/webp.c
> > +++ b/libavcodec/webp.c
> > @@ -1417,6 +1417,7 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
> >                                                  chunk_size, 0);
> >                  if (ret < 0)
> >                      return ret;
> > +                avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
> >              }
> >              bytestream2_skip(&gb, chunk_size);
> >              break;
> 
> The lossless mode can apparently change mid-stream, so it should NOT be
> an AVCodecContext field. Use per-frame side-data instead.

"everything" can change mid stream, this field is not about if a frame
is lossless or even if the whole file is guranteed to be lossless
(for such gurantee the whole file would need to be parsed which is
 not practical for gathering some secondary bit of information about a
 stream)

This field is simply to indicate if a stream appears to be lossless
based on parsing headers or the first keyframe.
So it is a property of the stream or decoder instance, similar to
the width, height, format, sample rate, bit rate, ... fields in
AVCodecContext are properties of a stream or codec instance even
though they too could and do change per frame.

What could be done, and maybe thats what you meant is to use side data
or IMHO better a flag or specific quality value of the existing
quality field from AVFrame, to communicate the lossless nature
of a frame. That per frame information could then be used by the core
to set the per stream information aka  avctx->properties
this is more complex but would make the per frame lossless-ness
information available to user applications

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150716/1ada7229/attachment.sig>


More information about the ffmpeg-devel mailing list