diff options
author | Ray Johnston <ray.johnston@artifex.com> | 2012-03-27 19:29:56 -0700 |
---|---|---|
committer | Ray Johnston <ray.johnston@artifex.com> | 2012-03-27 21:08:14 -0700 |
commit | 5b50a46f4ed3e54fec6727a1ad52258e5d32b0a9 (patch) | |
tree | 7f4ba5a113a243b0b12e07cf526955d7b6004104 | |
parent | 6a13e642324435d92f2f79f6c28b5f25758a249c (diff) |
Add -sBandListStorage={file|memory} option and default to no bitmap compression if file clist.
Also alphabetize the clist options and remove the arbitrary 10000 minimum for MaxBitmap
(now -dMaxBitmap=0 is legal). The change to not compress bitmaps (using CCITT) when going
to disk based clist improves performance.
-rw-r--r-- | gs/base/gdevprn.c | 60 | ||||
-rw-r--r-- | gs/base/gdevprn.h | 6 | ||||
-rw-r--r-- | gs/base/gxclbits.c | 3 | ||||
-rw-r--r-- | gs/base/gxclist.c | 2 | ||||
-rw-r--r-- | gs/base/lib.mak | 2 | ||||
-rw-r--r-- | gs/doc/Language.htm | 9 |
6 files changed, 65 insertions, 17 deletions
diff --git a/gs/base/gdevprn.c b/gs/base/gdevprn.c index eb14c5317..486cb7695 100644 --- a/gs/base/gdevprn.c +++ b/gs/base/gdevprn.c @@ -140,7 +140,7 @@ BACKTRACE(pdev); open_c: ppdev->buf = base; ppdev->buffer_space = space; - clist_init_io_procs(pclist_dev, false); + clist_init_io_procs(pclist_dev, ppdev->BLS_force_memory); clist_init_params(pclist_dev, base, space, pdev, ppdev->printer_procs.buf_procs, space_params->band, ppdev->is_async_renderer, @@ -497,25 +497,40 @@ gdev_prn_get_params(gx_device * pdev, gs_param_list * plist) gx_device_printer * const ppdev = (gx_device_printer *)pdev; int code = gx_default_get_params(pdev, plist); gs_param_string ofns; + gs_param_string bls; if (code < 0 || - (code = param_write_long(plist, "MaxBitmap", &ppdev->space_params.MaxBitmap)) < 0 || - (code = param_write_long(plist, "BufferSpace", &ppdev->space_params.BufferSpace)) < 0 || - (code = param_write_int(plist, "BandWidth", &ppdev->space_params.band.BandWidth)) < 0 || - (code = param_write_int(plist, "BandHeight", &ppdev->space_params.band.BandHeight)) < 0 || (code = param_write_long(plist, "BandBufferSpace", &ppdev->space_params.band.BandBufferSpace)) < 0 || - (code = param_write_int(plist, "NumRenderingThreads", &ppdev->num_render_threads_requested)) < 0 || - (code = param_write_bool(plist, "OpenOutputFile", &ppdev->OpenOutputFile)) < 0 || - (code = param_write_bool(plist, "ReopenPerPage", &ppdev->ReopenPerPage)) < 0 || - (code = param_write_bool(plist, "PageUsesTransparency", - &ppdev->page_uses_transparency)) < 0 || + (code = param_write_int(plist, "BandHeight", &ppdev->space_params.band.BandHeight)) < 0 || + (code = param_write_int(plist, "BandWidth", &ppdev->space_params.band.BandWidth)) < 0 || + (code = param_write_long(plist, "BufferSpace", &ppdev->space_params.BufferSpace)) < 0 || (ppdev->Duplex_set >= 0 && - (code = (ppdev->Duplex_set ? + (code = (ppdev->Duplex_set ? param_write_bool(plist, "Duplex", &ppdev->Duplex) : - param_write_null(plist, "Duplex"))) < 0) + param_write_null(plist, "Duplex"))) < 0) || + (code = param_write_long(plist, "MaxBitmap", &ppdev->space_params.MaxBitmap)) < 0 || + (code = param_write_int(plist, "NumRenderingThreads", &ppdev->num_render_threads_requested)) < 0 || + (code = param_write_bool(plist, "OpenOutputFile", &ppdev->OpenOutputFile)) < 0 || + (code = param_write_bool(plist, "PageUsesTransparency", &ppdev->page_uses_transparency)) < 0 || + (code = param_write_bool(plist, "ReopenPerPage", &ppdev->ReopenPerPage)) < 0 ) return code; + /* Force the default to 'memory' if clist file I/O is not included in this build */ + if (clist_io_procs_file_global == NULL) + ppdev->BLS_force_memory = true; + if (ppdev->BLS_force_memory) { + bls.data = (byte *)"memory"; + bls.size = 6; + bls.persistent = false; + } else { + bls.data = (byte *)"file"; + bls.size = 4; + bls.persistent = false; + } + if( (code = param_write_string(plist, "BandListStorage", &bls)) < 0 ) + return code; + ofns.data = (const byte *)ppdev->fname, ofns.size = strlen(ppdev->fname), ofns.persistent = false; @@ -553,6 +568,7 @@ gdev_prn_put_params(gx_device * pdev, gs_param_list * plist) int nthreads = ppdev->num_render_threads_requested; gdev_prn_space_params sp, save_sp; gs_param_string ofs; + gs_param_string bls; gs_param_dict mdict; sp = ppdev->space_params; @@ -617,7 +633,7 @@ label:\ break switch (code = param_read_long(plist, (param_name = "MaxBitmap"), &sp.MaxBitmap)) { - CHECK_PARAM_CASES(MaxBitmap, sp.MaxBitmap < 10000, mbe); + CHECK_PARAM_CASES(MaxBitmap, sp.MaxBitmap < 0, mbe); } switch (code = param_read_long(plist, (param_name = "BufferSpace"), &sp.BufferSpace)) { @@ -636,6 +652,21 @@ label:\ CHECK_PARAM_CASES(band.BandBufferSpace, sp.band.BandBufferSpace < 0, bbse); } + switch (code = param_read_string(plist, (param_name = "BandListStorage"), &bls)) { + case 0: + /* Only accept 'file' if the file procs are include in the build */ + if ((bls.size > 1) && (bls.data[0] == 'm' || + (clist_io_procs_file_global != NULL && bls.data[0] == 'f'))) + break; + /* falls through */ + default: + ecode = code; + param_signal_error(plist, param_name, ecode); + case 1: + bls.data = 0; + break; + } + switch (code = param_read_string(plist, (param_name = "OutputFile"), &ofs)) { case 0: if (pdev->LockSafetyParams && @@ -702,6 +733,9 @@ label:\ } ppdev->space_params = sp; ppdev->num_render_threads_requested = nthreads; + if (bls.data != 0) { + ppdev->BLS_force_memory = (bls.data[0] == 'm'); + } /* If necessary, free and reallocate the printer memory. */ /* Formerly, would not reallocate if device is not open: */ diff --git a/gs/base/gdevprn.h b/gs/base/gdevprn.h index fb0dea000..a03e45800 100644 --- a/gs/base/gdevprn.h +++ b/gs/base/gdevprn.h @@ -229,16 +229,17 @@ struct gdev_prn_space_params_s { /* ------ before calling the device open routine. ------ */\ gdev_prn_space_params space_params;\ char fname[prn_fname_sizeof]; /* OutputFile */\ + bool BLS_force_memory;\ /* ------ Other device parameters ------ */\ bool OpenOutputFile;\ bool ReopenPerPage;\ bool page_uses_transparency; /* PDF 1.4 transparency is used on page */\ bool Duplex;\ - int Duplex_set; /* -1 = not supported */\ + int Duplex_set; /* -1 = not supported */\ /* ------ End of parameters ------ */\ bool file_is_new; /* true iff file just opened */\ FILE *file; /* output file */\ - long buffer_space; /* amount of space for clist buffer, */\ + long buffer_space; /* amount of space for clist buffer, */\ /* 0 means not using clist */\ byte *buf; /* buffer for rendering */\ /* ---- Begin async rendering support --- */\ @@ -412,6 +413,7 @@ extern const gx_device_procs prn_std_procs; BandingAuto /* banding_type */\ },\ { 0 }, /* fname */\ + 0/*false*/, /* BLS_force_memory */\ 0/*false*/, /* OpenOutputFile */\ 0/*false*/, /* ReopenPerPage */\ 0/*false*/, /* page_uses_transparency */\ diff --git a/gs/base/gxclbits.c b/gs/base/gxclbits.c index 9af0c306f..3880cfef8 100644 --- a/gs/base/gxclbits.c +++ b/gs/base/gxclbits.c @@ -20,6 +20,7 @@ #include "gsbitops.h" #include "gxdevice.h" #include "gxdevmem.h" /* must precede gxcldev.h */ +#include "gdevprn.h" /* for BLS_force_memory */ #include "gxcldev.h" #include "gxfmap.h" @@ -739,7 +740,7 @@ clist_change_bits(gx_device_clist_writer * cldev, gx_clist_state * pcls, loc.tile->width * pdepth, loc.tile->height * loc.tile->num_planes, loc.tile->cb_raster, rsize, - (1 << cmd_compress_cfe) | decompress_elsewhere, + decompress_elsewhere | (((gx_device_printer *)cldev->target)->BLS_force_memory ? (1 << cmd_compress_cfe) : 0), &dp, &csize); if (code < 0) diff --git a/gs/base/gxclist.c b/gs/base/gxclist.c index c53c26805..f034cd541 100644 --- a/gs/base/gxclist.c +++ b/gs/base/gxclist.c @@ -211,6 +211,8 @@ const clist_io_procs_t *clist_io_procs_memory_global = NULL; void clist_init_io_procs(gx_device_clist *pclist_dev, bool in_memory) { + /* if clist_io_procs_file_global is NULL, then BAND_LIST_STORAGE=memory */ + /* was specified in the build, and "file" is not available */ if (in_memory || clist_io_procs_file_global == NULL) pclist_dev->common.page_info.io_procs = clist_io_procs_memory_global; else diff --git a/gs/base/lib.mak b/gs/base/lib.mak index 98db845d7..faa6b2529 100644 --- a/gs/base/lib.mak +++ b/gs/base/lib.mak @@ -1922,7 +1922,7 @@ $(GLOBJ)gxclist.$(OBJ) : $(GLSRC)gxclist.c $(AK) $(gx_h) $(gserrors_h)\ $(GLCC) $(GLO_)gxclist.$(OBJ) $(C_) $(GLSRC)gxclist.c $(GLOBJ)gxclbits.$(OBJ) : $(GLSRC)gxclbits.c $(AK) $(gx_h)\ - $(gserrors_h) $(memory__h) $(gpcheck_h)\ + $(gserrors_h) $(memory__h) $(gpcheck_h) $(gdevprn_h)\ $(gsbitops_h) $(gxcldev_h) $(gxdevice_h) $(gxdevmem_h) $(gxfmap_h)\ $(MAKEDIRS) $(GLCC) $(GLO_)gxclbits.$(OBJ) $(C_) $(GLSRC)gxclbits.c diff --git a/gs/doc/Language.htm b/gs/doc/Language.htm index 8c63ba4d5..e78fd9c39 100644 --- a/gs/doc/Language.htm +++ b/gs/doc/Language.htm @@ -1948,6 +1948,15 @@ full page buffer may be somewhat larger than the bitmap size alone. </dl> <dl> +<dt><code>BandListStorage <file|memory></code> +<dd>The default is determined by the make file macro <code>BAND_LIST_STORAGE</code>. +Since <code>memory</code> is always included, specifying <code>-sBandListStorage=memory</code> +when the default is <code>file</code> will use memory based storage for the +band list of the page. This is primarily intended for testing, but if the disk I/O is +slow, band list storage in memory may be faster. +</dl> + +<dl> <dt><code>BufferSpace <integer></code> <dd>Size of the buffer space for band lists, if the full page raster image (bitmap) is larger than <code>MaxBitmap</code> (see above.) |