public virtual Subband getSubband(int x, int y)
{
Subband cur, hhs;
// Check that we are inside this subband
if (x < ulx || y < uly || x >= ulx + w || y >= uly + h)
{
throw new System.ArgumentException();
}
cur = this;
while (cur.isNode)
{
hhs = cur.HH;
// While we are still at a node -> continue
if (x < hhs.ulx)
{
// Is the result of horizontal low-pass
if (y < hhs.uly)
{
// Vertical low-pass
cur = cur.LL;
}
else
{
// Vertical high-pass
cur = cur.LH;
}
}
else
{
// Is the result of horizontal high-pass
if (y < hhs.uly)
{
// Vertical low-pass
cur = cur.HL;
}
else
{
// Vertical high-pass
cur = cur.HH;
}
}
}
return cur;
}