private calcBasisWaveForms ( float wfs ) : void | ||
wfs | float | An size 2 array where the line and column waveforms will be /// returned. /// /// |
return | void |
private void calcBasisWaveForms(float[][] wfs)
{
if (l2Norm < 0)
{
// We are not finished with this element yet
if (isNode)
{
// We are on a node => search on childs
if (subb_LL.l2Norm < 0f)
{
subb_LL.calcBasisWaveForms(wfs);
wfs[0] = hFilter.getLPSynWaveForm(wfs[0], null);
wfs[1] = vFilter.getLPSynWaveForm(wfs[1], null);
}
else if (subb_HL.l2Norm < 0f)
{
subb_HL.calcBasisWaveForms(wfs);
wfs[0] = hFilter.getHPSynWaveForm(wfs[0], null);
wfs[1] = vFilter.getLPSynWaveForm(wfs[1], null);
}
else if (subb_LH.l2Norm < 0f)
{
subb_LH.calcBasisWaveForms(wfs);
wfs[0] = hFilter.getLPSynWaveForm(wfs[0], null);
wfs[1] = vFilter.getHPSynWaveForm(wfs[1], null);
}
else if (subb_HH.l2Norm < 0f)
{
subb_HH.calcBasisWaveForms(wfs);
wfs[0] = hFilter.getHPSynWaveForm(wfs[0], null);
wfs[1] = vFilter.getHPSynWaveForm(wfs[1], null);
}
else
{
// There is an error! If all childs have non-negative
// l2norm, then this node should have non-negative l2norm
throw new System.InvalidOperationException("You have found a bug in JJ2000!");
}
}
else
{
// This is a leaf, just use diracs (null is equivalent to
// dirac)
wfs[0] = new float[1];
wfs[0][0] = 1.0f;
wfs[1] = new float[1];
wfs[1][0] = 1.0f;
}
}
else
{
// This is an error! The calcBasisWaveForms() method is never
// called on an element with non-negative l2norm
throw new System.InvalidOperationException("You have found a bug in JJ2000!");
}
}
/// <summary> Calculates the basis waveform of the first leaf for which the L2-norm /// has not been calculated yet. This method searches recursively for the /// first leaf for which the value has not been calculated yet, and then /// calculates the L2-norm on the return path. /// /// <p>The wfs argument should be a size 2 array of float arrays (i.e. 2D /// array) and it must be of length 2 (or more). When returning, wfs[0] /// will contain the line waveform, and wfs[1] will contain the column /// waveform.</p> /// /// <p>This method can not be called on an element that ahs a non-negative /// value in l2Norm, since that means that we are done.</p> /// /// </summary> /// <param name="wfs">An size 2 array where the line and column waveforms will be /// returned. /// /// </param> private void calcBasisWaveForms(float[][] wfs) { if (l2Norm < 0) { // We are not finished with this element yet if (isNode) { // We are on a node => search on childs if (subb_LL.l2Norm < 0f) { subb_LL.calcBasisWaveForms(wfs); wfs[0] = hFilter.getLPSynWaveForm(wfs[0], null); wfs[1] = vFilter.getLPSynWaveForm(wfs[1], null); } else if (subb_HL.l2Norm < 0f) { subb_HL.calcBasisWaveForms(wfs); wfs[0] = hFilter.getHPSynWaveForm(wfs[0], null); wfs[1] = vFilter.getLPSynWaveForm(wfs[1], null); } else if (subb_LH.l2Norm < 0f) { subb_LH.calcBasisWaveForms(wfs); wfs[0] = hFilter.getLPSynWaveForm(wfs[0], null); wfs[1] = vFilter.getHPSynWaveForm(wfs[1], null); } else if (subb_HH.l2Norm < 0f) { subb_HH.calcBasisWaveForms(wfs); wfs[0] = hFilter.getHPSynWaveForm(wfs[0], null); wfs[1] = vFilter.getHPSynWaveForm(wfs[1], null); } else { // There is an error! If all childs have non-negative // l2norm, then this node should have non-negative l2norm throw new System.ApplicationException("You have found a bug in JJ2000!"); } } else { // This is a leaf, just use diracs (null is equivalent to // dirac) wfs[0] = new float[1]; wfs[0][0] = 1.0f; wfs[1] = new float[1]; wfs[1][0] = 1.0f; } } else { // This is an error! The calcBasisWaveForms() method is never // called on an element with non-negative l2norm throw new System.ApplicationException("You have found a bug in JJ2000!"); } }