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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jdmaster.c

?? WinCE開發技巧與實例的配套源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * jdmaster.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 master control logic for the JPEG decompressor.
 * These routines are concerned with selecting the modules to be executed
 * and with determining the number of passes and the work to be done in each
 * pass.
 */

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


/* Private state */

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

  int pass_number;		/* # of passes completed */

  boolean using_merged_upsample; /* TRUE if using merged upsample/cconvert */

  /* Saved references to initialized quantizer modules,
   * in case we need to switch modes.
   */
  struct jpeg_color_quantizer * quantizer_1pass;
  struct jpeg_color_quantizer * quantizer_2pass;
} my_decomp_master;

typedef my_decomp_master * my_master_ptr;


/*
 * Determine whether merged upsample/color conversion should be used.
 * CRUCIAL: this must match the actual capabilities of jdmerge.c!
 */

LOCAL(boolean)
use_merged_upsample (j_decompress_ptr cinfo)
{
#ifdef UPSAMPLE_MERGING_SUPPORTED
  /* Merging is the equivalent of plain box-filter upsampling */
  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
    return FALSE;
  /* jdmerge.c only supports YCC=>RGB color conversion */
  if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
      cinfo->out_color_space != JCS_RGB ||
      cinfo->out_color_components != RGB_PIXELSIZE)
    return FALSE;
  /* and it only handles 2h1v or 2h2v sampling ratios */
  if (cinfo->comp_info[0].h_samp_factor != 2 ||
      cinfo->comp_info[1].h_samp_factor != 1 ||
      cinfo->comp_info[2].h_samp_factor != 1 ||
      cinfo->comp_info[0].v_samp_factor >  2 ||
      cinfo->comp_info[1].v_samp_factor != 1 ||
      cinfo->comp_info[2].v_samp_factor != 1)
    return FALSE;
  /* furthermore, it doesn't work if we've scaled the IDCTs differently */
  if (cinfo->comp_info[0].DCT_scaled_size != cinfo->min_DCT_scaled_size ||
      cinfo->comp_info[1].DCT_scaled_size != cinfo->min_DCT_scaled_size ||
      cinfo->comp_info[2].DCT_scaled_size != cinfo->min_DCT_scaled_size)
    return FALSE;
  /* ??? also need to test for upsample-time rescaling, when & if supported */
  return TRUE;			/* by golly, it'll work... */
#else
  return FALSE;
#endif
}


/*
 * Compute output image dimensions and related values.
 * NOTE: this is exported for possible use by application.
 * Hence it mustn't do anything that can't be done twice.
 * Also note that it may be called before the master module is initialized!
 */

GLOBAL(void)
jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
#ifdef IDCT_SCALING_SUPPORTED
  int ci;
  jpeg_component_info *compptr;
#endif

  /* Prevent application from calling me at wrong times */
  if (cinfo->global_state != DSTATE_READY)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);

