Home | History | Annotate | Download | only in libjpeg

Lines Matching defs:in

35  * In the first pass over the image, we accumulate a histogram showing the
39 * in the same histogram cell.
43 * have as many boxes as desired colors. Then the mean color in each
51 * Heckbert-style quantizers vary a good deal in their policies for choosing
53 * used here have proved out well in experimental comparisons, but better ones
56 * In earlier versions of the IJG code, this module quantized in YCbCr color
63 * The present code works in the post-conversion color space, typically RGB.
65 * To improve the visual quality of the results, we actually work in scaled
66 * RGB space, giving G distances more weight than R, and R in turn more than
67 * B. To do everything in integer math, we must use integer scale factors.
69 * weights of the colors in the NTSC grayscale equation.
79 * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B
80 * and B,G,R orders. If you define some other weird order in jmorecfg.h,
81 * you'll get compile errors until you extend this logic. In that case
111 * (preferably unsigned long) for each cell. In practice this is overkill;
116 * (In the second pass the histogram space is re-used for pixel mapping data;
117 * in that capacity, each cell must be able to store zero to the number of
119 * Since the JPEG code is intended to run in small memory model on 80x86
120 * machines, we can't just allocate the histogram in one chunk. Instead
124 * on 80x86 machines, the pointer row is in near memory but the actual
125 * arrays are in far memory (same arrangement as we use for image arrays).
133 #define HIST_C0_BITS 5 /* bits of precision in R/B histogram */
134 #define HIST_C1_BITS 6 /* bits of precision in G histogram */
135 #define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
170 * current column. (If we are lucky, those variables are in registers, but
177 * Note: on a wide image, we might not have enough room in a PC's near data
189 typedef FSERROR FAR *FSERRPTR; /* pointer to error array (in FAR storage!) */
217 * In this module the prescan simply updates the histogram, which has been
220 * is actually output (in fact the buffer controller is probably passing a
401 * Since the differences are expressed in histogram-cell units,
450 * See notes in update_box about scaling distances.
455 /* We want to break any ties in favor of green, then red, blue last.
501 /* Compute representative color for a box, put it in colormap[icolor] */
572 * colors to the nearest color in the selected colormap.
578 * the actual input color, but it's almost as good. A zero in the cache
581 * nearest color for a cell, its colormap index plus one is recorded in the
583 * when they need to use an unfilled entry in the cache.
587 * calculation described by Spencer W. Thomas in chapter III.1 of Graphics
597 * 256Kb at our recommended precision. This is not feasible in DOS machines.
603 * referenced in pass2; many images use only part of the color gamut, so a
608 * and we need not compute their distances to individual cells in the subbox.
612 * size seems to be about 1/512th of the histogram (1/8th in each direction).
618 * with plenty of memory, filling the whole histogram in one shot with Thomas'
624 /* log2(histogram cells in update box) for each axis; this can be adjusted */
629 #define BOX_C0_ELEMS (1<<BOX_C0_LOG) /* # of hist cells in update box */
650 * for the nearest entry to some cell(s) in the update box. The update box
653 * placed in colorlist[].
678 /* For each color in colormap, find:
679 * 1. its minimum squared-distance to any point in the update box
681 * 2. its maximum squared-distance to any point in the update box.
683 * We save the minimum distance for each color in mindist[];
689 /* We compute the squared-c0-distance term, then add in the other two. */
762 /* Now we know that no cell in the update box is more than minmaxdist
778 /* Find the closest colormap entry for each cell in the update box,
780 * Return the indexes of the closest entries in the bestcolor[] array.
782 * find the distance from a colormap entry to successive cells in the box.
790 register INT32 dist2; /* current distance in inner loop */
803 * compute its distance to the center of each cell in the box.
807 /* Nominal steps between cell centers ("x" in Thomas article) */
825 /* Now loop over all cells in box, updating distance per Thomas method */
857 /* Fill the inverse-colormap entries in the update box that contains */
887 * for the nearest entry to some cell in the update box.
895 /* Save the best color numbers (plus 1) in the main cache array */
979 /* work right to left in this row */
987 /* work left to right in this row */
1097 * pixels in a dark area, etc.) The standard advice for avoiding this problem
1099 * colors; then repeated errors in the same direction cannot cause cascading
1110 /* Allocate and fill in the error_limiter table */
1114 int in, out;
1124 for (in = 0; in < STEPSIZE; in++, out++) {
1125 table[in] = out; table[-in] = -out;
1128 for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1) {
1129 table[in] = out; table[-in] = -out;
1132 for (; in <= MAXJSAMPLE; in++) {
1133 table[in] = out; table[-in] = -out;
1148 /* Select the representative colors and fill in cinfo->colormap */
1299 * Although we will cope with a later change in dither_mode,