[FFmpeg-cvslog] avcodec/jpeg2000dec: Free lengthinc earlier
Michael Niedermayer
git at videolan.org
Thu Dec 21 21:25:37 EET 2017
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Dec 17 23:35:26 2017 +0100| [80344959f064c7ea10d023862e0f6b79835de9de] | committer: Michael Niedermayer
avcodec/jpeg2000dec: Free lengthinc earlier
Reduces memory needed
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80344959f064c7ea10d023862e0f6b79835de9de
---
libavcodec/jpeg2000dec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 617273b36b..8071dc3c84 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1046,6 +1046,8 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
nb_code_blocks = prec->nb_codeblocks_height * prec->nb_codeblocks_width;
for (cblkno = 0; cblkno < nb_code_blocks; cblkno++) {
Jpeg2000Cblk *cblk = prec->cblk + cblkno;
+ if (!cblk->nb_terminationsinc && !cblk->lengthinc)
+ continue;
for (cwsno = 0; cwsno < cblk->nb_lengthinc; cwsno ++) {
if (cblk->data_allocated < cblk->length + cblk->lengthinc[cwsno] + 4) {
size_t new_size = FFMAX(2*cblk->data_allocated, cblk->length + cblk->lengthinc[cwsno] + 4);
@@ -1075,6 +1077,7 @@ static int jpeg2000_decode_packet(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
cblk->data_start[cblk->nb_terminations] = cblk->length;
}
}
+ av_freep(&cblk->lengthinc);
}
}
return 0;
More information about the ffmpeg-cvslog
mailing list