Lines Matching defs:in
38 * in the same histogram cell.
42 * have as many boxes as desired colors. Then the mean color in each
50 * Heckbert-style quantizers vary a good deal in their policies for choosing
52 * used here have proved out well in experimental comparisons, but better ones
55 * In earlier versions of the IJG code, this module quantized in YCbCr color
62 * The present code works in the post-conversion color space, typically RGB.
64 * To improve the visual quality of the results, we actually work in scaled
65 * RGB space, giving G distances more weight than R, and R in turn more than
66 * B. To do everything in integer math, we must use integer scale factors.
68 * weights of the colors in the NTSC grayscale equation.
78 * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B
79 * and B,G,R orders. If you define some other weird order in jmorecfg.h,
116 * in that capacity, each cell must be able to store zero to the number of
118 * Since the JPEG code is intended to run in small memory model on 80x86
119 * machines, we can't just allocate the histogram in one chunk. Instead
123 * on 80x86 machines, the pointer row is in near memory but the actual
124 * arrays are in far memory (same arrangement as we use for image arrays).
132 #define HIST_C0_BITS 5 /* bits of precision in R/B histogram */
133 #define HIST_C1_BITS 6 /* bits of precision in G histogram */
134 #define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
169 * current column. (If we are lucky, those variables are in registers, but
176 * Note: on a wide image, we might not have enough room in a PC's near data
188 typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */
219 * is actually output (in fact the buffer controller is probably passing a
400 * Since the differences are expressed in histogram-cell units,
449 * See notes in update_box about scaling distances.
454 /* We want to break any ties in favor of green, then red, blue last.
500 /* Compute representative color for a box, put it in colormap[icolor] */
571 * colors to the nearest color in the selected colormap.
577 * the actual input color, but it's almost as good. A zero in the cache
580 * nearest color for a cell, its colormap index plus one is recorded in the
582 * when they need to use an unfilled entry in the cache.
586 * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
596 * 256Kb at our recommended precision. This is not feasible in DOS machines.
602 * referenced in pass2; many images use only part of the color gamut, so a
607 * and we need not compute their distances to individual cells in the subbox.
611 * size seems to be about 1/512th of the histogram (1/8th in each direction).
617 * with plenty of memory, filling the whole histogram in one shot with Thomas'
623 /* log2(histogram cells in update box) for each axis; this can be adjusted */
628 #define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */
649 * for the nearest entry to some cell(s) in the update box. The update box
652 * placed in colorlist[].
677 /* For each color in colormap, find:
678 * 1. its minimum squared-distance to any point in the update box
680 * 2. its maximum squared-distance to any point in the update box.
682 * We save the minimum distance for each color in mindist[];
688 /* We compute the squared-c0-distance term, then add in the other two. */
761 /* Now we know that no cell in the update box is more than minmaxdist
777 /* Find the closest colormap entry for each cell in the update box,
779 * Return the indexes of the closest entries in the bestcolor[] array.
781 * find the distance from a colormap entry to successive cells in the box.
789 register INT32 dist2; /* current distance in inner loop */
802 * compute its distance to the center of each cell in the box.
806 /* Nominal steps between cell centers ("x" in Thomas article) */
824 /* Now loop over all cells in box, updating distance per Thomas method */
856 /* Fill the inverse-colormap entries in the update box that contains */
886 * for the nearest entry to some cell in the update box.
894 /* Save the best color numbers (plus 1) in the main cache array */
978 /* work right to left in this row */
986 /* work left to right in this row */
1096 * pixels in a dark area, etc.) The standard advice for avoiding this problem
1098 * colors; then repeated errors in the same direction cannot cause cascading
1109 /* Allocate and fill in the error_limiter table */
1113 int in, out;
1123 for (in = 0; in < STEPSIZE; in++, out++) {
1124 table[in] = out; table[-in] = -out;
1127 for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
1128 table[in] = out; table[-in] = -out;
1131 for (; in <= MAXJSAMPLE; in++) {
1132 table[in] = out; table[-in] = -out;
1147 /* Select the representative colors and fill in cinfo->colormap */
1298 * Although we will cope with a later change in dither_mode,