diff mbox series

[FFmpeg-devel,RFC,v3,3/5] libavcodec/jpeg2000: Modify cleanup

Message ID 20200824174034.17837-3-gautamramk@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,RFC,v3,1/5] libavcodec/jpeg2000: Make tag tree functions non static
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Gautam Ramakrishnan Aug. 24, 2020, 5:40 p.m. UTC
From: Gautam Ramakrishnan <gautamramk@gmail.com>

This patch makes the ff_jpeg2000_cleanup
function take in an extra parameter which
indicates whether it is called from the
encoder or decoder.
---
 libavcodec/j2kenc.c      | 2 +-
 libavcodec/jpeg2000.c    | 2 +-
 libavcodec/jpeg2000.h    | 2 +-
 libavcodec/jpeg2000dec.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index d9777fe07f..8699296434 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1218,7 +1218,7 @@  static void cleanup(Jpeg2000EncoderContext *s)
     for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++){
         for (compno = 0; compno < s->ncomponents; compno++){
             Jpeg2000Component *comp = s->tile[tileno].comp + compno;
-            ff_jpeg2000_cleanup(comp, codsty);
+            ff_jpeg2000_cleanup(comp, codsty, 1);
         }
         av_freep(&s->tile[tileno].comp);
     }
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 3d3e7ec313..70c25a0ca2 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -580,7 +580,7 @@  void ff_jpeg2000_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
     }
 }
 
-void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
+void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty, int isencoder)
 {
     int reslevelno, bandno, precno;
     for (reslevelno = 0;
diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index ad58b1ae88..fee9607e86 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -272,7 +272,7 @@  int ff_jpeg2000_init_component(Jpeg2000Component *comp,
 
 void ff_jpeg2000_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty);
 
-void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty);
+void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty, int isencoder);
 
 static inline int needs_termination(int style, int passno) {
     if (style & JPEG2000_CBLK_BYPASS) {
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 624542c2f8..c5192d007f 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -2123,7 +2123,7 @@  static void jpeg2000_dec_cleanup(Jpeg2000DecoderContext *s)
                 Jpeg2000Component *comp     = s->tile[tileno].comp   + compno;
                 Jpeg2000CodingStyle *codsty = s->tile[tileno].codsty + compno;
 
-                ff_jpeg2000_cleanup(comp, codsty);
+                ff_jpeg2000_cleanup(comp, codsty, 0);
             }
             av_freep(&s->tile[tileno].comp);
             av_freep(&s->tile[tileno].packed_headers);