func (this *DWT_CDF_9_7) Inverse(src, dst []int) (uint, uint, error) { if len(src) < int(this.width*this.height) { return 0, 0, errors.New("The input buffer is too small") } if len(dst) < int(this.width*this.height) { return 0, 0, errors.New("The output buffer is too small") } if kanzi.SameIntSlices(src, dst, false) == false { copy(dst, src) } i := this.steps - 1 for { // First horizontal transform this.computeInverse(dst, 1, this.width, this.height>>i, this.width>>i) // Then vertical transform on the updated signal this.computeInverse(dst, this.width, 1, this.width>>i, this.height>>i) if i == 0 { break } i-- } return this.width * this.height, this.width * this.height, nil }
func (this *DWT_CDF_9_7) Forward(src, dst []int) (uint, uint, error) { if len(src) < int(this.width*this.height) { return 0, 0, errors.New("The input buffer is too small") } if len(dst) < int(this.width*this.height) { return 0, 0, errors.New("The output buffer is too small") } if kanzi.SameIntSlices(src, dst, false) == false { copy(dst, src) } for i := uint(0); i < this.steps; i++ { // First, vertical transform this.computeForward(dst, this.width, 1, this.width>>i, this.height>>i) // Then horizontal transform on the updated signal this.computeForward(dst, 1, this.width, this.height>>i, this.width>>i) } return this.width * this.height, this.width * this.height, nil }