Bug 689732 - The pxlmono device always falls back to writing uncompressed bitmaps
Summary: The pxlmono device always falls back to writing uncompressed bitmaps
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Other Driver (show other bugs)
Version: master
Hardware: PC Linux
: P4 normal
Assignee: Marcos H. Woehrmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-02 19:24 UTC by Marcos H. Woehrmann
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2008-03-02 19:24:42 UTC
There may be a problem in pclxl_write_image_data() since it never compresses the
data, the s_RLE_template.process call fails and the code reverts to writing
uncompressed data.
Comment 1 Marcos H. Woehrmann 2008-03-02 20:04:05 UTC
After much tracing of srle.c and gdevpx.c I believe this bug is in 
the portion of s_RLE_process() that looks ahead in order to be able
to optimally compress the data.  Rather than attempting to modify the
function and probably breaking something else I'm taking the 99% solution
and just calling s_RLE_process with last set to true instead of false.
This disables the look ahead feature, presumably making the compression
very slightly suboptimal but at least now it works.

This change results in pxl files that are significantly smaller than before
(i.e. the test file associated with bug 689595 is reduced in size from 1.1 megs
to 387k). 

===================================================================
--- gdevpx.c    (revision 8578)
+++ gdevpx.c    (working copy)
@@ -514,14 +514,14 @@
            r.ptr = data + i * raster - 1;
            r.limit = r.ptr + width_bytes;
            if ((*s_RLE_template.process)
-               ((stream_state *) & rlstate, &r, &w, false) != 0 ||
+               ((stream_state *) & rlstate, &r, &w, true) != 0 ||
                r.ptr != r.limit
                )
                goto ncfree;
            r.ptr = (const byte *)"\000\000\000\000\000";
            r.limit = r.ptr + (-(int)width_bytes & 3);
            if ((*s_RLE_template.process)
-               ((stream_state *) & rlstate, &r, &w, false) != 0 ||
+               ((stream_state *) & rlstate, &r, &w, true) != 0 ||
                r.ptr != r.limit
                )

Commited as r8579.