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

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

?? jquant2.c

?? About JPEG, executable on Visual C++
?? C
?? 第 1 頁 / 共 4 頁
字號:
    } else {
      /* work left to right in this row */
      dir = 1;
      dir3 = 3;
      errorptr = cquantize->fserrors; /* => entry before first real column */
      cquantize->on_odd_row = TRUE; /* flip for next time */
    }
    /* Preset error values: no error propagated to first pixel from left */
    cur0 = cur1 = cur2 = 0;
    /* and no error propagated to row below yet */
    belowerr0 = belowerr1 = belowerr2 = 0;
    bpreverr0 = bpreverr1 = bpreverr2 = 0;

    for (col = width; col > 0; col--) {
      /* curN holds the error propagated from the previous pixel on the
       * current line.  Add the error propagated from the previous line
       * to form the complete error correction term for this pixel, and
       * round the error term (which is expressed * 16) to an integer.
       * RIGHT_SHIFT rounds towards minus infinity, so adding 8 is correct
       * for either sign of the error value.
       * Note: errorptr points to *previous* column's array entry.
       */
      cur0 = RIGHT_SHIFT(cur0 + errorptr[dir3+0] + 8, 4);
      cur1 = RIGHT_SHIFT(cur1 + errorptr[dir3+1] + 8, 4);
      cur2 = RIGHT_SHIFT(cur2 + errorptr[dir3+2] + 8, 4);
      /* Limit the error using transfer function set by init_error_limit.
       * See comments with init_error_limit for rationale.
       */
      cur0 = error_limit[cur0];
      cur1 = error_limit[cur1];
      cur2 = error_limit[cur2];
      /* Form pixel value + error, and range-limit to 0..MAXJSAMPLE.
       * The maximum error is +- MAXJSAMPLE (or less with error limiting);
       * this sets the required size of the range_limit array.
       */
      cur0 += GETJSAMPLE(inptr[0]);
      cur1 += GETJSAMPLE(inptr[1]);
      cur2 += GETJSAMPLE(inptr[2]);
      cur0 = GETJSAMPLE(range_limit[cur0]);
      cur1 = GETJSAMPLE(range_limit[cur1]);
      cur2 = GETJSAMPLE(range_limit[cur2]);
      /* Index into the cache with adjusted pixel value */
      cachep = & histogram[cur0>>C0_SHIFT][cur1>>C1_SHIFT][cur2>>C2_SHIFT];
      /* If we have not seen this color before, find nearest colormap */
      /* entry and update the cache */
      if (*cachep == 0)
	fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT);
      /* Now emit the colormap index for this cell */
      { register int pixcode = *cachep - 1;
	*outptr = (JSAMPLE) pixcode;
	/* Compute representation error for this pixel */
	cur0 -= GETJSAMPLE(colormap0[pixcode]);
	cur1 -= GETJSAMPLE(colormap1[pixcode]);
	cur2 -= GETJSAMPLE(colormap2[pixcode]);
      }
      /* Compute error fractions to be propagated to adjacent pixels.
       * Add these into the running sums, and simultaneously shift the
       * next-line error sums left by 1 column.
       */
      { register LOCFSERROR bnexterr, delta;

	bnexterr = cur0;	/* Process component 0 */
	delta = cur0 * 2;
	cur0 += delta;		/* form error * 3 */
	errorptr[0] = (FSERROR) (bpreverr0 + cur0);
	cur0 += delta;		/* form error * 5 */
	bpreverr0 = belowerr0 + cur0;
	belowerr0 = bnexterr;
	cur0 += delta;		/* form error * 7 */
	bnexterr = cur1;	/* Process component 1 */
	delta = cur1 * 2;
	cur1 += delta;		/* form error * 3 */
	errorptr[1] = (FSERROR) (bpreverr1 + cur1);
	cur1 += delta;		/* form error * 5 */
	bpreverr1 = belowerr1 + cur1;
	belowerr1 = bnexterr;
	cur1 += delta;		/* form error * 7 */
	bnexterr = cur2;	/* Process component 2 */
	delta = cur2 * 2;
	cur2 += delta;		/* form error * 3 */
	errorptr[2] = (FSERROR) (bpreverr2 + cur2);
	cur2 += delta;		/* form error * 5 */
	bpreverr2 = belowerr2 + cur2;
	belowerr2 = bnexterr;
	cur2 += delta;		/* form error * 7 */
      }
      /* At this point curN contains the 7/16 error value to be propagated
       * to the next pixel on the current line, and all the errors for the
       * next line have been shifted over.  We are therefore ready to move on.
       */
      inptr += dir3;		/* Advance pixel pointers to next column */
      outptr += dir;
      errorptr += dir3;		/* advance errorptr to current column */
    }
    /* Post-loop cleanup: we must unload the final error values into the
     * final fserrors[] entry.  Note we need not unload belowerrN because
     * it is for the dummy column before or after the actual array.
     */
    errorptr[0] = (FSERROR) bpreverr0; /* unload prev errs into array */
    errorptr[1] = (FSERROR) bpreverr1;
    errorptr[2] = (FSERROR) bpreverr2;
  }
}


