Merge pull request #22924 from alalek:logger_strip_base_dir
[platform/upstream/opencv.git] / 3rdparty / libjpeg / jccoefct.c
index 2f0a489..924a703 100644 (file)
@@ -156,7 +156,7 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
   for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
        yoffset++) {
     for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
-         MCU_col_num++) {
+        MCU_col_num++) {
       /* Determine where data comes from in input_buf and do the DCT thing.
        * Each call on forward_DCT processes a horizontal row of DCT blocks
        * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
@@ -168,48 +168,48 @@ compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
        */
       blkn = 0;
       for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
-        compptr = cinfo->cur_comp_info[ci];
-        forward_DCT = cinfo->fdct->forward_DCT[compptr->component_index];
-        blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
-                                                : compptr->last_col_width;
-        xpos = MCU_col_num * compptr->MCU_sample_width;
-        ypos = yoffset * compptr->DCT_v_scaled_size;
-        /* ypos == (yoffset+yindex) * DCTSIZE */
-        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
-          if (coef->iMCU_row_num < last_iMCU_row ||
-              yoffset+yindex < compptr->last_row_height) {
-            (*forward_DCT) (cinfo, compptr,
-                            input_buf[compptr->component_index],
-                            coef->MCU_buffer[blkn],
-                            ypos, xpos, (JDIMENSION) blockcnt);
-            if (blockcnt < compptr->MCU_width) {
-              /* Create some dummy blocks at the right edge of the image. */
-              FMEMZERO((void FAR *) coef->MCU_buffer[blkn + blockcnt],
-                       (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
-              for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
-                coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
-              }
-            }
-          } else {
-            /* Create a row of dummy blocks at the bottom of the image. */
-            FMEMZERO((void FAR *) coef->MCU_buffer[blkn],
-                     compptr->MCU_width * SIZEOF(JBLOCK));
-            for (bi = 0; bi < compptr->MCU_width; bi++) {
-              coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
-            }
-          }
-          blkn += compptr->MCU_width;
-          ypos += compptr->DCT_v_scaled_size;
-        }
+       compptr = cinfo->cur_comp_info[ci];
+       forward_DCT = cinfo->fdct->forward_DCT[compptr->component_index];
+       blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
+                                               : compptr->last_col_width;
+       xpos = MCU_col_num * compptr->MCU_sample_width;
+       ypos = yoffset * compptr->DCT_v_scaled_size;
+       /* ypos == (yoffset+yindex) * DCTSIZE */
+       for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+         if (coef->iMCU_row_num < last_iMCU_row ||
+             yoffset+yindex < compptr->last_row_height) {
+           (*forward_DCT) (cinfo, compptr,
+                           input_buf[compptr->component_index],
+                           coef->MCU_buffer[blkn],
+                           ypos, xpos, (JDIMENSION) blockcnt);
+           if (blockcnt < compptr->MCU_width) {
+             /* Create some dummy blocks at the right edge of the image. */
+             FMEMZERO((void FAR *) coef->MCU_buffer[blkn + blockcnt],
+                      (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
+             for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
+               coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
+             }
+           }
+         } else {
+           /* Create a row of dummy blocks at the bottom of the image. */
+           FMEMZERO((void FAR *) coef->MCU_buffer[blkn],
+                    compptr->MCU_width * SIZEOF(JBLOCK));
+           for (bi = 0; bi < compptr->MCU_width; bi++) {
+             coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
+           }
+         }
+         blkn += compptr->MCU_width;
+         ypos += compptr->DCT_v_scaled_size;
+       }
       }
       /* Try to write the MCU.  In event of a suspension failure, we will
        * re-DCT the MCU on restart (a bit inefficient, could be fixed...)
        */
       if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
-        /* Suspension forced; update state counters and exit */
-        coef->MCU_vert_offset = yoffset;
-        coef->mcu_ctr = MCU_col_num;
-        return FALSE;
+       /* Suspension forced; update state counters and exit */
+       coef->MCU_vert_offset = yoffset;
+       coef->mcu_ctr = MCU_col_num;
+       return FALSE;
       }
     }
     /* Completed an MCU row, but perhaps not an iMCU row */
