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

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

?? jquant2.c

?? WinCE開(kāi)發(fā)技巧與實(shí)例的配套源碼
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
  if (c0max > c0min)
    for (c0 = c0min; c0 <= c0max; c0++)
      for (c1 = c1min; c1 <= c1max; c1++) {
	histp = & histogram[c0][c1][c2min];
	for (c2 = c2min; c2 <= c2max; c2++)
	  if (*histp++ != 0) {
	    boxp->c0min = c0min = c0;
	    goto have_c0min;
	  }
      }
 have_c0min:
  if (c0max > c0min)
    for (c0 = c0max; c0 >= c0min; c0--)
      for (c1 = c1min; c1 <= c1max; c1++) {
	histp = & histogram[c0][c1][c2min];
	for (c2 = c2min; c2 <= c2max; c2++)
	  if (*histp++ != 0) {
	    boxp->c0max = c0max = c0;
	    goto have_c0max;
	  }
      }
 have_c0max:
  if (c1max > c1min)
    for (c1 = c1min; c1 <= c1max; c1++)
      for (c0 = c0min; c0 <= c0max; c0++) {
	histp = & histogram[c0][c1][c2min];
	for (c2 = c2min; c2 <= c2max; c2++)
	  if (*histp++ != 0) {
	    boxp->c1min = c1min = c1;
	    goto have_c1min;
	  }
      }
 have_c1min:
  if (c1max > c1min)
    for (c1 = c1max; c1 >= c1min; c1--)
      for (c0 = c0min; c0 <= c0max; c0++) {
	histp = & histogram[c0][c1][c2min];
	for (c2 = c2min; c2 <= c2max; c2++)
	  if (*histp++ != 0) {
	    boxp->c1max = c1max = c1;
	    goto have_c1max;
	  }
      }
 have_c1max:
  if (c2max > c2min)
    for (c2 = c2min; c2 <= c2max; c2++)
      for (c0 = c0min; c0 <= c0max; c0++) {
	histp = & histogram[c0][c1min][c2];
	for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
	  if (*histp != 0) {
	    boxp->c2min = c2min = c2;
	    goto have_c2min;
	  }
      }
 have_c2min:
  if (c2max > c2min)
    for (c2 = c2max; c2 >= c2min; c2--)
      for (c0 = c0min; c0 <= c0max; c0++) {
	histp = & histogram[c0][c1min][c2];
	for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
	  if (*histp != 0) {
	    boxp->c2max = c2max = c2;
	    goto have_c2max;
	  }
      }
 have_c2max:

  /* Update box volume.
   * We use 2-norm rather than real volume here; this biases the method
   * against making long narrow boxes, and it has the side benefit that
   * a box is splittable iff norm > 0.
   * Since the differences are expressed in histogram-cell units,
   * we have to shift back to JSAMPLE units to get consistent distances;
   * after which, we scale according to the selected distance scale factors.
   */
  dist0 = ((c0max - c0min) << C0_SHIFT) * C0_SCALE;
  dist1 = ((c1max - c1min) << C1_SHIFT) * C1_SCALE;
  dist2 = ((c2max - c2min) << C2_SHIFT) * C2_SCALE;
  boxp->volume = dist0*dist0 + dist1*dist1 + dist2*dist2;
  
  /* Now scan remaining volume of box and compute population */
  ccount = 0;
  for (c0 = c0min; c0 <= c0max; c0++)
    for (c1 = c1min; c1 <= c1max; c1++) {
      histp = & histogram[c0][c1][c2min];
      for (c2 = c2min; c2 <= c2max; c2++, histp++)
	if (*histp != 0) {
	  ccount++;
	}
    }
  boxp->colorcount = ccount;
}


LOCAL(int)
median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
	    int desired_colors)
