diff options
author | Henry Stiles <henry.stiles@artifex.com> | 2010-07-30 17:06:59 +0000 |
---|---|---|
committer | Henry Stiles <henry.stiles@artifex.com> | 2010-07-30 17:06:59 +0000 |
commit | 415aa2d55e7916e8ffc1896e6a7ac26d257a85a6 (patch) | |
tree | db96f4c4a8da7ff259f76285fb25e540e695e819 /gs | |
parent | c734f9431f4b5a4080643a6a8d0a639f61cd7361 (diff) |
rollback to revision 11564, 11565 broke the build
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11572 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs')
-rw-r--r-- | gs/Resource/Init/gs_lev2.ps | 10 | ||||
-rw-r--r-- | gs/Resource/Init/gs_res.ps | 4 | ||||
-rw-r--r-- | gs/Resource/Init/pdf_draw.ps | 10 | ||||
-rwxr-xr-x | gs/autogen.sh | 2 | ||||
-rw-r--r-- | gs/base/configure.ac | 2 | ||||
-rw-r--r-- | gs/base/gdevbbox.c | 12 | ||||
-rw-r--r-- | gs/base/gdevbit.c | 2 | ||||
-rw-r--r-- | gs/base/gdevdbit.c | 2 | ||||
-rw-r--r-- | gs/base/gdevpdtf.h | 2 | ||||
-rw-r--r-- | gs/base/gdevrinkj.c | 2 | ||||
-rw-r--r-- | gs/base/gsicc_create.c | 18 | ||||
-rw-r--r-- | gs/base/gsovrc.h | 2 | ||||
-rw-r--r-- | gs/base/gxi12bit.c | 376 | ||||
-rw-r--r-- | gs/base/gxi16bit.c | 24 | ||||
-rw-r--r-- | gs/base/gximage.h | 1 | ||||
-rw-r--r-- | gs/base/gxpcolor.h | 2 | ||||
-rw-r--r-- | gs/base/lib.mak | 7 | ||||
-rw-r--r-- | gs/base/sjpx.c | 110 | ||||
-rw-r--r-- | gs/base/strmio.h | 2 | ||||
-rw-r--r-- | gs/contrib/gdevbjc_.h | 2 |
20 files changed, 48 insertions, 544 deletions
diff --git a/gs/Resource/Init/gs_lev2.ps b/gs/Resource/Init/gs_lev2.ps index 912b93cb7..d89365f89 100644 --- a/gs/Resource/Init/gs_lev2.ps +++ b/gs/Resource/Init/gs_lev2.ps @@ -900,16 +900,6 @@ mark .dicttomark ] def -% Special type to install -% sGray ICC profile color space -/CIEsGRAYICC [ /ICCBased - mark - /N 1 - /DataSource (sgray) - /Alternate [/DeviceGray] - /Name (sgray) - .dicttomark -] def % ------ Painting ------ % diff --git a/gs/Resource/Init/gs_res.ps b/gs/Resource/Init/gs_res.ps index 75d77bb9a..f6dbc157a 100644 --- a/gs/Resource/Init/gs_res.ps +++ b/gs/Resource/Init/gs_res.ps @@ -1074,10 +1074,6 @@ end % level2dict /sRGBICC exch /ColorSpace defineresource pop systemdict /CIEsRGBICC undef } if - systemdict /CIEsGRAYICC .knownget { - /sGrayICC exch /ColorSpace defineresource pop - systemdict /CIEsGRAYICC undef - } if % ColorSpaceFamily resources colorspacedict { pop dup /ColorSpaceFamily defineresource pop } forall % Filter resources diff --git a/gs/Resource/Init/pdf_draw.ps b/gs/Resource/Init/pdf_draw.ps index f409ce98f..8a2052714 100644 --- a/gs/Resource/Init/pdf_draw.ps +++ b/gs/Resource/Init/pdf_draw.ps @@ -1042,9 +1042,9 @@ end /jp2_csp_dict << 12 { /DeviceCMYK } bind % CMYK - 14 { /Lab } bind % LAB - 16 {/sRGBICC /ColorSpace findresource} - 17 {/sGrayICC /ColorSpace findresource} +% 14 % LAB + 16 { /DeviceRGB } bind % sRGB {/sRGBICC /ColorSpace findresource} + 17 { /DeviceGray } bind % Gray {/sGray /ColorSpace findresource} 18 3 index % YCC is converted to RGB % 19 % CIEJab not supportec by PDF 1.7 % 20 % e-sRGB @@ -1064,8 +1064,8 @@ end /Components 1 index 8 getu16 % file len-14 (14) /Components NC def % file len-14 (14) 10 get 16#7F and 1 add - dup 12 eq { pop 16 } if - /BitsPerComponent exch def % file len-14 + 8 .min % color depth is reduced in the library + /BitsPerComponent exch def % file len-14 } bind /colr { currentdict /ColorSpace known not { diff --git a/gs/autogen.sh b/gs/autogen.sh index edf07a4a0..733ec2c40 100755 --- a/gs/autogen.sh +++ b/gs/autogen.sh @@ -35,4 +35,4 @@ else echo "running ./configure $@" fi -$srcdir/configure $@ && echo +$srcdir/configure "$@" && echo diff --git a/gs/base/configure.ac b/gs/base/configure.ac index c6167e904..3e48b8eaf 100644 --- a/gs/base/configure.ac +++ b/gs/base/configure.ac @@ -78,7 +78,7 @@ AC_PROG_SED dnl See if it is GNU sed or else. dnl - need more work to tell SED features. SED_EXTENDED_REGEX_OPT=-nre -sed_variant=`sed --version 2>&1` +sed_variant=`sed --version` sed_variant=`echo $sed_variant|sed -e 's/ .*//'` if test "$sed_variant" != GNU ; then SED_EXTENDED_REGEX_OPT=-nEe diff --git a/gs/base/gdevbbox.c b/gs/base/gdevbbox.c index 73e7bd7d1..41b7f5f20 100644 --- a/gs/base/gdevbbox.c +++ b/gs/base/gdevbbox.c @@ -1172,7 +1172,7 @@ static const gx_device_bbox_procs_t box_procs_forward = { static int bbox_create_compositor(gx_device * dev, gx_device ** pcdev, const gs_composite_t * pcte, - gs_imager_state * pis, gs_memory_t * memory, gx_device *cindev) + gs_imager_state * pis, gs_memory_t * memory, gx_device *cdev) { gx_device_bbox *const bdev = (gx_device_bbox *) dev; gx_device *target = bdev->target; @@ -1191,13 +1191,13 @@ bbox_create_compositor(gx_device * dev, * box in the same place. */ { - gx_device *temp_cdev; + gx_device *cdev; gx_device_bbox *bbcdev; int code = (*dev_proc(target, create_compositor)) - (target, &temp_cdev, pcte, pis, memory, cindev); + (target, &cdev, pcte, pis, memory, cdev); /* If the target did not create a new compositor then we are done. */ - if (code < 0 || target == temp_cdev) { + if (code < 0 || target == cdev) { *pcdev = dev; return code; } @@ -1205,11 +1205,11 @@ bbox_create_compositor(gx_device * dev, &st_device_bbox, "bbox_create_compositor"); if (bbcdev == 0) { - (*dev_proc(temp_cdev, close_device)) (temp_cdev); + (*dev_proc(cdev, close_device)) (cdev); return_error(gs_error_VMerror); } gx_device_bbox_init(bbcdev, target, memory); - gx_device_set_target((gx_device_forward *)bbcdev, temp_cdev); + gx_device_set_target((gx_device_forward *)bbcdev, cdev); bbcdev->box_procs = box_procs_forward; bbcdev->box_proc_data = bdev; *pcdev = (gx_device *) bbcdev; diff --git a/gs/base/gdevbit.c b/gs/base/gdevbit.c index e2ee432cf..faffcb95a 100644 --- a/gs/base/gdevbit.c +++ b/gs/base/gdevbit.c @@ -321,7 +321,7 @@ static void cmyk_cs_to_rgb_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[]) { color_cmyk_to_rgb(c, m, y, k, NULL, out, dev->memory); -} +}; static void private_rgb_cs_to_rgb_cm(gx_device * dev, const gs_imager_state *pis, diff --git a/gs/base/gdevdbit.c b/gs/base/gdevdbit.c index eaa4b21f5..a70b93de4 100644 --- a/gs/base/gdevdbit.c +++ b/gs/base/gdevdbit.c @@ -289,7 +289,7 @@ gx_default_copy_alpha(gx_device * dev, const byte * data, int data_x, } LINE_ACCUM(composite, bpp); } - LINE_ACCUM_COPY(dev, lout, bpp, x, rx, out_size, ry); + LINE_ACCUM_COPY(dev, lout, bpp, x, rx, raster, ry); } out:gs_free_object(mem, lout, "copy_alpha(lout)"); gs_free_object(mem, lin, "copy_alpha(lin)"); diff --git a/gs/base/gdevpdtf.h b/gs/base/gdevpdtf.h index 413eba616..fa6f0c26c 100644 --- a/gs/base/gdevpdtf.h +++ b/gs/base/gdevpdtf.h @@ -184,7 +184,7 @@ BASIC_PTRS(pdf_base_font_ptrs) {\ GC_OBJ_ELT(pdf_base_font_t, CIDSet),\ GC_OBJ_ELT(pdf_base_font_t, FontFile),\ GC_STRING_ELT(pdf_base_font_t, font_name)\ -} +};\ typedef struct { diff --git a/gs/base/gdevrinkj.c b/gs/base/gdevrinkj.c index 3b95ff8a7..c4bb4f696 100644 --- a/gs/base/gdevrinkj.c +++ b/gs/base/gdevrinkj.c @@ -287,7 +287,7 @@ cmyk_cs_to_spotrgb_cm(gx_device * dev, frac c, frac m, frac y, frac k, frac out[ color_cmyk_to_rgb(c, m, y, k, NULL, out, dev->memory); for(; i>0; i--) /* Clear spot colors */ out[2 + i] = 0; -} +}; static void gray_cs_to_spotcmyk_cm(gx_device * dev, frac gray, frac out[]) diff --git a/gs/base/gsicc_create.c b/gs/base/gsicc_create.c index 4230fdd41..2cb030f8d 100644 --- a/gs/base/gsicc_create.c +++ b/gs/base/gsicc_create.c @@ -148,9 +148,9 @@ add_xyzdata(unsigned char *input_ptr, icS15Fixed16Number temp_XYZ[]); #define icMultiUnicodeText 0x6d6c7563 /* 'mluc' v4 text type */ #define icMultiFunctionAtoBType 0x6d414220 /* 'mAB ' v4 lutAtoBtype type */ #define icSigChromaticAdaptationTag 0x63686164 /* 'chad' */ -#define D50_X 0.9642f -#define D50_Y 1.0f -#define D50_Z 0.8249f +#define D50_X 0.9642 +#define D50_Y 1.0 +#define D50_Z 0.8249 #define DEFAULT_TABLE_NSIZE 9 #define DEFAULT_TABLE_GRAYSIZE 128 @@ -1039,12 +1039,12 @@ static void gsicc_create_compute_cam( gs_vector3 *white_src, gs_vector3 *white_des, float *cam) { - float cat02matrix[] = {0.7328f, 0.4296f, -0.1624f, - -0.7036f, 1.6975f, 0.0061f, - 0.003f, 0.0136f, 0.9834f}; - float cat02matrixinv[] = {1.0961f, -0.2789f, 0.1827f, - 0.4544f, 0.4735f, 0.0721f, - -0.0096f, -0.0057f, 1.0153f}; + float cat02matrix[] = {0.7328, 0.4296, -0.1624, + -0.7036, 1.6975, 0.0061, + 0.003, 0.0136, 0.9834}; + float cat02matrixinv[] = {1.0961, -0.2789, 0.1827, + 0.4544, 0.4735, 0.0721, + -0.0096, -0.0057, 1.0153}; float vonkries_diag[9]; float temp_matrix[9]; float lms_wp_src[3], lms_wp_des[3]; diff --git a/gs/base/gsovrc.h b/gs/base/gsovrc.h index 6fefada3a..885869e1b 100644 --- a/gs/base/gsovrc.h +++ b/gs/base/gsovrc.h @@ -294,7 +294,7 @@ typedef struct gs_overprint_s { * entire gs_overprint_s structure. */ #define private_st_gs_overprint_t() /* In gsovrc.c */\ - gs_private_st_simple(st_overprint, gs_overprint_t, "gs_overprint_t") + gs_private_st_simple(st_overprint, gs_overprint_t, "gs_overprint_t"); diff --git a/gs/base/gxi12bit.c b/gs/base/gxi12bit.c index e664f1688..c1c7ffaa6 100644 --- a/gs/base/gxi12bit.c +++ b/gs/base/gxi12bit.c @@ -31,15 +31,6 @@ #include "gxcpath.h" #include "gximage.h" #include "vdtrace.h" -#include "gsicc.h" -#include "gsicc_cache.h" -#include "gsicc_littlecms.h" -#include "gxcie.h" -#include "gscie.h" - -extern void cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc, - const gs_imager_state * pis, gx_device * dev, bool has_transfer, - bool has_halftone, gs_color_select_t select); /* ---------------- Unpacking procedures ---------------- */ @@ -108,8 +99,6 @@ iclass_proc(gs_image_class_2_fracs); /* Use special (slow) logic for 12-bit source values. */ static irender_proc(image_render_frac); -static irender_proc(image_render_icc16); /* icc 16bit case */ - irender_proc_t gs_image_class_2_fracs(gx_image_enum * penum) { @@ -122,53 +111,8 @@ gs_image_class_2_fracs(gx_image_enum * penum) penum->mask_color.values[i] = bits2frac(penum->mask_color.values[i], 12); } - if ( (gs_color_space_get_index(penum->pcs) == gs_color_space_index_DeviceN && - penum->pcs->cmm_icc_profile_data == NULL) || penum->use_mask_color || - penum->bps != 16 || - gs_color_space_get_index(penum->pcs) == gs_color_space_index_DevicePixel) { - /* DevicePixel color space used in mask from 3x type. Basically - a simple color space that just is scaled to the device bit - depth when remapped. No CM needed */ - if_debug0('b', "[b]render=frac\n"); - return &image_render_frac; - } else { - /* Set up the link now */ - const gs_color_space *pcs; - gsicc_rendering_param_t rendering_params; - int k; - int src_num_comp = cs_num_components(penum->pcs); - - penum->icc_setup.need_decode = false; - /* Check if we need to do any decoding. If yes, then that will slow us down */ - for (k = 0; k < src_num_comp; k++) { - if ( penum->map[k].decoding != sd_none ) { - penum->icc_setup.need_decode = true; - break; - } - } - /* Define the rendering intents */ - rendering_params.black_point_comp = BP_ON; - rendering_params.object_type = GS_IMAGE_TAG; - rendering_params.rendering_intent = penum->pis->renderingintent; - if (gs_color_space_is_PSCIE(penum->pcs) && penum->pcs->icc_equivalent != NULL) { - pcs = penum->pcs->icc_equivalent; - } else { - pcs = penum->pcs; - } - penum->icc_setup.is_lab = pcs->cmm_icc_profile_data->islab; - penum->icc_setup.must_halftone = gx_device_must_halftone(penum->dev); - penum->icc_setup.has_transfer = gx_has_transfer(penum->pis, - penum->pis->icc_manager->device_profile->num_comps); - if (penum->icc_setup.is_lab) penum->icc_setup.need_decode = false; - if (penum->icc_link == NULL) { - penum->icc_link = gsicc_get_link(penum->pis, pcs, NULL, - &rendering_params, penum->memory, false); - } - /* Use the direct unpacking proc */ - penum->unpack = sample_unpackicc_16_proc; - if_debug0('b', "[b]render=icc16\n"); - return &image_render_icc16; - } + if_debug0('b', "[b]render=frac\n"); + return &image_render_frac; } return 0; } @@ -457,319 +401,3 @@ err: penum->used.y = 0; return code; } - -static inline float -rescale_input_color(gs_range range, float input) -{ - return((input-range.rmin)/(range.rmax-range.rmin)); -} - - -/* This one includes an extra adjustment for the CIE PS color space - non standard range */ -static void -decode_row_cie16(const gx_image_enum *penum, const unsigned short *psrc, - int spp, unsigned short *pdes, - const unsigned short *bufend, gs_range range_array[]) -{ - unsigned short *curr_pos = pdes; - int k; - float temp; - - while ( curr_pos < bufend ) { - for ( k = 0; k < spp; k ++ ) { - switch ( penum->map[k].decoding ) { - case sd_none: - *curr_pos = *psrc; - break; - case sd_lookup: - temp = penum->map[k].decode_lookup[(*psrc) >> 4]*65535.0; - temp = rescale_input_color(range_array[k], temp); - temp = temp*65535; - if (temp > 65535.0) temp = 65535.0; - if (temp < 0 ) temp = 0; - *curr_pos = (unsigned short) temp; - break; - case sd_compute: - temp = penum->map[k].decode_base + - (*psrc) * penum->map[k].decode_factor; - temp = rescale_input_color(range_array[k], temp); - temp = temp*65535; - if (temp > 65535) temp = 65535; - if (temp < 0 ) temp = 0; - *curr_pos = (unsigned short) temp; - default: - break; - } - curr_pos++; - psrc++; - } - } -} - -static void -decode_row16(const gx_image_enum *penum, const unsigned short *psrc, int spp, - unsigned short *pdes,const unsigned short *bufend) -{ - unsigned short *curr_pos = pdes; - int k; - float temp; - - while ( curr_pos < bufend ) { - for ( k = 0; k < spp; k ++ ) { - switch ( penum->map[k].decoding ) { - case sd_none: - *curr_pos = *psrc; - break; - case sd_lookup: - temp = penum->map[k].decode_lookup[(*psrc) >> 4]*65535; - if (temp > 65535) temp = 65535; - if (temp < 0 ) temp = 0; - *curr_pos = (unsigned short) temp; - break; - case sd_compute: - temp = penum->map[k].decode_base + - (*psrc) * penum->map[k].decode_factor; - temp *= 65535; - if (temp > 65535) temp = 65535; - if (temp < 0 ) temp = 0; - *curr_pos = (unsigned short) temp; - default: - break; - } - curr_pos++; - psrc++; - } - } -} - -/* Render an image with more than 8 bits per sample where we keep the data - in 16 bit form and hand directly to the CMM */ -static int -image_render_icc16(gx_image_enum * penum, const byte * buffer, int data_x, - uint w, int h, gx_device * dev) -{ - const gs_imager_state *pis = penum->pis; - gs_logical_operation_t lop = penum->log_op; - gx_dda_fixed_point pnext; - image_posture posture = penum->posture; - fixed xprev, yprev; - fixed pdyx, pdyy; /* edge of parallelogram */ - int vci, vdi; - const gs_color_space *pcs; - gx_device_color devc1; - gx_device_color devc2; - gx_device_color *pdevc; - gx_device_color *pdevc_next; - gx_device_color *ptemp; - int spp = penum->spp; - const unsigned short *psrc_initial = (const unsigned short *)buffer + data_x * spp; - const unsigned short *psrc = psrc_initial; - const unsigned short *rsrc = psrc + spp; /* psrc + spp at start of run */ - fixed xrun; /* x at start of run */ - int irun; /* int xrun */ - fixed yrun; /* y ditto */ - color_fracs run; /* run value */ - color_fracs next; /* next sample value */ - const unsigned short *bufend = psrc + w; - int code = 0, mcode = 0; - gsicc_bufferdesc_t input_buff_desc; - gsicc_bufferdesc_t output_buff_desc; - unsigned short *psrc_cm, *psrc_cm_start, *psrc_decode; - int k; - gx_color_value conc[GX_DEVICE_COLOR_MAX_COMPONENTS]; - int spp_cm, num_pixels; - gx_color_index color; - bool need_decode = penum->icc_setup.need_decode; - bool must_halftone = penum->icc_setup.must_halftone; - bool has_transfer = penum->icc_setup.has_transfer; - - if (h == 0) - return 0; - - if (penum->icc_link == NULL) { - return gs_rethrow(-1, "ICC Link not created during image render icc16"); - } - /* Needed for device N */ - memset(&(conc[0]), 0, sizeof(gx_color_value[GX_DEVICE_COLOR_MAX_COMPONENTS])); - if (gs_color_space_is_PSCIE(penum->pcs) && penum->pcs->icc_equivalent != NULL) { - pcs = penum->pcs->icc_equivalent; - } else { - pcs = penum->pcs; - } - pdevc = &devc1; - pdevc_next = &devc2; - /* These used to be set by init clues */ - pdevc->type = gx_dc_type_none; - pdevc_next->type = gx_dc_type_none; - if (h == 0) - return 0; - /* If the link is the identity, then we don't need to do any color - conversions except for potentially a decode. */ - if (penum->icc_link->is_identity && !need_decode) { - /* Fastest case. No decode or CM needed */ - psrc_cm = (unsigned short *) psrc; - spp_cm = spp; - bufend = psrc_cm + w; - psrc_cm_start = NULL; - } else { - spp_cm = pis->icc_manager->device_profile->num_comps; - psrc_cm = (unsigned short*) gs_alloc_bytes(pis->memory, - sizeof(unsigned short) * w * spp_cm/spp, - "image_render_icc16"); - psrc_cm_start = psrc_cm; - bufend = psrc_cm + w * spp_cm/spp; - if (penum->icc_link->is_identity) { - /* decode only. no CM. This is slow but does not happen that often */ - decode_row16(penum, psrc, spp, psrc_cm, bufend); - } else { - /* Set up the buffer descriptors. */ - num_pixels = w/spp; - gsicc_init_buffer(&input_buff_desc, spp, 2, - false, false, false, 0, w * 2, - 1, num_pixels); - gsicc_init_buffer(&output_buff_desc, spp_cm, 2, - false, false, false, 0, num_pixels * spp_cm * 2, - 1, num_pixels); - /* For now, just blast it all through the link. If we had a significant reduction - we will want to repack the data first and then do this. That will be - an optimization shortly. For now just allocate a new output - buffer. We can reuse the old one if the number of channels in the output is - less than or equal to the new one. */ - if (need_decode) { - /* Need decode and CM. This is slow but does not happen that often */ - psrc_decode = (unsigned short*) gs_alloc_bytes(pis->memory, - sizeof(unsigned short) * w * spp_cm/spp, - "image_render_icc16"); - if (penum->cie_range == NULL) { - decode_row16(penum, psrc, spp, psrc_decode, - (const unsigned short*) (psrc_decode+w)); - } else { - /* Decode needs to include adjustment for CIE range */ - decode_row_cie16(penum, psrc, spp, psrc_decode, - (const unsigned short*) (psrc_decode+w), - penum->cie_range); - } - gscms_transform_color_buffer(penum->icc_link, &input_buff_desc, - &output_buff_desc, (void*) psrc_decode, - (void*) psrc_cm); - gs_free_object(pis->memory, (byte *)psrc_decode, "image_render_color_icc"); - } else { - /* CM only. No decode */ - gscms_transform_color_buffer(penum->icc_link, &input_buff_desc, - &output_buff_desc, (void*) psrc, - (void*) psrc_cm); - } - } - } - - pnext = penum->dda.pixel0; - xrun = xprev = dda_current(pnext.x); - yrun = yprev = dda_current(pnext.y); - pdyx = dda_current(penum->dda.row.x) - penum->cur.x; - pdyy = dda_current(penum->dda.row.y) - penum->cur.y; - switch (posture) { - case image_portrait: - vci = penum->yci, vdi = penum->hci; - irun = fixed2int_var_rounded(xrun); - break; - case image_landscape: - default: /* we don't handle skew -- treat as landscape */ - vci = penum->xci, vdi = penum->wci; - irun = fixed2int_var_rounded(yrun); - break; - } - if_debug5('b', "[b]y=%d data_x=%d w=%d xt=%f yt=%f\n", - penum->y, data_x, w, fixed2float(xprev), fixed2float(yprev)); - memset(&run, 0, sizeof(run)); - memset(&next, 0, sizeof(next)); - run.v[0] = ~psrc_cm[0]; /* Force intial setting */ - while (psrc_cm < bufend) { - dda_next(pnext.x); - dda_next(pnext.y); - if ( penum->alpha ) { - /* If the pixels are different, then take care of the alpha now */ - /* will need to adjust spp below.... */ - } else { - memcpy(&(next.v[0]),psrc_cm, spp_cm * 2); - psrc_cm += spp_cm; - } - /* Compare to previous. If same then move on */ - if (posture != image_skewed && next.all[0] == run.all[0]) - goto inc; - /* This needs to be sped up */ - for ( k = 0; k < spp_cm; k++ ) { - conc[k] = next.v[k]; - } - /* Now we can do an encoding directly or we have to apply transfer - and or halftoning */ - if (must_halftone || has_transfer) { - /* We need to do the tranfer function and/or the halftoning */ - cmap_transfer_halftone(&(conc[0]), pdevc_next, pis, dev, - has_transfer, must_halftone, gs_color_select_source); - } else { - /* encode as a color index. avoid all the cv to frac to cv - conversions */ - color = dev_proc(dev, encode_color)(dev, &(conc[0])); - /* check if the encoding was successful; we presume failure is rare */ - if (color != gx_no_color_index) - color_set_pure(pdevc_next, color); - } - /* Fill the region between */ - /* xrun/irun and xprev */ - if (posture != image_portrait) { /* Parallelogram */ - code = (*dev_proc(dev, fill_parallelogram)) - (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy, - pdevc, lop); - xrun = xprev; - yrun = yprev; - } else { /* Rectangle */ - int xi = irun; - int wi = (irun = fixed2int_var_rounded(xprev)) - xi; - - if (wi < 0) - xi += wi, wi = -wi; - if (wi > 0) - code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi, - pdevc, dev, lop); - } - if (code < 0) - goto err; - rsrc = psrc; - if ((code = mcode) < 0) goto err; - /* Swap around the colors due to a change */ - ptemp = pdevc; - pdevc = pdevc_next; - pdevc_next = ptemp; - run = next; -inc: xprev = dda_current(pnext.x); - yprev = dda_current(pnext.y); /* harmless if no skew */ - } - /* Fill the final run. */ - if (posture != image_portrait) { - code = (*dev_proc(dev, fill_parallelogram)) - (dev, xrun, yrun, xprev - xrun, yprev - yrun, pdyx, pdyy, - pdevc, lop); - } else { - int xi = irun; - int wi = (irun = fixed2int_var_rounded(xprev)) - xi; - - if (wi < 0) - xi += wi, wi = -wi; - if (wi > 0) - code = gx_fill_rectangle_device_rop(xi, vci, wi, vdi, - pdevc, dev, lop); - } - /* Free cm buffer, if it was used */ - if (psrc_cm_start != NULL) { - gs_free_object(pis->memory, (byte *)psrc_cm_start, "image_render_icc16"); - } - return (code < 0 ? code : 1); - - /* Save position if error, in case we resume. */ -err: - gs_free_object(pis->memory, (byte *)psrc_cm_start, "image_render_icc16"); - penum->used.x = (rsrc - spp - psrc_initial) / spp; - penum->used.y = 0; - return code; -} diff --git a/gs/base/gxi16bit.c b/gs/base/gxi16bit.c index 6ff2c4316..b9a04128c 100644 --- a/gs/base/gxi16bit.c +++ b/gs/base/gxi16bit.c @@ -57,31 +57,7 @@ sample_unpack_16(byte * bptr, int *pdata_x, const byte * data, return bptr; } -static const byte * -sample_unpackicc_16(byte * bptr, int *pdata_x, const byte * data, - int data_x, uint dsize, const sample_map *ignore_smap, int spread, - int ignore_num_components_per_plane) -{ - /* Assuming an identity map for all components. */ - register unsigned short *bufp = (unsigned short *) bptr; - uint dskip = data_x << 1; - const byte *psrc = data + dskip; -#define inc_bufp16(bp, n) bp = ( unsigned short *)((byte *)(bp) + (n)) - uint sample; - int left = dsize - dskip; - - while (left > 2) { - sample = ((uint) psrc[0] << 8) + psrc[1]; - *bufp = (unsigned short)(sample); - inc_bufp16(bufp, spread); - psrc += 2; - left -= 2; - } - *pdata_x = 0; - return bptr; -} const sample_unpack_proc_t sample_unpack_16_proc = sample_unpack_16; -const sample_unpack_proc_t sample_unpackicc_16_proc = sample_unpackicc_16; /* ---------------- Rendering procedures ---------------- */ diff --git a/gs/base/gximage.h b/gs/base/gximage.h index e2124b0df..07c8cb11b 100644 --- a/gs/base/gximage.h +++ b/gs/base/gximage.h @@ -133,7 +133,6 @@ extern const sample_unpack_proc_t sample_unpack_12_proc; * if 16-bit samples are supported, 0 otherwise. */ extern const sample_unpack_proc_t sample_unpack_16_proc; -extern const sample_unpack_proc_t sample_unpackicc_16_proc; /* Define the distinct postures of an image. */ /* Each posture includes its reflected variant. */ diff --git a/gs/base/gxpcolor.h b/gs/base/gxpcolor.h index 94daae1ef..202ff97b7 100644 --- a/gs/base/gxpcolor.h +++ b/gs/base/gxpcolor.h @@ -178,7 +178,7 @@ struct gx_pattern_trans_s { #define private_st_pattern_trans() /* in gxpcmap.c */\ gs_private_st_ptrs2(st_pattern_trans, gx_pattern_trans_t, "gx_pattern_trans",\ pattern_trans_enum_ptrs, pattern_trans_reloc_ptrs,\ - pdev14, transbytes) + pdev14, transbytes); diff --git a/gs/base/lib.mak b/gs/base/lib.mak index ed350ebd0..42b2c43f2 100644 --- a/gs/base/lib.mak +++ b/gs/base/lib.mak @@ -460,7 +460,7 @@ gxht_h=$(GLSRC)gxht.h $(gsht1_h) $(gsrefct_h) $(gxhttype_h) $(gxtmap_h) $(gscspa gxcie_h=$(GLSRC)gxcie.h $(gscie_h) gxpcolor_h=$(GLSRC)gxpcolor.h\ $(gspcolor_h) $(gxcspace_h) $(gxdevice_h) $(gxdevmem_h) $(gxpcache_h) $(gxblend_h)\ - $(gxcpath_h) $(gxdcolor_h) $(gxiclass_h) + $(gxcpath_h) $(gxdcolor_h) gscolor_h=$(GLSRC)gscolor.h $(gxtmap_h) gsstate_h=$(GLSRC)gsstate.h\ $(gscolor_h) $(gscpm_h) $(gscsel_h) $(gsdevice_h) $(gsht_h) $(gsline_h) @@ -705,8 +705,7 @@ $(GLOBJ)gxi12bit.$(OBJ) : $(GLSRC)gxi12bit.c $(GXERR)\ $(gsccolor_h) $(gspaint_h)\ $(gxarith_h) $(gxcmap_h) $(gxcpath_h) $(gxdcolor_h) $(gxdevice_h)\ $(gxdevmem_h) $(gxfixed_h) $(gxfrac_h) $(gximage_h) $(gxistate_h)\ - $(gxmatrix_h) $(vdtrace_h) $(gsicc_h) $(gsicc_cache_h) $(gsicc_littlecms_h)\ - $(gxcie_h) $(gscie_h) + $(gxmatrix_h) $(vdtrace_h) $(GLCC) $(GLO_)gxi12bit.$(OBJ) $(C_) $(GLSRC)gxi12bit.c $(GLOBJ)gxi16bit.$(OBJ) : $(GLSRC)gxi16bit.c $(GXERR)\ @@ -2687,7 +2686,7 @@ $(GLOBJ)gdevp14.$(OBJ) : $(GLSRC)gdevp14.c $(GXERR) $(math__h) $(memory__h)\ $(gsrect_h) $(gzstate_h) $(gdevdevn_h) $(gdevp14_h) $(gsovrc_h) $(gxcmap_h) $(gscolor1_h)\ $(gstrans_h) $(gsutil_h) $(gxcldev_h) $(gxclpath_h) $(gxdcconv_h) $(vdtrace_h)\ $(gscolorbuffer_h) $(gsptype2_h) $(gxpcolor_h) $(gsptype1_h) $(gzcpath_h)\ - $(gxpaint_h) $(gsicc_manage_h) $(gxclist_h) $(gxiclass_h) $(gximage_h) + $(gxpaint_h) $(gsicc_manage_h) $(gxclist_h) $(GLCC) $(GLO_)gdevp14.$(OBJ) $(C_) $(GLSRC)gdevp14.c translib_=$(GLOBJ)gstrans.$(OBJ) $(GLOBJ)gximag3x.$(OBJ)\ diff --git a/gs/base/sjpx.c b/gs/base/sjpx.c index 5f0954df5..317f27f36 100644 --- a/gs/base/sjpx.c +++ b/gs/base/sjpx.c @@ -165,7 +165,7 @@ dump_jpxd_colorspace(const stream_jpxd_state * state) #endif /* DEBUG */ static int -copy_row_gray(byte *dest, jas_image_t *image, +copy_row_gray(unsigned char *dest, jas_image_t *image, int x, int y, int bytes) { int i, p; @@ -200,7 +200,7 @@ copy_row_gray(byte *dest, jas_image_t *image, } static int -copy_row_rgb(byte *dest, jas_image_t *image, +copy_row_rgb(unsigned char *dest, jas_image_t *image, int x, int y, int bytes) { int i, p; @@ -227,7 +227,7 @@ copy_row_rgb(byte *dest, jas_image_t *image, } static int -copy_row_yuv(byte *dest, jas_image_t *image, +copy_row_yuv(unsigned char *dest, jas_image_t *image, int x, int y, int bytes) { int i,j; @@ -287,7 +287,7 @@ copy_row_yuv(byte *dest, jas_image_t *image, } static int -copy_row_default(byte *dest, jas_image_t *image, +copy_row_default(unsigned char *dest, jas_image_t *image, int x, int y, int bytes) { int i, c,n; @@ -304,67 +304,6 @@ copy_row_default(byte *dest, jas_image_t *image, return count; } -/* This is really inefficient and needs some work but at least - now we will get 16 bit data out correctly when it is in a non standard - color space. Note that indexing into dest (stream buffer) starts at +1. */ -static int -copy_row_default16(byte *dest, jas_image_t *image, - int x, int y, int bytes) -{ - int c,n; - int count; - int pixel_width; - byte *curr_ptr = dest+1; /* The offset */ - int value; - - n = jas_image_numcmpts(image); - count = bytes; - pixel_width = n*sizeof(unsigned short); - - while (count >= pixel_width) { - for (c = 0; c < n; c++) { - value = jas_image_readcmptsample(image, c, x, y); - /* endian issues here? */ - *curr_ptr++ = ((value >> 8) & 0xff); - *curr_ptr++ = (value & 0xff); - } - x++; - count = count - pixel_width; - } - return bytes-count; -} - -static int -copy_row_gray16(byte *dest, jas_image_t *image, - int x, int y, int bytes, int bits) -{ - int count; - int pixel_width; - byte *curr_ptr = dest+1; /* The offset */ - int shift; - int p, v; - unsigned short value; - - v = jas_image_getcmptbytype(image, JAS_IMAGE_CT_GRAY_Y); - if (v < 0) return 0; /* no matching component */ - - count = bytes; - pixel_width = 2; - shift = max(16 - bits, 0); - - while (count >= pixel_width) { - p = jas_image_readcmptsample(image, v, x, y); - value = p << shift; - /* endian issues here? */ - *curr_ptr++ = ((value >> 8) & 0xff); - *curr_ptr++ = (value & 0xff); - x++; - count = count - pixel_width; - } - return bytes-count; -} - - /* buffer the input stream into our state */ static int s_jpxd_buffer_input(stream_jpxd_state *const state, stream_cursor_read *pr, @@ -373,10 +312,10 @@ s_jpxd_buffer_input(stream_jpxd_state *const state, stream_cursor_read *pr, /* grow internal buffer if necessary */ if (bytes > state->bufsize - state->buffill) { int newsize = state->bufsize; - byte *newbuf = NULL; + unsigned char *newbuf = NULL; while (newsize - state->buffill < bytes) newsize <<= 1; - newbuf = (byte *)gs_malloc(state->jpx_memory, newsize, 1, + newbuf = (unsigned char *)gs_malloc(state->jpx_memory, newsize, 1, "JPXDecode temp buffer"); /* TODO: check for allocation failure */ memcpy(newbuf, state->buffer, state->buffill); @@ -479,28 +418,21 @@ s_jpxd_process(stream_state * ss, stream_cursor_read * pr, jas_image_t *image = state->image; int numcmpts = jas_image_numcmpts(image); int bits = jas_image_cmptprec(image, 0); - int stride, image_size; + int stride = numcmpts*jas_image_width(image); + long image_size = stride*jas_image_height(image); int clrspc = jas_image_clrspc(image); int x, y; long usable, done; - stride = numcmpts*jas_image_width(image); - - if (bits > 8) stride = 2*numcmpts*jas_image_width(image); if (bits == 4) stride = (stride + 1)/2; - image_size = stride*jas_image_height(image); /* copy data out of the decoded image data */ /* be lazy and only write the rest of the current row */ y = state->offset / stride; x = state->offset - y*stride; /* bytes, not samples */ usable = min(out_size, stride - x); - /* now samples */ - if (bits > 8) { - x = x/(numcmpts*2); - } else { - x = x/numcmpts; - } + x = x/numcmpts; /* now samples */ + /* Make sure we can return a full pixel. This can fail if we get the colorspace wrong. */ if (usable < numcmpts) return ERRC; @@ -526,20 +458,10 @@ s_jpxd_process(stream_state * ss, stream_cursor_read * pr, else /* use the stream's colorspace */ switch (jas_clrspc_fam(clrspc)) { case JAS_CLRSPC_FAM_GRAY: - if (bits > 8) { - done = copy_row_gray16(pw->ptr, image, x, y, usable, bits); - } else { - done = copy_row_gray(pw->ptr, image, x, y, usable); - } + done = copy_row_gray(pw->ptr, image, x, y, usable); break; case JAS_CLRSPC_FAM_RGB: - if (bits == 16) { - /* This will have issues if we have mixed compononents - with different bps. Unlikely, but it could happen */ - done = copy_row_default16(pw->ptr, image, x, y, usable); - } else { - done = copy_row_rgb(pw->ptr, image, x, y, usable); - } + done = copy_row_rgb(pw->ptr, image, x, y, usable); break; case JAS_CLRSPC_FAM_YCBCR: done = copy_row_yuv(pw->ptr, image, x, y, usable); @@ -548,13 +470,7 @@ s_jpxd_process(stream_state * ss, stream_cursor_read * pr, case JAS_CLRSPC_FAM_LAB: case JAS_CLRSPC_FAM_UNKNOWN: default: - if (bits == 16) { - /* This will have issues if we have mixed compononents - with different bps. Unlikely, but it could happen */ - done = copy_row_default16(pw->ptr, image, x, y, usable); - } else { - done = copy_row_default(pw->ptr, image, x, y, usable); - } + done = copy_row_default(pw->ptr, image, x, y, usable); break; } /* advance pointers for returned data */ diff --git a/gs/base/strmio.h b/gs/base/strmio.h index 45bd1736f..5921470fa 100644 --- a/gs/base/strmio.h +++ b/gs/base/strmio.h @@ -55,7 +55,7 @@ int sfseek(stream *s, long offset, int whence); /* * Seek to beginning of the file */ -int srewind(stream *s); +int srewind(stream *s);; /* * Return the current position in the stream or -1 if error. diff --git a/gs/contrib/gdevbjc_.h b/gs/contrib/gdevbjc_.h index 5ad3f7514..d61a94a5d 100644 --- a/gs/contrib/gdevbjc_.h +++ b/gs/contrib/gdevbjc_.h @@ -140,7 +140,7 @@ typedef struct gx_device_bjc_printer_s gx_device_bjc_printer; { (int) 255, /* White paper */ \ (int) 255, /* */ \ (int) 255 } /* */ \ -} +}; #define bjc_device(procs, dname, w10, h10, xdpi, ydpi, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_page, def_ink)\ |