[gs-cvs] rev 7860 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Tue Apr 17 07:09:51 PDT 2007
Author: leonardo
Date: 2007-04-17 07:09:50 -0700 (Tue, 17 Apr 2007)
New Revision: 7860
Modified:
trunk/gs/src/gxclbits.c
trunk/gs/src/gxclist.c
trunk/gs/src/gxpcmap.c
Log:
Implementing high level patterns, step 8.
DETAILS :
This is a preparation for fixing the bug 688396, step 8
This change is algorithmically equivalent :
the new behavior is temporarily disabled with
MAX_BITMAP_PATTERN_SIZE macro.
The revision 7856 appears incorrect in the part
"Disables tile cache for clist-based patterns.".
As a consequence, the revision 7855 appears incorrect in the part
"2. Releases the clist buffer when the clist writer completes with a pattern stream.".
This patch fixes that.
It allocates a half of 32K buffer for clist writer stream,
and another half for tile cache.
When building with MAX_BITMAP_PATTERN_SIZE 0,
the clist-based pattern code pased the testing with
ppmraw -r600 comparefiles
and pkmraw -r600 comparefiles.
Rather this testing detected few problems,
we believe that they're not important for the bug 688396.
This code needs further improvements :
1. Large uncolored patterns are not implemented. Need a color substitution forwarding device.
2. Get rid of non_gc_memory in the pattern clist.
3. For CET tests the choice of image-based or clist-based representation must be smarter than
MAX_BITMAP_PATTERN_SIZE threshold. While rendering a small pattern to memory device,
check whether PaintProc applies another apttern. If so, discard the image and
convert to the clist representation with running PaintProc at second time.
Need a special forwarding device for the pattern color detection.
4. When compiled with MAX_BITMAP_PATTERN_SIZE 0,
a wrong rendering of imagemask inside a pattern stream with ppmraw -r600 245-13.ps, 269-01.ps
5. When compiled with MAX_BITMAP_PATTERN_SIZE 0,
a wrong rendering of image inside a pattern stream with pkmraw -r600 035-07.ps
6. When compiled with MAX_BITMAP_PATTERN_SIZE 0,
a minor coordinate difference (+-1 pixel) appeared with pkmraw -r600 244-01.ps
7. When compiled with MAX_BITMAP_PATTERN_SIZE 0,
the rendeting is slow with pkmraw -r600 245-13.ps, 269-01.ps
8. (time optimization) clist_init is called twice when creating a clist-based pattern.
9. (space optimization) Store pattern stream in the pattern cache memory; properly
account the stream size while computing the cache memory usage.
10. (space optimization, 32K per pattern) Purge and free clist buffer
(which includes a tile cache) when a clist-based pattern is not active
between reading and writing. Why the tile cace is a property of a clist object ?
We would like to have a single global tile cache.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxclbits.c
===================================================================
--- trunk/gs/src/gxclbits.c 2007-04-17 06:55:36 UTC (rev 7859)
+++ trunk/gs/src/gxclbits.c 2007-04-17 14:09:50 UTC (rev 7860)
@@ -683,7 +683,7 @@
tile_loc loc;
int code;
- top:if (clist_find_bits(cldev, tiles->id, &loc)) { /* The bitmap is in the cache. Check whether this band */
+ top:if (clist_find_bits(cldev, tiles->id, &loc)) { /* The bitmap is in the cache. Check whether this band */
/* knows about it. */
uint band_index = pcls - cldev->states;
byte *bptr = ts_mask(loc.tile) + (band_index >> 3);
Modified: trunk/gs/src/gxclist.c
===================================================================
--- trunk/gs/src/gxclist.c 2007-04-17 06:55:36 UTC (rev 7859)
+++ trunk/gs/src/gxclist.c 2007-04-17 14:09:50 UTC (rev 7860)
@@ -345,7 +345,6 @@
gx_device_memory bdev;
gx_device *pbdev = (gx_device *)&bdev;
int code;
- extern dev_proc_open_device(pattern_clist_open_device);
/* Call create_buf_device to get the memory planarity set up. */
cdev->buf_procs.create_buf_device(&pbdev, target, NULL, NULL, clist_get_band_complexity(0, 0));
@@ -354,7 +353,7 @@
if (dev_proc(pbdev, copy_alpha) == gx_no_copy_alpha)
cdev->disable_mask |= clist_disable_copy_alpha;
if (cdev->procs.open_device == pattern_clist_open_device) {
- bits_size = 0;
+ bits_size = data_size / 2;
} else if (band_height) {
/*
* The band height is fixed, so the band buffer requirement
@@ -366,9 +365,6 @@
if (band_data_size >= band_space)
return_error(gs_error_rangecheck);
bits_size = min(band_space - band_data_size, data_size >> 1);
- code = clist_init_tile_cache(dev, data, bits_size);
- if (code < 0)
- return code;
} else {
/*
* Choose the largest band height that will fit in the
@@ -380,10 +376,10 @@
band_space - bits_size, page_uses_transparency);
if (band_height == 0)
return_error(gs_error_rangecheck);
- code = clist_init_tile_cache(dev, data, bits_size);
- if (code < 0)
- return code;
}
+ code = clist_init_tile_cache(dev, data, bits_size);
+ if (code < 0)
+ return code;
cdev->page_tile_cache_size = bits_size;
data += bits_size;
size -= bits_size;
@@ -410,9 +406,8 @@
cdev->permanent_error = 0;
nbands = cdev->nbands;
cdev->ymin = cdev->ymax = -1; /* render_init not done yet */
- if (cdev->procs.open_device != pattern_clist_open_device)
- memset(cdev->tile_table, 0, (cdev->tile_hash_mask + 1) *
- sizeof(*cdev->tile_table));
+ memset(cdev->tile_table, 0, (cdev->tile_hash_mask + 1) *
+ sizeof(*cdev->tile_table));
cdev->cnext = cdev->cbuf;
cdev->ccl = 0;
cdev->band_range_list.head = cdev->band_range_list.tail = 0;
Modified: trunk/gs/src/gxpcmap.c
===================================================================
--- trunk/gs/src/gxpcmap.c 2007-04-17 06:55:36 UTC (rev 7859)
+++ trunk/gs/src/gxpcmap.c 2007-04-17 14:09:50 UTC (rev 7860)
@@ -699,8 +699,6 @@
ctile->is_simple = pinst->is_simple;
ctile->is_dummy = false;
if (fdev->procs.open_device != pattern_clist_open_device) {
- gx_device_pattern_accum *padev = (gx_device_pattern_accum *)fdev;
-
if (mbits != 0) {
make_bitmap(&ctile->tbits, mbits, gs_next_ids(pis->memory, 1));
mbits->bitmap_memory = 0; /* don't free the bits */
@@ -724,6 +722,7 @@
ctile->tmask.size.x = 0;
ctile->tmask.size.y = 0;
ctile->cdev = cdev;
+#if 0 /* Don't free - tile cache is used by clist reader. */
gs_free_object(cwdev->bandlist_memory, cwdev->data, "gx_pattern_cache_add_entry");
cwdev->data = NULL;
cwdev->states = NULL;
@@ -731,6 +730,7 @@
cwdev->cnext = NULL;
cwdev->cend = NULL;
cwdev->ccl = NULL;
+#endif
/* Prevent freeing files on pattern_paint_cleanup : */
cwdev->do_not_open_or_close_bandfiles = true;
}
More information about the gs-cvs
mailing list