Bug 691830 - matrix accuracy problem
Summary: matrix accuracy problem
Status: NOTIFIED LATER
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PCL raster (show other bugs)
Version: master
Hardware: PC Windows XP
: P2 normal
Assignee: Henry Stiles
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-10 13:12 UTC by norbert.janssen
Modified: 2011-10-02 02:35 UTC (History)
0 users

See Also:
Customer: 661
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description norbert.janssen 2010-12-10 13:12:36 UTC
In pximage.c (pxBeginImage()) there is some code which calculates the ImageMatrix.

          gs_matrix_invert(&dmat, &dmat);
          gs_matrix_multiply(&dmat, &imat, &pxenum->image.ImageMatrix);

I found a little problem with this (at least when compiled with MSVC, don't know for CYGWIN/gcc).
          the ImageMatrix.tx/ty should be same as dmat.tx/ty but there is a very minor difference due to using float math i.s.o. double math.

And needed to use the following to solve this.

          gs_matrix_double ddmat,dimat;

	  gs_matrix_invert_to_double(&dmat, &ddmat);
	  gs_matrix_multiply_double(&ddmat, &imat, &dimat);
	  pxenum->image.ImageMatrix.xx = (float)dimat.xx;
	  pxenum->image.ImageMatrix.yx = (float)dimat.yx;
	  pxenum->image.ImageMatrix.xy = (float)dimat.xy;
	  pxenum->image.ImageMatrix.yy = (float)dimat.yy;
	  pxenum->image.ImageMatrix.tx = (float)dimat.tx;
	  pxenum->image.ImageMatrix.ty = (float)dimat.ty;

Usage of invert_double + multiply_double is also used in gxipixel.c gx_image_enum_begin() function.

Seems logical to have better accuracy for this combination. Perhaps make a new method in gsmatrix.c for this?
Comment 1 Henry Stiles 2011-02-24 15:40:37 UTC
We really do want single precision here to be consistent with the graphics library, Invert/Multiply used in gxipixel.c is exactly what is needed for Postscript and PDF images and it must be done in single precision to be compatible with Adobe.  Also, I haven't seen the need for doubles on HP printers but the PCL specification is less clear on required precision.  Maybe we can find another solution if you can attach the file that prompted the change.