cz.cuni.jagrlib.piece
Class FractalCompressionQtree.ImageBlock

java.lang.Object
  extended by cz.cuni.jagrlib.piece.FractalCompressionQtree.ImageBlock
All Implemented Interfaces:
java.lang.Comparable<FractalCompressionQtree.ImageBlock>
Enclosing class:
FractalCompressionQtree

protected class FractalCompressionQtree.ImageBlock
extends java.lang.Object
implements java.lang.Comparable<FractalCompressionQtree.ImageBlock>

Decoded image block, acts as Q-tree node as well.


Field Summary
 FractalCompressionQtree.ImageBlock[] desc
          Descendants (can be empty).
 double error
          Reconstruction error (for adaptive encoder).
 double o
          Pixel transform coefficients (contrast, brightness).
 int order
          Block order (descending reconstruction error).
 int orientation
          Best source orientation (see RasterSearch.ORI_0123, ..).
 double s
          Pixel transform coefficients (contrast, brightness).
 int size
          Block size in pixels.
 double sourceX
          Best source coordinates.
 double sourceY
          Best source coordinates.
 int x0
          Upper-left corner coordinates.
 int y0
          Upper-left corner coordinates.
 
Constructor Summary
FractalCompressionQtree.ImageBlock(int x, int y, int siz)
          Non-initialized (inner) Q-tree node.
FractalCompressionQtree.ImageBlock(int x, int y, int siz, RasterGraphics g)
          Initialized (matched) Q-tree node.
 
Method Summary
 int compareTo(FractalCompressionQtree.ImageBlock o)
          Natural ordering: descending [ error ].
 void encode()
          Encoding the sub-tree rooted here.
 void logTree(int depth)
          Write decomposition diagram into the FractalCompressionQtree.log image.
 boolean match(RasterGraphics g)
          Computes block match in the prepared reference image.
 void setChild(int ord, FractalCompressionQtree.ImageBlock ch)
          Inserts the given child sub-tree, creates desc array if necessary.
 void transformImage()
          Performs one step of fractal transform (PIFS).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x0

public int x0
Upper-left corner coordinates.


y0

public int y0
Upper-left corner coordinates.


size

public int size
Block size in pixels.


sourceX

public double sourceX
Best source coordinates.


sourceY

public double sourceY
Best source coordinates.


orientation

public int orientation
Best source orientation (see RasterSearch.ORI_0123, ..).


s

public double s
Pixel transform coefficients (contrast, brightness).


o

public double o
Pixel transform coefficients (contrast, brightness).


error

public double error
Reconstruction error (for adaptive encoder).


order

public int order
Block order (descending reconstruction error). 0 for the best (=final) nodes.


desc

public FractalCompressionQtree.ImageBlock[] desc
Descendants (can be empty).

Constructor Detail

FractalCompressionQtree.ImageBlock

public FractalCompressionQtree.ImageBlock(int x,
                                          int y,
                                          int siz)
Non-initialized (inner) Q-tree node.


FractalCompressionQtree.ImageBlock

public FractalCompressionQtree.ImageBlock(int x,
                                          int y,
                                          int siz,
                                          RasterGraphics g)
Initialized (matched) Q-tree node.

Method Detail

setChild

public void setChild(int ord,
                     FractalCompressionQtree.ImageBlock ch)
Inserts the given child sub-tree, creates desc array if necessary.


match

public boolean match(RasterGraphics g)
Computes block match in the prepared reference image. Returns true if succeeded.


encode

public void encode()
            throws java.io.IOException
Encoding the sub-tree rooted here. Code of one node will be:
 CTX_CTRL:  { CTRL_REC     | recursive descent (w/o block match)
              CTRL_NODE    | inner node (contains inferior block match)
              CTRL_FAIL    | failed leaf node (dead-end)
              >= CTRL_ORI0 } leaf node (1st symbol defines its orientation)
 [raw-bits: order]           block order number (if 'bestCodeOnly' is not set)
 CTX_COORD: x, y             reference image coordinates
 CTX_S:     s                quantized 's' coef (multiplier)
 CTX_O:     o                quantized 'o' coef (addend)
 

Throws:
java.io.IOException

transformImage

public void transformImage()
Performs one step of fractal transform (PIFS). Source image was already downsampled by a factor of 2.


logTree

public void logTree(int depth)
Write decomposition diagram into the FractalCompressionQtree.log image.


compareTo

public int compareTo(FractalCompressionQtree.ImageBlock o)
Natural ordering: descending [ error ].

Specified by:
compareTo in interface java.lang.Comparable<FractalCompressionQtree.ImageBlock>