Summary: | mode 9 uncompress simply does not work correctly. | ||
---|---|---|---|
Product: | GhostPCL | Reporter: | Hin-Tak Leung <htl10> |
Component: | PCL raster | Assignee: | Ken Sharp <ken.sharp> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ghostpdl-bugs |
Priority: | P4 | Keywords: | bountiable |
Version: | master | ||
Hardware: | PC | ||
OS: | Linux | ||
Customer: | Word Size: | --- | |
Attachments: |
mode 9 test file
possible patch -sDEVICE=pdfwrite result final part of the mode 9 compression Removing the misleading comment about mode 9. |
Description
Hin-Tak Leung
2014-01-30 22:48:24 UTC
Created attachment 10632 [details]
possible patch
possible patch, not quite completely correct yet, but at least it is more correct than the current code, and you get to see the tiger, mostly.
Created attachment 10637 [details]
-sDEVICE=pdfwrite result
I came up with a better patch, and can confirm the code has always been wrong (for as long as it was, which was 1998!).
Here is the pdfwrite result from the corrected code. Strange the resolution seems to be off by a factor of two, despite the fact that the input does not seem to contain any undocumented, etc, instructions. But the rendering is "obviously correct"...
The "always been wrong" code was part of a single code drop in 1998: commit 9267edc4dbc22ae78acf61e12b15a35aa9ec4fca Author: Henry Stiles <henry.stiles@artifex.com> Date: Mon Aug 10 03:06:20 1998 +0000 This is the first archived release of jan's pcl5c code. There is no version number yet. left "pcl6-win32-mode9and10.exe" in my home dir in casper. I've committed the patch, it does not 100% decompress the sample file but it is much improved. Thanks for the code Hin-Tak, I've no idea whay this wasn't included before since the old code is clearly wrong. The fix is no 100%, so I have not closed the bug, but I think its well worth having the improvement anyway. It seems I have a diff from a little after this patch, slightly different, plus some debugging code within too, so probably can revisit and/or see whether the small additions does what it does. Btw, you said you would, but haven't made this bountiable yet. (In reply to Hin-Tak Leung from comment #6) > It seems I have a diff from a little after this patch, slightly different, > plus some debugging code within too, so probably can revisit and/or see > whether the small additions does what it does. > > Btw, you said you would, but haven't made this bountiable yet. Oops,sorry, E_TOOMANYBUGS..... Done now. Thanks. My local patch seems to differ slightly, and with some more debug code within, and also, most interestingly, remove the entire block of (presumably wrong) comments just before. So it is quite likely I have gotten to the end of it and started "fixing" the comments. I shall revisit this and see what further progress I made a long time ago. Created attachment 24347 [details] final part of the mode 9 compression This small change is an update to https://bugs.ghostscript.com/attachment.cgi?id=10632 to make it all work. Created attachment 24348 [details]
Removing the misleading comment about mode 9.
This is an addtional optional change I made ages ago, to remove the block of misleading comments above that routine.
I wrote in comment 2 that "I came up with a better patch", I think this is it. Back then the color was correct but the resolution is off by 2x2, now the color is wrong (the tiger comes out as purple), but the resolution is corrrect. I'd say commit these, close this, and start a new one on the "color regression". I don't feel too strongly about removing the comment, but included it as a separate patch, just in case somebody else agrees with me also. Argh, ignored this part - the resolution is still wrong. The color wrong (but related and also mode 9) file is bug 695047. So probably should have two follow-up bug, one for this on resolution, the other on 695047 for the colour. (In reply to Hin-Tak Leung from comment #11) ... > Back then the color was correct but the resolution is off by 2x2, now the > color is wrong (the tiger comes out as purple), but the resolution is > corrrect. ... (In reply to Hin-Tak Leung from comment #11) > Back then the color was correct but the resolution is off by 2x2, now the > color is wrong (the tiger comes out as purple), but the resolution is > corrrect. > > I'd say commit these, close this, and start a new one on the "color > regression". > > I don't feel too strongly about removing the comment, but included it as a > separate patch, just in case somebody else agrees with me also. This does indeed seem to work correctly (as regards decompression) now, and 695047 also decompresses correctly. Colour is still wrong but that is a separate issue. Thanks! As I mentioned in bug 694082, I assume we have a signed contributers agreement from you and have managed to send you bounties in the past so if you'd just confirm how to go about that (by private email to me please) then I'll get that sorted. As with 694082 I'm leaving this bug open (and not yet pushing the commits to master) until we've got that sorted out, to make sure I do not forget. Yes, faxed contributers agreement to Miles over a decade ago. The follow-up about the wrong resolution is bug 706749. Fixed in commit 1a458b1c130a273d923b5dfbf8dc205a8104f637 |