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

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

?? jquant2.c

?? About JPEG, executable on Visual C++
?? C
?? 第 1 頁 / 共 4 頁
字號:
  int numcolors = cinfo->actual_number_of_colors;
  int maxc0, maxc1, maxc2;
  int centerc0, centerc1, centerc2;
  int i, x, ncolors;
  INT32 minmaxdist, min_dist, max_dist, tdist;
  INT32 mindist[MAXNUMCOLORS];	/* min distance to colormap entry i */

  /* Compute true coordinates of update box's upper corner and center.
   * Actually we compute the coordinates of the center of the upper-corner
   * histogram cell, which are the upper bounds of the volume we care about.
   * Note that since ">>" rounds down, the "center" values may be closer to
   * min than to max; hence comparisons to them must be "<=", not "<".
   */
  maxc0 = minc0 + ((1 << BOX_C0_SHIFT) - (1 << C0_SHIFT));
  centerc0 = (minc0 + maxc0) >> 1;
  maxc1 = minc1 + ((1 << BOX_C1_SHIFT) - (1 << C1_SHIFT));
  centerc1 = (minc1 + maxc1) >> 1;
  maxc2 = minc2 + ((1 << BOX_C2_SHIFT) - (1 << C2_SHIFT));
  centerc2 = (minc2 + maxc2) >> 1;

  /* For each color in colormap, find:
   *  1. its minimum squared-distance to any point in the update box
   *     (zero if color is within update box);
   *  2. its maximum squared-distance to any point in the update box.
   * Both of these can be found by considering only the corners of the box.
   * We save the minimum distance for each color in mindist[];
   * only the smallest maximum distance is of interest.
   */
  minmaxdist = 0x7FFFFFFFL;

  for (i = 0; i < numcolors; i++) {
    /* We compute the squared-c0-distance term, then add in the other two. */
    x = GETJSAMPLE(cinfo->colormap[0][i]);
    if (x < minc0) {
      tdist = (x - minc0) * C0_SCALE;
      min_dist = tdist*tdist;
      tdist = (x - maxc0) * C0_SCALE;
      max_dist = tdist*tdist;
    } else if (x > maxc0) {
      tdist = (x - maxc0) * C0_SCALE;
      min_dist = tdist*tdist;
      tdist = (x - minc0) * C0_SCALE;
      max_dist = tdist*tdist;
    } else {
      /* within cell range so no contribution to min_dist */
      min_dist = 0;
      if (x <= centerc0) {
	tdist = (x - maxc0) * C0_SCALE;
	max_dist = tdist*tdist;
      } else {
	tdist = (x - minc0) * C0_SCALE;
	max_dist = tdist*tdist;
      }
    }

    x = GETJSAMPLE(cinfo->colormap[1][i]);
    if (x < minc1) {
      tdist = (x - minc1) * C1_SCALE;
      min_dist += tdist*tdist;
      tdist = (x - maxc1) * C1_SCALE;
      max_dist += tdist*tdist;
    } else if (x > maxc1) {
      tdist = (x - maxc1) * C1_SCALE;
      min_dist += tdist*tdist;
      tdist = (x - minc1) * C1_SCALE;
      max_dist += tdist*tdist;
    } else {
      /* within cell range so no contribution to min_dist */
      if (x <= centerc1) {
	tdist = (x - maxc1) * C1_SCALE;
	max_dist += tdist*tdist;
      } else {
	tdist = (x - minc1) * C1_SCALE;
	max_dist += tdist*tdist;
      }
    }

    x = GETJSAMPLE(cinfo->colormap[2][i]);
    if (x < minc2) {
      tdist = (x - minc2) * C2_SCALE;
      min_dist += tdist*tdist;
      tdist = (x - maxc2) * C2_SCALE;
      max_dist += tdist*tdist;
    } else if (x > maxc2) {
      tdist = (x - maxc2) * C2_SCALE;
      min_dist += tdist*tdist;
      tdist = (x - minc2) * C2_SCALE;
      max_dist += tdist*tdist;
    } else {
      /* within cell range so no contribution to min_dist */
      if (x <= centerc2) {
	tdist = (x - maxc2) * C2_SCALE;
	max_dist += tdist*tdist;
      } else {
	tdist = (x - minc2) * C2_SCALE;
	max_dist += tdist*tdist;
      }
    }

    mindist[i] = min_dist;	/* save away the results */
    if (max_dist < minmaxdist)
      minmaxdist = max_dist;
  }

  /* Now we know that no cell in the update box is more than minmaxdist
   * away from some colormap entry.  Therefore, only colors that are
   * within minmaxdist of some part of the box need be considered.
   */
  ncolors = 0;
  for (i = 0; i < numcolors; i++) {
    if (mindist[i] <= minmaxdist)
      colorlist[ncolors++] = (JSAMPLE) i;
  }
  return ncolors;
}


