[FFmpeg-devel] [PATCH] avcodec/avcodec: Document signed/unsignedness of sample formats in relation to bits_per_raw_sample

Michael Niedermayer michael at niedermayer.cc
Fri Apr 15 17:57:13 CEST 2016


On Fri, Apr 15, 2016 at 12:44:15PM +0200, wm4 wrote:
> On Fri, 15 Apr 2016 00:42:22 +0200
> Michael Niedermayer <michael at niedermayer.cc> wrote:
> 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavcodec/avcodec.h |    8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 9e6169f..e5ba9aa 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3850,8 +3850,12 @@ typedef struct AVCodecParameters {
> >       * sample format has more bits, the least significant bits are additional
> >       * padding bits, which are always 0. Use right shifts to reduce the sample
> >       * to its actual size. For example, audio formats with 24 bit samples will
> > -     * have bits_per_raw_sample set to 24, and format set to AV_SAMPLEFMT_S32.
> > -     * To get the original sample use "(uint32_t)sample >> 8"."
> > +     * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
> > +     * To get the original sample use "(int32_t)sample >> 8"."
> 
> OK. AFAIK this isn't UB, but implementation defined. But probably fine.

applied


> 
> > +     *
> > +     * Sample formats that contain a S(num) like AV_SAMPLE_FMT_S32 use signed
> > +     * integers, formats that contain a U(num) like AV_SAMPLE_FMT_U8 use unsigned
> > +     * integers.
> 
> Hm, I don't think that needs to be mentioned here. U8 is the only
> unsigned format too. And the doxygen for AVSampleFormat is quite clear.

removed

thx

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad
-------------- 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/20160415/e16ec154/attachment.sig>


More information about the ffmpeg-devel mailing list