亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jdinput.cpp

?? Windows 圖形編程 書籍
?? CPP
字號:
//-------------------------------------------------------------------------//
//          Windows Graphics Programming: Win32 GDI and DirectDraw         //
//                        ISBN  0-13-086985-6                              //
//                                                                         //
//  Modified by: Yuan, Feng                             www.fengyuan.com   //
//  Changes    : C++, exception, in-memory source, BGR byte order          //
//  Version    : 1.00.000, May 31, 2000                                    //
//-------------------------------------------------------------------------//

/*
 * jdinput.c
 *
 * Copyright (C) 1991-1997, 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 input control logic for the JPEG decompressor.
 * These routines are concerned with controlling the decompressor's input
 * processing (marker reading and coefficient decoding).  The actual input
 * reading is done in jdmarker.c, jdhuff.c, and jdphuff.c.
 */

#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"


/* Private state */

typedef struct {
  struct jpeg_input_controller pub; /* public fields */

  boolean inheaders;		/* TRUE until first SOS is reached */
} my_input_controller;

typedef my_input_controller * my_inputctl_ptr;


/* Forward declarations */
int consume_markers (j_decompress_ptr cinfo);


/*
 * Routines to calculate various quantities related to the size of the image.
 */

LOCAL(void)
initial_setup (j_decompress_ptr cinfo)
/* Called once, when first SOS marker is reached */
{
  int ci;
  jpeg_component_info *compptr;

  /* Make sure image isn't bigger than I can handle */
  if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
      (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
    cinfo->ERREXIT1(JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);

  /* For now, precision must match compiled-in value... */
  if (cinfo->data_precision != BITS_IN_JSAMPLE)
    cinfo->ERREXIT1(JERR_BAD_PRECISION, cinfo->data_precision);

  /* Check that number of components won't exceed internal array sizes */
  if (cinfo->num_components > MAX_COMPONENTS)
    cinfo->ERREXIT2(JERR_COMPONENT_COUNT, cinfo->num_components,
	     MAX_COMPONENTS);

  /* Compute maximum sampling factors; check factor validity */
  cinfo->max_h_samp_factor = 1;
  cinfo->max_v_samp_factor = 1;
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
	compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
      cinfo->ERREXIT(JERR_BAD_SAMPLING);
    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
				   compptr->h_samp_factor);
    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
				   compptr->v_samp_factor);
  }

  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE.
   * In the full decompressor, this will be overridden by jdmaster.c;
   * but in the transcoder, jdmaster.c is not used, so we must do it here.
   */
  cinfo->min_DCT_scaled_size = DCTSIZE;

  /* Compute dimensions of components */
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    compptr->DCT_scaled_size = DCTSIZE;
    /* Size in DCT blocks */
    compptr->width_in_blocks = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
		    (long) (cinfo->max_h_samp_factor * DCTSIZE));
    compptr->height_in_blocks = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
		    (long) (cinfo->max_v_samp_factor * DCTSIZE));
    /* downsampled_width and downsampled_height will also be overridden by
     * jdmaster.c if we are doing full decompression.  The transcoder library
     * doesn't use these values, but the calling application might.
     */
    /* Size in samples */
    compptr->downsampled_width = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
		    (long) cinfo->max_h_samp_factor);
    compptr->downsampled_height = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
		    (long) cinfo->max_v_samp_factor);
    /* Mark component needed, until color conversion says otherwise */
    compptr->component_needed = TRUE;
    /* Mark no quantization table yet saved for component */
    compptr->quant_table = NULL;
  }

  /* Compute number of fully interleaved MCU rows. */
  cinfo->total_iMCU_rows = (JDIMENSION)
    jdiv_round_up((long) cinfo->image_height,
		  (long) (cinfo->max_v_samp_factor*DCTSIZE));

  /* Decide whether file contains multiple scans */
  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
    cinfo->inputctl->has_multiple_scans = TRUE;
  else
    cinfo->inputctl->has_multiple_scans = FALSE;
}


