?? jcmainct.c
字號:
/* * jcmainct.c * * Copyright (C) 1994-1996, Thomas G. Lane. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * * This file contains the main buffer controller for compression. * The main buffer lies between the pre-processor and the JPEG * compressor proper; it holds downsampled data in the JPEG colorspace. */#define JPEG_INTERNALS#include "jinclude.h"#include "jpeglib.h"/* Note: currently, there is no operating mode in which a full-image buffer * is needed at this step. If there were, that mode could not be used with * "raw data" input, since this module is bypassed in that case. However, * we've left the code here for possible use in special applications. */#undef FULL_MAIN_BUFFER_SUPPORTED/* Private buffer controller object */typedef struct { struct jpeg_c_main_controller pub; /* public fields */ JDIMENSION cur_iMCU_row; /* number of current iMCU row */ JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */ //boolean suspended; /* remember if we suspended output */ //J_BUF_MODE pass_mode; /* current operating mode */} my_main_controller;typedef my_main_controller * my_main_ptr;/* * Initialize for a processing pass. */METHODDEF(void)start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode){ my_main_ptr main = (my_main_ptr) cinfo->main; /* Do nothing in raw-data mode. */// if (cinfo->raw_data_in)// return; main->cur_iMCU_row = 0; /* initialize counters */ main->rowgroup_ctr = 0; //main->suspended = FALSE; // main->pass_mode = pass_mode; /* save mode for use by process_data */}/* * Process some data. * This routine handles the simple pass-through mode, * where we have only a strip buffer. */GLOBAL(void) process_data_simple_main1 (j_compress_ptr cinfo, JDIMENSION *in_row_ctr){ my_main_ptr main = (my_main_ptr) cinfo->main; while (main->cur_iMCU_row < cinfo->total_iMCU_rows) { *in_row_ctr += v_sampf[0]<<3; cMCUrow = main->cur_iMCU_row; //pwhsu++:20040120 compress_data1(cinfo); main->rowgroup_ctr = 0; main->cur_iMCU_row++; } /*end of while*/ //pwhsu:20031020}/* * Initialize main buffer controller. */GLOBAL(void)jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer){ my_main_ptr main; int ci; jpeg_component_info *compptr; main = (my_main_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_main_controller)); cinfo->main = (struct jpeg_c_main_controller *) main; main->pub.start_pass = start_pass_main; /* We don't need to create a buffer in raw-data mode. */// if (cinfo->raw_data_in)// return; /* Create the buffer. It holds downsampled data, so each component * may be of a different size. */#if 0 if (need_full_buffer) {#ifdef FULL_MAIN_BUFFER_SUPPORTED /* Allocate a full-image virtual array for each component */ /* Note we pad the bottom to a multiple of the iMCU height */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { main->whole_image[ci] = (*cinfo->mem->request_virt_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE, compptr->width_in_blocks * DCTSIZE, (JDIMENSION) jround_up((long) compptr->height_in_blocks, (long) compptr->v_samp_factor) * DCTSIZE, (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); }#else ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);#endif } else {#ifdef FULL_MAIN_BUFFER_SUPPORTED main->whole_image[0] = NULL; /* flag for no virtual arrays */#endif#if 0 /* Allocate a strip buffer for each component */ for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { main->buffer[ci] = (*cinfo->mem->alloc_sarray) ((j_common_ptr) cinfo, JPOOL_IMAGE, compptr->width_in_blocks * DCTSIZE, (JDIMENSION) (compptr->v_samp_factor * DCTSIZE)); }#endif }#endif}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -