CADI.Common.LogicalTarget.JPEG2000
Class CalculateRequiredComponentsDWT

java.lang.Object
  extended by CADI.Common.LogicalTarget.JPEG2000.CalculateRequiredComponentsDWT

public class CalculateRequiredComponentsDWT
extends java.lang.Object

This class calculates which components are needed to decompres one component when the DWT has been applied.

Usage example:
  construct
  run
  get functions

Version:
1.0.1 2008/09/08
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  byte[] bitMap
          Contains a bitmap that indicates if the component is relevant.
private static int[][] filter_5_3_EvenEven
          Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Even-Even position (2n,2m).
private static int[][] filter_5_3_EvenOdd
          Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Even-Odd position (2n,2m).
private static int[][] filter_5_3_OddEven
          Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Odd-Even position (2n,2m).
private static int[][] filter_5_3_OddOdd
          Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Odd-Odd position (2n,2m).
private static int[][] filter_9_7_AnyAny
          Position correspondence for filter 9/7 if the coefficient position in a normal domain is in a any-any position.
private static int[][] filter_9_7_AnyAny_x
          Position correspondence for filter 9/7 if the coefficient position in a normal domain is in a any-any position, to mark the coefficients in the 2 next columns, special cases for optimization.
private static int[][] filter_9_7_AnyAny_y
          Position correspondence for filter 9/7 if the coefficient position in a normal domain is in a any-any position, to mark the coefficients in the 2 next rows, special cases for optimization.
private  boolean[] inputComponents
          Is an one-dimension array that indicates which are the components to be decompressed.
private  int maxComponents
          Maximum number of components.
private  int maxRLevel
          Maximum number of resolution levels.
private  byte[][] nextRlevelBitMap
          Contains a bitmap that indicates if a component is marked to be checked in the next resolution level.
private  int[][][] subbandSizes
          Contains the subband sizes by component and resolution level.
private  int WTLevels
          DWT levels to apply for each component.
private  int WTType
          Discrete wavelet transform to be applied for each component.
private  int ySize
           
 
Constructor Summary
CalculateRequiredComponentsDWT(boolean[] inputComponents, int WTLevels, int WTType)
          Constructor.
 
