public WaveletCSFFilter(int width, int height, int levels, int channelType)
    {
        if (width < 8)
            throw new IllegalArgumentException("The width of the image must be at least 8");

        if (height < 8)
            throw new IllegalArgumentException("The height of the image must be at least 8");

        if (levels < 2)
            throw new IllegalArgumentException("The number of wavelet sub-band levels must be at least 2");

        if (levels >= 8)
           throw new IllegalArgumentException("The number of wavelet sub-band levels must be at most 7");

       if ((channelType != Y_CHANNEL) && (channelType != Cb_CHANNEL)
               && (channelType != Cr_CHANNEL))
           throw new IllegalArgumentException("The channel must be of type Y or Cr or Cb");

        this.width = width;
        this.height = height;
        this.levels = levels;
        this.buffer = new int[(Math.max(width, height) <= 512) ? 16384 : 32768];
        this.channelType = channelType;
    }