Re: Fix (device interface) : Provide an access to image data filter for devices.
"Leonardo" <[email protected]> Wed, 31 Dec 2008 14:40:27 +0300
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. ------=_NextPart_000_0014_01C96B55.B95509C0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Here is an improved revision of the patch. Added more initialization to gximag3x.c and did more testing. ----- Original Message ----- From: "Igor V. Melichev" <[email protected]> To: "'tech'" <[email protected]>; <[email protected]> Sent: Monday, December 29, 2008 3:00 PM Subject: Fix (device interface) : Provide an access to image data filter for devices. xefitra > Fix (device interface) : Provide an access to image data filter for > devices. > > DETAILS : > > This is a preparation for the bug 690199 > "File generates very large clist, crashes at 200 dpi" > > The scheduled fix is to compress image data in clist. > For doing that the clist writer needs to know > whether the image should be packed with > a DCT, Flate or JBig2 filter. > > The patch adds the new field gx_image_enum_common_s::plane_stream > that devices can access in the image_plane_data method can know > what filter was used to pack source data. > > Rather it extends the device interface, > the change is backward compatible for devices. > Interpreters should call the new function > gs_image_set_plane_stream, otherwise the new > functionality is not provided. > > See new comment in gxiparam.h for more details. > > EXPECTED DIFFERENCES : > > None. > ------=_NextPart_000_0014_01C96B55.B95509C0 Content-Type: text/plain; format=flowed; name="patch.txt"; reply-type=original Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patch.txt" Not committed yet. Needs improvement. [Log message beg] Fix (device interface) : Provide an access to image data filter for = devices. DETAILS : This is a preparation for the bug 690199=20 "File generates very large clist, crashes at 200 dpi"=20 The scheduled fix is to compress image data in clist. For doing that the clist writer needs to know whether the image should be packed with=20 a DCT, Flate or JBig2 filter.=20 The patch adds the new field gx_image_enum_common_s::plane_stream that devices can access in the image_plane_data method can know what filter was used to pack source data. =20 Rather it extends the device interface, the change is backward compatible for devices. Interpreters should call the new function gs_image_set_plane_stream, otherwise the new functionality is not provided. See new comment in gxiparam.h for more details. =20 EXPECTED DIFFERENCES : None. [Log message end]=20 =20 =20 =20 =20 =20 *** F:\SVN-GS\gs\gs\base\gdevddrw.c Wed Dec 31 00:27:22 2008 --- files\gs\base\gdevddrw.c Wed Dec 31 14:30:00 2008 *************** *** 840,843 **** --- 840,845 ---- static=20 ENUM_PTRS_WITH(image_enum_common_enum_ptrs, gx_image_enum_common_t = *eptr) + if (index <=3D eptr->num_planes) + return ENUM_OBJ(eptr->plane_streams[index - 1]); return 0; case 0: return ENUM_OBJ(gx_device_enum_ptr(eptr->dev)); *************** *** 846,850 **** --- 848,856 ---- static RELOC_PTRS_WITH(image_enum_common_reloc_ptrs, = gx_image_enum_common_t *eptr) { + int i; +=20 eptr->dev =3D gx_device_reloc_ptr(eptr->dev, gcst); + for (i =3D 0; i < eptr->num_planes; i++) + RELOC_OBJ(eptr->plane_streams[i]); } RELOC_PTRS_END =20 =20 =20 *** F:\SVN-GS\gs\gs\base\gsimage.c Tue Dec 9 11:02:32 2008 --- files\gs\base\gsimage.c Wed Dec 31 14:30:00 2008 *************** *** 670,671 **** --- 670,676 ---- } =20 + /* Set plane_streams[i] */ + void gs_image_set_plane_stream(gs_image_enum *pie, int i, stream *s) + { + pie->info->plane_streams[i] =3D s; + } =20 =20 =20 *** F:\SVN-GS\gs\gs\base\gsimage.h Thu Sep 25 04:54:40 2008 --- files\gs\base\gsimage.h Wed Dec 31 14:30:00 2008 *************** *** 200,202 **** --- 200,205 ---- int gs_image_cleanup_and_free_enum(gs_image_enum * penum, gs_state = *pgs); =20 + /* Set plane_streams[i] */ + void gs_image_set_plane_stream(gs_image_enum *pie, int i, stream *s); +=20 #endif /* gsimage_INCLUDED */ =20 =20 =20 *** F:\SVN-GS\gs\gs\base\gximag3x.c Thu Sep 25 04:54:40 2008 --- files\gs\base\gximag3x.c Wed Dec 31 14:30:00 2008 *************** *** 317,320 **** --- 317,322 ---- memcpy(&penum->plane_depths[pi], &penum->pixel.info->plane_depths[0], penum->pixel.info->num_planes * = sizeof(penum->plane_depths[0])); + memcpy(&penum->plane_streams[pi], = &penum->pixel.info->plane_streams[0], + penum->pixel.info->num_planes * = sizeof(penum->plane_streams[0])); penum->plane_depths[pi] +=3D added_depth; penum->num_planes =3D pi + penum->pixel.info->num_planes; =20 =20 =20 *** F:\SVN-GS\gs\gs\base\gximage.c Thu Sep 25 04:54:40 2008 --- files\gs\base\gximage.c Wed Dec 31 14:30:00 2008 *************** *** 105,110 **** return_error(gs_error_rangecheck); } ! for (i =3D 0; i < piec->num_planes; ++i) piec->plane_widths[i] =3D pic->Width; return 0; } --- 105,112 ---- return_error(gs_error_rangecheck); } ! for (i =3D 0; i < piec->num_planes; ++i) { piec->plane_widths[i] =3D pic->Width; + piec->plane_streams[i] =3D NULL; + } return 0; } =20 =20 =20 *** F:\SVN-GS\gs\gs\base\gxiparam.h Thu Sep 25 04:54:50 2008 --- files\gs\base\gxiparam.h Wed Dec 31 14:30:00 2008 *************** *** 219,223 **** int num_planes;\ int plane_depths[GS_IMAGE_MAX_COMPONENTS]; /* [num_planes] */\ ! int plane_widths[GS_IMAGE_MAX_COMPONENTS] /* [num_planes] */ struct gx_image_enum_common_s { gx_image_enum_common; --- 219,229 ---- int num_planes;\ int plane_depths[GS_IMAGE_MAX_COMPONENTS]; /* [num_planes] */\ ! int plane_widths[GS_IMAGE_MAX_COMPONENTS]; /* [num_planes] */\ ! /* Rather plane_stream allows to access the data stream, ! this field is not intended for that, ! and we don't provide a consistency if a data is written through = it. ! The only correct use is to retrieve the filter parameters ! for high level devices and for clist writer. */\ ! stream *plane_streams[GS_IMAGE_MAX_COMPONENTS] /* [num_planes] */ struct gx_image_enum_common_s { gx_image_enum_common; =20 =20 =20 =20 =20 *** F:\SVN-GS\gs\gs\psi\zimage.c Thu Sep 25 04:49:08 2008 --- files\gs\psi\zimage.c Mon Dec 29 14:36:36 2008 *************** *** 505,508 **** --- 505,509 ---- plane_data[px].data =3D sbufptr(s); plane_data[px].size =3D avail; + gs_image_set_plane_stream(penum, px, s); } =20 =20 ------=_NextPart_000_0014_01C96B55.B95509C0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ gs-code-review mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-code-review ------=_NextPart_000_0014_01C96B55.B95509C0--