@Override
   public void subSample(int[] input, int[] output) 
   {
      SliceIntArray src = new SliceIntArray(input, 0);
      SliceIntArray dst = new SliceIntArray(output, 0);
      this.dwt.forward(src, dst);
      int offs = 0;
      final int sh = this.shift;
      final int h = this.height;
      final int w = this.width;
      final int adjust = (sh <= 1) ? 0 : (1 << sh) >> 1;

      for (int j=0; j<h; j++)
      {
         if (j+j<h)
         {
            for (int i=0; i+i<w; i++)
            {
               if (output[offs+i] >= adjust)
                  output[offs+i] = (output[offs+i] + adjust) >> sh;
               else if (output[offs+i] <= -adjust)
                  output[offs+i] = (output[offs+i] - adjust) >> sh;
               else
                  output[offs+i] = 0;
            }
            
            for (int i=w/2; i<w; i++)
               output[offs+i] = 0;
         }
         else
         {
            for (int i=0; i<w; i++)
               output[offs+i] = 0;
         }
         
         offs += this.stride;
      }
   }