/* Repeatedly select and split the largest box until we have enough boxes */
{
  int n,lb;
  int c0,c1,c2,cmax;
  register boxptr b1,b2;

  while (numboxes < desired_colors) {
    /* Select box to split.
     * Current algorithm: by population for first half, then by volume.
     */
    if (numboxes*2 <= desired_colors) {
      b1 = find_biggest_color_pop(boxlist, numboxes);
    } else {
      b1 = find_biggest_volume(boxlist, numboxes);
    }
    if (b1 == NULL)		/* no splittable boxes left! */
      break;
    b2 = &boxlist[numboxes];	/* where new box will go */
    /* Copy the color bounds to the new box. */
    b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
    b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min;
    /* Choose which axis to split the box on.
     * Current algorithm: longest scaled axis.
     * See notes in update_box about scaling distances.
     */
    c0 = ((b1->c0max - b1->c0min) << C0_SHIFT) * C0_SCALE;
    c1 = ((b1->c1max - b1->c1min) << C1_SHIFT) * C1_SCALE;
    c2 = ((b1->c2max - b1->c2min) << C2_SHIFT) * C2_SCALE;
    /* We want to break any ties in favor of green, then red, blue last.
     * This code does the right thing for R,G,B or B,G,R color orders only.
     */
#if RGB_RED == 0
    cmax = c1; n = 1;
    if (c0 > cmax) { cmax = c0; n = 0; }
    if (c2 > cmax) { n = 2; }
#else
    cmax = c1; n = 1;
    if (c2 > cmax) { cmax = c2; n = 2; }
    if (c0 > cmax) { n = 0; }
#endif
    /* Choose split point along selected axis, and update box bounds.
     * Current algorithm: split at halfway point.
     * (Since the box has been shrunk to minimum volume,
     * any split will produce two nonempty subboxes.)
     * Note that lb value is max for lower box, so must be < old max.
     */
    switch (n) {
    case 0:
      lb = (b1->c0max + b1->c0min) / 2;
      b1->c0max = lb;
      b2->c0min = lb+1;
      break;
    case 1:
      lb = (b1->c1max + b1->c1min) / 2;
      b1->c1max = lb;
      b2->c1min = lb+1;
      break;
    case 2:
      lb = (b1->c2max + b1->c2min) / 2;
      b1->c2max = lb;
      b2->c2min = lb+1;
      break;
    }
    /* Update stats for boxes */
    update_box(cinfo, b1);
    update_box(cinfo, b2);
    numboxes++;
  }
  return numboxes;
}


LOCAL(void)
compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
/* Compute representative color for a box, put it in colormap[icolor] */
{
  /* Current algorithm: mean weighted by pixels (not colors) */
  /* Note it is important to get the rounding correct! */
  my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
  hist3d histogram = cquantize->histogram;
  histptr histp;
  int c0,c1,c2;
  int c0min,c0max,c1min,c1max,c2min,c2max;
  long count;
  long total = 0;
  long c0total = 0;
  long c1total = 0;
  long c2total = 0;
  
  c0min = boxp->c0min;  c0max = boxp->c0max;
  c1min = boxp->c1min;  c1max = boxp->c1max;
  c2min = boxp->c2min;  c2max = boxp->c2max;
  
  for (c0 = c0min; c0 <= c0max; c0++)
    for (c1 = c1min; c1 <= c1max; c1++) {
      histp = & histogram[c0][c1][c2min];
      for (c2 = c2min; c2 <= c2max; c2++) {
	if ((count = *histp++) != 0) {
	  total += count;
	  c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
	  c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count;
	  c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count;
	}
      }
    }
  
  cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total);
  cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total);
  cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total);
}