/*
 * Initialize the error-limiting transfer function (lookup table).
 * The raw F-S error computation can potentially compute error values of up to
 * +- MAXJSAMPLE.  But we want the maximum correction applied to a pixel to be
 * much less, otherwise obviously wrong pixels will be created.  (Typical
 * effects include weird fringes at color-area boundaries, isolated bright
 * pixels in a dark area, etc.)  The standard advice for avoiding this problem
 * is to ensure that the "corners" of the color cube are allocated as output
 * colors; then repeated errors in the same direction cannot cause cascading
 * error buildup.  However, that only prevents the error from getting
 * completely out of hand; Aaron Giles reports that error limiting improves
 * the results even with corner colors allocated.
 * A simple clamping of the error values to about +- MAXJSAMPLE/8 works pretty
 * well, but the smoother transfer function used below is even better.  Thanks
 * to Aaron Giles for this idea.
 */

LOCAL(void)
init_error_limit (j_decompress_ptr cinfo)
/* Allocate and fill in the error_limiter table */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  int * table;
  int in, out;

  table = (int *) (*cinfo->mem->alloc_small)
    ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int));
  table += MAXJSAMPLE;		/* so can index -MAXJSAMPLE .. +MAXJSAMPLE */
  cquantize->error_limiter = table;

#define STEPSIZE ((MAXJSAMPLE+1)/16)
  /* Map errors 1:1 up to +- MAXJSAMPLE/16 */
  out = 0;
  for (in = 0; in < STEPSIZE; in++, out++) {
    table[in] = out; table[-in] = -out;
  }
  /* Map errors 1:2 up to +- 3*MAXJSAMPLE/16 */
  for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
    table[in] = out; table[-in] = -out;
  }
  /* Clamp the rest to final out value (which is (MAXJSAMPLE+1)/8) */
  for (; in <= MAXJSAMPLE; in++) {
    table[in] = out; table[-in] = -out;
  }
#undef STEPSIZE
}


/*
 * Finish up at the end of each pass.
 */

METHODDEF(void)
finish_pass1 (j_decompress_ptr cinfo)
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;

  /* Select the representative colors and fill in cinfo->colormap */
  cinfo->colormap = cquantize->sv_colormap;
  select_colors(cinfo, cquantize->desired);
  /* Force next pass to zero the color index table */
  cquantize->needs_zeroed = TRUE;
}


METHODDEF(void)
finish_pass2 (j_decompress_ptr cinfo)
{
  /* no work */
}


/*
 * Initialize for each processing pass.
 */

METHODDEF(void)
start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  hist3d histogram = cquantize->histogram;
  int i;

  /* Only F-S dithering or no dithering is supported. */
  /* If user asks for ordered dither, give him F-S. */
  if (cinfo->dither_mode != JDITHER_NONE)
    cinfo->dither_mode = JDITHER_FS;

  if (is_pre_scan) {
    /* Set up method pointers */
    cquantize->pub.color_quantize = prescan_quantize;
    cquantize->pub.finish_pass = finish_pass1;
    cquantize->needs_zeroed = TRUE; /* Always zero histogram */
  } else {
    /* Set up method pointers */
    if (cinfo->dither_mode == JDITHER_FS)
      cquantize->pub.color_quantize = pass2_fs_dither;
    else
      cquantize->pub.color_quantize = pass2_no_dither;
    cquantize->pub.finish_pass = finish_pass2;

    /* Make sure color count is acceptable */
    i = cinfo->actual_number_of_colors;
    if (i < 1)
      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1);
    if (i > MAXNUMCOLORS)
      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);

    if (cinfo->dither_mode == JDITHER_FS) {
      size_t arraysize = (size_t) ((cinfo->output_width + 2) *
				   (3 * SIZEOF(FSERROR)));
      /* Allocate Floyd-Steinberg workspace if we didn't already. */
      if (cquantize->fserrors == NULL)
	cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
	  ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
      /* Initialize the propagated errors to zero. */
      jzero_far((void FAR *) cquantize->fserrors, arraysize);
      /* Make the error-limit table if we didn't already. */
      if (cquantize->error_limiter == NULL)
	init_error_limit(cinfo);
      cquantize->on_odd_row = FALSE;
    }

  }
  /* Zero the histogram or inverse color map, if necessary */
  if (cquantize->needs_zeroed) {
    for (i = 0; i < HIST_C0_ELEMS; i++) {
      jzero_far((void FAR *) histogram[i],
		HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell));
    }
    cquantize->needs_zeroed = FALSE;
  }
}


