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

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

?? jcmaster.c

?? 這是JPEG解碼、編碼的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * jcmaster.c
 *
 * Copyright (C) 1991-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 master control logic for the JPEG compressor.
 * These routines are concerned with parameter validation, initial setup,
 * and inter-pass control (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 enum {
	main_pass,		/* input data, also do first output step */
	huff_opt_pass,		/* Huffman code optimization pass */
	output_pass		/* data output pass */
} c_pass_type;

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

  c_pass_type pass_type;	/* the type of the current pass */

  int pass_number;		/* # of passes completed */
  int total_passes;		/* total # of passes needed */

  int scan_number;		/* current index in scan_info[] */
} my_comp_master;

typedef my_comp_master * my_master_ptr;


/*
 * Support routines that do various essential calculations.
 */

LOCAL(void)
initial_setup (j_compress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
  int ci;
  jpeg_component_info *compptr;
  long samplesperrow;
  JDIMENSION jd_samplesperrow;

  /* Sanity check on image dimensions */
  if (cinfo->image_height <= 0 || cinfo->image_width <= 0
      || cinfo->num_components <= 0 || cinfo->input_components <= 0)
    ERREXIT(cinfo, JERR_EMPTY_IMAGE);

  /* 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)
    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);

  /* Width of an input scanline must be representable as JDIMENSION. */
  samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
  jd_samplesperrow = (JDIMENSION) samplesperrow;
  if ((long) jd_samplesperrow != samplesperrow)
    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);

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

  /* Check that number of components won't exceed internal array sizes */
  if (cinfo->num_components > MAX_COMPONENTS)
    ERREXIT2(cinfo, 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)
      ERREXIT(cinfo, 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);
  }

  /* Compute dimensions of components */
  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
       ci++, compptr++) {
    /* Fill in the correct component_index value; don't rely on application */
    compptr->component_index = ci;
    /* For compression, we never do DCT scaling. */
    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));
    /* 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 (this flag isn't actually used for compression) */
    compptr->component_needed = TRUE;
  }

  /* Compute number of fully interleaved MCU rows (number of times that
   * main controller will call coefficient controller).
   */
  cinfo->total_iMCU_rows = (JDIMENSION)
    jdiv_round_up((long) cinfo->image_height,
		  (long) (cinfo->max_v_samp_factor*DCTSIZE));
}


#ifdef C_MULTISCAN_FILES_SUPPORTED

LOCAL(void)
validate_script (j_compress_ptr cinfo)
/* Verify that the scan script in cinfo->scan_info[] is valid; also
 * determine whether it uses progressive JPEG, and set cinfo->progressive_mode.
 */
{
  const jpeg_scan_info * scanptr;
  int scanno, ncomps, ci, coefi, thisi;
  int Ss, Se, Ah, Al;
  boolean component_sent[MAX_COMPONENTS];
#ifdef C_PROGRESSIVE_SUPPORTED
  int * last_bitpos_ptr;
  int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
  /* -1 until that coefficient has been seen; then last Al for it */
#endif

  if (cinfo->num_scans <= 0)
    ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);

  /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;
   * for progressive JPEG, no scan can have this.
   */
  scanptr = cinfo->scan_info;
  if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) {
#ifdef C_PROGRESSIVE_SUPPORTED
    cinfo->progressive_mode = TRUE;
    last_bitpos_ptr = & last_bitpos[0][0];
    for (ci = 0; ci < cinfo->num_components; ci++) 
      for (coefi = 0; coefi < DCTSIZE2; coefi++)
	*last_bitpos_ptr++ = -1;
#else
    ERREXIT(cinfo, JERR_NOT_COMPILED);
#endif
  } else {
    cinfo->progressive_mode = FALSE;
    for (ci = 0; ci < cinfo->num_components; ci++) 
      component_sent[ci] = FALSE;
  }

  for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {
    /* Validate component indexes */
    ncomps = scanptr->comps_in_scan;
    if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)
      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);
    for (ci = 0; ci < ncomps; ci++) {
      thisi = scanptr->component_index[ci];
      if (thisi < 0 || thisi >= cinfo->num_components)
	ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
      /* Components must appear in SOF order within each scan */
      if (ci > 0 && thisi <= scanptr->component_index[ci-1])
	ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
    }
    /* Validate progression parameters */
    Ss = scanptr->Ss;
    Se = scanptr->Se;
    Ah = scanptr->Ah;
    Al = scanptr->Al;
    if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED
      if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
	  Ah < 0 || Ah > 13 || Al < 0 || Al > 13)
	ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
      if (Ss == 0) {
	if (Se != 0)		/* DC and AC together not OK */
	  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
      } else {
	if (ncomps != 1)	/* AC scans must be for only one component */
	  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
      }
      for (ci = 0; ci < ncomps; ci++) {
	last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
	if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
	  ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
	for (coefi = Ss; coefi <= Se; coefi++) {
	  if (last_bitpos_ptr[coefi] < 0) {
	    /* first scan of this coefficient */
	    if (Ah != 0)
	      ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
	  } else {
	    /* not first scan */
	    if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
	      ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
	  }
	  last_bitpos_ptr[coefi] = Al;
	}
      }
