Lines Matching defs:in
36 * In the first pass over the image, we accumulate a histogram showing the
40 * in the same histogram cell.
44 * have as many boxes as desired colors. Then the mean color in each
52 * Heckbert-style quantizers vary a good deal in their policies for choosing
54 * used here have proved out well in experimental comparisons, but better ones
57 * In earlier versions of the IJG code, this module quantized in YCbCr color
64 * The present code works in the post-conversion color space, typically RGB.
66 * To improve the visual quality of the results, we actually work in scaled
67 * RGB space, giving G distances more weight than R, and R in turn more than
68 * B. To do everything in integer math, we must use integer scale factors.
70 * weights of the colors in the NTSC grayscale equation.
93 * (preferably unsigned long) for each cell. In practice this is overkill;
98 * (In the second pass the histogram space is re-used for pixel mapping data;
99 * in that capacity, each cell must be able to store zero to the number of
101 * Since the JPEG code is intended to run in small memory model on 80x86
102 * machines, we can't just allocate the histogram in one chunk. Instead
113 #define HIST_C0_BITS 5 /* bits of precision in R/B histogram */
114 #define HIST_C1_BITS 6 /* bits of precision in G histogram */
115 #define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
150 * current column. (If we are lucky, those variables are in registers, but
194 * In this module the prescan simply updates the histogram, which has been
197 * is actually output (in fact the buffer controller is probably passing a
378 * Since the differences are expressed in histogram-cell units,
427 * See notes in update_box about scaling distances.
432 /* We want to break any ties in favor of green, then red, blue last.
479 /* Compute representative color for a box, put it in colormap[icolor] */
550 * colors to the nearest color in the selected colormap.
556 * the actual input color, but it's almost as good. A zero in the cache
559 * nearest color for a cell, its colormap index plus one is recorded in the
561 * when they need to use an unfilled entry in the cache.
565 * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
575 * 256Kb at our recommended precision. This is not feasible in DOS machines.
581 * referenced in pass2; many images use only part of the color gamut, so a
586 * and we need not compute their distances to individual cells in the subbox.
590 * size seems to be about 1/512th of the histogram (1/8th in each direction).
596 * with plenty of memory, filling the whole histogram in one shot with Thomas'
602 /* log2(histogram cells in update box) for each axis; this can be adjusted */
607 #define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */
628 * for the nearest entry to some cell(s) in the update box. The update box
631 * placed in colorlist[].
656 /* For each color in colormap, find:
657 * 1. its minimum squared-distance to any point in the update box
659 * 2. its maximum squared-distance to any point in the update box.
661 * We save the minimum distance for each color in mindist[];
667 /* We compute the squared-c0-distance term, then add in the other two. */
740 /* Now we know that no cell in the update box is more than minmaxdist
756 /* Find the closest colormap entry for each cell in the update box,
758 * Return the indexes of the closest entries in the bestcolor[] array.
760 * find the distance from a colormap entry to successive cells in the box.
768 register INT32 dist2; /* current distance in inner loop */
781 * compute its distance to the center of each cell in the box.
785 /* Nominal steps between cell centers ("x" in Thomas article) */
803 /* Now loop over all cells in box, updating distance per Thomas method */
835 /* Fill the inverse-colormap entries in the update box that contains */
865 * for the nearest entry to some cell in the update box.
873 /* Save the best color numbers (plus 1) in the main cache array */
957 /* work right to left in this row */
965 /* work left to right in this row */
1066 * pixels in a dark area, etc.) The standard advice for avoiding this problem
1068 * colors; then repeated errors in the same direction cannot cause cascading
1079 /* Allocate and fill in the error_limiter table */
1083 int in, out;
1093 for (in = 0; in < STEPSIZE; in++, out++) {
1094 table[in] = out; table[-in] = -out;
1097 for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
1098 table[in] = out; table[-in] = -out;
1101 for (; in <= MAXJSAMPLE; in++) {
1102 table[in] = out; table[-in] = -out;
1117 /* Select the representative colors and fill in cinfo->colormap */
1269 * in dither_mode, we do not promise to honor max_memory_to_use if