private void wavelet2DDecomposition(DataBlk band, SubbandAn subband, int c)
{
int ulx, uly, w, h;
int band_w, band_h;
// If subband is empty (i.e. zero size) nothing to do
if (subband.w == 0 || subband.h == 0)
{
return ;
}
ulx = subband.ulx;
uly = subband.uly;
w = subband.w;
h = subband.h;
band_w = getTileCompWidth(tIdx, c);
band_h = getTileCompHeight(tIdx, c);
if (intData)
{
//Perform the decompositions if the filter is implemented with an
//integer arithmetic.
int i, j;
int offset;
int[] tmpVector = new int[System.Math.Max(w, h)];
int[] data = ((DataBlkInt) band).DataInt;
//Perform the vertical decomposition
if (subband.ulcy % 2 == 0)
{
// Even start index => use LPF
for (j = 0; j < w; j++)
{
offset = uly * band_w + ulx + j;
for (i = 0; i < h; i++)
tmpVector[i] = data[offset + (i * band_w)];
subband.vFilter.analyze_lpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + ((h + 1) / 2) * band_w, band_w);
}
}
else
{
// Odd start index => use HPF
for (j = 0; j < w; j++)
{
offset = uly * band_w + ulx + j;
for (i = 0; i < h; i++)
tmpVector[i] = data[offset + (i * band_w)];
subband.vFilter.analyze_hpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + (h / 2) * band_w, band_w);
}
}
//Perform the horizontal decomposition.
if (subband.ulcx % 2 == 0)
{
// Even start index => use LPF
for (i = 0; i < h; i++)
{
offset = (uly + i) * band_w + ulx;
for (j = 0; j < w; j++)
tmpVector[j] = data[offset + j];
subband.hFilter.analyze_lpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + (w + 1) / 2, 1);
}
}
else
{
// Odd start index => use HPF
for (i = 0; i < h; i++)
{
offset = (uly + i) * band_w + ulx;
for (j = 0; j < w; j++)
tmpVector[j] = data[offset + j];
subband.hFilter.analyze_hpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + w / 2, 1);
}
}
}
else
{
//Perform the decompositions if the filter is implemented with a
//float arithmetic.
int i, j;
int offset;
float[] tmpVector = new float[System.Math.Max(w, h)];
float[] data = ((DataBlkFloat) band).DataFloat;
//Perform the vertical decomposition.
if (subband.ulcy % 2 == 0)
{
// Even start index => use LPF
for (j = 0; j < w; j++)
{
offset = uly * band_w + ulx + j;
for (i = 0; i < h; i++)
tmpVector[i] = data[offset + (i * band_w)];
subband.vFilter.analyze_lpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + ((h + 1) / 2) * band_w, band_w);
}
}
else
{
// Odd start index => use HPF
for (j = 0; j < w; j++)
{
offset = uly * band_w + ulx + j;
for (i = 0; i < h; i++)
tmpVector[i] = data[offset + (i * band_w)];
subband.vFilter.analyze_hpf(tmpVector, 0, h, 1, data, offset, band_w, data, offset + (h / 2) * band_w, band_w);
}
}
//Perform the horizontal decomposition.
if (subband.ulcx % 2 == 0)
{
// Even start index => use LPF
for (i = 0; i < h; i++)
{
offset = (uly + i) * band_w + ulx;
for (j = 0; j < w; j++)
tmpVector[j] = data[offset + j];
subband.hFilter.analyze_lpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + (w + 1) / 2, 1);
}
}
else
{
// Odd start index => use HPF
for (i = 0; i < h; i++)
{
offset = (uly + i) * band_w + ulx;
for (j = 0; j < w; j++)
tmpVector[j] = data[offset + j];
subband.hFilter.analyze_hpf(tmpVector, 0, w, 1, data, offset, 1, data, offset + w / 2, 1);
}
}
}
}