LOCAL(void)
find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
		  int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
/* Find the closest colormap entry for each cell in the update box,
 * given the list of candidate colors prepared by find_nearby_colors.
 * Return the indexes of the closest entries in the bestcolor[] array.
 * This routine uses Thomas' incremental distance calculation method to
 * find the distance from a colormap entry to successive cells in the box.
 */
{
  int ic0, ic1, ic2;
  int i, icolor;
  register INT32 * bptr;	/* pointer into bestdist[] array */
  JSAMPLE * cptr;		/* pointer into bestcolor[] array */
  INT32 dist0, dist1;		/* initial distance values */
  register INT32 dist2;		/* current distance in inner loop */
  INT32 xx0, xx1;		/* distance increments */
  register INT32 xx2;
  INT32 inc0, inc1, inc2;	/* initial values for increments */
  /* This array holds the distance to the nearest-so-far color for each cell */
  INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];

  /* Initialize best-distance for each cell of the update box */
  bptr = bestdist;
  for (i = BOX_C0_ELEMS*BOX_C1_ELEMS*BOX_C2_ELEMS-1; i >= 0; i--)
    *bptr++ = 0x7FFFFFFFL;
  
  /* For each color selected by find_nearby_colors,
   * compute its distance to the center of each cell in the box.
   * If that's less than best-so-far, update best distance and color number.
   */
  
  /* Nominal steps between cell centers ("x" in Thomas article) */
#define STEP_C0  ((1 << C0_SHIFT) * C0_SCALE)
#define STEP_C1  ((1 << C1_SHIFT) * C1_SCALE)
#define STEP_C2  ((1 << C2_SHIFT) * C2_SCALE)
  
  for (i = 0; i < numcolors; i++) {
    icolor = GETJSAMPLE(colorlist[i]);
    /* Compute (square of) distance from minc0/c1/c2 to this color */
    inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE;
    dist0 = inc0*inc0;
    inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE;
    dist0 += inc1*inc1;
    inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE;
    dist0 += inc2*inc2;
    /* Form the initial difference increments */
    inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
    inc1 = inc1 * (2 * STEP_C1) + STEP_C1 * STEP_C1;
    inc2 = inc2 * (2 * STEP_C2) + STEP_C2 * STEP_C2;
    /* Now loop over all cells in box, updating distance per Thomas method */
    bptr = bestdist;
    cptr = bestcolor;
    xx0 = inc0;
    for (ic0 = BOX_C0_ELEMS-1; ic0 >= 0; ic0--) {
      dist1 = dist0;
      xx1 = inc1;
      for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) {
	dist2 = dist1;
	xx2 = inc2;
	for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) {
	  if (dist2 < *bptr) {
	    *bptr = dist2;
	    *cptr = (JSAMPLE) icolor;
	  }
	  dist2 += xx2;
	  xx2 += 2 * STEP_C2 * STEP_C2;
	  bptr++;
	  cptr++;
	}
	dist1 += xx1;
	xx1 += 2 * STEP_C1 * STEP_C1;
      }
      dist0 += xx0;
      xx0 += 2 * STEP_C0 * STEP_C0;
    }
  }
}


LOCAL(void)
fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
/* Fill the inverse-colormap entries in the update box that contains */
/* histogram cell c0/c1/c2.  (Only that one cell MUST be filled, but */
/* we can fill as many others as we wish.) */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  hist3d histogram = cquantize->histogram;
  int minc0, minc1, minc2;	/* lower left corner of update box */
  int ic0, ic1, ic2;
  register JSAMPLE * cptr;	/* pointer into bestcolor[] array */
  register histptr cachep;	/* pointer into main cache array */
  /* This array lists the candidate colormap indexes. */
  JSAMPLE colorlist[MAXNUMCOLORS];
  int numcolors;		/* number of candidate colors */
  /* This array holds the actually closest colormap index for each cell. */
  JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];

  /* Convert cell coordinates to update box ID */
  c0 >>= BOX_C0_LOG;
  c1 >>= BOX_C1_LOG;
  c2 >>= BOX_C2_LOG;

  /* Compute true coordinates of update box's origin corner.
   * Actually we compute the coordinates of the center of the corner
   * histogram cell, which are the lower bounds of the volume we care about.
   */
  minc0 = (c0 << BOX_C0_SHIFT) + ((1 << C0_SHIFT) >> 1);
  minc1 = (c1 << BOX_C1_SHIFT) + ((1 << C1_SHIFT) >> 1);
  minc2 = (c2 << BOX_C2_SHIFT) + ((1 << C2_SHIFT) >> 1);
  
  /* Determine which colormap entries are close enough to be candidates
   * for the nearest entry to some cell in the update box.
   */
  numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist);

  /* Determine the actually nearest colors. */
  find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
		   bestcolor);

  /* Save the best color numbers (plus 1) in the main cache array */
  c0 <<= BOX_C0_LOG;		/* convert ID back to base cell indexes */
  c1 <<= BOX_C1_LOG;
  c2 <<= BOX_C2_LOG;
  cptr = bestcolor;
  for (ic0 = 0; ic0 < BOX_C0_ELEMS; ic0++) {
    for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
      cachep = & histogram[c0+ic0][c1+ic1][c2];
      for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
	*cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1);
      }
    }
  }
}


