[FFmpeg-devel] [PATCH] avcodec: Add bits_per_raw_sample to AVCodecParameters

Michael Niedermayer michael at niedermayer.cc
Mon Apr 11 03:12:20 CEST 2016


On Sun, Apr 10, 2016 at 11:39:57PM +0000, Kieran Kunhya wrote:
> On Mon, 11 Apr 2016 at 00:33 Michael Niedermayer <michael at niedermayer.cc>
> wrote:
> 
> > The bits_per_raw_sample represents the number of bits of precission per
> > sample.
> >
> > The field is added at the logical place, not at the end as the code was
> > just
> > recently added
> >
> > This fixes the regression about loosing the audio sample precission
> > information
> >
> > The change in the fate test checksum un-does the change from the merge
> >
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/avcodec.h |   17 +++++++++++++++++
> >  libavcodec/utils.c   |    2 ++
> >  tests/ref/lavf/ffm   |    2 +-
> >  3 files changed, 20 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index b3655c5..87739d7 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3832,9 +3832,26 @@ typedef struct AVCodecParameters {
> >       */
> >      int64_t bit_rate;
> >
> > +    /**
> > +     * The number of bits per sample in the codedwords.
> > +     *
> > +     * This is basically the bitrate per sample
> > +     *
> > +     * This could be for example 4 for ADPCM
> > +     * For PCM formats this matches bits_per_raw_sample
> > +     * Can be 0
> > +     */
> >      int bits_per_coded_sample;
> >
> >      /**
> > +     * The number of bits of precission in the samples.
> > +     *
> > +     * For ADPCM this might be 12 or 16 or similar
> > +     * Can be 0
> > +     */
> > +    int bits_per_raw_sample;
> >
> >
> Precision spelt wrong. Also needs more clarification as to the difference
> between the two

on one side of a bitstream format there is raw pcm data (raw samples)
and on the other a compressed bitstream (aka coded samples)
these 2 where intended to specify the number of bits per sample in
these 2 representations

i really dont know how to word this so that its clear and everyone
understands it


> - I have no idea what the difference is or why one would
> use bits_per_coded_sample for anything.

bits_per_coded_sample is used by several codecs (huffyuv, ima adpcm,
...) in avi as a single byte extradata. so it must be transported from
the demuxer (avi headers) to the decoder and encoder to muxer
to make this worse, in some of these codecs it matches the
bits_per_raw_sample, in some it does not


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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- 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/20160411/6df74203/attachment.sig>


More information about the ffmpeg-devel mailing list