Message ID | 20220911142721.30812-1-michael@niedermayer.cc |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/5] avformat/mxfdec: Avoid some redundant writing to tables in mxf_compute_ptses_fake_index() | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
sön 2022-09-11 klockan 16:27 +0200 skrev Michael Niedermayer: > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavformat/mxfdec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > index e63e803aa56..4ceb6cf672f 100644 > --- a/libavformat/mxfdec.c > +++ b/libavformat/mxfdec.c > @@ -1939,10 +1939,10 @@ static int > mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta > if (index_table->nb_ptses <= 0) > return 0; > > - if (!(index_table->ptses = av_calloc(index_table->nb_ptses, > sizeof(int64_t))) || > + if (!(index_table->ptses = av_malloc_array(index_table- > >nb_ptses, sizeof(int64_t))) || > !(index_table->fake_index = av_calloc(index_table->nb_ptses, > sizeof(AVIndexEntry))) || > !(index_table->offsets = av_calloc(index_table->nb_ptses, > sizeof(int8_t))) || > - !(flags = av_calloc(index_table->nb_ptses, > sizeof(uint8_t)))) { > + !(flags = av_malloc_array(index_table- > >nb_ptses, sizeof(uint8_t)))) { Looks OK. Seems like the same thing can be done with offsets /Tomas
On Tue, Sep 20, 2022 at 01:12:44PM +0200, Tomas Härdin wrote: > sön 2022-09-11 klockan 16:27 +0200 skrev Michael Niedermayer: > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavformat/mxfdec.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > > index e63e803aa56..4ceb6cf672f 100644 > > --- a/libavformat/mxfdec.c > > +++ b/libavformat/mxfdec.c > > @@ -1939,10 +1939,10 @@ static int > > mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta > > if (index_table->nb_ptses <= 0) > > return 0; > > > > - if (!(index_table->ptses = av_calloc(index_table->nb_ptses, > > sizeof(int64_t))) || > > + if (!(index_table->ptses = av_malloc_array(index_table- > > >nb_ptses, sizeof(int64_t))) || > > !(index_table->fake_index = av_calloc(index_table->nb_ptses, > > sizeof(AVIndexEntry))) || > > !(index_table->offsets = av_calloc(index_table->nb_ptses, > > sizeof(int8_t))) || > > - !(flags = av_calloc(index_table->nb_ptses, > > sizeof(uint8_t)))) { > > + !(flags = av_malloc_array(index_table- > > >nb_ptses, sizeof(uint8_t)))) { > > Looks OK. Seems like the same thing can be done with offsets willl apply with offsets too thx [...]
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index e63e803aa56..4ceb6cf672f 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1939,10 +1939,10 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta if (index_table->nb_ptses <= 0) return 0; - if (!(index_table->ptses = av_calloc(index_table->nb_ptses, sizeof(int64_t))) || + if (!(index_table->ptses = av_malloc_array(index_table->nb_ptses, sizeof(int64_t))) || !(index_table->fake_index = av_calloc(index_table->nb_ptses, sizeof(AVIndexEntry))) || !(index_table->offsets = av_calloc(index_table->nb_ptses, sizeof(int8_t))) || - !(flags = av_calloc(index_table->nb_ptses, sizeof(uint8_t)))) { + !(flags = av_malloc_array(index_table->nb_ptses, sizeof(uint8_t)))) { av_freep(&index_table->ptses); av_freep(&index_table->fake_index); av_freep(&index_table->offsets);
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/mxfdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)