diff mbox series

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

Message ID 20200819122102.5584-3-gautamramk@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,RFC,1/4] 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. 19, 2020, 12:21 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(-)

Comments

Moritz Barsnick Aug. 20, 2020, 9:32 a.m. UTC | #1
On Wed, Aug 19, 2020 at 17:51:01 +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.

I fail to see an explanation why, ...

> -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

... and what it does with this change. Looks like an NOP from the patch
file alone.

Moritz
Gautam Ramakrishnan Aug. 20, 2020, 2:32 p.m. UTC | #2
On Thu, Aug 20, 2020 at 3:02 PM Moritz Barsnick <barsnick@gmx.net> wrote:
>
> On Wed, Aug 19, 2020 at 17:51:01 +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.
>
> I fail to see an explanation why, ...
>
> > -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
>
> ... and what it does with this change. Looks like an NOP from the patch
> file alone.
It was done to provide functionality for the next patch in the series.
>
> Moritz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Moritz Barsnick Aug. 20, 2020, 4:21 p.m. UTC | #3
On Thu, Aug 20, 2020 at 20:02:32 +0530, Gautam Ramakrishnan wrote:
> On Thu, Aug 20, 2020 at 3:02 PM Moritz Barsnick <barsnick@gmx.net> wrote:
> > ... and what it does with this change. Looks like an NOP from the patch
> > file alone.
> It was done to provide functionality for the next patch in the series.

I then suggest squashing it with the next patch. Perhaps someone else
can comment.

Moritz
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);