/*
 * Switch to a new external colormap between output passes.
 */

METHODDEF(void)
new_color_map_2_quant (j_decompress_ptr cinfo)
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;

  /* Reset the inverse color map */
  cquantize->needs_zeroed = TRUE;
}


/*
 * Module initialization routine for 2-pass color quantization.
 */

GLOBAL(void)
jinit_2pass_quantizer (j_decompress_ptr cinfo)
{
  my_cquantize_ptr cquantize;
  int i;

  cquantize = (my_cquantize_ptr)
    (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
				SIZEOF(my_cquantizer));
  cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
  cquantize->pub.start_pass = start_pass_2_quant;
  cquantize->pub.new_color_map = new_color_map_2_quant;
  cquantize->fserrors = NULL;	/* flag optional arrays not allocated */
  cquantize->error_limiter = NULL;

  /* Make sure jdmaster didn't give me a case I can't handle */
  if (cinfo->out_color_components != 3)
    ERREXIT(cinfo, JERR_NOTIMPL);

  /* Allocate the histogram/inverse colormap storage */
  cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small)
    ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d));
  for (i = 0; i < HIST_C0_ELEMS; i++) {
    cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large)
      ((j_common_ptr) cinfo, JPOOL_IMAGE,
       HIST_C1_ELEMS*HIST_C2_ELEMS * SIZEOF(histcell));
  }
  cquantize->needs_zeroed = TRUE; /* histogram is garbage now */

  /* Allocate storage for the completed colormap, if required.
   * We do this now since it is FAR storage and may affect
   * the memory manager's space calculations.
   */
  if (cinfo->enable_2pass_quant) {
    /* Make sure color count is acceptable */
    int desired = cinfo->desired_number_of_colors;
    /* Lower bound on # of colors ... somewhat arbitrary as long as > 0 */
    if (desired < 8)
      ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
    /* Make sure colormap indexes can be represented by JSAMPLEs */
    if (desired > MAXNUMCOLORS)
      ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
    cquantize->sv_colormap = (*cinfo->mem->alloc_sarray)
      ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3);
    cquantize->desired = desired;
  } else
    cquantize->sv_colormap = NULL;

  /* Only F-S dithering or no dithering is supported. */
  /* If user asks for ordered dither, give him F-S. */
  if (cinfo->dither_mode != JDITHER_NONE)
    cinfo->dither_mode = JDITHER_FS;

  /* Allocate Floyd-Steinberg workspace if necessary.
   * This isn't really needed until pass 2, but again it is FAR storage.
   * Although we will cope with a later change in dither_mode,
   * we do not promise to honor max_memory_to_use if dither_mode changes.
   */
  if (cinfo->dither_mode == JDITHER_FS) {
    cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
      ((j_common_ptr) cinfo, JPOOL_IMAGE,
       (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR))));
    /* Might as well create the error-limiting table too. */
    init_error_limit(cinfo);
  }
}

