[FFmpeg-devel] [PATCH 3/5] avcodec: add max_samples

Michael Niedermayer michael at niedermayer.cc
Tue Sep 3 14:10:03 EEST 2019


On Tue, Sep 03, 2019 at 12:21:26PM +0200, Tomas Härdin wrote:
> tis 2019-09-03 klockan 09:20 +0200 skrev Paul B Mahol:
> > 
> > On 9/3/19, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > > TODO: APIChanges, bump version
> > > 
> > > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > > ---
> > >  libavcodec/avcodec.h                 | 8 ++++++++
> > >  libavcodec/options_table.h           | 1 +
> > >  tests/ref/fate/api-mjpeg-codec-param | 2 ++
> > >  tests/ref/fate/api-png-codec-param   | 2 ++
> > >  4 files changed, 13 insertions(+)
> > > 
> > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > index de4feb6a65..4b771a6ae6 100644
> > > --- a/libavcodec/avcodec.h
> > > +++ b/libavcodec/avcodec.h
> > > @@ -3371,6 +3371,14 @@ typedef struct AVCodecContext {
> > >       * - encoding: unused
> > >       */
> > >      int discard_damaged_percentage;
> > > +
> > > +    /**
> > > +     * The number of samples per frame to maximally accept.
> > > +     *
> > > +     * - decoding: set by user
> > > +     * - encoding: set by user
> > > +     */
> > > +    int64_t max_samples;
> > >  } AVCodecContext;
> > 
> > NAK, you can use max_pixels for the same cause.
> 
> Or the other way around. Has max_pixels made it to an official release
> yet? 

max_pixels is in AVCodecContext since 3.3

but even if it wasnt. while no question max_samples would be a much
better name for a unified field than max_pixels.

We do not unify other related fields like
width & height with for example nb_samples and channels

There is also a semantic difference between max_pixels and max_samples

the max_pixels are the samples at one instance of time
while max_samples cover a period of time depending on the duration of a packet

if ever a video codec had packets covering a period of time the same way
audio does (like maybe 0.5 seconds or 15 frames) we would not apply
max_pixels to the whole but to the 15 frames individually

So IMHO its possible to use the same field for both but it feels a
bit like bending 2 slightly different things onto each other.

But sure if people prefer it ill change the patches.


> Using it for samples is obviously confusing

yes

thanks


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190903/9d30d327/attachment.sig>


More information about the ffmpeg-devel mailing list