#ifdef IDCT_SCALING_SUPPORTED

  /* Compute actual output image dimensions and DCT scaling choices. */
  if (cinfo->scale_num * 8 <= cinfo->scale_denom) {
    /* Provide 1/8 scaling */
    cinfo->output_width = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width, 8L);
    cinfo->output_height = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height, 8L);
    cinfo->min_DCT_scaled_size = 1;
  } else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {
    /* Provide 1/4 scaling */
    cinfo->output_width = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width, 4L);
    cinfo->output_height = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height, 4L);
    cinfo->min_DCT_scaled_size = 2;
  } else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {
    /* Provide 1/2 scaling */
    cinfo->output_width = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width, 2L);
    cinfo->output_height = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height, 2L);
    cinfo->min_DCT_scaled_size = 4;
  } else {
    /* Provide 1/1 scaling */
    cinfo->output_width = cinfo->image_width;
    cinfo->output_height = cinfo->image_height;
    cinfo->min_DCT_scaled_size = DCTSIZE;
  }
  /* In selecting the actual DCT scaling for each component, we try to
   * scale up the chroma components via IDCT scaling rather than upsampling.
   * This saves time if the upsampler gets to use 1:1 scaling.
   * Note this code assumes that the supported DCT scalings are powers of 2.
   */
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    int ssize = cinfo->min_DCT_scaled_size;
    while (ssize < DCTSIZE &&
	   (compptr->h_samp_factor * ssize * 2 <=
	    cinfo->max_h_samp_factor * cinfo->min_DCT_scaled_size) &&
	   (compptr->v_samp_factor * ssize * 2 <=
	    cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size)) {
      ssize = ssize * 2;
    }
    compptr->DCT_scaled_size = ssize;
  }

  /* Recompute downsampled dimensions of components;
   * application needs to know these if using raw downsampled data.
   */
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    /* Size in samples, after IDCT scaling */
    compptr->downsampled_width = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_width *
		    (long) (compptr->h_samp_factor * compptr->DCT_scaled_size),
		    (long) (cinfo->max_h_samp_factor * DCTSIZE));
    compptr->downsampled_height = (JDIMENSION)
      jdiv_round_up((long) cinfo->image_height *
		    (long) (compptr->v_samp_factor * compptr->DCT_scaled_size),
		    (long) (cinfo->max_v_samp_factor * DCTSIZE));
  }

#else /* !IDCT_SCALING_SUPPORTED */

  /* Hardwire it to "no scaling" */
  cinfo->output_width = cinfo->image_width;
  cinfo->output_height = cinfo->image_height;
  /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
   * and has computed unscaled downsampled_width and downsampled_height.
   */

#endif /* IDCT_SCALING_SUPPORTED */

  /* Report number of components in selected colorspace. */
  /* Probably this should be in the color conversion module... */
  switch (cinfo->out_color_space) {
  case JCS_GRAYSCALE:
    cinfo->out_color_components = 1;
    break;
  case JCS_RGB:
#if RGB_PIXELSIZE != 3
    cinfo->out_color_components = RGB_PIXELSIZE;
    break;
#endif /* else share code with YCbCr */
  case JCS_YCbCr:
    cinfo->out_color_components = 3;
    break;
  case JCS_CMYK:
  case JCS_YCCK:
    cinfo->out_color_components = 4;
    break;
  default:			/* else must be same colorspace as in file */
    cinfo->out_color_components = cinfo->num_components;
    break;
  }
  cinfo->output_components = (cinfo->quantize_colors ? 1 :
			      cinfo->out_color_components);

  /* See if upsampler will want to emit more than one row at a time */
  if (use_merged_upsample(cinfo))
    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  else
    cinfo->rec_outbuf_height = 1;
}


/*
 * Several decompression processes need to range-limit values to the range
 * 0..MAXJSAMPLE; the input value may fall somewhat outside this range
 * due to noise introduced by quantization, roundoff error, etc.  These
 * processes are inner loops and need to be as fast as possible.  On most
 * machines, particularly CPUs with pipelines or instruction prefetch,
 * a (subscript-check-less) C table lookup
 *		x = sample_range_limit[x];
 * is faster than explicit tests
 *		if (x < 0)  x = 0;
 *		else if (x > MAXJSAMPLE)  x = MAXJSAMPLE;
 * These processes all use a common table prepared by the routine below.
 *
 * For most steps we can mathematically guarantee that the initial value
 * of x is within MAXJSAMPLE+1 of the legal range, so a table running from
 * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient.  But for the initial
 * limiting step (just after the IDCT), a wildly out-of-range value is 
 * possible if the input data is corrupt.  To avoid any chance of indexing
 * off the end of memory and getting a bad-pointer trap, we perform the
 * post-IDCT limiting thus:
 *		x = range_limit[x & MASK];
 * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit
 * samples.  Under normal circumstances this is more than enough range and
 * a correct output will be generated; with bogus input data the mask will
 * cause wraparound, and we will safely generate a bogus-but-in-range output.
 * For the post-IDCT step, we want to convert the data from signed to unsigned
 * representation by adding CENTERJSAMPLE at the same time that we limit it.
 * So the post-IDCT limiting table ends up looking like this:
 *   CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE,
 *   MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
 *   0          (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times),
 *   0,1,...,CENTERJSAMPLE-1
 * Negative inputs select values from the upper half of the table after
 * masking.
 *
 * We can save some space by overlapping the start of the post-IDCT table
 * with the simpler range limiting table.  The post-IDCT table begins at
 * sample_range_limit + CENTERJSAMPLE.
 *
 * Note that the table is allocated in near data space on PCs; it's small
 * enough and used often enough to justify this.
 */