#endif /* QUANT_2PASS_SUPPORTED */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品电影一区二区| 99久久精品免费看| 日韩亚洲欧美中文三级| 亚洲丝袜另类动漫二区| 欧洲精品在线观看| 亚洲狠狠爱一区二区三区| 69堂亚洲精品首页| 另类中文字幕网| 国产午夜精品福利| av在线一区二区| 一区二区三区资源| 91精品国产入口在线| 精品亚洲成av人在线观看| 国产精品视频线看| 日本精品一区二区三区四区的功能| 一级精品视频在线观看宜春院| 欧美巨大另类极品videosbest| 麻豆精品一区二区| 国产精品电影院| 欧美一区二区久久| 高清shemale亚洲人妖| 亚洲综合成人在线视频| 日韩欧美色综合| 国产成人精品综合在线观看| 亚洲女人的天堂| 欧美成人一区二区三区片免费| 99综合影院在线| 亚洲成av人影院| 欧美精品一区二区三区蜜桃| 波波电影院一区二区三区| 天天色综合成人网| 中文字幕精品一区二区三区精品 | 青青青伊人色综合久久| 国产成人啪免费观看软件| 欧美一区二区三区四区视频| 国产亚洲女人久久久久毛片| 日韩国产一二三区| 91无套直看片红桃| 国产精品天美传媒沈樵| 韩国三级中文字幕hd久久精品| 91福利在线观看| 1区2区3区欧美| 成人丝袜高跟foot| 国产精品福利一区二区| 另类的小说在线视频另类成人小视频在线| 欧美成人一级视频| 7777精品伊人久久久大香线蕉的| 成人av资源在线| 亚洲国产精品自拍| 一本一道波多野结衣一区二区| 国产精品人人做人人爽人人添| 成人免费高清在线观看| 久久精品亚洲一区二区三区浴池| 色视频欧美一区二区三区| 日韩欧美资源站| 亚洲柠檬福利资源导航| 99精品视频在线观看免费| 亚洲男人电影天堂| 亚洲精品高清在线观看| 国产成人精品免费视频网站| 免费看日韩a级影片| 午夜精品国产更新| 欧美一区二区三区免费视频| 成人免费毛片app| 精品制服美女久久| 免费看黄色91| 日韩激情视频网站| 日本伊人色综合网| 亚洲不卡av一区二区三区| 亚洲人成网站在线| 亚洲色图清纯唯美| 亚洲精品日韩综合观看成人91| 国产精品乱人伦| 一个色妞综合视频在线观看| 国产精品久久久久久久久久免费看| 欧美大片一区二区| 精品久久久久久无| 精品国产成人在线影院| www国产成人免费观看视频 深夜成人网| 欧美日韩国产123区| 欧美高清dvd| 91麻豆精品国产| 欧美一级夜夜爽| 日韩视频国产视频| 久久日韩粉嫩一区二区三区| 欧美精品一区二区在线播放| 日韩精品最新网址| 久久久久国产精品麻豆| 国产欧美精品区一区二区三区| 欧美国产成人精品| 最新成人av在线| 亚洲综合一二区| 日韩va欧美va亚洲va久久| 青青草97国产精品免费观看 | 日韩一区二区三区电影在线观看| 欧美日韩免费电影| 欧美电影免费观看高清完整版| 欧美va天堂va视频va在线| 久久久久国产成人精品亚洲午夜| 欧美激情一二三区| 亚洲蜜臀av乱码久久精品蜜桃| 一区二区三区免费网站| 日韩电影免费在线观看网站| 韩国一区二区视频| 91丨porny丨蝌蚪视频| 欧美日韩亚州综合| 久久亚洲精品小早川怜子| 国产精品网曝门| 午夜不卡av在线| 九九国产精品视频| 99久久国产综合精品色伊| 色视频一区二区| 精品国产123| 一区二区三区中文字幕| 毛片av中文字幕一区二区| 成人高清伦理免费影院在线观看| 91久久国产综合久久| 精品欧美黑人一区二区三区| 日韩理论片在线| 国产专区欧美精品| 在线日韩一区二区| 久久青草欧美一区二区三区| 一区二区三区日韩在线观看| 蜜臀av性久久久久蜜臀av麻豆| 99riav久久精品riav| 日韩一区二区高清| 亚洲视频每日更新| 国产曰批免费观看久久久| 91福利国产成人精品照片| 久久久影视传媒| 午夜精品成人在线视频| 国产91精品一区二区麻豆网站| 777久久久精品| 亚洲特级片在线| 国产精品主播直播| 中文字幕精品三区| 久久精品国产精品亚洲红杏| 日本韩国欧美一区| 亚洲国产成人一区二区三区| 日韩av在线发布| 欧美系列在线观看| 国产精品情趣视频| 加勒比av一区二区| 在线成人免费观看| 亚洲最大色网站| 成人激情动漫在线观看| 337p日本欧洲亚洲大胆色噜噜| 亚洲在线视频一区| 一本一道久久a久久精品综合蜜臀| 久久久久久一二三区| 美国一区二区三区在线播放| 欧美丝袜丝交足nylons| 亚洲视频免费观看| 97精品久久久午夜一区二区三区 | 日韩欧美www| 午夜精品123| 欧美日韩视频在线观看一区二区三区| 亚洲国产电影在线观看| 国产乱对白刺激视频不卡| 精品久久久久一区| 蜜桃视频第一区免费观看| 欧美精品九九99久久| 午夜视频一区在线观看| 欧美日韩一区国产| 五月婷婷久久综合| 777亚洲妇女| 蓝色福利精品导航| 日韩区在线观看| 久久精品国产精品亚洲精品| 精品国产欧美一区二区| 久久成人久久爱| 久久综合狠狠综合久久激情| 国产一区三区三区| 国产午夜精品福利| www.欧美亚洲| 亚洲精选在线视频| 欧美性猛交xxxxxxxx| 日日夜夜精品免费视频| 日韩欧美在线观看一区二区三区| 日韩精品一级二级| 精品久久久久久无| 粉嫩av一区二区三区| 亚洲欧洲国产日本综合| 日本高清不卡视频| 亚欧色一区w666天堂| 欧美一级视频精品观看| 日本欧美韩国一区三区| 欧美精品一区二区三区高清aⅴ| 国产一区二区三区国产| 亚洲成人综合视频| 日韩一区二区在线看| 国产在线精品一区二区不卡了 | 久久奇米777| 99久久综合色| 亚洲成人你懂的| 欧美变态口味重另类| www.性欧美| 亚洲va欧美va人人爽| 精品久久人人做人人爽| 96av麻豆蜜桃一区二区|