#endif
    } else {
      /* For sequential JPEG, all progression parameters must be these: */
      if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
	ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
      /* Make sure components are not sent twice */
      for (ci = 0; ci < ncomps; ci++) {
	thisi = scanptr->component_index[ci];
	if (component_sent[thisi])
	  ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
	component_sent[thisi] = TRUE;
      }
    }
  }

  /* Now verify that everything got sent. */
  if (cinfo->progressive_mode) {
#ifdef C_PROGRESSIVE_SUPPORTED
    /* For progressive mode, we only check that at least some DC data
     * got sent for each component; the spec does not require that all bits
     * of all coefficients be transmitted.  Would it be wiser to enforce
     * transmission of all coefficient bits??
     */
    for (ci = 0; ci < cinfo->num_components; ci++) {
      if (last_bitpos[ci][0] < 0)
	ERREXIT(cinfo, JERR_MISSING_DATA);
    }
#endif
  } else {
    for (ci = 0; ci < cinfo->num_components; ci++) {
      if (! component_sent[ci])
	ERREXIT(cinfo, JERR_MISSING_DATA);
    }
  }
}

#endif /* C_MULTISCAN_FILES_SUPPORTED */


LOCAL(void)
select_scan_parameters (j_compress_ptr cinfo)
/* Set up the scan parameters for the current scan */
{
  int ci;

#ifdef C_MULTISCAN_FILES_SUPPORTED
  if (cinfo->scan_info != NULL) {
    /* Prepare for current scan --- the script is already validated */
    my_master_ptr master = (my_master_ptr) cinfo->master;
    const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;

    cinfo->comps_in_scan = scanptr->comps_in_scan;
    for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
      cinfo->cur_comp_info[ci] =
	&cinfo->comp_info[scanptr->component_index[ci]];
    }
    cinfo->Ss = scanptr->Ss;
    cinfo->Se = scanptr->Se;
    cinfo->Ah = scanptr->Ah;
    cinfo->Al = scanptr->Al;
  }
  else