LOCAL(void)
prepare_range_limit_table (j_decompress_ptr cinfo)
/* Allocate and fill in the sample_range_limit table */
{
  JSAMPLE * table;
  int i;

  table = (JSAMPLE *)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
		(5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE));
  table += (MAXJSAMPLE+1);	/* allow negative subscripts of simple table */
  cinfo->sample_range_limit = table;
  /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
  /* Main part of "simple" table: limit[x] = x */
  for (i = 0; i <= MAXJSAMPLE; i++)
    table[i] = (JSAMPLE) i;
  table += CENTERJSAMPLE;	/* Point to where post-IDCT table starts */
  /* End of simple table, rest of first half of post-IDCT table */
  for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
    table[i] = MAXJSAMPLE;
  /* Second half of post-IDCT table */
  MEMZERO(table + (2 * (MAXJSAMPLE+1)),
	  (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));
  MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
	  cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));
}


/*
 * Master selection of decompression modules.
 * This is done once at jpeg_start_decompress time.  We determine
 * which modules will be used and give them appropriate initialization calls.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美一区在线| av在线综合网| 精品国产一区二区三区不卡| 蜜臀av在线播放一区二区三区| 欧美丝袜第三区| 免费看日韩a级影片| 精品成a人在线观看| 国产精品18久久久久久久久久久久| 久久精品一区四区| 91在线看国产| 同产精品九九九| 精品国产sm最大网站免费看| 国产v综合v亚洲欧| 一区二区三区久久| 欧美一区二区三区思思人| 国产酒店精品激情| 18成人在线观看| 欧美日本乱大交xxxxx| 久久精品国产久精国产爱| 国产精品私房写真福利视频| 色嗨嗨av一区二区三区| 免费成人在线视频观看| 国产精品久99| 欧美精品123区| 国产成人免费在线观看不卡| 亚洲精品菠萝久久久久久久| 日韩精品一区二区三区视频| 99久久伊人精品| 青青草原综合久久大伊人精品优势| 久久久噜噜噜久噜久久综合| 欧美在线视频不卡| 国产很黄免费观看久久| 亚洲1区2区3区视频| 中文字幕乱码久久午夜不卡| 欧美日韩国产一区| 成人激情动漫在线观看| 美国一区二区三区在线播放| 自拍偷拍亚洲激情| 26uuu国产一区二区三区| 欧美三级电影一区| 丁香激情综合五月| 经典三级一区二区| 午夜欧美视频在线观看| 国产精品毛片久久久久久 | 99久久精品免费看国产免费软件| 亚洲午夜av在线| 国产精品美日韩| 久久蜜臀精品av| 91精品一区二区三区在线观看| 欧美精品乱码久久久久久| 粉嫩av一区二区三区在线播放 | 亚洲成在线观看| 中文字幕欧美国产| 久久蜜桃av一区二区天堂| 欧美精选一区二区| 在线看日韩精品电影| 丁香天五香天堂综合| 精品一区二区综合| 免费人成黄页网站在线一区二区| 亚洲永久精品国产| 中文字幕视频一区二区三区久| 精品国产sm最大网站| 日韩三级电影网址| 91精品国产乱码久久蜜臀| 欧美性猛交一区二区三区精品| 成人av免费观看| 成人在线视频首页| 床上的激情91.| 大尺度一区二区| 处破女av一区二区| 成人av影视在线观看| 国产1区2区3区精品美女| 韩国一区二区视频| 狠狠色丁香九九婷婷综合五月| 久国产精品韩国三级视频| 免费人成黄页网站在线一区二区| 青青草原综合久久大伊人精品| 亚洲.国产.中文慕字在线| 亚洲午夜私人影院| 亚州成人在线电影| 日韩va亚洲va欧美va久久| 日韩av高清在线观看| 日韩国产一区二| 久久99热狠狠色一区二区| 国产一区二区在线免费观看| 国产精品1区2区3区| 不卡一区中文字幕| 色屁屁一区二区| 欧美日韩精品专区| 日韩欧美激情在线| 久久久久久9999| 中文字幕一区二区三| 亚洲一区在线观看网站| 日本色综合中文字幕| 麻豆精品蜜桃视频网站| 国产精品123区| 色欧美片视频在线观看在线视频| 欧美性受xxxx黑人xyx性爽| 欧美一区二区三区爱爱| 久久人人97超碰com| 中文字幕永久在线不卡| 亚洲成人av中文| 狠狠色丁香婷综合久久| 成人午夜激情片| 欧美日韩一卡二卡三卡| 久久亚洲二区三区| 一区二区三区日韩| 久久国产尿小便嘘嘘尿| 成人免费毛片a| 在线不卡a资源高清| 久久青草欧美一区二区三区| 一区二区三区四区不卡视频| 久久超碰97中文字幕| 99re成人精品视频| 欧美一区二区久久| 最新中文字幕一区二区三区| 日韩成人一区二区| 99久久国产免费看| 欧美一区二区福利在线| 国产精品麻豆久久久| 亚洲成人综合网站| 国产成人av影院| 777午夜精品视频在线播放| 国产精品三级视频| 日本一不卡视频| 94色蜜桃网一区二区三区| 欧美一区二区三区播放老司机| 国产精品麻豆视频| 国内外成人在线| 欧美日产国产精品| 日韩美女久久久| 国产激情视频一区二区在线观看 | 91精品视频网| 亚洲人成网站在线| 久久激五月天综合精品| 欧美性色黄大片| 亚洲私人黄色宅男| 国产精品一区二区在线观看网站 | 色狠狠色噜噜噜综合网| 久久免费的精品国产v∧| 亚洲777理论| 91免费观看视频| 久久精品免视看| 亚洲图片欧美视频| 成人av免费在线| 国产日本一区二区| 久草精品在线观看| 日韩一级黄色片| 午夜精品视频一区| 欧美性大战久久久| 一区二区欧美国产| 国产福利不卡视频| 久久蜜臀精品av| 久久成人精品无人区| 日韩欧美激情在线| 蜜桃传媒麻豆第一区在线观看| 欧美午夜一区二区三区 | 懂色av一区二区在线播放| 欧美成人三级在线| 日本欧美大码aⅴ在线播放| 欧美亚日韩国产aⅴ精品中极品| 国产精品国产a| 成人av网址在线| 亚洲色图19p| 91丝袜呻吟高潮美腿白嫩在线观看| 中文子幕无线码一区tr| 风间由美一区二区三区在线观看 | 欧美亚洲禁片免费| 亚洲精品欧美激情| 91蜜桃在线观看| 亚洲色大成网站www久久九九| 成人一区二区视频| 亚洲欧美自拍偷拍色图| 99久久国产综合精品色伊| 亚洲色图另类专区| 欧美日韩一区二区三区四区| 视频一区视频二区中文字幕| 这里是久久伊人| 国产一区二三区| 中文在线一区二区| 91久久一区二区| 亚洲福利视频一区| 337p亚洲精品色噜噜噜| 狠狠色2019综合网| 亚洲欧洲日韩女同| 在线欧美小视频| 天天免费综合色| 日韩一区二区三区在线观看| 狠狠色伊人亚洲综合成人| 亚洲国产成人午夜在线一区 | 国产乱码字幕精品高清av| 欧美国产一区二区在线观看| 99精品欧美一区| 亚洲无线码一区二区三区| 制服丝袜成人动漫| 国产福利一区二区三区视频在线| 一色桃子久久精品亚洲| 欧美日韩国产123区| 国产精品一二三在| 一区二区三区日韩精品视频|