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

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

?? jdmaster.c

?? 常好且全面的jpeg圖像壓縮算法
?? 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一区二区三区免费野_久草精品视频
在线播放91灌醉迷j高跟美女 | 亚洲永久免费av| 久久综合久久综合亚洲| 日韩区在线观看| 在线不卡中文字幕播放| 欧美一级欧美三级| 日韩午夜精品电影| 久久久蜜桃精品| 日本一区二区三区在线观看| 国产亚洲一区二区三区在线观看| 欧美精品一区二区久久久| 欧美日韩国产不卡| 日韩三级免费观看| 国产欧美一区二区精品久导航 | 成人激情视频网站| 97精品视频在线观看自产线路二| 日本韩国精品在线| 精品婷婷伊人一区三区三| 欧美一区二区三区在线电影| 久久综合久久综合九色| 国产精品色眯眯| 亚洲成人自拍偷拍| 国产一区三区三区| 一本色道久久综合亚洲91| 欧美日韩一卡二卡三卡| 欧美一区二区播放| 国产精品美女一区二区三区| 亚洲人精品午夜| 青青草国产成人av片免费| 国产精品一二三区在线| 97se狠狠狠综合亚洲狠狠| 欧美日韩视频第一区| 久久午夜国产精品| 亚洲激情图片一区| 九色综合狠狠综合久久| 成a人片国产精品| 欧美一区中文字幕| 国产精品久久久一本精品| 午夜欧美视频在线观看| 成人美女视频在线看| 欧美一区二区啪啪| 国产精品久久久久久久久久免费看| 亚洲成人av在线电影| 成人午夜免费电影| 欧美mv日韩mv亚洲| 午夜精品成人在线| gogo大胆日本视频一区| xfplay精品久久| 日韩精彩视频在线观看| 99精品久久免费看蜜臀剧情介绍| 精品久久久网站| 天堂精品中文字幕在线| 91农村精品一区二区在线| 26uuu亚洲综合色欧美| 午夜视频一区二区| 91免费在线播放| 国产精品美女久久久久aⅴ| 久久精品72免费观看| 欧美日韩在线精品一区二区三区激情 | 国产精品传媒在线| 国产一区二区三区高清播放| 日韩一区二区三区视频在线| 亚洲国产一区二区三区| 91国产免费观看| 亚洲欧洲综合另类| 成人av免费网站| 国产精品家庭影院| 成人午夜视频网站| 欧美国产一区二区| 成人午夜在线免费| 国产精品伦理在线| 成人av在线网站| 中文字幕一区二区在线观看| 国产91清纯白嫩初高中在线观看| 欧美va亚洲va香蕉在线| 极品少妇一区二区三区精品视频| 欧美一级片免费看| 精油按摩中文字幕久久| 精品美女一区二区| 国产精品综合二区| 中文字幕不卡一区| 色综合久久综合| 一区二区久久久| 欧美日韩在线观看一区二区| 午夜成人免费电影| 精品剧情v国产在线观看在线| 九一九一国产精品| 欧美国产禁国产网站cc| 99riav一区二区三区| 亚洲激情欧美激情| 91麻豆精品国产91久久久更新时间 | 三级久久三级久久久| 91精品婷婷国产综合久久性色| 日本免费在线视频不卡一不卡二| 日韩欧美你懂的| 丰满亚洲少妇av| 亚洲自拍偷拍九九九| 91精品国产一区二区三区蜜臀| 精品一区二区三区视频在线观看| 国产欧美日韩在线| 欧美视频中文字幕| 另类小说综合欧美亚洲| 国产精品色婷婷久久58| 在线91免费看| 国产精品小仙女| 一区二区三区欧美| 欧美成人性福生活免费看| jlzzjlzz欧美大全| 强制捆绑调教一区二区| 国产精品久线观看视频| 欧美日韩情趣电影| 成人教育av在线| 日本系列欧美系列| 国产精品大尺度| 欧美不卡视频一区| 在线视频一区二区三区| 激情综合色丁香一区二区| 亚洲色图制服丝袜| 2021久久国产精品不只是精品| 91片在线免费观看| 激情欧美一区二区| 亚洲v精品v日韩v欧美v专区| 中文一区二区完整视频在线观看| 欧美久久一二区| 99久久国产综合精品女不卡| 国产一区在线不卡| 日本亚洲视频在线| 亚洲一区二区在线免费看| 久久久久久久久免费| 欧美一二三四区在线| 日本高清成人免费播放| 99久久国产综合精品色伊 | 91在线精品秘密一区二区| 美腿丝袜一区二区三区| 天堂久久一区二区三区| 一区二区三区成人| 国产精品久久久久一区| 久久亚区不卡日本| 欧美一区二区日韩一区二区| 欧美日韩午夜在线| 色综合天天综合网天天看片| 国产91精品久久久久久久网曝门| 久久超碰97中文字幕| 日韩高清在线一区| 日韩电影一区二区三区| 亚洲午夜电影网| 亚洲国产一区二区三区| 亚洲一区视频在线观看视频| 国产精品每日更新在线播放网址| 国产视频一区二区在线观看| 欧美激情一区二区三区在线| 精品粉嫩超白一线天av| 久久天堂av综合合色蜜桃网| 久久一留热品黄| 亚洲国产精品激情在线观看| 欧美国产精品中文字幕| 国产精品欧美精品| 亚洲乱码国产乱码精品精98午夜| 最新欧美精品一区二区三区| 综合激情成人伊人| 亚洲午夜久久久久中文字幕久| 亚洲h精品动漫在线观看| 亚洲大片一区二区三区| 日韩高清不卡在线| 麻豆freexxxx性91精品| 国产一区二区免费视频| 成人综合在线观看| 94-欧美-setu| 4438亚洲最大| 久久久亚洲综合| 中文字幕中文字幕一区二区| 中文字幕在线播放不卡一区| 亚洲人成影院在线观看| 亚洲第一精品在线| 久久国产福利国产秒拍| www.一区二区| 欧美疯狂性受xxxxx喷水图片| 精品久久久久久久久久久久久久久| 久久久久久久网| 亚洲精品国产成人久久av盗摄 | 亚洲国产精品嫩草影院| 三级久久三级久久| 国产精品亚洲专一区二区三区 | 欧美aaa在线| 国产精品综合视频| 欧美性欧美巨大黑白大战| 制服丝袜成人动漫| 国产精品美女久久久久久2018| 亚洲18女电影在线观看| 国产乱子轮精品视频| 在线观看精品一区| 久久综合中文字幕| 一区二区三区四区蜜桃| 久久99精品一区二区三区| 色婷婷av一区| 中文字幕免费不卡| 琪琪一区二区三区| 日本精品裸体写真集在线观看 | 在线观看91精品国产麻豆| 国产精品丝袜黑色高跟|