code: public static int borderForwardUpper( WlCoef desc , int dataLength) {
  		int w = Math.max( desc.offsetScaling+desc.getScalingLength() , desc.offsetWavelet+desc.getWaveletLength());
  
  		int a = dataLength%2;
  		w -= a;
  
  		return Math.max((w + (w%2))-2,0)+a;
  	}
docs: Returns the upper border (offset from image edge) for a forward wavelet transform.