Lines Matching defs:dp
4596 standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id,
4599 memset(dp, 0, sizeof *dp);
4601 dp->ps = ps;
4602 dp->colour_type = COL_FROM_ID(id);
4603 dp->bit_depth = DEPTH_FROM_ID(id);
4604 if (dp->bit_depth < 1 || dp->bit_depth > 16)
4606 if (dp->colour_type == 3)
4607 dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = 8;
4609 dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT =
4610 dp->bit_depth;
4611 dp->interlace_type = INTERLACE_FROM_ID(id);
4612 check_interlace_type(dp->interlace_type);
4613 dp->id = id;
4615 dp->w = 0;
4616 dp->h = 0;
4617 dp->npasses = 0;
4618 dp->pixel_size = 0;
4619 dp->bit_width = 0;
4620 dp->cbRow = 0;
4621 dp->do_interlace = do_interlace;
4622 dp->littleendian = 0;
4623 dp->is_transparent = 0;
4624 dp->speed = ps->speed;
4625 dp->use_update_info = use_update_info;
4626 dp->npalette = 0;
4628 memset(&dp->transparent, 0, sizeof dp->transparent);
4630 memset(dp->palette, 0xff, sizeof dp->palette);
4637 standard_palette_init(standard_display *dp)
4639 store_palette_entry *palette = store_current_palette(dp->ps, &dp->npalette);
4642 if (dp->npalette > 0)
4644 int i = dp->npalette;
4645 memcpy(dp->palette, palette, i * sizeof *palette);
4655 dp->is_transparent = 1;
4657 dp->is_transparent = 0;
4659 dp->is_transparent = (i >= 0);
4761 standard_palette_validate(standard_display *dp, png_const_structp pp,
4767 if (read_palette(palette, &npalette, pp, pi) != dp->is_transparent)
4770 if (npalette != dp->npalette)
4776 pos = safecatn(msg, sizeof msg, pos, dp->npalette);
4786 if (palette[i].red != dp->palette[i].red ||
4787 palette[i].green != dp->palette[i].green ||
4788 palette[i].blue != dp->palette[i].blue ||
4789 palette[i].alpha != dp->palette[i].alpha)
4803 standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
4805 if (png_get_bit_depth(pp, pi) != dp->bit_depth)
4808 if (png_get_color_type(pp, pi) != dp->colour_type)
4814 if (png_get_interlace_type(pp, pi) != dp->interlace_type)
4820 dp->w = png_get_image_width(pp, pi);
4822 if (dp->w != standard_width(pp, dp->id))
4825 dp->h = png_get_image_height(pp, pi);
4827 if (dp->h != standard_height(pp, dp->id))
4843 if (dp->colour_type & PNG_COLOR_MASK_COLOR)
4845 if (sBIT->red == 0 || sBIT->red > dp->bit_depth)
4848 dp->red_sBIT = sBIT->red;
4850 if (sBIT->green == 0 || sBIT->green > dp->bit_depth)
4853 dp->green_sBIT = sBIT->green;
4855 if (sBIT->blue == 0 || sBIT->blue > dp->bit_depth)
4858 dp->blue_sBIT = sBIT->blue;
4863 if (sBIT->gray == 0 || sBIT->gray > dp->bit_depth)
4866 dp->blue_sBIT = dp->green_sBIT = dp->red_sBIT = sBIT->gray;
4872 if (dp->colour_type & PNG_COLOR_MASK_ALPHA)
4874 if (sBIT->alpha == 0 || sBIT->alpha > dp->bit_depth)
4877 dp->alpha_sBIT = sBIT->alpha;
4890 if (png_get_rowbytes(pp, pi) != standard_rowsize(pp, dp->id))
4896 standard_palette_validate(dp, pp, pi);
4910 switch (dp->colour_type)
4913 dp->transparent.red = dp->transparent.green = dp->transparent.blue =
4915 dp->has_tRNS = 1;
4919 dp->transparent.red = trans_color->red;
4920 dp->transparent.green = trans_color->green;
4921 dp->transparent.blue = trans_color->blue;
4922 dp->has_tRNS = 1;
4942 dp->npasses = npasses_from_interlace_type(pp, dp->interlace_type);
4943 if (!dp->do_interlace)
4946 if (dp->npasses != png_set_interlace_handling(pp))
4952 if (dp->npasses > 1)
4967 standard_info_part2(standard_display *dp, png_const_structp pp,
4976 dp->filler)
4979 dp->pixel_size = bit_size(pp, ct, bd);
4981 dp->bit_width = png_get_image_width(pp, pi) * dp->pixel_size;
4982 dp->cbRow = png_get_rowbytes(pp, pi);
4985 if (dp->cbRow != (dp->bit_width+7)/8)
4989 store_ensure_image(dp->ps, pp, nImages, dp->cbRow, dp->h);
4993 standard_info_imp(standard_display *dp, png_structp pp, png_infop pi,
4999 standard_info_part1(dp, pp, pi);
5004 if (dp->use_update_info)
5007 int i = dp->use_update_info;
5018 standard_info_part2(dp, pp, pi, nImages);
5024 standard_display *dp = voidcast(standard_display*,
5030 standard_info_imp(dp, pp, pi, 1 /*only one image*/);
5037 const standard_display *dp = voidcast(standard_display*,
5052 if (dp->do_interlace && dp->interlace_type == PNG_INTERLACE_ADAM7)
5067 if (y >= dp->h)
5070 row = store_image_row(dp->ps, pp, 0, y);
5074 if (dp->do_interlace)
5077 if (dp->interlace_type == PNG_INTERLACE_ADAM7)
5078 deinterlace_row(row, new_row, dp->pixel_size, dp->w, pass,
5079 dp->littleendian);
5081 row_copy(row, new_row, dp->pixel_size * dp->w, dp->littleendian);
5089 else if (dp->interlace_type == PNG_INTERLACE_ADAM7 &&
5091 PNG_PASS_COLS(dp->w, pass) > 0)
5096 sequential_row(standard_display *dp, png_structp pp, png_infop pi,
5099 const int npasses = dp->npasses;
5100 const int do_interlace = dp->do_interlace &&
5101 dp->interlace_type == PNG_INTERLACE_ADAM7;
5102 const png_uint_32 height = standard_height(pp, dp->id);
5103 const png_uint_32 width = standard_width(pp, dp->id);
5104 const png_store* ps = dp->ps;
5139 dp->pixel_size, dp->w, pass, dp->littleendian);
5143 dp->pixel_size, dp->w, pass, dp->littleendian);
5242 standard_text_validate(standard_display *dp, png_const_structp pp,
5250 standard_check_text(pp, tp, "image name", dp->ps->current->name);
5270 # define standard_text_validate(dp,pp,pi,check_end) ((void)0)
5274 standard_row_validate(standard_display *dp, png_const_structp pp,
5284 standard_row(pp, std, dp->id, y);
5292 (where = pixel_cmp(std, store_image_row(dp->ps, pp, iImage, y),
5293 dp->bit_width)) != 0)
5298 store_image_row(dp->ps, pp, iImage, y)[where-1]);
5303 (where = pixel_cmp(std, store_image_row(dp->ps, pp, iDisplay, y),
5304 dp->bit_width)) != 0)
5309 store_image_row(dp->ps, pp, iDisplay, y)[where-1]);
5315 standard_image_validate(standard_display *dp, png_const_structp pp, int iImage,
5321 store_image_check(dp->ps, pp, iImage);
5324 store_image_check(dp->ps, pp, iDisplay);
5326 for (y=0; y<dp->h; ++y)
5327 standard_row_validate(dp, pp, iImage, iDisplay, y);
5330 dp->ps->validated = 1;
5337 standard_display *dp = voidcast(standard_display*,
5345 standard_text_validate(dp, pp, pi,
5347 standard_image_validate(dp, pp, 0, -1);
6151 transform_display_init(transform_display *dp, png_modifier *pm, png_uint_32 id,
6154 memset(dp, 0, sizeof *dp);
6157 standard_display_init(&dp->this, &pm->this, id, do_read_interlace,
6161 dp->pm = pm;
6162 dp->transform_list = transform_list;
6163 dp->max_gamma_8 = 16;
6166 dp->output_colour_type = 255; /* invalid */
6167 dp->output_bit_depth = 255; /* invalid */
6168 dp->unpacked = 0; /* not unpacked */
6172 transform_info_imp(transform_display *dp, png_structp pp, png_infop pi)
6175 standard_info_part1(&dp->this, pp, pi);
6178 dp->transform_list->set(dp->transform_list, dp, pp, pi);
6182 int i = dp->this.use_update_info;
6190 standard_info_part2(&dp->this, pp, pi, 1/*images*/);
6193 dp->output_colour_type = png_get_color_type(pp, pi);
6194 dp->output_bit_depth = png_get_bit_depth(pp, pi);
6199 if (dp->output_bit_depth >= 8 &&
6200 (dp->output_colour_type == PNG_COLOR_TYPE_RGB ||
6201 dp->output_colour_type == PNG_COLOR_TYPE_GRAY) && dp->this.filler)
6202 dp->output_colour_type |= 4;
6208 switch (dp->output_colour_type)
6211 if (dp->output_bit_depth > 8) goto error;
6214 if (dp->output_bit_depth == 1 || dp->output_bit_depth == 2 ||
6215 dp->output_bit_depth == 4)
6219 if (dp->output_bit_depth == 8 || dp->output_bit_depth == 16)
6229 pos = safecatn(message, sizeof message, pos, dp->output_colour_type);
6231 pos = safecatn(message, sizeof message, pos, dp->output_bit_depth);
6245 test_pixel.colour_type = dp->this.colour_type; /* input */
6246 test_pixel.bit_depth = dp->this.bit_depth;
6254 test_pixel.have_tRNS = dp->this.is_transparent != 0;
6258 dp->transform_list->mod(dp->transform_list, &test_pixel, pp, dp);
6260 if (test_pixel.colour_type != dp->output_colour_type)
6265 pos = safecatn(message, sizeof message, pos, dp->output_colour_type);
6272 if (test_pixel.bit_depth != dp->output_bit_depth)
6277 pos = safecatn(message, sizeof message, pos, dp->output_bit_depth);
6289 else if (dp->unpacked && test_pixel.bit_depth != 8)
6291 else if (!dp->unpacked && test_pixel.colour_type != PNG_COLOR_TYPE_PALETTE
6308 else if (test_pixel.bit_depth != dp->output_bit_depth)
6317 pos = safecatn(message, sizeof message, pos, dp->output_bit_depth);
6379 transform_image_validate(transform_display *dp, png_const_structp pp,
6383 const png_store* const ps = dp->this.ps;
6384 const png_byte in_ct = dp->this.colour_type;
6385 const png_byte in_bd = dp->this.bit_depth;
6386 const png_uint_32 w = dp->this.w;
6387 const png_uint_32 h = dp->this.h;
6388 const png_byte out_ct = dp->output_colour_type;
6389 const png_byte out_bd = dp->output_bit_depth;
6392 const png_byte red_sBIT = dp->this.red_sBIT;
6393 const png_byte green_sBIT = dp->this.green_sBIT;
6394 const png_byte blue_sBIT = dp->this.blue_sBIT;
6395 const png_byte alpha_sBIT = dp->this.alpha_sBIT;
6396 const int have_tRNS = dp->this.is_transparent;
6405 store_image_check(dp->this.ps, pp, 0);
6418 if (npalette != dp->this.npalette)
6439 !dp->pm->calculations_use_input_precision)
6468 image_pixel_init(&in_pixel, std, in_ct, in_bd, x, dp->this.palette,
6487 dp->transform_list->mod(dp->transform_list, &in_pixel, pp, dp);
6512 dp->pm->limit + 1./(2*((1U<<in_pixel.red_sBIT)-1)), "red/gray",
6519 dp->pm->limit + 1./(2*((1U<<in_pixel.green_sBIT)-1)), "green",
6526 dp->pm->limit + 1./(2*((1U<<in_pixel.blue_sBIT)-1)), "blue",
6533 dp->pm->limit + 1./(2*((1U<<in_pixel.alpha_sBIT)-1)), "alpha",
6539 dp->this.ps->validated = 1;
6546 transform_display *dp = voidcast(transform_display*,
6549 if (!dp->this.speed)
6550 transform_image_validate(dp, pp, pi);
6552 dp->this.ps->validated = 1;
8861 gamma_display_init(gamma_display *dp, png_modifier *pm, png_uint_32 id,
8868 standard_display_init(&dp->this, &pm->this, id, do_read_interlace,
8872 dp->pm = pm;
8873 dp->file_gamma = file_gamma;
8874 dp->screen_gamma = screen_gamma;
8875 dp->background_gamma = background_gamma;
8876 dp->sbit = sbit;
8877 dp->threshold_test = threshold_test;
8878 dp->use_input_precision = use_input_precision;
8879 dp->scale16 = scale16;
8880 dp->expand16 = expand16;
8881 dp->do_background = do_background;
8883 dp->background_color = *pointer_to_the_background_color;
8885 memset(&dp->background_color, 0, sizeof dp->background_color);
8888 dp->maxerrout = dp->maxerrpc = dp->maxerrabs = 0;
8892 gamma_info_imp(gamma_display *dp, png_structp pp, png_infop pi)
8895 standard_info_part1(&dp->this, pp, pi);
8902 if (dp->scale16)
8914 if (dp->expand16)
8921 if (dp->do_background >= ALPHA_MODE_OFFSET)
8926 int mode = dp->do_background - ALPHA_MODE_OFFSET;
8932 const double sg = dp->screen_gamma;
8950 png_set_gamma(pp, sg, dp->file_gamma);
8952 png_fixed_point f = fix(dp->file_gamma);
8966 png_set_gamma(pp, dp->screen_gamma, dp->file_gamma);
8969 png_fixed_point s = fix(dp->screen_gamma);
8970 png_fixed_point f = fix(dp->file_gamma);
8975 if (dp->do_background)
8980 const double bg = dp->background_gamma;
8986 png_set_background(pp, &dp->background_color, dp->do_background,
8989 png_set_background_fixed(pp, &dp->background_color,
8990 dp->do_background, 0/*need_expand*/, g);
8999 int i = dp->this.use_update_info;
9007 standard_info_part2(&dp->this, pp, pi, 1 /*images*/);
9024 gamma_display *dp;
9053 init_validate_info(validate_info *vi, gamma_display *dp, png_const_structp pp,
9059 vi->dp = dp;
9061 if (dp->sbit > 0 && dp->sbit < in_depth)
9063 vi->sbit = dp->sbit;
9064 vi->isbit_shift = in_depth - dp->sbit;
9078 vi->screen_gamma = dp->screen_gamma;
9084 vi->use_input_precision = dp->use_input_precision;
9086 vi->maxabs = abserr(dp->pm, in_depth, out_depth);
9087 vi->maxpc = pcerr(dp->pm, in_depth, out_depth);
9088 vi->maxcalc = calcerr(dp->pm, in_depth, out_depth);
9089 vi->maxout = outerr(dp->pm, in_depth, out_depth);
9090 vi->outquant = output_quantization_factor(dp->pm, in_depth, out_depth);
9092 vi->outlog = outlog(dp->pm, in_depth, out_depth);
9094 if ((dp->this.colour_type & PNG_COLOR_MASK_ALPHA) != 0 ||
9095 (dp->this.colour_type == 3 && dp->this.is_transparent) ||
9096 ((dp->this.colour_type == 0 || dp->this.colour_type == 2) &&
9097 dp->this.has_tRNS))
9099 vi->do_background = dp->do_background;
9103 const double bg_inverse = 1/dp->background_gamma;
9107 r = dp->background_color.red; r /= outmax;
9108 g = dp->background_color.green; g /= outmax;
9109 b = dp->background_color.blue; b /= outmax;
9133 vi->gamma_correction = 1/(dp->file_gamma*dp->screen_gamma);
9137 vi->file_inverse = 1/dp->file_gamma;
9141 vi->scale16 = dp->scale16;
9265 if (encoded_error > vi->dp->maxerrout)
9266 vi->dp->maxerrout = encoded_error;
9358 if (log_max_error && encoded_error > vi->dp->maxerrout)
9359 vi->dp->maxerrout = encoded_error;
9388 if (log_max_error && error > vi->dp->maxerrabs)
9389 vi->dp->maxerrabs = error;
9397 if (percentage_error > vi->dp->maxerrpc)
9398 vi->dp->maxerrpc = percentage_error;
9479 if (pass == 0 && vi->use_input_precision && vi->dp->sbit)
9777 store_verbose(&vi->dp->pm->this, vi->pp, pass, msg);
9786 gamma_image_validate(gamma_display *dp, png_const_structp pp,
9790 const png_store* const ps = dp->this.ps;
9791 const png_byte in_ct = dp->this.colour_type;
9792 const png_byte in_bd = dp->this.bit_depth;
9793 const png_uint_32 w = dp->this.w;
9794 const png_uint_32 h = dp->this.h;
9795 const size_t cbRow = dp->this.cbRow;
9841 const store_palette_entry *in_palette = dp->this.palette;
9842 const int in_is_transparent = dp->this.is_transparent;
9850 store_image_check(dp->this.ps, pp, 0);
9855 init_validate_info(&vi, dp, pp, in_ct==3?8:in_bd, out_ct==3?8:out_bd);
9857 processing = (vi.gamma_correction > 0 && !dp->threshold_test)
9859 process_tRNS = dp->this.has_tRNS && vi.do_background;
9902 dp->this.palette[in_index].alpha :
9941 dp->this.transparent.red)
9947 dp->this.transparent.red &&
9949 dp->this.transparent.green &&
9951 dp->this.transparent.blue)
10004 dp->this.ps->validated = 1;
10011 gamma_display *dp = voidcast(gamma_display*, png_get_progressive_ptr(pp));
10013 if (!dp->this.speed)
10014 gamma_image_validate(dp, pp, pi);
10016 dp->this.ps->validated = 1;