@@ -286,16 +286,16 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
     for (block_row = 0; block_row < block_rows; block_row++) {
       thisblockrow = buffer[block_row];
       (*forward_DCT) (cinfo, compptr, input_buf[ci], thisblockrow,
-                      (JDIMENSION) (block_row * compptr->DCT_v_scaled_size),
-                      (JDIMENSION) 0, blocks_across);
+                     (JDIMENSION) (block_row * compptr->DCT_v_scaled_size),
+                     (JDIMENSION) 0, blocks_across);
       if (ndummy > 0) {
-        /* Create dummy blocks at the right edge of the image. */
-        thisblockrow += blocks_across; /* => first dummy block */
-        FMEMZERO((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
-        lastDC = thisblockrow[-1][0];
-        for (bi = 0; bi < ndummy; bi++) {
-          thisblockrow[bi][0] = lastDC;
-        }
+       /* Create dummy blocks at the right edge of the image. */
+       thisblockrow += blocks_across; /* => first dummy block */
+       FMEMZERO((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
+       lastDC = thisblockrow[-1][0];
+       for (bi = 0; bi < ndummy; bi++) {
+         thisblockrow[bi][0] = lastDC;
+       }
       }
     }
     /* If at end of image, create dummy block rows as needed.
@@ -307,19 +307,19 @@ compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
       blocks_across += ndummy; /* include lower right corner */
       MCUs_across = blocks_across / h_samp_factor;
       for (block_row = block_rows; block_row < compptr->v_samp_factor;
-           block_row++) {
-        thisblockrow = buffer[block_row];
-        lastblockrow = buffer[block_row-1];
-        FMEMZERO((void FAR *) thisblockrow,
-                 (size_t) (blocks_across * SIZEOF(JBLOCK)));
-        for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
-          lastDC = lastblockrow[h_samp_factor-1][0];
-          for (bi = 0; bi < h_samp_factor; bi++) {
-            thisblockrow[bi][0] = lastDC;
-          }
-          thisblockrow += h_samp_factor; /* advance to next MCU in row */
-          lastblockrow += h_samp_factor;
-        }
+          block_row++) {
+       thisblockrow = buffer[block_row];
+       lastblockrow = buffer[block_row-1];
+       FMEMZERO((void FAR *) thisblockrow,
+                (size_t) (blocks_across * SIZEOF(JBLOCK)));
+       for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
+         lastDC = lastblockrow[h_samp_factor-1][0];
+         for (bi = 0; bi < h_samp_factor; bi++) {
+           thisblockrow[bi][0] = lastDC;
+         }
+         thisblockrow += h_samp_factor; /* advance to next MCU in row */
+         lastblockrow += h_samp_factor;
+       }
       }
     }
   }
@@ -369,25 +369,25 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
   for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
        yoffset++) {
     for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
-         MCU_col_num++) {
+        MCU_col_num++) {
       /* Construct list of pointers to DCT blocks belonging to this MCU */
       blkn = 0;                        /* index of current DCT block within MCU */
       for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
-        compptr = cinfo->cur_comp_info[ci];
-        start_col = MCU_col_num * compptr->MCU_width;
-        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
-          buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
-          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
-            coef->MCU_buffer[blkn++] = buffer_ptr++;
-          }
-        }
+       compptr = cinfo->cur_comp_info[ci];
+       start_col = MCU_col_num * compptr->MCU_width;
+       for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
+         buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
+         for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
+           coef->MCU_buffer[blkn++] = buffer_ptr++;
+         }
+       }
       }
       /* Try to write the MCU. */
       if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
-        /* Suspension forced; update state counters and exit */
-        coef->MCU_vert_offset = yoffset;
-        coef->mcu_ctr = MCU_col_num;
-        return FALSE;
+       /* Suspension forced; update state counters and exit */
+       coef->MCU_vert_offset = yoffset;
+       coef->mcu_ctr = MCU_col_num;
+       return FALSE;
       }
     }
     /* Completed an MCU row, but perhaps not an iMCU row */
@@ -413,7 +413,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
 
   coef = (my_coef_ptr)
     (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
-                                SIZEOF(my_coef_controller));
+                               SIZEOF(my_coef_controller));
   cinfo->coef = (struct jpeg_c_coef_controller *) coef;
   coef->pub.start_pass = start_pass_coef;
 
@@ -426,14 +426,14 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
     jpeg_component_info *compptr;
 
     for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
-         ci++, compptr++) {
+        ci++, compptr++) {
       coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
-        ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
-         (JDIMENSION) jround_up((long) compptr->width_in_blocks,
-                                (long) compptr->h_samp_factor),
-         (JDIMENSION) jround_up((long) compptr->height_in_blocks,
-                                (long) compptr->v_samp_factor),
-         (JDIMENSION) compptr->v_samp_factor);
+       ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
+        (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+                               (long) compptr->h_samp_factor),
+        (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+                               (long) compptr->v_samp_factor),
+        (JDIMENSION) compptr->v_samp_factor);
     }
 #else
     ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
@@ -445,7 +445,7 @@ jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
 
     buffer = (JBLOCKROW)
       (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
-                                  C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
+                                 C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
     for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
       coef->MCU_buffer[i] = buffer + i;
     }