Lines Matching refs:cinfo
228 prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
231 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
237 JDIMENSION width = cinfo->output_width;
317 update_box (j_decompress_ptr cinfo, boxptr boxp)
321 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
428 median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
494 update_box(cinfo, b1);
495 update_box(cinfo, b2);
503 compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
508 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
536 cinfo->colormap[0][icolor] = (JSAMPLE) ((c0total + (total>>1)) / total);
537 cinfo->colormap[1][icolor] = (JSAMPLE) ((c1total + (total>>1)) / total);
538 cinfo->colormap[2][icolor] = (JSAMPLE) ((c2total + (total>>1)) / total);
543 select_colors (j_decompress_ptr cinfo, int desired_colors)
551 boxlist = (boxptr) (*cinfo->mem->alloc_small)
552 ((j_common_ptr) cinfo, JPOOL_IMAGE, desired_colors * SIZEOF(box));
562 update_box(cinfo, & boxlist[0]);
564 numboxes = median_cut(cinfo, boxlist, numboxes, desired_colors);
567 compute_color(cinfo, & boxlist[i], i);
568 cinfo->actual_number_of_colors = numboxes;
569 TRACEMS1(cinfo, 1, JTRC_QUANT_SELECTED, numboxes);
650 find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
661 int numcolors = cinfo->actual_number_of_colors;
693 x = GETJSAMPLE(cinfo->colormap[0][i]);
716 x = GETJSAMPLE(cinfo->colormap[1][i]);
738 x = GETJSAMPLE(cinfo->colormap[2][i]);
779 find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
818 inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE;
820 inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE;
822 inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE;
859 fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
864 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
892 numcolors = find_nearby_colors(cinfo, minc0, minc1, minc2, colorlist);
895 find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
919 pass2_no_dither (j_decompress_ptr cinfo,
923 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
930 JDIMENSION width = cinfo->output_width;
944 fill_inverse_cmap(cinfo, c0,c1,c2);
953 pass2_fs_dither (j_decompress_ptr cinfo,
957 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
970 JDIMENSION width = cinfo->output_width;
971 JSAMPLE *range_limit = cinfo->sample_range_limit;
973 JSAMPROW colormap0 = cinfo->colormap[0];
974 JSAMPROW colormap1 = cinfo->colormap[1];
975 JSAMPROW colormap2 = cinfo->colormap[2];
1035 fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT);
1112 init_error_limit (j_decompress_ptr cinfo)
1115 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
1119 table = (int *) (*cinfo->mem->alloc_small)
1120 ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE*2+1) * SIZEOF(int));
1147 finish_pass1 (j_decompress_ptr cinfo)
1149 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
1151 /* Select the representative colors and fill in cinfo->colormap */
1152 cinfo->colormap = cquantize->sv_colormap;
1153 select_colors(cinfo, cquantize->desired);
1160 finish_pass2 (j_decompress_ptr cinfo)
1171 start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan)
1173 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
1179 if (cinfo->dither_mode != JDITHER_NONE)
1180 cinfo->dither_mode = JDITHER_FS;
1189 if (cinfo->dither_mode == JDITHER_FS)
1196 i = cinfo->actual_number_of_colors;
1198 ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 1);
1200 ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
1202 if (cinfo->dither_mode == JDITHER_FS) {
1203 size_t arraysize = (size_t) ((cinfo->output_width + 2) *
1207 cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
1208 ((j_common_ptr) cinfo, JPOOL_IMAGE, arraysize);
1213 init_error_limit(cinfo);
1234 new_color_map_2_quant (j_decompress_ptr cinfo)
1236 my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
1248 jinit_2pass_quantizer (j_decompress_ptr cinfo)
1254 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
1256 cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
1263 if (cinfo->out_color_components != 3)
1264 ERREXIT(cinfo, JERR_NOTIMPL);
1267 cquantize->histogram = (hist3d) (*cinfo->mem->alloc_small)
1268 ((j_common_ptr) cinfo, JPOOL_IMAGE, HIST_C0_ELEMS * SIZEOF(hist2d));
1270 cquantize->histogram[i] = (hist2d) (*cinfo->mem->alloc_large)
1271 ((j_common_ptr) cinfo, JPOOL_IMAGE,
1280 if (cinfo->enable_2pass_quant) {
1282 int desired = cinfo->desired_number_of_colors;
1285 ERREXIT1(cinfo, JERR_QUANT_FEW_COLORS, 8);
1288 ERREXIT1(cinfo, JERR_QUANT_MANY_COLORS, MAXNUMCOLORS);
1289 cquantize->sv_colormap = (*cinfo->mem->alloc_sarray)
1290 ((j_common_ptr) cinfo,JPOOL_IMAGE, (JDIMENSION) desired, (JDIMENSION) 3);
1297 if (cinfo->dither_mode != JDITHER_NONE)
1298 cinfo->dither_mode = JDITHER_FS;
1305 if (cinfo->dither_mode == JDITHER_FS) {
1306 cquantize->fserrors = (FSERRPTR) (*cinfo->mem->alloc_large)
1307 ((j_common_ptr) cinfo, JPOOL_IMAGE,
1308 (size_t) ((cinfo->output_width + 2) * (3 * SIZEOF(FSERROR))));
1310 init_error_limit(cinfo);