diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2015-03-16 16:57:13 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2015-03-16 16:57:13 +0000 |
| commit | 463eb3a18155d848733e33afbc75bfdccc9a1784 (patch) | |
| tree | eede2f2bcc29723fae9149c445c78424e90af653 /jpeg/jdmaster.c | |
| parent | 992192dd0261da8efc9df6016806e05f80b9b81e (diff) | |
Update bundled libjpeg from jpeg-8c to jpeg-9a.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10626 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'jpeg/jdmaster.c')
| -rw-r--r-- | jpeg/jdmaster.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/jpeg/jdmaster.c b/jpeg/jdmaster.c index 8c1146e4f..6f42d3c5a 100644 --- a/jpeg/jdmaster.c +++ b/jpeg/jdmaster.c @@ -2,7 +2,7 @@ * jdmaster.c * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2002-2009 by Guido Vollbeding. + * Modified 2002-2013 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -51,7 +51,8 @@ use_merged_upsample (j_decompress_ptr cinfo) /* jdmerge.c only supports YCC=>RGB color conversion */ if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || cinfo->out_color_space != JCS_RGB || - cinfo->out_color_components != RGB_PIXELSIZE) + cinfo->out_color_components != RGB_PIXELSIZE || + cinfo->color_transform) return FALSE; /* and it only handles 2h1v or 2h2v sampling ratios */ if (cinfo->comp_info[0].h_samp_factor != 2 || @@ -158,11 +159,11 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo) cinfo->out_color_components = 1; break; case JCS_RGB: -#if RGB_PIXELSIZE != 3 + case JCS_BG_RGB: cinfo->out_color_components = RGB_PIXELSIZE; break; -#endif /* else share code with YCbCr */ case JCS_YCbCr: + case JCS_BG_YCC: cinfo->out_color_components = 3; break; case JCS_CMYK: @@ -275,10 +276,19 @@ master_selection (j_decompress_ptr cinfo) long samplesperrow; JDIMENSION jd_samplesperrow; + /* For now, precision must match compiled-in value... */ + if (cinfo->data_precision != BITS_IN_JSAMPLE) + ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision); + /* Initialize dimensions and other stuff */ jpeg_calc_output_dimensions(cinfo); prepare_range_limit_table(cinfo); + /* Sanity check on image dimensions */ + if (cinfo->output_height <= 0 || cinfo->output_width <= 0 || + cinfo->out_color_components <= 0) + ERREXIT(cinfo, JERR_EMPTY_IMAGE); + /* Width of an output scanline must be representable as JDIMENSION. */ samplesperrow = (long) cinfo->output_width * (long) cinfo->out_color_components; jd_samplesperrow = (JDIMENSION) samplesperrow; @@ -523,7 +533,7 @@ jinit_master_decompress (j_decompress_ptr cinfo) master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_decomp_master)); - cinfo->master = (struct jpeg_decomp_master *) master; + cinfo->master = &master->pub; master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.finish_output_pass = finish_output_pass; |
