diff mbox series

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

Message ID 20200825042007.18535-3-gautamramk@gmail.com
State New
Headers show
Series [FFmpeg-devel,RFC,v4,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. 25, 2020, 4:20 a.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(-)

Comments

Michael Niedermayer Aug. 25, 2020, 8:43 a.m. UTC | #1
On Tue, Aug 25, 2020 at 09:50:05AM +0530, gautamramk@gmail.com wrote:
> 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(-)

"Modify cleanup" is a bit generic as description

something like
"Pass is_encoder flag into the ff_jpeg2000_cleanup function."

is probably a better 1 line description

also you could probably use av_codec_is_encoder() instead

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 87acd2d5c9..711655f1d6 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1220,7 +1220,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);