Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

jdcoefct.c File Reference

#include "jinclude.h"
#include "jpeglib.h"

Include dependency graph for jdcoefct.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  my_coef_controller

Defines

#define JPEG_INTERNALS

Typedefs

typedef my_coef_controllermy_coef_ptr

Functions

METHODDEF int decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
METHODDEF int dummy_consume_data (j_decompress_ptr cinfo)
GLOBAL void jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
METHODDEF int decompress_onepass JPP ((j_decompress_ptr cinfo, JSAMPIMAGE output_buf))
LOCAL void start_iMCU_row (j_decompress_ptr cinfo)
METHODDEF void start_input_pass (j_decompress_ptr cinfo)
METHODDEF void start_output_pass (j_decompress_ptr cinfo)


Define Documentation

#define JPEG_INTERNALS
 

Definition at line 17 of file jdcoefct.c.


Typedef Documentation

typedef my_coef_controller* my_coef_ptr
 

Definition at line 62 of file jdcoefct.c.


Function Documentation

METHODDEF int decompress_onepass j_decompress_ptr  cinfo,
JSAMPIMAGE  output_buf
 

Definition at line 147 of file jdcoefct.c.

References jpeg_decompress_struct::blocks_in_MCU, jpeg_decompress_struct::coef, jpeg_component_info::component_index, jpeg_component_info::component_needed, jpeg_decompress_struct::comps_in_scan, jpeg_decompress_struct::cur_comp_info, jpeg_component_info::DCT_scaled_size, jpeg_decompress_struct::entropy, FAR, jpeg_decompress_struct::idct, jpeg_decompress_struct::input_iMCU_row, jpeg_decompress_struct::inputctl, jpeg_inverse_dct::inverse_DCT, j_decompress_ptr, JBLOCK, JDIMENSION, JSAMPARRAY, jzero_far(), jpeg_component_info::last_col_width, jpeg_component_info::last_row_height, jpeg_component_info::MCU_blocks, my_coef_controller::MCU_buffer, my_coef_controller::MCU_ctr, jpeg_component_info::MCU_height, my_coef_controller::MCU_rows_per_iMCU_row, jpeg_component_info::MCU_sample_width, my_coef_controller::MCU_vert_offset, jpeg_component_info::MCU_width, jpeg_decompress_struct::MCUs_per_row, my_coef_ptr, jpeg_decompress_struct::output_iMCU_row, size_t, SIZEOF, start_iMCU_row(), jpeg_decompress_struct::total_iMCU_rows, and yoffset.