#endif
  {
    /* Prepare for single sequential-JPEG scan containing all components */
    if (cinfo->num_components > MAX_COMPS_IN_SCAN)
      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
	       MAX_COMPS_IN_SCAN);
    cinfo->comps_in_scan = cinfo->num_components;
    for (ci = 0; ci < cinfo->num_components; ci++) {
      cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
    }
    cinfo->Ss = 0;
    cinfo->Se = DCTSIZE2-1;
    cinfo->Ah = 0;
    cinfo->Al = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美一区二区精品久导航 | 91亚洲精华国产精华精华液| 欧美精品一区二区三区一线天视频 | 亚洲成人av福利| 欧美久久久久免费| 蜜桃av一区二区| 精品国产1区2区3区| 国产精品亚洲成人| 亚洲三级在线免费观看| 91黄色激情网站| 日韩成人免费电影| 久久精品人人做| 91色视频在线| 秋霞av亚洲一区二区三| 精品福利二区三区| 91浏览器在线视频| 日本一道高清亚洲日美韩| 久久这里只精品最新地址| 成人av网在线| 日韩中文欧美在线| 久久久91精品国产一区二区精品| 成人精品gif动图一区| 亚洲综合色成人| 久久综合成人精品亚洲另类欧美| 99久久精品国产导航| 日本欧美在线观看| 国产精品不卡在线观看| 欧美日韩精品二区第二页| 久久福利视频一区二区| 亚洲色图色小说| 日韩欧美国产小视频| 色婷婷久久一区二区三区麻豆| 看电视剧不卡顿的网站| 亚洲欧洲精品天堂一级| 日韩欧美视频在线| 91黄色在线观看| 国产一区二区三区免费看| 亚洲色图视频网站| 久久综合九色综合97婷婷| 色婷婷亚洲精品| 丁香激情综合国产| 日本不卡视频在线| 一区二区三区中文字幕电影 | 久久久久国产精品麻豆| 欧美美女bb生活片| 99麻豆久久久国产精品免费| 亚洲成人午夜影院| 日韩美女啊v在线免费观看| 日韩欧美你懂的| 欧美日韩一级二级三级| 成人不卡免费av| 国产高清成人在线| 久久电影国产免费久久电影 | 中文字幕精品—区二区四季| 欧美一级一区二区| 欧美色区777第一页| 99久久久精品| 成人一级视频在线观看| 久久国产精品第一页| 性久久久久久久久| 一区二区视频在线看| 国产色综合久久| 欧美精品一区二区三区四区| 欧美日韩国产首页| 日本高清成人免费播放| 国产91对白在线观看九色| 久久99热国产| 久久99精品国产麻豆婷婷| 亚洲不卡在线观看| 亚洲成人1区2区| 亚洲高清不卡在线观看| 一区二区三区波多野结衣在线观看| 国产精品日日摸夜夜摸av| 国产三级一区二区三区| 久久久国产一区二区三区四区小说| 日韩欧美一卡二卡| 欧美精品一区二区三区在线| 欧美精品一区二区三区蜜桃视频| 日韩你懂的在线观看| 精品久久五月天| 欧美精品一区二区三区久久久| 日韩免费视频一区二区| 精品成人私密视频| 国产日韩精品一区二区浪潮av| 久久香蕉国产线看观看99| 精品国产免费一区二区三区四区| 日韩欧美国产三级| 国产日产亚洲精品系列| 国产精品欧美久久久久一区二区| 国产亚洲一区字幕| 一色屋精品亚洲香蕉网站| 亚洲国产精品人人做人人爽| 日韩在线卡一卡二| 狠狠色狠狠色综合日日91app| 看国产成人h片视频| 国产精品一区三区| 91一区一区三区| 欧美色中文字幕| 日韩一区二区三区观看| 精品国产3级a| 亚洲天堂a在线| 日韩中文字幕av电影| 精品一区二区三区的国产在线播放| 精品综合免费视频观看| 国产91丝袜在线播放0| 一本色道久久综合亚洲aⅴ蜜桃| 欧美亚男人的天堂| ww亚洲ww在线观看国产| 17c精品麻豆一区二区免费| 五月综合激情网| 国产一区二区不卡老阿姨| 91在线码无精品| 精品裸体舞一区二区三区| 国产精品少妇自拍| 偷偷要91色婷婷| 成人亚洲一区二区一| 欧美日韩五月天| 中文久久乱码一区二区| 午夜欧美在线一二页| 国产精品99久久久久久宅男| 在线免费观看视频一区| 精品国产乱码久久久久久浪潮| 国产精品久久影院| 麻豆精品在线视频| 欧洲精品一区二区| 国产欧美一区视频| 日韩激情一区二区| 99国产欧美另类久久久精品| 欧美一级爆毛片| 亚洲黄色片在线观看| 国产一区二区伦理片| 欧美日韩中字一区| 综合婷婷亚洲小说| 国产一区二区中文字幕| 7777精品伊人久久久大香线蕉| 国产精品美女一区二区| 久久疯狂做爰流白浆xx| 欧美日韩亚洲高清一区二区| 国产精品久久久久久久久免费丝袜 | 亚洲午夜免费视频| 福利电影一区二区三区| 日韩欧美国产一区二区三区 | 欧美日韩国产影片| 国产女同互慰高潮91漫画| 琪琪一区二区三区| 在线观看亚洲一区| 亚洲欧美综合在线精品| 国产精品亚洲第一| 久久综合久久99| 久久99久久精品| 4438x亚洲最大成人网| 亚洲精品免费在线观看| 丁香婷婷综合激情五月色| 精品国产一区二区三区久久影院| 天天射综合影视| 欧美日韩一区成人| 亚洲第一激情av| 欧洲一区二区av| 亚洲一区免费视频| 欧美在线综合视频| 一区二区三区在线观看动漫| 99久久伊人久久99| 国产精品国产三级国产专播品爱网 | 国产精品无码永久免费888| 韩国欧美一区二区| 精品国产91亚洲一区二区三区婷婷| 男女性色大片免费观看一区二区| 欧美日韩国产在线播放网站| 亚洲综合免费观看高清完整版在线| www.综合网.com| 国产精品国产三级国产普通话99| 国产成人自拍网| 国产免费久久精品| 成人性视频网站| 亚洲欧美自拍偷拍色图| youjizz久久| 一区二区视频免费在线观看| 91久久精品网| 日本欧美一区二区| 精品人在线二区三区| 国内精品伊人久久久久av影院| 亚洲精品一区二区三区香蕉| 国产综合色在线| 欧美激情综合五月色丁香小说| 国产91清纯白嫩初高中在线观看| 国产精品久久久久久久久免费丝袜 | 成人av资源在线观看| 中文字幕五月欧美| 色系网站成人免费| 天堂蜜桃91精品| 精品成人a区在线观看| 国产91色综合久久免费分享| 亚洲欧美日韩国产综合| 精品视频123区在线观看| 美腿丝袜亚洲一区| 欧美激情一区二区三区| 色哟哟在线观看一区二区三区| 亚洲成人av福利| 久久精品网站免费观看| 91亚洲精华国产精华精华液|