Method Summary
private  void anyAny_x(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (any,any) and if (any-2,any) has been marked before, only for wavelet filter 9/7.
private  void anyAny_y(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (any,any) and the (any,any-2) has been marked before, only for wavelet filter 9/7.
private  void anyAny(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (any,any) only for wavelet filter 9/7.
private  void evenEven(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (2n,2n).
private  void evenOdd(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (2n,2n+1).
 boolean[] getRequiredComponents()
          Returns an one-dimensional array of booleans.
private  boolean isMarked(int rLevel, int y, int x)
          Check if a coefficient has to be checked to be shifted
private  boolean isSelected(int c)
          Check if a component is selected.
private  void mark(int rLevel, int y, int x)
          Mark a coefficient, this allow to know if the coefficient has to be shifted in the next ressolution level.
private  void oddEven(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (2n+1,2n).
private  void oddOdd(int rLevel, int y, int x)
          Mark the required coefficients if the coefficient is in a position (2n+1,2n+1).
private  void rasterWavelet5_3()
          Performs the raster for a component if the wavelet transform is 5/3 (-wt 1)
private  void rasterWavelet9_7()
          Performs the raster for a component if the wavelet transform is 9/7 (-wt 2)
 void run()
          Performs the calculus of the number of components which are needed to inver the DWT.
private  void shift(int rLevel, int y, int x, int subband)
          Mark a coefficient in the bitMap.
private  int[][][] subbandSizesCalculation()
          Calculate the subband sizes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputComponents

private boolean[] inputComponents
Is an one-dimension array that indicates which are the components to be decompressed.


WTLevels

private int WTLevels
DWT levels to apply for each component.

Negative values not allowed.


WTType

private int WTType
Discrete wavelet transform to be applied for each component.

Valid values are:


maxComponents

private int maxComponents
Maximum number of components.


bitMap

private byte[] bitMap
Contains a bitmap that indicates if the component is relevant.


nextRlevelBitMap

private byte[][] nextRlevelBitMap
Contains a bitmap that indicates if a component is marked to be checked in the next resolution level. (index meaning [z][rLevel][x,y] one bit bit simulates an x,y position).


subbandSizes

private int[][][] subbandSizes
Contains the subband sizes by component and resolution level.


filter_5_3_EvenEven

private static final int[][] filter_5_3_EvenEven
Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Even-Even position (2n,2m).

First array index represents the x position in the next resolution level and the second one y position(p.e. if x=6 and y=4, in the next resolution level for HL subband will have correspondence with (x=3,y=1) and (x=3,y=2).


filter_5_3_EvenOdd

private static final int[][] filter_5_3_EvenOdd
Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Even-Odd position (2n,2m).

First array index represents the x position in the next resolution level and the second one y position.


filter_5_3_OddEven

private static final int[][] filter_5_3_OddEven
Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Odd-Even position (2n,2m).

First array index represents the x position in the next resolution level and the second one y position.


filter_5_3_OddOdd

private static final int[][] filter_5_3_OddOdd
Position correspondence for filter 5/3 if the coefficient position in a normal domain is in a Odd-Odd position (2n,2m).

First array index represents the x position in the next resolution level and the second one y position.


filter_9_7_AnyAny

private static final int[][] filter_9_7_AnyAny
Position correspondence for filter 9/7 if the coefficient position in a normal domain is in a any-any position.

First array index represents the x position in the next resolution level and the second one y position.


filter_9_7_AnyAny_x

private static final int[][] filter_9_7_AnyAny_x
Position correspondence for filter 9/7 if the coefficient position in a normal domain is in a any-any position, to mark the coefficients in the 2 next columns, special cases for optimization.

First array index represents the x position in the next resolution level and the second one y position.


filter_9_7_AnyAny_y

private static final int[][] filter_9_7_AnyAny_y
Position correspondence for filter 9/7 if the coefficient position in a normal domain is in a any-any position, to mark the coefficients in the 2 next rows, special cases for optimization.

First array index represents the x position in the next resolution level and the second one y position.


ySize

private int ySize

maxRLevel

private int maxRLevel
Maximum number of resolution levels.

Constructor Detail

CalculateRequiredComponentsDWT

public CalculateRequiredComponentsDWT(boolean[] inputComponents,
                                      int WTLevels,
                                      int WTType)
Constructor.

Parameters:
inputComponents - definition in inputComponents.
WTLevels - definition in WTLevels.
WTType - definition in WTType.
Method Detail

run

public void run()
Performs the calculus of the number of components which are needed to inver the DWT.


getRequiredComponents

public boolean[] getRequiredComponents()
Returns an one-dimensional array of booleans. If the value of the element is true means that this component is required to invert the DWT. Otherwise, it is not required.

Returns:
an one-dimensional array with the relevant components. The array size if the maximum number of components. And its elements are true if the component is relevant, and false if it is not.

rasterWavelet5_3

private void rasterWavelet5_3()
Performs the raster for a component if the wavelet transform is 5/3 (-wt 1)


rasterWavelet9_7

private void rasterWavelet9_7()
Performs the raster for a component if the wavelet transform is 9/7 (-wt 2)


shift

private void shift(int rLevel,
                   int y,
                   int x,
                   int subband)
Mark a coefficient in the bitMap.

Parameters:
rLevel - ressolution level where belong the x and y postion.
y - position of the subband and rlevel.
x - position of the subband and rlevel.
subband - where belong the x and y postion.

anyAny

private void anyAny(int rLevel,
                    int y,
                    int x)
Mark the required coefficients if the coefficient is in a position (any,any) only for wavelet filter 9/7.

Parameters:
rLevel - is the ressolution level
y - position
x - position

anyAny_y

private void anyAny_y(int rLevel,
                      int y,
                      int x)
Mark the required coefficients if the coefficient is in a position (any,any) and the (any,any-2) has been marked before, only for wavelet filter 9/7.

Parameters:
rLevel - is the ressolution level
y - position
x - position

anyAny_x

private void anyAny_x(int rLevel,
                      int y,
                      int x)
Mark the required coefficients if the coefficient is in a position (any,any) and if (any-2,any) has been marked before, only for wavelet filter 9/7.

Parameters:
rLevel - is the ressolution level
y - position
x - position

evenEven

private void evenEven(int rLevel,
                      int y,
                      int x)
Mark the required coefficients if the coefficient is in a position (2n,2n).

Parameters:
rLevel - is the ressolution level
x - position

evenOdd

private void evenOdd(int rLevel,
                     int y,
                     int x)
Mark the required coefficients if the coefficient is in a position (2n,2n+1).

Parameters:
rLevel - is the ressolution level
y - position
x - position

oddEven

private void oddEven(int rLevel,
                     int y,
                     int x)
Mark the required coefficients if the coefficient is in a position (2n+1,2n).

Parameters:
rLevel - is the ressolution level
y - position
x - position

oddOdd

private void oddOdd(int rLevel,
                    int y,
                    int x)
Mark the required coefficients if the coefficient is in a position (2n+1,2n+1).

Parameters:
rLevel - is the ressolution level
y - position
x - position

mark

private void mark(int rLevel,
                  int y,
                  int x)
Mark a coefficient, this allow to know if the coefficient has to be shifted in the next ressolution level.

Parameters:
rLevel - ressolution level where belong the x and y postion.
y - position of the subband and rlevel.
x - position of the subband and rlevel.

isMarked

private boolean isMarked(int rLevel,
                         int y,
                         int x)
Check if a coefficient has to be checked to be shifted

Parameters:
rLevel - ressolution level where belong the x and y postion.
y - position of the subband and rlevel.
x - position of the subband and rlevel.
Returns:
a boolean, true is marked to be checked or false if not

isSelected

private boolean isSelected(int c)
Check if a component is selected.

Parameters:
c - component
Returns:
a boolean, true if the component(x) belongs to the components to be decompressed, and false if (x) does not belong to.

subbandSizesCalculation

private int[][][] subbandSizesCalculation()
Calculate the subband sizes.

Returns:
a multi-dimensional array with the subband sizes. Indexes mean subbandSizes[rLevel][LH|HL|HH][yBegin|xBegin|yEnd|xEnd]


CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)