LOCAL(void)
select_colors (j_decompress_ptr cinfo, int desired_colors)
/* Master routine for color selection */
{
  boxptr boxlist;
  int numboxes;
  int i;

  /* Allocate workspace for box list */
  boxlist = (boxptr) (*cinfo->mem->alloc_small)
    ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box));
  /* Initialize one box containing whole space */
  numboxes = 1;
  boxlist[0].c0min = 0;
  boxlist[0].c0max = MAXJSAMPLE >> C0_SHIFT;
  boxlist[0].c1min = 0;
  boxlist[0].c1max = MAXJSAMPLE >> C1_SHIFT;
  boxlist[0].c2min = 0;
  boxlist[0].c2max = MAXJSAMPLE >> C2_SHIFT;
  /* Shrink it to actually-used volume and set its statistics */
  update_box(cinfo, & boxlist[0]);
  /* Perform median-cut to produce final box list */
  numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors);
  /* Compute the representative color for each box, fill colormap */
  for (i = 0; i < numboxes; i++)
    compute_color(cinfo, & boxlist[i], i);
  cinfo->actual_number_of_colors = numboxes;
  TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes);
}


/*
 * These routines are concerned with the time-critical task of mapping input
 * colors to the nearest color in the selected colormap.
 *
 * We re-use the histogram space as an "inverse color map", essentially a
 * cache for the results of nearest-color searches.  All colors within a
 * histogram cell will be mapped to the same colormap entry, namely the one
 * closest to the cell's center.  This may not be quite the closest entry to
 * the actual input color, but it's almost as good.  A zero in the cache
 * indicates we haven't found the nearest color for that cell yet; the array
 * is cleared to zeroes before starting the mapping pass.  When we find the
 * nearest color for a cell, its colormap index plus one is recorded in the
 * cache for future use.  The pass2 scanning routines call fill_inverse_cmap
 * when they need to use an unfilled entry in the cache.
 *
 * Our method of efficiently finding nearest colors is based on the "locally
 * sorted search" idea described by Heckbert and on the incremental distance
 * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
 * Gems II (James Arvo, ed.  Academic Press, 1991).  Thomas points out that
 * the distances from a given colormap entry to each cell of the histogram can
 * be computed quickly using an incremental method: the differences between
 * distances to adjacent cells themselves differ by a constant.  This allows a
 * fairly fast implementation of the "brute force" approach of computing the
 * distance from every colormap entry to every histogram cell.  Unfortunately,
 * it needs a work array to hold the best-distance-so-far for each histogram
 * cell (because the inner loop has to be over cells, not colormap entries).
 * The work array elements have to be INT32s, so the work array would need
 * 256Kb at our recommended precision.  This is not feasible in DOS machines.
 *
 * To get around these problems, we apply Thomas' method to compute the
 * nearest colors for only the cells within a small subbox of the histogram.
 * The work array need be only as big as the subbox, so the memory usage
 * problem is solved.  Furthermore, we need not fill subboxes that are never
 * referenced in pass2; many images use only part of the color gamut, so a
 * fair amount of work is saved.  An additional advantage of this
 * approach is that we can apply Heckbert's locality criterion to quickly
 * eliminate colormap entries that are far away from the subbox; typically
 * three-fourths of the colormap entries are rejected by Heckbert's criterion,
 * and we need not compute their distances to individual cells in the subbox.
 * The speed of this approach is heavily influenced by the subbox size: too
 * small means too much overhead, too big loses because Heckbert's criterion
 * can't eliminate as many colormap entries.  Empirically the best subbox
 * size seems to be about 1/512th of the histogram (1/8th in each direction).
 *
 * Thomas' article also describes a refined method which is asymptotically
 * faster than the brute-force method, but it is also far more complex and
 * cannot efficiently be applied to small subboxes.  It is therefore not
 * useful for programs intended to be portable to DOS machines.  On machines
 * with plenty of memory, filling the whole histogram in one shot with Thomas'
 * refined method might be faster than the present code --- but then again,
 * it might not be any faster, and it's certainly more complicated.
 */


/* log2(histogram cells in update box) for each axis; this can be adjusted */
#define BOX_C0_LOG  (HIST_C0_BITS-3)
#define BOX_C1_LOG  (HIST_C1_BITS-3)
#define BOX_C2_LOG  (HIST_C2_BITS-3)

