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

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

?? jquant2.c

?? WinCE開發技巧與實例的配套源碼
?? 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一区二区三区免费野_久草精品视频
精品一区二区三区免费视频| 欧美一卡二卡在线| 亚洲综合在线观看视频| 色狠狠一区二区三区香蕉| 日韩精品乱码av一区二区| 日韩视频免费观看高清完整版| 看电视剧不卡顿的网站| 欧美激情在线看| 欧美一卡2卡三卡4卡5免费| 麻豆极品一区二区三区| 精品国产一区a| 精品三级在线观看| 国产亚洲一区二区三区四区 | 精品久久久久久最新网址| 精品国产乱码久久久久久浪潮 | 欧美电视剧在线看免费| 91影院在线观看| 麻豆高清免费国产一区| 一区二区三区四区不卡在线| 久久免费电影网| 久久综合九色综合久久久精品综合| 欧美性大战久久久| 成a人片亚洲日本久久| 成人免费视频一区二区| 国产精品香蕉一区二区三区| 国产一区欧美一区| 国产主播一区二区三区| 国产精品一区免费在线观看| 黄网站免费久久| 丁香亚洲综合激情啪啪综合| 成人毛片在线观看| 欧美一级艳片视频免费观看| 国产美女在线精品| 国产精品久久久久久久裸模 | 夜色激情一区二区| 欧美剧在线免费观看网站| 成人午夜看片网址| av动漫一区二区| 在线精品视频一区二区三四| 色婷婷综合久久久久中文 | 国产精品网站一区| 亚洲码国产岛国毛片在线| 亚洲中国最大av网站| 日韩av午夜在线观看| 人人狠狠综合久久亚洲| 国产盗摄一区二区三区| 色婷婷国产精品综合在线观看| 欧美日韩激情一区二区三区| 91精品国产日韩91久久久久久| 久久综合狠狠综合久久综合88| 国产精品妹子av| 美女网站色91| 色菇凉天天综合网| 日韩欧美123| 日韩激情中文字幕| yourporn久久国产精品| 精品日韩在线一区| 亚洲成人在线观看视频| www.亚洲在线| 国产三级一区二区三区| 麻豆成人av在线| 欧美日韩精品一区二区| 亚洲日穴在线视频| 9色porny自拍视频一区二区| 欧美一区二区三区免费| 性欧美疯狂xxxxbbbb| 色菇凉天天综合网| 亚洲久草在线视频| 欧美在线你懂的| 亚洲国产精品一区二区www| 在线观看中文字幕不卡| 亚洲欧美国产高清| 日本丶国产丶欧美色综合| 亚洲精品欧美专区| 欧洲视频一区二区| 日本不卡一区二区三区高清视频| 欧美色网站导航| 日韩福利电影在线观看| 精品免费日韩av| 国产精品亚洲成人| 亚洲天堂精品在线观看| 欧美在线999| 国产在线不卡一卡二卡三卡四卡| 中文一区在线播放| av一二三不卡影片| 色综合天天综合色综合av| 成人国产精品免费| 国产日韩欧美a| 精品免费99久久| 欧美一区二区三区视频免费播放 | 亚洲欧美在线高清| 国产欧美日韩三级| 欧美激情一区二区三区四区| 国产无遮挡一区二区三区毛片日本| 在线播放中文一区| 欧美性色欧美a在线播放| 国产麻豆精品95视频| 精品亚洲国产成人av制服丝袜 | 国产午夜精品一区二区三区嫩草| 在线精品视频小说1| 色综合久久久久综合99| 精品一区二区三区在线播放| 午夜亚洲国产au精品一区二区| 国产精品污www在线观看| 久久中文字幕电影| 久久亚洲综合色| 久久先锋影音av鲁色资源网| 久久这里只精品最新地址| 4438亚洲最大| 日韩免费观看2025年上映的电影| 欧美日韩国产片| 国产日韩精品一区二区三区在线| 国产日韩av一区二区| 国产精品美女久久久久av爽李琼| 26uuu亚洲综合色| 国产亚洲视频系列| 专区另类欧美日韩| 亚洲成人免费看| 丁香六月综合激情| 一本大道久久精品懂色aⅴ| 欧美日本在线一区| 欧美成人午夜电影| 中文字幕亚洲综合久久菠萝蜜| 18成人在线视频| 午夜精品久久久久久久久| 免费欧美在线视频| 欧美性一级生活| 亚洲国产精华液网站w| 蜜臀av性久久久久蜜臀aⅴ| 日韩一区二区在线观看视频播放| 亚洲综合色丁香婷婷六月图片| 91国偷自产一区二区使用方法| 日韩女优av电影在线观看| 亚洲主播在线播放| 色呦呦日韩精品| 亚洲视频资源在线| eeuss国产一区二区三区| 精品国内片67194| 日本成人中文字幕| 91麻豆精品久久久久蜜臀| 亚洲美女电影在线| 色乱码一区二区三区88| 亚洲免费观看高清完整版在线| 国产精品538一区二区在线| 4hu四虎永久在线影院成人| 亚洲成av人片在线观看无码| 在线一区二区三区四区五区| 一区二区三区毛片| 亚洲国产综合人成综合网站| 国产aⅴ综合色| 亚洲成人动漫av| 亚洲国产精品久久一线不卡| 欧美色图在线观看| 国产精品一区二区x88av| 伊人开心综合网| 久久九九全国免费| 欧美日韩高清一区| 成人福利电影精品一区二区在线观看| 一级日本不卡的影视| 国产亚洲视频系列| 91原创在线视频| 亚洲男人的天堂在线观看| 一级日本不卡的影视| 26uuu国产一区二区三区| 亚洲一区二区三区四区五区中文 | 成人午夜碰碰视频| 91丨porny丨户外露出| 精品少妇一区二区三区视频免付费| 日本一区二区三区高清不卡| 久久精品72免费观看| 在线视频欧美精品| 亚洲精品自拍动漫在线| 成a人片亚洲日本久久| 久久久精品一品道一区| 麻豆精品视频在线观看免费| 91麻豆精品国产91久久久久久久久| 中文字幕精品—区二区四季| 国产精品白丝jk白祙喷水网站| 欧美一区二区视频在线观看 | 亚洲欧美乱综合| 成人av在线一区二区三区| 久久久久国产免费免费| 乱中年女人伦av一区二区| 国产日韩av一区二区| 国产黄色精品网站| 国产精品久久久久久久岛一牛影视 | 亚洲男同性视频| 国产一区二区三区精品欧美日韩一区二区三区| 91最新地址在线播放| 国产麻豆成人精品| 欧美做爰猛烈大尺度电影无法无天| 3d动漫精品啪啪一区二区竹菊| 精品久久免费看| 国产精品国产自产拍在线| 26uuu另类欧美| 亚洲人快播电影网| 91亚洲永久精品| 亚洲蜜臀av乱码久久精品| av午夜一区麻豆| 亚洲精品乱码久久久久久黑人|