LOCAL(void)
per_scan_setup (j_decompress_ptr cinfo)
/* Do computations that are needed before processing a JPEG scan */
/* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */
{
  int ci, mcublks, tmp;
  jpeg_component_info *compptr;
  
  if (cinfo->comps_in_scan == 1) {
    
    /* Noninterleaved (single-component) scan */
    compptr = cinfo->cur_comp_info[0];
    
    /* Overall image size in MCUs */
    cinfo->MCUs_per_row = compptr->width_in_blocks;
    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
    
    /* For noninterleaved scan, always one block per MCU */
    compptr->MCU_width = 1;
    compptr->MCU_height = 1;
    compptr->MCU_blocks = 1;
    compptr->MCU_sample_width = compptr->DCT_scaled_size;
    compptr->last_col_width = 1;
    /* For noninterleaved scans, it is convenient to define last_row_height
     * as the number of block rows present in the last iMCU row.
     */
    tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
    if (tmp == 0) tmp = compptr->v_samp_factor;
    compptr->last_row_height = tmp;
    
    /* Prepare array describing MCU composition */
    cinfo->blocks_in_MCU = 1;
    cinfo->MCU_membership[0] = 0;
    
  } else {
    
    /* Interleaved (multi-component) scan */
    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
      cinfo->ERREXIT2(JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
	       MAX_COMPS_IN_SCAN);
    
    /* Overall image size in MCUs */
    cinfo->MCUs_per_row = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width,
		    (long) (cinfo->max_h_samp_factor*DCTSIZE));
    cinfo->MCU_rows_in_scan = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height,
		    (long) (cinfo->max_v_samp_factor*DCTSIZE));
    
    cinfo->blocks_in_MCU = 0;
    
    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
      compptr = cinfo->cur_comp_info[ci];
      /* Sampling factors give # of blocks of component in each MCU */
      compptr->MCU_width = compptr->h_samp_factor;
      compptr->MCU_height = compptr->v_samp_factor;
      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
      compptr->MCU_sample_width = compptr->MCU_width * compptr->DCT_scaled_size;
      /* Figure number of non-dummy blocks in last MCU column & row */
      tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
      if (tmp == 0) tmp = compptr->MCU_width;
      compptr->last_col_width = tmp;
      tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
      if (tmp == 0) tmp = compptr->MCU_height;
      compptr->last_row_height = tmp;
      /* Prepare array describing MCU composition */
      mcublks = compptr->MCU_blocks;
      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
	cinfo->ERREXIT(JERR_BAD_MCU_SIZE);
      while (mcublks-- > 0) {
	cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
      }
    }
    
  }
}


/*
 * Save away a copy of the Q-table referenced by each component present
 * in the current scan, unless already saved during a prior scan.
 *
 * In a multiple-scan JPEG file, the encoder could assign different components
 * the same Q-table slot number, but change table definitions between scans
 * so that each component uses a different Q-table.  (The IJG encoder is not
 * currently capable of doing this, but other encoders might.)  Since we want
 * to be able to dequantize all the components at the end of the file, this
 * means that we have to save away the table actually used for each component.
 * We do this by copying the table at the start of the first scan containing
 * the component.
 * The JPEG spec prohibits the encoder from changing the contents of a Q-table
 * slot between scans of a component using that slot.  If the encoder does so
 * anyway, this decoder will simply use the Q-table values that were current
 * at the start of the first scan for the component.
 *
 * The decompressor output side looks only at the saved quant tables,
 * not at the current Q-table slots.
 */

