about summary refs log tree commit diff
path: root/converter/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-11-06 22:54:15 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-11-06 22:54:15 +0000
commit67718b8cac27fb7da636239095dc87ed91cfbd3d (patch)
treed63379436fe5ece404fe41e5d4d83fd416aee6df /converter/other
parent23b0070607384cab19f8a0f80af1f85d3b031c3d (diff)
downloadnetpbm-mirror-67718b8cac27fb7da636239095dc87ed91cfbd3d.tar.gz
netpbm-mirror-67718b8cac27fb7da636239095dc87ed91cfbd3d.tar.xz
netpbm-mirror-67718b8cac27fb7da636239095dc87ed91cfbd3d.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4461 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other')
-rw-r--r--converter/other/jpeg2000/libjasper/jpc/jpc_t1enc.c54
1 files changed, 25 insertions, 29 deletions
diff --git a/converter/other/jpeg2000/libjasper/jpc/jpc_t1enc.c b/converter/other/jpeg2000/libjasper/jpc/jpc_t1enc.c
index 2735a94a..34b9738c 100644
--- a/converter/other/jpeg2000/libjasper/jpc/jpc_t1enc.c
+++ b/converter/other/jpeg2000/libjasper/jpc/jpc_t1enc.c
@@ -156,49 +156,44 @@ static int jpc_encrawrefpass(jpc_bitstream_t *out, int bitpos, int,
 \*****************************************************************************/
 
 static void
-encodeBlocksOfPrc(jpc_enc_prc_t *   const prcP,
-                  jpc_enc_band_t *  const bandP,
-                  jpc_enc_tcmpt_t * const tcmptP,
-                  jpc_enc_t *       const encoderP,
-                  const char **     const errorP) {
+encodeBlocksOfPrecinct(jpc_enc_prc_t *   const prcP,
+                       jpc_enc_band_t *  const bandP,
+                       jpc_enc_tcmpt_t * const tcmptP,
+                       jpc_enc_t *       const encoderP,
+                       const char **     const errorP) {
 
     if (prcP->cblks) {
         int bmx;
         uint_fast32_t cblkno;
 
-        bmx = 0;
-
-        for (cblkno = 0; cblkno < prcP->numcblks; ++ cblkno) {
+        for (cblkno = 0, bmx = 0; cblkno < prcP->numcblks; ++ cblkno) {
             jpc_enc_cblk_t * const cblkP = &prcP->cblks[cblkno];
 
             int mx;
-            uint_fast32_t i;
+            uint_fast32_t row;
 
-            mx = 0;
-            for (i = 0; i < jas_matrix_numrows(cblkP->data); ++i) {
-                uint_fast32_t j;
+            for (row = 0, mx = 0;
+                 row < jas_matrix_numrows(cblkP->data);
+                 ++row) {
 
-                for (j = 0;
-                     j < jas_matrix_numcols(cblkP->data);
-                     ++j) {
-                    int const v =
-                        abs(jas_matrix_get(cblkP->data, i, j));
+                uint_fast32_t col;
+
+                for (col = 0; col < jas_matrix_numcols(cblkP->data); ++col) {
+                    int const v = abs(jas_matrix_get(cblkP->data, row, col));
                     if (v > mx)
                         mx = v;
                 }
             }
             if (mx > bmx)
                 bmx = mx;
-            cblkP->numbps =
-                JAS_MAX(jpc_firstone(mx) + 1 - JPC_NUMEXTRABITS,
-                        0);
+
+            cblkP->numbps = MAX(jpc_firstone(mx) + 1 - JPC_NUMEXTRABITS, 0);
         }
 
         for (cblkno = 0; cblkno < prcP->numcblks; ++ cblkno) {
             jpc_enc_cblk_t * const cblkP = &prcP->cblks[cblkno];
 
-            cblkP->numimsbs = bandP->numbps - cblkP->numbps;
-            assert(cblkP->numimsbs >= 0);
+            assert(cblkP->numbps <= bandP->numbps);
         }
 
         for (cblkno = 0, *errorP = NULL;
@@ -222,10 +217,11 @@ encodeBlocksOfPrc(jpc_enc_prc_t *   const prcP,
 
 
 
-/* Encode all of the code blocks associated with the current tile. */
 int
 jpc_enc_enccblks(jpc_enc_t * const encoderP) {
-
+/*----------------------------------------------------------------------------
+  Encode all of the code blocks associated with the current tile.
+-----------------------------------------------------------------------------*/
     jpc_enc_tile_t * const tileP = encoderP->curtile;
 
     uint_fast32_t cmptno;
@@ -250,11 +246,11 @@ jpc_enc_enccblks(jpc_enc_t * const encoderP) {
 
                             const char * error;
 
-                            encodeBlocksOfPrc(&bandP->prcs[prcno],
-                                              bandP,
-                                              tcmptP,
-                                              encoderP,
-                                              &error);
+                            encodeBlocksOfPrecinct(&bandP->prcs[prcno],
+                                                   bandP,
+                                                   tcmptP,
+                                                   encoderP,
+                                                   &error);
 
                             if (error) {
                                 pm_strfree(error);