Path: blob/master/3rdparty/libjpeg-turbo/src/jdmainct.h
16337 views
/*1* jdmainct.h2*3* This file was part of the Independent JPEG Group's software:4* Copyright (C) 1994-1996, Thomas G. Lane.5* For conditions of distribution and use, see the accompanying README.ijg6* file.7*/89#define JPEG_INTERNALS10#include "jpeglib.h"11#include "jpegcomp.h"121314/* Private buffer controller object */1516typedef struct {17struct jpeg_d_main_controller pub; /* public fields */1819/* Pointer to allocated workspace (M or M+2 row groups). */20JSAMPARRAY buffer[MAX_COMPONENTS];2122boolean buffer_full; /* Have we gotten an iMCU row from decoder? */23JDIMENSION rowgroup_ctr; /* counts row groups output to postprocessor */2425/* Remaining fields are only used in the context case. */2627/* These are the master pointers to the funny-order pointer lists. */28JSAMPIMAGE xbuffer[2]; /* pointers to weird pointer lists */2930int whichptr; /* indicates which pointer set is now in use */31int context_state; /* process_data state machine status */32JDIMENSION rowgroups_avail; /* row groups available to postprocessor */33JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */34} my_main_controller;3536typedef my_main_controller *my_main_ptr;373839/* context_state values: */40#define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */41#define CTX_PROCESS_IMCU 1 /* feeding iMCU to postprocessor */42#define CTX_POSTPONED_ROW 2 /* feeding postponed row group */434445LOCAL(void)46set_wraparound_pointers (j_decompress_ptr cinfo)47/* Set up the "wraparound" pointers at top and bottom of the pointer lists.48* This changes the pointer list state from top-of-image to the normal state.49*/50{51my_main_ptr main_ptr = (my_main_ptr) cinfo->main;52int ci, i, rgroup;53int M = cinfo->_min_DCT_scaled_size;54jpeg_component_info *compptr;55JSAMPARRAY xbuf0, xbuf1;5657for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;58ci++, compptr++) {59rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /60cinfo->_min_DCT_scaled_size; /* height of a row group of component */61xbuf0 = main_ptr->xbuffer[0][ci];62xbuf1 = main_ptr->xbuffer[1][ci];63for (i = 0; i < rgroup; i++) {64xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];65xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];66xbuf0[rgroup*(M+2) + i] = xbuf0[i];67xbuf1[rgroup*(M+2) + i] = xbuf1[i];68}69}70}717273