00148 {
00149   my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
00150   JDIMENSION MCU_col_num;   /* index of current MCU within row */
00151   JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
00152   JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
00153   int blkn, ci, xindex, yindex, yoffset, useful_width;
00154   JSAMPARRAY output_ptr;
00155   JDIMENSION start_col, output_col;
00156   jpeg_component_info *compptr;
00157   inverse_DCT_method_ptr inverse_DCT;
00158 
00159   /* Loop to process as much as one whole iMCU row */
00160   for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
00161        yoffset++) {
00162     for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
00163      MCU_col_num++) {
00164       /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
00165       jzero_far((void FAR *) coef->MCU_buffer[0],
00166         (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
00167       if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
00168     /* Suspension forced; update state counters and exit */
00169     coef->MCU_vert_offset = yoffset;
00170     coef->MCU_ctr = MCU_col_num;
00171     return JPEG_SUSPENDED;
00172       }
00173       /* Determine where data should go in output_buf and do the IDCT thing.
00174        * We skip dummy blocks at the right and bottom edges (but blkn gets
00175        * incremented past them!).  Note the inner loop relies on having
00176        * allocated the MCU_buffer[] blocks sequentially.
00177        */
00178       blkn = 0;         /* index of current DCT block within MCU */
00179       for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
00180     compptr = cinfo->cur_comp_info[ci];
00181     /* Don't bother to IDCT an uninteresting component. */
00182     if (! compptr->component_needed) {
00183       blkn += compptr->MCU_blocks;
00184       continue;
00185     }
00186     inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
00187     useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
00188                             : compptr->last_col_width;
00189     output_ptr = output_buf[ci] + yoffset * compptr->DCT_scaled_size;
00190     start_col = MCU_col_num * compptr->MCU_sample_width;
00191     for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
00192       if (cinfo->input_iMCU_row < last_iMCU_row ||
00193           yoffset+yindex < compptr->last_row_height) {
00194         output_col = start_col;
00195         for (xindex = 0; xindex < useful_width; xindex++) {
00196           (*inverse_DCT) (cinfo, compptr,
00197                   (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
00198                   output_ptr, output_col);
00199           output_col += compptr->DCT_scaled_size;
00200         }
00201       }
00202       blkn += compptr->MCU_width;
00203       output_ptr += compptr->DCT_scaled_size;
00204     }
00205       }
00206     }
00207     /* Completed an MCU row, but perhaps not an iMCU row */
00208     coef->MCU_ctr = 0;
00209   }
00210   /* Completed the iMCU row, advance counters for next one */
00211   cinfo->output_iMCU_row++;
00212   if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
00213     start_iMCU_row(cinfo);
00214     return JPEG_ROW_COMPLETED;
00215   }
00216   /* Completed the scan */
00217   (*cinfo->inputctl->finish_input_pass) (cinfo);
00218   return JPEG_SCAN_COMPLETED;
00219 }

Here is the call graph for this function:

METHODDEF int dummy_consume_data j_decompress_ptr  cinfo  ) 
 

Definition at line 227 of file jdcoefct.c.

References j_decompress_ptr.

00228 {
00229   return JPEG_SUSPENDED;    /* Always indicate nothing was done */
00230 }

GLOBAL void jinit_d_coef_controller j_decompress_ptr  cinfo,
boolean  need_full_buffer
 

Definition at line 665 of file jdcoefct.c.

References buffer, jpeg_decompress_struct::coef, jpeg_decompress_struct::comp_info, D_MAX_BLOCKS_IN_MCU, ERREXIT, jpeg_component_info::h_samp_factor, jpeg_component_info::height_in_blocks, i, j_common_ptr, j_decompress_ptr, JBLOCK, JBLOCKROW, JDIMENSION, JERR_NOT_COMPILED, jround_up(), my_coef_controller::MCU_buffer, my_coef_ptr, jpeg_decompress_struct::num_components, jpeg_decompress_struct::progressive_mode, my_coef_controller::pub, SIZEOF, jpeg_component_info::v_samp_factor, my_coef_controller::whole_image, and jpeg_component_info::width_in_blocks.

00666 {
00667   my_coef_ptr coef;
00668 
00669   coef = (my_coef_ptr)
00670     (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00671                 SIZEOF(my_coef_controller));
00672   cinfo->coef = (struct jpeg_d_coef_controller *) coef;
00673   coef->pub.start_input_pass = start_input_pass;
00674   coef->pub.start_output_pass = start_output_pass;
00675 #ifdef BLOCK_SMOOTHING_SUPPORTED
00676   coef->coef_bits_latch = NULL;
00677 #endif
00678 
00679   /* Create the coefficient buffer. */
00680   if (need_full_buffer) {
00681 #ifdef D_MULTISCAN_FILES_SUPPORTED
00682     /* Allocate a full-image virtual array for each component, */
00683     /* padded to a multiple of samp_factor DCT blocks in each direction. */
00684     /* Note we ask for a pre-zeroed array. */
00685     int ci, access_rows;
00686     jpeg_component_info *compptr;
00687 
00688     for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
00689      ci++, compptr++) {
00690       access_rows = compptr->v_samp_factor;
00691 #ifdef BLOCK_SMOOTHING_SUPPORTED
00692       /* If block smoothing could be used, need a bigger window */
00693       if (cinfo->progressive_mode)
00694     access_rows *= 3;
00695 #endif
00696       coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
00697     ((j_common_ptr) cinfo, JPOOL_IMAGE, TRUE,
00698      (JDIMENSION) jround_up((long) compptr->width_in_blocks,
00699                 (long) compptr->h_samp_factor),
00700      (JDIMENSION) jround_up((long) compptr->height_in_blocks,
00701                 (long) compptr->v_samp_factor),
00702      (JDIMENSION) access_rows);
00703     }
00704     coef->pub.consume_data = consume_data;
00705     coef->pub.decompress_data = decompress_data;
00706     coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
00707 #else
00708     ERREXIT(cinfo, JERR_NOT_COMPILED);
00709 #endif
00710   } else {
00711     /* We only need a single-MCU buffer. */
00712     JBLOCKROW buffer;
00713     int i;
00714 
00715     buffer = (JBLOCKROW)
00716       (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
00717                   D_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
00718     for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
00719       coef->MCU_buffer[i] = buffer + i;
00720     }
00721     coef->pub.consume_data = dummy_consume_data;
00722     coef->pub.decompress_data = decompress_onepass;
00723     coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
00724   }
00725 }

Here is the call graph for this function:

METHODDEF int decompress_onepass JPP (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)   ) 
 

LOCAL void start_iMCU_row j_decompress_ptr  cinfo  ) 
 

Definition at line 79 of file jdcoefct.c.

References jpeg_decompress_struct::coef, jpeg_decompress_struct::comps_in_scan, jpeg_decompress_struct::cur_comp_info, jpeg_decompress_struct::input_iMCU_row, j_decompress_ptr, jpeg_component_info::last_row_height, my_coef_controller::MCU_ctr, my_coef_controller::MCU_rows_per_iMCU_row, my_coef_controller::MCU_vert_offset, my_coef_ptr, jpeg_decompress_struct::total_iMCU_rows, and jpeg_component_info::v_samp_factor.

00081 {
00082   my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
00083 
00084   /* In an interleaved scan, an MCU row is the same as an iMCU row.
00085    * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
00086    * But at the bottom of the image, process only what's left.
00087    */
00088   if (cinfo->comps_in_scan > 1) {
00089     coef->MCU_rows_per_iMCU_row = 1;
00090   } else {
00091     if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
00092       coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
00093     else
00094       coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
00095   }
00096 
00097   coef->MCU_ctr = 0;
00098   coef->MCU_vert_offset = 0;
00099 }

METHODDEF void start_input_pass j_decompress_ptr  cinfo  ) 
 

Definition at line 107 of file jdcoefct.c.

References jpeg_decompress_struct::input_iMCU_row, j_decompress_ptr, and start_iMCU_row().

00108 {
00109   cinfo->input_iMCU_row = 0;
00110   start_iMCU_row(cinfo);
00111 }

Here is the call graph for this function:

METHODDEF void start_output_pass j_decompress_ptr  cinfo  ) 
 

Definition at line 119 of file jdcoefct.c.

References jpeg_decompress_struct::coef, jpeg_decompress_struct::do_block_smoothing, j_decompress_ptr, my_coef_ptr, jpeg_decompress_struct::output_iMCU_row, and my_coef_controller::pub.

00120 {
00121 #ifdef BLOCK_SMOOTHING_SUPPORTED
00122   my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
00123 
00124   /* If multipass, check to see whether to use block smoothing on this pass */
00125   if (coef->pub.coef_arrays != NULL) {
00126     if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
00127       coef->pub.decompress_data = decompress_smooth_data;
00128     else
00129       coef->pub.decompress_data = decompress_data;
00130   }
00131 #endif
00132   cinfo->output_iMCU_row = 0;
00133 }


Generated on Thu Aug 25 14:02:23 2005 for Quake III Arena by  doxygen 1.3.9.1