[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire docs/design_SpanImages.rst org/fenfire/...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] fenfire docs/design_SpanImages.rst org/fenfire/... |
Date: |
Sat, 21 Jun 2003 09:56:15 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Branch:
Changes by: Tuomas J. Lukka <address@hidden> 03/06/21 09:56:14
Modified files:
docs : design_SpanImages.rst
org/fenfire/spanimages/gl: SingleImage.java
Added files:
org/fenfire/spanimages/gl: PaperMaker.java PoolManager.java
Log message:
uncommitted work from last thursday
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/docs/design_SpanImages.rst.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/PaperMaker.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/PoolManager.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/spanimages/gl/SingleImage.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: fenfire/docs/design_SpanImages.rst
diff -u fenfire/docs/design_SpanImages.rst:1.7
fenfire/docs/design_SpanImages.rst:1.8
--- fenfire/docs/design_SpanImages.rst:1.7 Mon Jun 16 12:48:29 2003
+++ fenfire/docs/design_SpanImages.rst Sat Jun 21 09:56:14 2003
@@ -158,13 +158,49 @@
class SingleImage
jlink
+ fields
+
+ ---
+ pq.n = PageScrollBlockImager.s;
+ iq.n = ImageScrollBlockImager.s;
+
+ horizontally(40, xx, PageScrollBlockImager, ImageScrollBlockImager);
+
+ vertically(50, yy, ScrollBlockImager, xx, SingleImage);
+
+ vertically(80, zz, SingleImage);
+
+
+An important architectural feature is that the classes are not static:
+this allows us to, e.g, plug in filters for the images of PageImageSpan.
+
+The Single Image class
+----------------------
+
+The class used by the repositories to represent the single images
+is ``SingleImage``.
+
+.. UML:: fenfirespans_sbimg_single
+
+ jlinkpackage org.fenfire.spanimages.gl
+
+ class SingleImage
+ jlink
+ realize org.nongnu.libvob.gl.GL.StatsCallback
assoc compos multi(1) - multi(1) org.nongnu.libvob.gl.MipzipLoader
assoc compos multi(1) - multi(1) org.nongnu.libvob.gl.GL.TexAccum
+ fields
+ float missingPixels[20]
+ long lastUpdate
+ String scrollBlock
+ int page
+ float resolution
+
+ jlinkpackage org.nongnu.libvob.gl
class org.nongnu.libvob.gl.GL.TexAccum
jlink
- jlinkpackage org.nongnu.libvob.gl
class org.nongnu.libvob.gl.MipzipLoader
jlink
@@ -172,21 +208,10 @@
float origWidth, origHeight
---
- pq.n = PageScrollBlockImager.s;
- iq.n = ImageScrollBlockImager.s;
-
- horizontally(40, xx, PageScrollBlockImager, ImageScrollBlockImager);
-
- vertically(50, yy, ScrollBlockImager, xx, SingleImage);
-
horizontally(60, ww, org.nongnu.libvob.gl.MipzipLoader,
- org.nongnu.libvob.gl.GL.TexAccum
- );
- vertically(80, zz, SingleImage, ww);
-
+ org.nongnu.libvob.gl.GL.TexAccum);
+ vertically(60, yy, SingleImage, ww);
-An important architectural feature is that the classes are not static:
-this allows us to, e.g, plug in filters for the images of PageImageSpan.
Mapping Images to Paper objects
-------------------------------
@@ -226,29 +251,32 @@
Now we come to the *raison d'etre* of this architecture: centralized
handling of the feedback from vobscene rendering. The TexAccum class in
Libvob is able to accumulate the approximate number of pixels rendered
-at each mipmap level of each texture.
+at each mipmap level of each texture. This is collected by the SingleImage
class.
+
+Because the ``MemoryPartitioner`` approach is a bit hard for us to interface
with here
+(the quality - calling time stuff is not optimal for us) we have
+our own partitioner.
+
+The PoolManager keeps a set of active textures.
.. UML:: fenfirespans_texaccum
jlinkpackage org.fenfire.spanimages.gl
- class org.nongnu.libvob.memory.MemoryPartitioner
+ class org.nongnu.libvob.gl.GL.StatsCallback "interface"
jlink
class PoolManager
jlink
- assoc compos - org.nongnu.libvob.memory.MemoryPartitioner
+ realize org.nongnu.libvob.gl.GL.StatsCallback
+ assoc multi(1) - multi(*) SingleImage
methods
SpanImageVob makeVob(SingleImage i, Paper p, float[] texgen, float
w, float h)
- qual q
- fields
- SingleImage i
+ class SingleImage
---
- q.n = PoolManager.s;
-
- org.nongnu.libvob.memory.MemoryPartitioner.s + (0, 60) = PoolManager.n;
+ vertically(60, xx, org.nongnu.libvob.gl.GL.StatsCallback, PoolManager,
SingleImage);
@@ -276,10 +304,14 @@
dep "use" DefaultSpanImageFactory ScrollBlockImager
dep "use" DefaultSpanImageFactory PaperMaker
-
+ dep "use" DefaultSpanImageFactory PoolManager
+
class ScrollBlockImager "abstract"
jlink
+ class PoolManager
+ jlink
+
class PaperMaker "interface"
jlink
@@ -287,7 +319,7 @@
DefaultSpanImageFactory.c = (0,0);
- vertically(60, xx, ScrollBlockImager, PaperMaker);
+ vertically(60, xx, ScrollBlockImager, PaperMaker, PoolManager);
horizontally(60, yy, SpanImageFactory, DefaultSpanImageFactory, xx);
Index: fenfire/org/fenfire/spanimages/gl/SingleImage.java
diff -u fenfire/org/fenfire/spanimages/gl/SingleImage.java:1.1
fenfire/org/fenfire/spanimages/gl/SingleImage.java:1.2
--- fenfire/org/fenfire/spanimages/gl/SingleImage.java:1.1 Thu Jun 12
07:07:45 2003
+++ fenfire/org/fenfire/spanimages/gl/SingleImage.java Sat Jun 21 09:56:14 2003
@@ -5,18 +5,42 @@
import org.nongnu.libvob.gl.*;
import org.nongnu.libvob.memory.*;
+/** A single texture image of an imagespan or pageimagespan.
+ * This class incorporates a single picture and tracks how the different mipmap
+ * levels would be used.
+ */
public class SingleImage {
public static boolean dbg = true;
private static void p(String s) { System.out.println("SingleImage: "+s); }
- private MipzipLoader loader;
- private MipzipMemoryConsumer consumer;
- private GL.TexAccum accum;
+ public MipzipLoader loader;
+ public GL.TexAccum accum;
+
+ /** For each mipmap level of loader, the number of pixels
+ * that would be rendered less than optimally.
+ * These numbers are calculated cumulatively with time, along
+ * with an exponential decay term.
+ */
+ public final double[] missingPixels;
+
+ public double nPixels() {
+ return missingPixels[missingPixels.length - 1];
+ }
+
+
+ private long lastUpdate = System.currentTimeMillis();
+
+ /** Decay coefficient.
+ * Coefficient C for exp(- C*(t1-t0)) when decaying.
+ */
+ public static float exponentialCoeff;
+
public final String scrollBlock;
public final int page;
public final float resolution;
+
/** Create.
* @param scrollBlock The scrollblock identifier.
* @param page The page index. For ImageSpans, always 0.
@@ -26,7 +50,6 @@
* 160dpi, then this number is 160.
*/
public SingleImage(
- MemoryPartitioner pool,
String scrollBlock, int page,
String filename,
float resolution) throws java.io.IOException {
@@ -35,23 +58,31 @@
this.resolution = resolution;
this.loader = new MipzipLoader(new File(filename));
- this.consumer = new MipzipMemoryConsumer(pool, loader);
this.accum = GL.createTexAccum();
- }
- public void updatePool() {
- double r[] = new double[20];
- for(int i=0; i<20; i++)
- r[i] = accum.get(i);
- accum.clear();
+ this.missingPixels = new double[this.loader.getNLevels()];
+ }
- if(dbg) {
- StringBuffer s = new StringBuffer();
- for(int i=0; i<20; i++) {
- s.append(" "); s.append(i);
- }
- p(scrollBlock+" "+page+" : "+s);
+ /** Read the data from the texaccum and add to
+ * missingPixels.
+ */
+ public synchronized void readTexAccum() {
+ double nnow = 0;
+ for(int i=0; i<missingPixels.length; i++) {
+ nnow += accum.get(i);
+ missingPixels[missingPixels.length-1 - i] += nnow;
}
+ accum.clear();
+ }
+ /** Update to the given time.
+ */
+ public synchronized void updateTime(long curTime) {
+ double msecs = curTime - lastUpdate;
+ lastUpdate = curTime;
+ double mul = Math.exp(- exponentialCoeff * msecs);
+ for(int i=0; i<missingPixels.length; i++)
+ missingPixels[i] *= mul;
}
+
}