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

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

?? jquant2.c

?? WinCE開發技巧與實例的配套源碼
?? 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一区二区三区免费野_久草精品视频
91美女在线视频| 成人动漫视频在线| 亚洲一区在线观看网站| 国产欧美一区二区三区沐欲 | 欧美一卡2卡三卡4卡5免费| 99精品视频在线免费观看| 粉嫩av一区二区三区| 国产一区二区三区不卡在线观看 | 亚洲品质自拍视频| 最新久久zyz资源站| 亚洲女女做受ⅹxx高潮| 亚洲女女做受ⅹxx高潮| 一区二区三区四区视频精品免费| 亚洲精品一二三四区| 亚洲美女精品一区| 亚欧色一区w666天堂| 日韩国产欧美在线视频| 日韩国产精品久久久| 美女视频黄频大全不卡视频在线播放| 日本视频免费一区| 国产成人精品亚洲午夜麻豆| av亚洲产国偷v产偷v自拍| 91麻豆精品在线观看| 欧美日韩精品一区二区| 日韩欧美一级二级三级| 国产午夜精品美女毛片视频| 亚洲日本在线观看| 日韩精品免费视频人成| 国产精品一区二区你懂的| 99re这里只有精品6| 日本韩国欧美在线| 欧美一激情一区二区三区| 中文字幕不卡在线播放| 爽好久久久欧美精品| 国产高清精品网站| 欧美影院午夜播放| 久久这里都是精品| 夜夜嗨av一区二区三区中文字幕| 日韩和欧美一区二区| 丁香一区二区三区| 欧美精品v日韩精品v韩国精品v| 精品毛片乱码1区2区3区| 一区二区三区四区在线免费观看 | 久久久精品影视| 一区二区视频在线看| 久久er99精品| 欧美亚洲国产一区在线观看网站| 2017欧美狠狠色| 亚洲二区在线观看| 99综合影院在线| 久久天天做天天爱综合色| 亚洲国产一区二区在线播放| 懂色av一区二区三区免费看| 日韩一区二区三区视频在线| 亚洲色图制服丝袜| 国产99精品国产| 精品欧美一区二区久久 | 久久先锋影音av鲁色资源 | 7777精品伊人久久久大香线蕉的 | 久久久久免费观看| 日本伊人色综合网| 欧美色视频一区| 亚洲精品中文在线观看| www.欧美.com| 国产精品国产三级国产aⅴ入口| 精品综合久久久久久8888| 欧美日韩免费电影| 亚洲国产精品久久不卡毛片| 91麻豆国产福利在线观看| 国产精品久久久久久久久久免费看| 韩国三级在线一区| 欧美精品一区二区三区在线播放| 日韩精品高清不卡| 欧美肥妇free| 美女视频网站黄色亚洲| 精品久久人人做人人爽| 久久爱另类一区二区小说| 欧美一级高清片| 国内精品嫩模私拍在线| 精品动漫一区二区三区在线观看| 另类小说视频一区二区| 精品日韩一区二区三区| 国产成人精品亚洲日本在线桃色 | 色综合久久中文综合久久97| 国产精品视频在线看| www.av亚洲| 一区二区三区免费观看| 欧美日韩免费观看一区三区| 日日摸夜夜添夜夜添国产精品| 欧美一区永久视频免费观看| 美国毛片一区二区三区| 久久亚洲欧美国产精品乐播| 国产不卡视频一区| 亚洲色图都市小说| 欧美精品三级日韩久久| 精品一区精品二区高清| 国产精品国产自产拍高清av王其| 91在线无精精品入口| 性做久久久久久| 久久久久久久久久久99999| 成人小视频免费观看| 一区二区三区在线免费观看| 欧美视频一二三区| 国产福利一区在线| 亚洲成人激情av| 久久先锋资源网| 欧美综合在线视频| 国产精品一区二区你懂的| 亚洲女人的天堂| 日韩欧美国产精品| 99久久精品免费看国产免费软件| 午夜一区二区三区视频| 久久综合资源网| 欧美亚洲一区二区在线观看| 久久精品国产久精国产爱| 国产精品久久久久永久免费观看| 欧美性生活一区| 国产成人免费视频网站| 亚洲一二三四在线观看| 国产片一区二区三区| 欧美日韩国产综合草草| 成人一区在线观看| 午夜伦欧美伦电影理论片| 国产精品卡一卡二卡三| 精品精品欲导航| 欧美三级日本三级少妇99| 成人国产精品视频| 麻豆成人综合网| 婷婷一区二区三区| 亚洲黄色在线视频| 国产精品久久久久久一区二区三区 | 亚洲精品视频在线看| 久久先锋影音av鲁色资源| 在线播放91灌醉迷j高跟美女| 99精品视频在线观看| 国产一区二区主播在线| 日韩黄色片在线观看| 亚洲一区二区在线观看视频| 亚洲品质自拍视频| 亚洲欧美怡红院| 国产精品久久久久一区二区三区| 久久久午夜精品理论片中文字幕| 欧美一区二区在线免费观看| 欧美日韩色一区| 欧美日韩精品一区二区天天拍小说| 91蜜桃在线观看| 色综合久久综合| 一本大道久久a久久精二百| av欧美精品.com| 国产suv精品一区二区883| 韩国精品主播一区二区在线观看| 美女一区二区三区| 韩国精品一区二区| 国产不卡高清在线观看视频| 国产91精品欧美| 99热在这里有精品免费| 99久久99久久综合| 日本高清不卡一区| 欧美日韩黄视频| 欧美一级日韩一级| 2022国产精品视频| 欧美激情艳妇裸体舞| 亚洲欧美日韩小说| 五月婷婷综合网| 久久99精品国产麻豆婷婷| 国产一区二区三区黄视频 | 亚洲乱码国产乱码精品精小说| 国产精品黄色在线观看| 亚洲一区在线视频观看| 日本视频一区二区| 成人性生交大片免费看中文网站| 97se亚洲国产综合自在线不卡| 在线免费亚洲电影| 日韩三级高清在线| 国产精品久久一卡二卡| 亚洲自拍偷拍九九九| 久久不见久久见免费视频1| 国产成人高清在线| 欧美日韩精品一区二区三区| 精品福利在线导航| 一区二区三区成人| 精品在线观看视频| 欧美专区日韩专区| 亚洲精品一区二区三区影院| 中文字幕亚洲电影| 美女mm1313爽爽久久久蜜臀| www.日韩av| 精品久久久久久久久久久久包黑料| 中文字幕在线不卡国产视频| 肉肉av福利一精品导航| 成人精品电影在线观看| 91精品国产色综合久久不卡电影| 久久综合丝袜日本网| 亚洲综合久久久久| 国产一区二区美女诱惑| 欧美天堂一区二区三区| 国产精品另类一区| 日本不卡123| 在线观看视频一区二区欧美日韩| 2021中文字幕一区亚洲|