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

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

?? jquant2.c

?? 這是JPEG解碼、編碼的源代碼
?? 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一区二区三区免费野_久草精品视频
国产欧美精品一区aⅴ影院| 欧美日韩综合一区| 久久99九九99精品| 免费在线观看成人| 麻豆精品一区二区三区| 日韩av在线发布| 久久精品国产成人一区二区三区| 蜜臀久久久久久久| 久久精品免费看| 国产美女精品一区二区三区| 国产成人h网站| 床上的激情91.| 91蝌蚪porny| 欧美久久久久久久久久| 精品少妇一区二区三区免费观看 | 国产精品一级黄| 国产高清亚洲一区| 99精品国产视频| 欧美体内she精高潮| 欧美一区二区播放| 国产欧美精品在线观看| 一区二区三区中文字幕| 日韩一区精品字幕| 国产99一区视频免费| 一本大道av伊人久久综合| 欧美一区二区视频网站| 国产免费久久精品| 午夜日韩在线观看| 国产成人av一区二区三区在线| 不卡一区在线观看| 欧美日韩精品一区二区三区四区| 精品捆绑美女sm三区| 《视频一区视频二区| 图片区日韩欧美亚洲| 成人网在线播放| 777a∨成人精品桃花网| 中文字幕一区二区三区在线播放| 日日摸夜夜添夜夜添精品视频 | 成人午夜视频网站| 欧美亚一区二区| 久久综合给合久久狠狠狠97色69| 亚洲三级电影网站| 美女视频黄久久| 色激情天天射综合网| 久久综合久久综合亚洲| 亚洲成人中文在线| 成人丝袜18视频在线观看| 欧美一区二区网站| 一级做a爱片久久| 国产成人自拍高清视频在线免费播放| 91久久奴性调教| 日韩中文字幕一区二区三区| 国产成人精品亚洲午夜麻豆| 欧美一区二区三区免费观看视频 | 色94色欧美sute亚洲线路二| 国产亚洲欧美日韩在线一区| 日韩成人免费电影| 日本大香伊一区二区三区| 国产精品丝袜久久久久久app| 日本美女一区二区三区视频| 欧美三级中文字| 亚洲精品亚洲人成人网在线播放| 国产.欧美.日韩| 久久久久久电影| 韩日av一区二区| 日韩欧美电影一二三| 视频一区二区国产| 538在线一区二区精品国产| 夜夜嗨av一区二区三区中文字幕| 成人永久aaa| 国产精品福利一区二区三区| 福利电影一区二区| 国产日韩欧美综合在线| 极品销魂美女一区二区三区| 精品国产自在久精品国产| 热久久久久久久| 精品人伦一区二区色婷婷| 国产中文一区二区三区| 精品美女一区二区| 国产a精品视频| 亚洲人成亚洲人成在线观看图片| 成人黄色一级视频| 亚洲免费在线视频| 色屁屁一区二区| 亚洲午夜激情av| 91精品蜜臀在线一区尤物| 日本午夜一本久久久综合| 日韩一区二区不卡| 极品少妇xxxx精品少妇| 久久久国际精品| 不卡的看片网站| 亚洲综合久久av| 91精品国产一区二区三区香蕉 | av电影在线观看不卡| 国产精品久久久久久久午夜片| 91网站在线观看视频| 亚洲国产日韩一级| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 蜜臀91精品一区二区三区| ww亚洲ww在线观看国产| aaa亚洲精品一二三区| 亚洲国产欧美在线人成| 精品国产成人在线影院 | 91蝌蚪porny成人天涯| 亚洲成av人片在线观看无码| 久久综合久久综合久久综合| av在线播放一区二区三区| 首页国产丝袜综合| 国产精品欧美久久久久无广告 | 亚洲在线观看免费| 欧美大片在线观看一区二区| bt欧美亚洲午夜电影天堂| 亚洲大片免费看| 国产精品久久久久一区二区三区| 欧洲精品中文字幕| 高清久久久久久| 日韩成人精品在线| 亚洲三级小视频| 久久色.com| 欧美一区二区三区在线观看| 91同城在线观看| 国产精品一区二区三区四区 | 日韩欧美国产电影| 波多野结衣中文字幕一区二区三区| 天堂一区二区在线| 亚洲女同ⅹxx女同tv| 久久亚洲一级片| 欧美精品色综合| 日本福利一区二区| 成人aaaa免费全部观看| 久草这里只有精品视频| 午夜不卡av免费| 一区二区三区欧美久久| 国产精品狼人久久影院观看方式| 精品国产百合女同互慰| 538prom精品视频线放| 欧美日韩精品欧美日韩精品一| av资源站一区| 丁香一区二区三区| 国产精品一区二区在线观看网站| 视频一区中文字幕| 亚洲v中文字幕| 亚洲国产欧美在线| 亚洲一区二区视频在线观看| 亚洲欧美另类图片小说| 中文字幕亚洲一区二区va在线| 欧美激情在线看| 国产欧美日韩精品a在线观看| 精品国产乱码久久久久久久久| 欧美一级高清大全免费观看| 69p69国产精品| 欧美精品乱人伦久久久久久| 欧美日韩在线播| 欧美视频一区二区三区四区 | 日本一区二区综合亚洲| 久久日韩粉嫩一区二区三区| 欧美精品一区二区高清在线观看| 精品日韩99亚洲| 国产欧美日韩卡一| 最新成人av在线| 玉足女爽爽91| 婷婷激情综合网| 免费观看在线综合| 国产精一区二区三区| 成人免费毛片片v| 在线观看视频一区| 欧美精品777| 久久久久久一级片| 亚洲女同一区二区| 天堂午夜影视日韩欧美一区二区| 青青草伊人久久| 国产成人精品亚洲日本在线桃色| av激情综合网| 91福利小视频| 精品噜噜噜噜久久久久久久久试看 | 国产女人水真多18毛片18精品视频| 国产性做久久久久久| 亚洲男同性视频| 久色婷婷小香蕉久久| 成人性视频免费网站| 欧美在线高清视频| 久久综合色播五月| 一区二区欧美视频| 国产精品主播直播| 欧美在线视频不卡| 久久午夜老司机| 亚洲国产欧美一区二区三区丁香婷| 久久 天天综合| 欧美体内she精高潮| 久久久精品天堂| 天天爽夜夜爽夜夜爽精品视频| 国产高清不卡二三区| 精品1区2区3区| 亚洲欧洲在线观看av| 欧美96一区二区免费视频| 91在线小视频| 久久久久久久久久久电影| 亚洲国产日韩a在线播放| 国产91丝袜在线播放九色| 9191国产精品|