# HG changeset patch # User robcast # Date 1139938278 -3600 # Node ID 0fc853d98820ad858aa956b96f19c9660ba73510 # Parent 6a74da78f304169e20d39245a7f3186c81093e49 Experiment with TileCache size (better leave it...) diff -r 6a74da78f304 -r 0fc853d98820 servlet/src/digilib/image/JAIDocuImage.java --- a/servlet/src/digilib/image/JAIDocuImage.java Mon Feb 13 20:59:02 2006 +0100 +++ b/servlet/src/digilib/image/JAIDocuImage.java Tue Feb 14 18:31:18 2006 +0100 @@ -46,6 +46,7 @@ import digilib.io.FileOps; import digilib.io.ImageFile; import digilib.io.ImageFileset; +import javax.media.jai.TileCache; /** A DocuImage implementation using Java Advanced Imaging Library. */ public class JAIDocuImage extends DocuImageImpl { @@ -54,6 +55,13 @@ protected Interpolation interpol = null; + static { + /* we could set our own tile cache size here + TileCache tc = JAI.createTileCache(100*1024*1024); + JAI.getDefaultInstance().setTileCache(tc); + */ + } + /* returns a list of supported image formats */ public Iterator getSupportedFormats() { Enumeration codecs = ImageCodec.getCodecs(); @@ -63,6 +71,7 @@ logger.debug("known format:"+((ImageCodec) codec).getFormatName()); formats.add(((ImageCodec) codec).getFormatName()); } + logger.debug("tilecachesize:"+JAI.getDefaultInstance().getTileCache().getMemoryCapacity()); return formats.iterator(); } @@ -186,8 +195,11 @@ /* * blur and "Scale" for downscaling color images */ - int subsample = (int) Math.floor(1 / scale); - blur(subsample); + if ((scale <= 0.5) && (quality > 1)) { + int bl = (int) Math.floor(1 / scale); + // don't blur more than 3 + blur(Math.min(bl, 3)); + } scaleAll((float) scale); } else { /* @@ -225,9 +237,8 @@ public void blur(int radius) throws ImageOpException { RenderedImage blurredImg; - // DEBUG - logger.debug("blur: " + radius); int klen = Math.max(radius, 2); + logger.debug("blur: " + klen); int ksize = klen * klen; float f = 1f / ksize; float[] kern = new float[ksize];