nuclear@1: /* nuclear@1: * jccoefct.c nuclear@1: * nuclear@1: * Copyright (C) 1994-1997, Thomas G. Lane. nuclear@1: * This file is part of the Independent JPEG Group's software. nuclear@1: * For conditions of distribution and use, see the accompanying README file. nuclear@1: * nuclear@1: * This file contains the coefficient buffer controller for compression. nuclear@1: * This controller is the top level of the JPEG compressor proper. nuclear@1: * The coefficient buffer lies between forward-DCT and entropy encoding steps. nuclear@1: */ nuclear@1: nuclear@1: #define JPEG_INTERNALS nuclear@1: #include "jinclude.h" nuclear@1: #include "jpeglib.h" nuclear@1: nuclear@1: nuclear@1: /* We use a full-image coefficient buffer when doing Huffman optimization, nuclear@1: * and also for writing multiple-scan JPEG files. In all cases, the DCT nuclear@1: * step is run during the first pass, and subsequent passes need only read nuclear@1: * the buffered coefficients. nuclear@1: */ nuclear@1: #ifdef ENTROPY_OPT_SUPPORTED nuclear@1: #define FULL_COEF_BUFFER_SUPPORTED nuclear@1: #else nuclear@1: #ifdef C_MULTISCAN_FILES_SUPPORTED nuclear@1: #define FULL_COEF_BUFFER_SUPPORTED nuclear@1: #endif nuclear@1: #endif nuclear@1: nuclear@1: nuclear@1: /* Private buffer controller object */ nuclear@1: nuclear@1: typedef struct { nuclear@1: struct jpeg_c_coef_controller pub; /* public fields */ nuclear@1: nuclear@1: JDIMENSION iMCU_row_num; /* iMCU row # within image */ nuclear@1: JDIMENSION mcu_ctr; /* counts MCUs processed in current row */ nuclear@1: int MCU_vert_offset; /* counts MCU rows within iMCU row */ nuclear@1: int MCU_rows_per_iMCU_row; /* number of such rows needed */ nuclear@1: nuclear@1: /* For single-pass compression, it's sufficient to buffer just one MCU nuclear@1: * (although this may prove a bit slow in practice). We allocate a nuclear@1: * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each nuclear@1: * MCU constructed and sent. (On 80x86, the workspace is FAR even though nuclear@1: * it's not really very big; this is to keep the module interfaces unchanged nuclear@1: * when a large coefficient buffer is necessary.) nuclear@1: * In multi-pass modes, this array points to the current MCU's blocks nuclear@1: * within the virtual arrays. nuclear@1: */ nuclear@1: JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU]; nuclear@1: nuclear@1: /* In multi-pass modes, we need a virtual block array for each component. */ nuclear@1: jvirt_barray_ptr whole_image[MAX_COMPONENTS]; nuclear@1: } my_coef_controller; nuclear@1: nuclear@1: typedef my_coef_controller * my_coef_ptr; nuclear@1: nuclear@1: nuclear@1: /* Forward declarations */ nuclear@1: METHODDEF(boolean) compress_data nuclear@1: JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); nuclear@1: #ifdef FULL_COEF_BUFFER_SUPPORTED nuclear@1: METHODDEF(boolean) compress_first_pass nuclear@1: JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); nuclear@1: METHODDEF(boolean) compress_output nuclear@1: JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf)); nuclear@1: #endif nuclear@1: nuclear@1: nuclear@1: LOCAL(void) nuclear@1: start_iMCU_row (j_compress_ptr cinfo) nuclear@1: /* Reset within-iMCU-row counters for a new row */ nuclear@1: { nuclear@1: my_coef_ptr coef = (my_coef_ptr) cinfo->coef; nuclear@1: nuclear@1: /* In an interleaved scan, an MCU row is the same as an iMCU row. nuclear@1: * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. nuclear@1: * But at the bottom of the image, process only what's left. nuclear@1: */ nuclear@1: if (cinfo->comps_in_scan > 1) { nuclear@1: coef->MCU_rows_per_iMCU_row = 1; nuclear@1: } else { nuclear@1: if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1)) nuclear@1: coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor; nuclear@1: else nuclear@1: coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height; nuclear@1: } nuclear@1: nuclear@1: coef->mcu_ctr = 0; nuclear@1: coef->MCU_vert_offset = 0; nuclear@1: } nuclear@1: nuclear@1: nuclear@1: /* nuclear@1: * Initialize for a processing pass. nuclear@1: */ nuclear@1: nuclear@1: METHODDEF(void) nuclear@1: start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) nuclear@1: { nuclear@1: my_coef_ptr coef = (my_coef_ptr) cinfo->coef; nuclear@1: nuclear@1: coef->iMCU_row_num = 0; nuclear@1: start_iMCU_row(cinfo); nuclear@1: nuclear@1: switch (pass_mode) { nuclear@1: case JBUF_PASS_THRU: nuclear@1: if (coef->whole_image[0] != NULL) nuclear@1: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); nuclear@1: coef->pub.compress_data = compress_data; nuclear@1: break; nuclear@1: #ifdef FULL_COEF_BUFFER_SUPPORTED nuclear@1: case JBUF_SAVE_AND_PASS: nuclear@1: if (coef->whole_image[0] == NULL) nuclear@1: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); nuclear@1: coef->pub.compress_data = compress_first_pass; nuclear@1: break; nuclear@1: case JBUF_CRANK_DEST: nuclear@1: if (coef->whole_image[0] == NULL) nuclear@1: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); nuclear@1: coef->pub.compress_data = compress_output; nuclear@1: break; nuclear@1: #endif nuclear@1: default: nuclear@1: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); nuclear@1: break; nuclear@1: } nuclear@1: } nuclear@1: nuclear@1: nuclear@1: /* nuclear@1: * Process some data in the single-pass case. nuclear@1: * We process the equivalent of one fully interleaved MCU row ("iMCU" row) nuclear@1: * per call, ie, v_samp_factor block rows for each component in the image. nuclear@1: * Returns TRUE if the iMCU row is completed, FALSE if suspended. nuclear@1: * nuclear@1: * NB: input_buf contains a plane for each component in image, nuclear@1: * which we index according to the component's SOF position. nuclear@1: */ nuclear@1: nuclear@1: METHODDEF(boolean) nuclear@1: compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf) nuclear@1: { nuclear@1: my_coef_ptr coef = (my_coef_ptr) cinfo->coef; nuclear@1: JDIMENSION MCU_col_num; /* index of current MCU within row */ nuclear@1: JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; nuclear@1: JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; nuclear@1: int blkn, bi, ci, yindex, yoffset, blockcnt; nuclear@1: JDIMENSION ypos, xpos; nuclear@1: jpeg_component_info *compptr; nuclear@1: nuclear@1: /* Loop to write as much as one whole iMCU row */ nuclear@1: for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; nuclear@1: yoffset++) { nuclear@1: for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col; nuclear@1: MCU_col_num++) { nuclear@1: /* Determine where data comes from in input_buf and do the DCT thing. nuclear@1: * Each call on forward_DCT processes a horizontal row of DCT blocks nuclear@1: * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks nuclear@1: * sequentially. Dummy blocks at the right or bottom edge are filled in nuclear@1: * specially. The data in them does not matter for image reconstruction, nuclear@1: * so we fill them with values that will encode to the smallest amount of nuclear@1: * data, viz: all zeroes in the AC entries, DC entries equal to previous nuclear@1: * block's DC value. (Thanks to Thomas Kinsman for this idea.) nuclear@1: */ nuclear@1: blkn = 0; nuclear@1: for (ci = 0; ci < cinfo->comps_in_scan; ci++) { nuclear@1: compptr = cinfo->cur_comp_info[ci]; nuclear@1: blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width nuclear@1: : compptr->last_col_width; nuclear@1: xpos = MCU_col_num * compptr->MCU_sample_width; nuclear@1: ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */ nuclear@1: for (yindex = 0; yindex < compptr->MCU_height; yindex++) { nuclear@1: if (coef->iMCU_row_num < last_iMCU_row || nuclear@1: yoffset+yindex < compptr->last_row_height) { nuclear@1: (*cinfo->fdct->forward_DCT) (cinfo, compptr, nuclear@1: input_buf[compptr->component_index], nuclear@1: coef->MCU_buffer[blkn], nuclear@1: ypos, xpos, (JDIMENSION) blockcnt); nuclear@1: if (blockcnt < compptr->MCU_width) { nuclear@1: /* Create some dummy blocks at the right edge of the image. */ nuclear@1: jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt], nuclear@1: (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK)); nuclear@1: for (bi = blockcnt; bi < compptr->MCU_width; bi++) { nuclear@1: coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0]; nuclear@1: } nuclear@1: } nuclear@1: } else { nuclear@1: /* Create a row of dummy blocks at the bottom of the image. */ nuclear@1: jzero_far((void FAR *) coef->MCU_buffer[blkn], nuclear@1: compptr->MCU_width * SIZEOF(JBLOCK)); nuclear@1: for (bi = 0; bi < compptr->MCU_width; bi++) { nuclear@1: coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0]; nuclear@1: } nuclear@1: } nuclear@1: blkn += compptr->MCU_width; nuclear@1: ypos += DCTSIZE; nuclear@1: } nuclear@1: } nuclear@1: /* Try to write the MCU. In event of a suspension failure, we will nuclear@1: * re-DCT the MCU on restart (a bit inefficient, could be fixed...) nuclear@1: */ nuclear@1: if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { nuclear@1: /* Suspension forced; update state counters and exit */ nuclear@1: coef->MCU_vert_offset = yoffset; nuclear@1: coef->mcu_ctr = MCU_col_num; nuclear@1: return FALSE; nuclear@1: } nuclear@1: } nuclear@1: /* Completed an MCU row, but perhaps not an iMCU row */ nuclear@1: coef->mcu_ctr = 0; nuclear@1: } nuclear@1: /* Completed the iMCU row, advance counters for next one */ nuclear@1: coef->iMCU_row_num++; nuclear@1: start_iMCU_row(cinfo); nuclear@1: return TRUE; nuclear@1: } nuclear@1: nuclear@1: nuclear@1: #ifdef FULL_COEF_BUFFER_SUPPORTED nuclear@1: nuclear@1: /* nuclear@1: * Process some data in the first pass of a multi-pass case. nuclear@1: * We process the equivalent of one fully interleaved MCU row ("iMCU" row) nuclear@1: * per call, ie, v_samp_factor block rows for each component in the image. nuclear@1: * This amount of data is read from the source buffer, DCT'd and quantized, nuclear@1: * and saved into the virtual arrays. We also generate suitable dummy blocks nuclear@1: * as needed at the right and lower edges. (The dummy blocks are constructed nuclear@1: * in the virtual arrays, which have been padded appropriately.) This makes nuclear@1: * it possible for subsequent passes not to worry about real vs. dummy blocks. nuclear@1: * nuclear@1: * We must also emit the data to the entropy encoder. This is conveniently nuclear@1: * done by calling compress_output() after we've loaded the current strip nuclear@1: * of the virtual arrays. nuclear@1: * nuclear@1: * NB: input_buf contains a plane for each component in image. All nuclear@1: * components are DCT'd and loaded into the virtual arrays in this pass. nuclear@1: * However, it may be that only a subset of the components are emitted to nuclear@1: * the entropy encoder during this first pass; be careful about looking nuclear@1: * at the scan-dependent variables (MCU dimensions, etc). nuclear@1: */ nuclear@1: nuclear@1: METHODDEF(boolean) nuclear@1: compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf) nuclear@1: { nuclear@1: my_coef_ptr coef = (my_coef_ptr) cinfo->coef; nuclear@1: JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; nuclear@1: JDIMENSION blocks_across, MCUs_across, MCUindex; nuclear@1: int bi, ci, h_samp_factor, block_row, block_rows, ndummy; nuclear@1: JCOEF lastDC; nuclear@1: jpeg_component_info *compptr; nuclear@1: JBLOCKARRAY buffer; nuclear@1: JBLOCKROW thisblockrow, lastblockrow; nuclear@1: nuclear@1: for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; nuclear@1: ci++, compptr++) { nuclear@1: /* Align the virtual buffer for this component. */ nuclear@1: buffer = (*cinfo->mem->access_virt_barray) nuclear@1: ((j_common_ptr) cinfo, coef->whole_image[ci], nuclear@1: coef->iMCU_row_num * compptr->v_samp_factor, nuclear@1: (JDIMENSION) compptr->v_samp_factor, TRUE); nuclear@1: /* Count non-dummy DCT block rows in this iMCU row. */ nuclear@1: if (coef->iMCU_row_num < last_iMCU_row) nuclear@1: block_rows = compptr->v_samp_factor; nuclear@1: else { nuclear@1: /* NB: can't use last_row_height here, since may not be set! */ nuclear@1: block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor); nuclear@1: if (block_rows == 0) block_rows = compptr->v_samp_factor; nuclear@1: } nuclear@1: blocks_across = compptr->width_in_blocks; nuclear@1: h_samp_factor = compptr->h_samp_factor; nuclear@1: /* Count number of dummy blocks to be added at the right margin. */ nuclear@1: ndummy = (int) (blocks_across % h_samp_factor); nuclear@1: if (ndummy > 0) nuclear@1: ndummy = h_samp_factor - ndummy; nuclear@1: /* Perform DCT for all non-dummy blocks in this iMCU row. Each call nuclear@1: * on forward_DCT processes a complete horizontal row of DCT blocks. nuclear@1: */ nuclear@1: for (block_row = 0; block_row < block_rows; block_row++) { nuclear@1: thisblockrow = buffer[block_row]; nuclear@1: (*cinfo->fdct->forward_DCT) (cinfo, compptr, nuclear@1: input_buf[ci], thisblockrow, nuclear@1: (JDIMENSION) (block_row * DCTSIZE), nuclear@1: (JDIMENSION) 0, blocks_across); nuclear@1: if (ndummy > 0) { nuclear@1: /* Create dummy blocks at the right edge of the image. */ nuclear@1: thisblockrow += blocks_across; /* => first dummy block */ nuclear@1: jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK)); nuclear@1: lastDC = thisblockrow[-1][0]; nuclear@1: for (bi = 0; bi < ndummy; bi++) { nuclear@1: thisblockrow[bi][0] = lastDC; nuclear@1: } nuclear@1: } nuclear@1: } nuclear@1: /* If at end of image, create dummy block rows as needed. nuclear@1: * The tricky part here is that within each MCU, we want the DC values nuclear@1: * of the dummy blocks to match the last real block's DC value. nuclear@1: * This squeezes a few more bytes out of the resulting file... nuclear@1: */ nuclear@1: if (coef->iMCU_row_num == last_iMCU_row) { nuclear@1: blocks_across += ndummy; /* include lower right corner */ nuclear@1: MCUs_across = blocks_across / h_samp_factor; nuclear@1: for (block_row = block_rows; block_row < compptr->v_samp_factor; nuclear@1: block_row++) { nuclear@1: thisblockrow = buffer[block_row]; nuclear@1: lastblockrow = buffer[block_row-1]; nuclear@1: jzero_far((void FAR *) thisblockrow, nuclear@1: (size_t) (blocks_across * SIZEOF(JBLOCK))); nuclear@1: for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) { nuclear@1: lastDC = lastblockrow[h_samp_factor-1][0]; nuclear@1: for (bi = 0; bi < h_samp_factor; bi++) { nuclear@1: thisblockrow[bi][0] = lastDC; nuclear@1: } nuclear@1: thisblockrow += h_samp_factor; /* advance to next MCU in row */ nuclear@1: lastblockrow += h_samp_factor; nuclear@1: } nuclear@1: } nuclear@1: } nuclear@1: } nuclear@1: /* NB: compress_output will increment iMCU_row_num if successful. nuclear@1: * A suspension return will result in redoing all the work above next time. nuclear@1: */ nuclear@1: nuclear@1: /* Emit data to the entropy encoder, sharing code with subsequent passes */ nuclear@1: return compress_output(cinfo, input_buf); nuclear@1: } nuclear@1: nuclear@1: nuclear@1: /* nuclear@1: * Process some data in subsequent passes of a multi-pass case. nuclear@1: * We process the equivalent of one fully interleaved MCU row ("iMCU" row) nuclear@1: * per call, ie, v_samp_factor block rows for each component in the scan. nuclear@1: * The data is obtained from the virtual arrays and fed to the entropy coder. nuclear@1: * Returns TRUE if the iMCU row is completed, FALSE if suspended. nuclear@1: * nuclear@1: * NB: input_buf is ignored; it is likely to be a NULL pointer. nuclear@1: */ nuclear@1: nuclear@1: METHODDEF(boolean) nuclear@1: compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) nuclear@1: { nuclear@1: my_coef_ptr coef = (my_coef_ptr) cinfo->coef; nuclear@1: JDIMENSION MCU_col_num; /* index of current MCU within row */ nuclear@1: int blkn, ci, xindex, yindex, yoffset; nuclear@1: JDIMENSION start_col; nuclear@1: JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN]; nuclear@1: JBLOCKROW buffer_ptr; nuclear@1: jpeg_component_info *compptr; nuclear@1: nuclear@1: /* Align the virtual buffers for the components used in this scan. nuclear@1: * NB: during first pass, this is safe only because the buffers will nuclear@1: * already be aligned properly, so jmemmgr.c won't need to do any I/O. nuclear@1: */ nuclear@1: for (ci = 0; ci < cinfo->comps_in_scan; ci++) { nuclear@1: compptr = cinfo->cur_comp_info[ci]; nuclear@1: buffer[ci] = (*cinfo->mem->access_virt_barray) nuclear@1: ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index], nuclear@1: coef->iMCU_row_num * compptr->v_samp_factor, nuclear@1: (JDIMENSION) compptr->v_samp_factor, FALSE); nuclear@1: } nuclear@1: nuclear@1: /* Loop to process one whole iMCU row */ nuclear@1: for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row; nuclear@1: yoffset++) { nuclear@1: for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row; nuclear@1: MCU_col_num++) { nuclear@1: /* Construct list of pointers to DCT blocks belonging to this MCU */ nuclear@1: blkn = 0; /* index of current DCT block within MCU */ nuclear@1: for (ci = 0; ci < cinfo->comps_in_scan; ci++) { nuclear@1: compptr = cinfo->cur_comp_info[ci]; nuclear@1: start_col = MCU_col_num * compptr->MCU_width; nuclear@1: for (yindex = 0; yindex < compptr->MCU_height; yindex++) { nuclear@1: buffer_ptr = buffer[ci][yindex+yoffset] + start_col; nuclear@1: for (xindex = 0; xindex < compptr->MCU_width; xindex++) { nuclear@1: coef->MCU_buffer[blkn++] = buffer_ptr++; nuclear@1: } nuclear@1: } nuclear@1: } nuclear@1: /* Try to write the MCU. */ nuclear@1: if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) { nuclear@1: /* Suspension forced; update state counters and exit */ nuclear@1: coef->MCU_vert_offset = yoffset; nuclear@1: coef->mcu_ctr = MCU_col_num; nuclear@1: return FALSE; nuclear@1: } nuclear@1: } nuclear@1: /* Completed an MCU row, but perhaps not an iMCU row */ nuclear@1: coef->mcu_ctr = 0; nuclear@1: } nuclear@1: /* Completed the iMCU row, advance counters for next one */ nuclear@1: coef->iMCU_row_num++; nuclear@1: start_iMCU_row(cinfo); nuclear@1: return TRUE; nuclear@1: } nuclear@1: nuclear@1: #endif /* FULL_COEF_BUFFER_SUPPORTED */ nuclear@1: nuclear@1: nuclear@1: /* nuclear@1: * Initialize coefficient buffer controller. nuclear@1: */ nuclear@1: nuclear@1: GLOBAL(void) nuclear@1: jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer) nuclear@1: { nuclear@1: my_coef_ptr coef; nuclear@1: nuclear@1: coef = (my_coef_ptr) nuclear@1: (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, nuclear@1: SIZEOF(my_coef_controller)); nuclear@1: cinfo->coef = (struct jpeg_c_coef_controller *) coef; nuclear@1: coef->pub.start_pass = start_pass_coef; nuclear@1: nuclear@1: /* Create the coefficient buffer. */ nuclear@1: if (need_full_buffer) { nuclear@1: #ifdef FULL_COEF_BUFFER_SUPPORTED nuclear@1: /* Allocate a full-image virtual array for each component, */ nuclear@1: /* padded to a multiple of samp_factor DCT blocks in each direction. */ nuclear@1: int ci; nuclear@1: jpeg_component_info *compptr; nuclear@1: nuclear@1: for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; nuclear@1: ci++, compptr++) { nuclear@1: coef->whole_image[ci] = (*cinfo->mem->request_virt_barray) nuclear@1: ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, nuclear@1: (JDIMENSION) jround_up((long) compptr->width_in_blocks, nuclear@1: (long) compptr->h_samp_factor), nuclear@1: (JDIMENSION) jround_up((long) compptr->height_in_blocks, nuclear@1: (long) compptr->v_samp_factor), nuclear@1: (JDIMENSION) compptr->v_samp_factor); nuclear@1: } nuclear@1: #else nuclear@1: ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); nuclear@1: #endif nuclear@1: } else { nuclear@1: /* We only need a single-MCU buffer. */ nuclear@1: JBLOCKROW buffer; nuclear@1: int i; nuclear@1: nuclear@1: buffer = (JBLOCKROW) nuclear@1: (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE, nuclear@1: C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK)); nuclear@1: for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) { nuclear@1: coef->MCU_buffer[i] = buffer + i; nuclear@1: } nuclear@1: coef->whole_image[0] = NULL; /* flag for no virtual arrays */ nuclear@1: } nuclear@1: }