LOCAL(void)
latch_quant_tables (j_decompress_ptr cinfo)
{
  int ci, qtblno;
  jpeg_component_info *compptr;
  JQUANT_TBL * qtbl;

  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
    compptr = cinfo->cur_comp_info[ci];
    /* No work if we already saved Q-table for this component */
    if (compptr->quant_table != NULL)
      continue;
    /* Make sure specified quantization table is present */
    qtblno = compptr->quant_tbl_no;
    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
	cinfo->quant_tbl_ptrs[qtblno] == NULL)
      cinfo->ERREXIT1(JERR_NO_QUANT_TABLE, qtblno);
    /* OK, save away the quantization table */
    qtbl = (JQUANT_TBL *)
      cinfo->mem->alloc_small(JPOOL_IMAGE, sizeof(JQUANT_TBL));
    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
    compptr->quant_table = qtbl;
  }
}


/*
 * Initialize the input modules to read a scan of compressed data.
 * The first call to this is done by jdmaster.c after initializing
 * the entire decompressor (during jpeg_start_decompress).
 * Subsequent calls come from consume_markers, below.
 */

LOCAL(void) start_input_pass (j_decompress_ptr cinfo)
{
  per_scan_setup(cinfo);
  latch_quant_tables(cinfo);
  (*cinfo->entropy->start_pass) (cinfo);
  (*cinfo->coef->start_input_pass) (cinfo);
  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
}


/*
 * Finish up after inputting a compressed-data scan.
 * This is called by the coefficient controller after it's read all
 * the expected data of the scan.
 */

void finish_input_pass (j_decompress_ptr cinfo)
{
  cinfo->inputctl->consume_input = consume_markers;
}


/*
 * Read JPEG markers before, between, or after compressed-data scans.
 * Change state as necessary when a new scan is reached.
 * Return value is JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI.
 *
 * The consume_input method pointer points either here or to the
 * coefficient controller's consume_data routine, depending on whether
 * we are reading a compressed data segment or inter-segment markers.
 */