/*
 * Map some rows of pixels to the output colormapped representation.
 */

METHODDEF(void)
pass2_no_dither (j_decompress_ptr cinfo,
		 JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
/* This version performs no dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  hist3d histogram = cquantize->histogram;
  register JSAMPROW inptr, outptr;
  register histptr cachep;
  register int c0, c1, c2;
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;

  for (row = 0; row < num_rows; row++) {
    inptr = input_buf[row];
    outptr = output_buf[row];
    for (col = width; col > 0; col--) {
      /* get pixel value and index into the cache */
      c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT;
      c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT;
      c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT;
      cachep = & histogram[c0][c1][c2];
      /* If we have not seen this color before, find nearest colormap entry */
      /* and update the cache */
      if (*cachep == 0)
	fill_inverse_cmap(cinfo, c0,c1,c2);
      /* Now emit the colormap index for this cell */
      *outptr++ = (JSAMPLE) (*cachep - 1);
    }
  }
}


METHODDEF(void)
pass2_fs_dither (j_decompress_ptr cinfo,
		 JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
/* This version performs Floyd-Steinberg dithering */
{
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  hist3d histogram = cquantize->histogram;
  register LOCFSERROR cur0, cur1, cur2;	/* current error or pixel value */
  LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */
  LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */
  register FSERRPTR errorptr;	/* => fserrors[] at column before current */
  JSAMPROW inptr;		/* => current input pixel */
  JSAMPROW outptr;		/* => current output pixel */
  histptr cachep;
  int dir;			/* +1 or -1 depending on direction */
  int dir3;			/* 3*dir, for advancing inptr & errorptr */
  int row;
  JDIMENSION col;
  JDIMENSION width = cinfo->output_width;
  JSAMPLE *range_limit = cinfo->sample_range_limit;
  int *error_limit = cquantize->error_limiter;
  JSAMPROW colormap0 = cinfo->colormap[0];
  JSAMPROW colormap1 = cinfo->colormap[1];
  JSAMPROW colormap2 = cinfo->colormap[2];
  SHIFT_TEMPS

  for (row = 0; row < num_rows; row++) {
    inptr = input_buf[row];
    outptr = output_buf[row];
    if (cquantize->on_odd_row) {
      /* work right to left in this row */
      inptr += (width-1) * 3;	/* so point to rightmost pixel */
      outptr += width-1;
      dir = -1;
      dir3 = -3;
      errorptr = cquantize->fserrors + (width+1)*3; /* => entry after last column */
      cquantize->on_odd_row = FALSE; /* flip for next time */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品91xxx| 激情欧美日韩一区二区| 国产欧美视频一区二区三区| 日韩视频123| 日韩欧美国产综合在线一区二区三区| 91福利资源站| 欧美色区777第一页| 欧美日韩小视频| 欧美一区二区在线观看| 在线成人高清不卡| 欧美日韩成人高清| 欧美一级xxx| 精品日韩av一区二区| 国产丝袜美腿一区二区三区| 国产精品久久影院| 亚洲主播在线观看| 日本视频中文字幕一区二区三区| 全国精品久久少妇| 成人永久aaa| 在线观看国产91| 91麻豆精品国产无毒不卡在线观看| 欧美一区二区三区公司| 久久久九九九九| 亚洲美女精品一区| 青青草原综合久久大伊人精品| 久久精品国产亚洲a| 成人小视频免费观看| 91女人视频在线观看| 欧美一区二区三区在线| 国产欧美日韩不卡免费| 亚洲妇熟xx妇色黄| 成人午夜视频在线| 欧美亚一区二区| 久久婷婷色综合| 亚洲人xxxx| 国内精品嫩模私拍在线| 91亚洲永久精品| 日韩欧美国产一区二区在线播放 | 亚洲大片一区二区三区| 另类人妖一区二区av| 91香蕉视频mp4| 欧美大胆一级视频| 亚洲综合图片区| 国产一区二区三区国产| 精品视频免费看| 日本一区二区三区在线不卡| 日本aⅴ亚洲精品中文乱码| 99久久99久久精品免费看蜜桃| 欧美精品777| 亚洲欧洲韩国日本视频| 精品综合久久久久久8888| 欧美在线播放高清精品| 亚洲国产精品v| 久久成人免费网| 欧美日韩国产一级片| 亚洲乱码一区二区三区在线观看| 国产一区二区免费看| 欧美熟乱第一页| 亚洲欧洲av在线| 国产精品一区2区| 91精品国产91久久久久久一区二区| 最近日韩中文字幕| 丁香一区二区三区| 久久久噜噜噜久久人人看| 麻豆精品视频在线观看视频| 欧美精品久久久久久久久老牛影院| 亚洲激情六月丁香| 国产一区二区三区四区在线观看| 在线电影一区二区三区| 图片区小说区区亚洲影院| 日本精品裸体写真集在线观看 | av影院午夜一区| 久久久久国产成人精品亚洲午夜| 麻豆成人免费电影| 91精品蜜臀在线一区尤物| 亚洲高清在线精品| 欧美日韩国产影片| 午夜精彩视频在线观看不卡| 在线观看视频一区| 亚洲三级久久久| av一区二区三区黑人| 日韩理论片在线| 欧美中文字幕不卡| 亚洲午夜国产一区99re久久| 欧美人体做爰大胆视频| 香蕉av福利精品导航| 日韩欧美精品在线| 久久爱www久久做| 久久久久久免费| 国产精品538一区二区在线| 中国av一区二区三区| 一本高清dvd不卡在线观看| 亚洲国产一区二区在线播放| 欧美色视频在线| 精品一区二区三区视频| 国产欧美综合色| 色狠狠色狠狠综合| 秋霞影院一区二区| 国产欧美一区二区精品性| 99久久婷婷国产精品综合| 亚洲综合色区另类av| 日韩欧美高清dvd碟片| 国产91综合一区在线观看| 亚洲精品中文在线| 日韩限制级电影在线观看| 成人免费视频播放| 亚洲国产色一区| 久久久亚洲高清| 91久久香蕉国产日韩欧美9色| 青青青伊人色综合久久| 中文字幕制服丝袜成人av| 欧洲一区二区av| 国产精品一区二区在线看| 亚洲国产日韩在线一区模特| 久久综合av免费| 欧美午夜精品一区二区蜜桃 | 国产精品免费视频一区| 欧美在线free| 国产91精品久久久久久久网曝门 | 欧美成人一区二区三区| 波波电影院一区二区三区| 日韩和的一区二区| 亚洲欧洲另类国产综合| 日韩午夜激情免费电影| 91麻豆国产精品久久| 激情六月婷婷久久| 亚洲h在线观看| 中文字幕五月欧美| 久久无码av三级| 欧美一区二区视频观看视频 | 日本美女一区二区三区| 国产精品卡一卡二| 国产亚洲短视频| 日韩三级免费观看| 欧美在线观看一区| 色欧美乱欧美15图片| 国产69精品久久99不卡| 国产一区二区按摩在线观看| 日韩高清不卡一区二区| 一区二区三区日本| 亚洲男女毛片无遮挡| 国产精品久久久久久亚洲伦| 久久久久久久久一| 日韩精品一区二区三区四区 | 在线免费精品视频| www.欧美.com| 国产精品一区二区黑丝| 国产一区二区三区免费看| 久久99国产精品麻豆| 日本麻豆一区二区三区视频| 日韩精品久久久久久| 视频一区欧美日韩| 蜜桃一区二区三区四区| 日韩不卡手机在线v区| 欧美aaa在线| 久久国产夜色精品鲁鲁99| 伦理电影国产精品| 韩国午夜理伦三级不卡影院| 国产成人精品午夜视频免费| 国产一区二区三区电影在线观看| 韩国精品免费视频| 国产精品一区二区三区四区| 成人午夜免费av| av男人天堂一区| 91成人网在线| 欧美片在线播放| 欧美成人午夜电影| 久久精品一区二区三区四区| 欧美国产综合一区二区| 亚洲三级久久久| 日韩精品成人一区二区三区| 国内精品伊人久久久久影院对白| 国产精品一区专区| 91免费看视频| 日韩欧美资源站| 亚洲国产精品二十页| 一区二区三区中文免费| 美脚の诱脚舐め脚责91| 成人永久aaa| 欧美日韩一区二区欧美激情| 精品国产乱码久久久久久图片| 国产日韩精品一区二区浪潮av| 1000部国产精品成人观看| 亚洲国产毛片aaaaa无费看| 久久成人18免费观看| 成人av综合一区| 欧美久久免费观看| 日本一区二区三区高清不卡| 亚洲国产精品视频| 国产精品一线二线三线精华| 欧美日韩在线精品一区二区三区激情 | 国产精品国产三级国产普通话蜜臀| 一区二区三区在线影院| 国产美女视频一区| 欧美日韩亚州综合| 国产精品理伦片| 韩国三级中文字幕hd久久精品| 91蝌蚪porny成人天涯| 精品国产精品一区二区夜夜嗨| 亚洲精品网站在线观看|