#define BOX_C0_ELEMS  (1<<BOX_C0_LOG) /* # of hist cells in update box */
#define BOX_C1_ELEMS  (1<<BOX_C1_LOG)
#define BOX_C2_ELEMS  (1<<BOX_C2_LOG)

#define BOX_C0_SHIFT  (C0_SHIFT + BOX_C0_LOG)
#define BOX_C1_SHIFT  (C1_SHIFT + BOX_C1_LOG)
#define BOX_C2_SHIFT  (C2_SHIFT + BOX_C2_LOG)


/*
 * The next three routines implement inverse colormap filling.  They could
 * all be folded into one big routine, but splitting them up this way saves
 * some stack space (the mindist[] and bestdist[] arrays need not coexist)
 * and may allow some compilers to produce better code by registerizing more
 * inner-loop variables.
 */

LOCAL(int)
find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
		    JSAMPLE colorlist[])
/* Locate the colormap entries close enough to an update box to be candidates
 * for the nearest entry to some cell(s) in the update box.  The update box
 * is specified by the center coordinates of its first cell.  The number of
 * candidate colormap entries is returned, and their colormap indexes are
 * placed in colorlist[].
 * This routine uses Heckbert's "locally sorted search" criterion to select
 * the colors that need further consideration.
 */
{

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品对白一区国产伦| 精品成人a区在线观看| 日本欧美一区二区| 中文一区二区完整视频在线观看| 欧美偷拍一区二区| 国产麻豆一精品一av一免费| 亚洲一区二区高清| 国产性色一区二区| 这里是久久伊人| 91视频免费观看| 国产成人免费视频| 蜜桃av噜噜一区| 亚洲一区二三区| 国产精品夫妻自拍| 久久综合狠狠综合久久综合88| 欧美三级视频在线观看| 91网页版在线| 成人国产视频在线观看| 蜜臀av在线播放一区二区三区| 亚洲欧美一区二区久久| 国产偷国产偷精品高清尤物| 91精品国产综合久久国产大片| 日本电影亚洲天堂一区| 成人久久视频在线观看| 国产在线精品国自产拍免费| 卡一卡二国产精品| 视频一区二区国产| 五月婷婷久久丁香| 亚洲午夜羞羞片| 亚洲另类在线制服丝袜| 成人欧美一区二区三区| 亚洲视频免费在线观看| 国产精品第13页| 国产精品久久久久一区二区三区共| 久久久久97国产精华液好用吗| 欧美成人精品高清在线播放| 欧美高清一级片在线| 欧美女孩性生活视频| 欧美视频日韩视频在线观看| 91黄色在线观看| 欧美性三三影院| 欧美裸体bbwbbwbbw| 911精品产国品一二三产区| 欧美精品一级二级| 欧美一区日韩一区| 精品国产一区二区三区久久影院| 欧美成人三级在线| 国产午夜三级一区二区三| 国产网红主播福利一区二区| 国产精品美女一区二区| 亚洲免费大片在线观看| 亚洲午夜av在线| 日韩中文欧美在线| 久久97超碰国产精品超碰| 激情综合网天天干| 床上的激情91.| 色综合天天综合狠狠| 欧美性色黄大片| 日韩欧美精品在线视频| 久久精品一级爱片| 亚洲女爱视频在线| 午夜av一区二区| 国产一区二区三区免费在线观看 | 久久综合狠狠综合久久综合88| 精品99999| 国产精品久久影院| 亚洲一线二线三线久久久| 午夜欧美大尺度福利影院在线看| 日本vs亚洲vs韩国一区三区二区 | 国产一区二区三区在线观看精品 | 欧美高清你懂得| 日韩欧美电影一二三| 国产精品美女久久久久久| 亚洲精品老司机| 狠狠久久亚洲欧美| 91免费国产视频网站| 日韩一二三四区| 国产精品久久久久影院色老大 | 国产精品网友自拍| 亚洲一区二区三区四区在线免费观看 | 国产在线精品一区二区夜色| 成人永久aaa| 欧美一区二区三区视频在线| 国产精品全国免费观看高清| 亚洲成人黄色影院| 成人精品高清在线| 欧美v日韩v国产v| 亚洲欧美日韩国产中文在线| 精品一区二区三区视频| 日本精品一级二级| 久久久精品tv| 日韩av网站在线观看| 成av人片一区二区| 日韩免费高清av| 亚洲精品欧美在线| 国产成人亚洲综合a∨婷婷图片| 欧美亚洲综合在线| 国产清纯在线一区二区www| 亚洲一区在线视频| 波多野结衣精品在线| 日韩久久久久久| 亚洲一区二区在线观看视频| 粉嫩av一区二区三区| 日韩一区二区电影网| 亚洲最大成人网4388xx| 国产91高潮流白浆在线麻豆| 日韩欧美国产一二三区| 亚洲午夜av在线| 91影院在线免费观看| 久久久久久久一区| 麻豆91精品91久久久的内涵| 欧美天天综合网| 亚洲欧洲av另类| 国产成人精品三级| 精品少妇一区二区三区在线播放| 一区二区三区91| 不卡视频免费播放| 欧美激情自拍偷拍| 韩日av一区二区| 日韩视频一区二区三区| 午夜欧美在线一二页| 91久久精品国产91性色tv| 国产精品久久午夜| 成人午夜视频网站| 国产人伦精品一区二区| 国模一区二区三区白浆| 精品国产在天天线2019| 蜜桃视频在线一区| 91精品国产色综合久久不卡蜜臀 | 国产精品一卡二卡在线观看| 日韩精品综合一本久道在线视频| 亚洲成人免费影院| 欧美日韩激情一区二区三区| 艳妇臀荡乳欲伦亚洲一区| 99久久精品久久久久久清纯| 中文字幕在线播放不卡一区| 福利一区二区在线观看| 国产精品久久久久久亚洲毛片| 不卡视频免费播放| 亚洲日本乱码在线观看| 91福利精品第一导航| 亚洲美女一区二区三区| 欧美中文字幕一区| 性欧美疯狂xxxxbbbb| 在线电影国产精品| 九九视频精品免费| 国产欧美一区二区精品性色| 高清av一区二区| 亚洲三级免费电影| 欧美亚洲另类激情小说| 亚洲超碰精品一区二区| 欧美另类久久久品| 美国毛片一区二区| 国产午夜久久久久| 91麻豆成人久久精品二区三区| 亚洲精品伦理在线| 欧美一区三区四区| 丁香婷婷综合激情五月色| 自拍av一区二区三区| 欧美体内she精视频| 久久av资源网| 国产精品毛片大码女人| 在线观看日韩国产| 欧美96一区二区免费视频| 久久久久国产精品厨房| 97se亚洲国产综合自在线| 亚洲成人自拍一区| 精品成人佐山爱一区二区| 成人高清视频在线观看| 亚洲美女淫视频| 欧美一区二区三区四区视频| 国产91精品在线观看| 亚洲女性喷水在线观看一区| 9191国产精品| 成人av先锋影音| 三级在线观看一区二区| 久久久高清一区二区三区| 91农村精品一区二区在线| 男男视频亚洲欧美| 亚洲日韩欧美一区二区在线| 91精品国产综合久久福利| www.日韩精品| 日韩福利电影在线观看| 亚洲国产电影在线观看| 欧美色偷偷大香| 国产成人av资源| 午夜av一区二区| 亚洲欧美一区二区三区久本道91| 日韩三级伦理片妻子的秘密按摩| 成人av动漫在线| 久久精品国产久精国产爱| 亚洲人成在线观看一区二区| 精品盗摄一区二区三区| 欧美性受xxxx黑人xyx性爽| 国产精品一区专区| 日韩福利视频网| 一区二区三区精密机械公司| 久久精品亚洲国产奇米99| 欧美人妖巨大在线| 91麻豆免费观看|