int consume_markers (j_decompress_ptr cinfo)
{
  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;
  int val;

  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
    return JPEG_REACHED_EOI;

  val = (*cinfo->marker->read_markers) (cinfo);

  switch (val) {
  case JPEG_REACHED_SOS:	/* Found SOS */
    if (inputctl->inheaders) {	/* 1st SOS */
      initial_setup(cinfo);
      inputctl->inheaders = FALSE;
      /* Note: start_input_pass must be called by jdmaster.c
       * before any more input can be consumed.  jdapimin.c is
       * responsible for enforcing this sequencing.
       */
    } else {			/* 2nd or later SOS marker */
      if (! inputctl->pub.has_multiple_scans)
	cinfo->ERREXIT(JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
      start_input_pass(cinfo);
    }
    break;
  case JPEG_REACHED_EOI:	/* Found EOI */
    inputctl->pub.eoi_reached = TRUE;
    if (inputctl->inheaders) {	/* Tables-only datastream, apparently */
      if (cinfo->marker->saw_SOF)
	cinfo->ERREXIT(JERR_SOF_NO_SOS);
    } else {
      /* Prevent infinite loop in coef ctlr's decompress_data routine
       * if user set output_scan_number larger than number of scans.
       */
      if (cinfo->output_scan_number > cinfo->input_scan_number)
	cinfo->output_scan_number = cinfo->input_scan_number;
    }
    break;
  case JPEG_SUSPENDED:
    break;
  }

  return val;
}


/*
 * Reset state to begin a fresh datastream.
 */

void reset_input_controller (j_decompress_ptr cinfo)
{
  my_inputctl_ptr inputctl = (my_inputctl_ptr) cinfo->inputctl;

  inputctl->pub.consume_input = consume_markers;
  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  inputctl->pub.eoi_reached = FALSE;
  inputctl->inheaders = TRUE;
  /* Reset other modules */
  cinfo->err->reset_error_mgr ();
  (*cinfo->marker->reset_marker_reader) (cinfo);
  /* Reset progression state -- would be cleaner if entropy decoder did this */
  cinfo->coef_bits = NULL;
}


/*
 * Initialize the input controller module.
 * This is called only once, when the decompression object is created.
 */

GLOBAL(void)
jinit_input_controller (j_decompress_ptr cinfo)
{
  my_inputctl_ptr inputctl;

  /* Create subobject in permanent pool */
  inputctl = (my_inputctl_ptr)
    cinfo->mem->alloc_small(JPOOL_PERMANENT,
				sizeof(my_input_controller));
  cinfo->inputctl = (struct jpeg_input_controller *) inputctl;
  /* Initialize method pointers */
  inputctl->pub.consume_input = consume_markers;
  inputctl->pub.reset_input_controller = reset_input_controller;
  inputctl->pub.start_input_pass = start_input_pass;
  inputctl->pub.finish_input_pass = finish_input_pass;
  /* Initialize state: can't use reset_input_controller since we don't
   * want to try to reset other modules yet.
   */
  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  inputctl->pub.eoi_reached = FALSE;
  inputctl->inheaders = TRUE;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精选在线播放| 26uuu亚洲综合色欧美| 久久99久久久欧美国产| 亚洲视频小说图片| 国产精品三级视频| 国产精品三级久久久久三级| 国产一区二区三区高清播放| 综合久久久久综合| 久久精品亚洲精品国产欧美| 欧美区视频在线观看| 99久久精品一区| 国产精品一区二区视频| 天堂一区二区在线| 亚洲精品自拍动漫在线| 国产喷白浆一区二区三区| 日韩欧美亚洲国产精品字幕久久久| 99久久精品久久久久久清纯| 国产精一品亚洲二区在线视频| 五月天激情小说综合| 亚洲免费伊人电影| 亚洲国产高清aⅴ视频| 精品国产区一区| 欧美一级日韩不卡播放免费| 欧美三级日韩三级| 91久久久免费一区二区| 色综合天天综合给合国产| 成人性生交大片免费| 国产凹凸在线观看一区二区| 久久99国产乱子伦精品免费| 日av在线不卡| 亚洲va国产va欧美va观看| 亚洲最大色网站| 亚洲啪啪综合av一区二区三区| 国产精品你懂的在线欣赏| 久久女同互慰一区二区三区| 欧美精品一区二区三区在线| 欧美成人乱码一区二区三区| 日韩一区二区免费高清| 欧美本精品男人aⅴ天堂| 欧美一区三区二区| 日韩一区二区三区视频在线| 欧美一级片在线| 欧美v日韩v国产v| 精品国产免费一区二区三区四区 | 91国产精品成人| 日本黄色一区二区| 久久精品一区二区三区不卡| 欧美大片免费久久精品三p| 欧美电视剧免费全集观看| 精品国产一区久久| 久久久精品中文字幕麻豆发布| 欧美激情在线一区二区三区| 中文字幕五月欧美| 亚洲一区在线观看免费观看电影高清 | 26uuu精品一区二区三区四区在线| 日韩欧美不卡一区| 国产夜色精品一区二区av| 国产欧美一区二区精品仙草咪| 国产精品久久久久久久久久免费看| 国产精品久久久久一区二区三区共 | 欧美一区二区三区视频| 欧美videofree性高清杂交| 欧美高清在线精品一区| 亚洲美女在线一区| 午夜婷婷国产麻豆精品| 久久精品国产精品亚洲红杏| 风流少妇一区二区| 欧美探花视频资源| 2021国产精品久久精品| 中文av一区二区| 午夜婷婷国产麻豆精品| 国产福利视频一区二区三区| 一本到不卡免费一区二区| 日韩一区二区三免费高清| 国产精品毛片a∨一区二区三区| 亚洲精品国产无套在线观| 蜜臀久久99精品久久久久宅男 | 中文字幕一区二区三区在线播放| 亚洲一区二区三区四区五区中文| 久久99精品国产麻豆婷婷| aa级大片欧美| 日韩一区二区免费高清| 日韩一区欧美一区| 美脚の诱脚舐め脚责91| 91蜜桃免费观看视频| 欧美变态tickling挠脚心| 亚洲免费在线看| 黑人巨大精品欧美黑白配亚洲 | 国产午夜精品福利| 亚洲成人久久影院| 粉嫩av一区二区三区| 5566中文字幕一区二区电影 | 喷白浆一区二区| 不卡一二三区首页| 精品欧美一区二区三区精品久久 | 欧美一级二级三级蜜桃| 亚洲欧美在线另类| 久久国产免费看| 欧美性大战久久久| 国产精品视频一二三区 | 亚洲日本在线看| 蜜臀av国产精品久久久久 | 91精彩视频在线观看| 久久亚洲精精品中文字幕早川悠里| 亚洲精品免费视频| 国产精品1区二区.| 欧美mv和日韩mv国产网站| 午夜精品123| 色天使久久综合网天天| 国产亚洲欧洲997久久综合| 日韩av一区二区在线影视| 色爱区综合激月婷婷| 国产色爱av资源综合区| 久久电影网电视剧免费观看| 欧美群妇大交群中文字幕| 一区二区三区四区蜜桃| 波多野结衣亚洲一区| 国产亚洲女人久久久久毛片| 极品少妇xxxx精品少妇偷拍| 宅男噜噜噜66一区二区66| 亚洲一区二区欧美| 99国产一区二区三精品乱码| 中文字幕的久久| 国产91露脸合集magnet | 一个色综合av| 91老师片黄在线观看| 欧美激情综合五月色丁香| 国产福利精品导航| 久久久久88色偷偷免费| 国内成+人亚洲+欧美+综合在线| 日韩美女一区二区三区四区| 污片在线观看一区二区| 欧美伦理视频网站| 日韩经典中文字幕一区| 欧美乱妇一区二区三区不卡视频| 亚洲高清不卡在线| 欧美日韩国产一区| 日韩福利视频导航| 欧美一区二区免费视频| 天堂资源在线中文精品| 91精品婷婷国产综合久久性色| 日韩高清不卡在线| 精品少妇一区二区三区| 国产一区二区三区在线观看免费| 久久综合九色综合97婷婷女人| 激情久久五月天| 国产午夜亚洲精品午夜鲁丝片| 国产传媒欧美日韩成人| 国产精品福利一区二区三区| av亚洲产国偷v产偷v自拍| 亚洲欧美在线另类| 欧美揉bbbbb揉bbbbb| 日本三级亚洲精品| 久久色.com| 91社区在线播放| 日韩电影在线一区二区| 亚洲精品在线免费观看视频| 粗大黑人巨茎大战欧美成人| 亚洲天堂免费看| 欧美精选在线播放| 国产一区二区三区精品欧美日韩一区二区三区 | 国产一区二区在线影院| 中文字幕综合网| 精品视频在线免费| 九色综合国产一区二区三区| 欧美极品美女视频| 欧美日韩一本到| 韩国女主播成人在线| 国产精品久久久久久久久果冻传媒| 欧美系列日韩一区| 国产精品一区专区| 亚洲宅男天堂在线观看无病毒| 精品国内片67194| 99精品视频中文字幕| 丝袜亚洲另类欧美| 肉肉av福利一精品导航| 国产精品系列在线| 欧美日韩国产免费一区二区 | 欧美日韩激情在线| 国产福利不卡视频| 亚洲一区二区三区在线播放| 久久久777精品电影网影网| 欧美伊人精品成人久久综合97| 激情综合色综合久久| 一区二区三区四区精品在线视频 | 国产精品亲子乱子伦xxxx裸| 欧美日韩视频在线一区二区| 国产激情视频一区二区三区欧美| 亚洲自拍另类综合| 国产精品少妇自拍| 日韩一区二区三区四区| 色哟哟一区二区三区| 国产中文一区二区三区| 亚欧色一区w666天堂| 中文字幕国产一区| 日韩亚洲国产中文字幕欧美| 欧美亚洲国产一区二区三区| www.亚洲激情.com| 国内精品免费**视频| 日本视频一区二区|