[FFmpeg-cvslog] j2k: remove cblk from band

Michael Niedermayer git at videolan.org
Mon May 27 15:21:57 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon May 27 14:55:46 2013 +0200| [a05db52c12f08463005cce4c13c86edd51f21fa3] | committer: Michael Niedermayer

j2k: remove cblk from band

cblk is now in the same place as in jpeg2000, which will simplify
merging the 2 decoders

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a05db52c12f08463005cce4c13c86edd51f21fa3
---

 libavcodec/j2k.c |   25 +++++++++----------------
 libavcodec/j2k.h |    1 -
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c
index ba7a8e5..f93a99d 100644
--- a/libavcodec/j2k.c
+++ b/libavcodec/j2k.c
@@ -306,11 +306,6 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
             band->cblknx = ff_jpeg2000_ceildiv(band->cblknx, dx);
             band->cblkny = ff_jpeg2000_ceildiv(band->cblkny, dy);
 
-            band->cblk = av_malloc_array(band->cblknx *
-                                         band->cblkny,
-                                         sizeof(*band->cblk));
-            if (!band->cblk)
-                return AVERROR(ENOMEM);
             band->prec = av_malloc_array(reslevel->num_precincts_x *
                                          reslevel->num_precincts_y,
                                          sizeof(*band->prec));
@@ -399,11 +394,9 @@ int ff_j2k_init_component(Jpeg2000Component *comp,
                 if (!prec->zerobits)
                     return AVERROR(ENOMEM);
 
-//                 prec->cblk = av_malloc_array(prec->nb_codeblocks_width *
-//                                              prec->nb_codeblocks_height,
-//                                              sizeof(*prec->cblk));
-                prec->cblk = band->cblk;
-                av_assert0(nb_precincts == 1);
+                prec->cblk = av_malloc_array(prec->nb_codeblocks_width *
+                                             prec->nb_codeblocks_height,
+                                             sizeof(*prec->cblk));
                 if (!prec->cblk)
                     return AVERROR(ENOMEM);
                 for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
@@ -461,11 +454,11 @@ void ff_j2k_reinit(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
                 Jpeg2000Prec *prec = band->prec + precno;
                 tag_tree_zero(prec->zerobits, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
                 tag_tree_zero(prec->cblkincl, prec->xi1 - prec->xi0, prec->yi1 - prec->yi0);
-            }
-            for (cblkno = 0; cblkno < band->cblknx * band->cblkny; cblkno++) {
-                Jpeg2000Cblk *cblk = band->cblk + cblkno;
-                cblk->length = 0;
-                cblk->lblock = 3;
+                for (cblkno = 0; cblkno < prec->nb_codeblocks_width * prec->nb_codeblocks_height; cblkno++) {
+                    Jpeg2000Cblk *cblk = prec->cblk + cblkno;
+                    cblk->length = 0;
+                    cblk->lblock = 3;
+                }
             }
         }
     }
@@ -483,8 +476,8 @@ void ff_j2k_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty)
                     Jpeg2000Prec *prec = band->prec + precno;
                     av_freep(&prec->zerobits);
                     av_freep(&prec->cblkincl);
+                    av_freep(&prec->cblk);
                 }
-                av_freep(&band->cblk);
                 av_freep(&band->prec);
             }
         av_freep(&reslevel->band);
diff --git a/libavcodec/j2k.h b/libavcodec/j2k.h
index 16cc6b0..4748e36 100644
--- a/libavcodec/j2k.h
+++ b/libavcodec/j2k.h
@@ -182,7 +182,6 @@ typedef struct Jpeg2000Band {
     uint16_t cblknx, cblkny;
     uint32_t stepsize; // quantization stepsize (* 2^13)
     Jpeg2000Prec *prec;
-    Jpeg2000Cblk *cblk;
 } Jpeg2000Band; // subband
 
 typedef struct Jpeg2000ResLevel {



More information about the ffmpeg-cvslog mailing list