/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; File: wrap.c ;;; Author: Eero Simoncelli ;;; Description: Circular convolution on 2D images. ;;; Creation Date: Spring, 1987. ;;; MODIFICATIONS: ;;; 6/96: Switched array types to double float. ;;; 2/97: made more robust and readable. Added STOP arguments. ;;; ---------------------------------------------------------------- ;;; Object-Based Vision and Image Understanding System (OBVIUS), ;;; Copyright 1988, Vision Science Group, Media Laboratory, ;;; Massachusetts Institute of Technology. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ #include #include "convolve.h" /* -------------------------------------------------------------------- Performs correlation (i.e., convolution with filt(-x,-y)) of FILT with IMAGE followed by subsampling (a.k.a. REDUCE in Burt&Adelson81). The operations are combined to avoid unnecessary computation of the convolution samples that are to be discarded in the subsampling operation. The convolution is done in 9 sections so that mod operations are not performed unnecessarily. The subsampling lattice is specified by the START, STEP and STOP parameters. -------------------------------------------------------------------- */ /* abstract out the inner product computation */ #define INPROD(YSTART,YIND,XSTART,XIND) \ { \ sum=0.0; \ for (y_im=YSTART, filt_pos=0, x_filt_stop=x_fdim; \ x_filt_stop<=filt_size; \ y_im++, x_filt_stop+=x_fdim) \ for (x_im=XSTART ; \ filt_pos