From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- .../src/matlabPyrTools/MEX/convolve.c | 325 +++++++++++++++++++++ 1 file changed, 325 insertions(+) create mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c new file mode 100755 index 0000000..60a11a4 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/matlabPyrTools/MEX/convolve.c @@ -0,0 +1,325 @@ +/* +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;; File: convolve.c +;;; Author: Eero Simoncelli +;;; Description: General convolution code for 2D images +;;; Creation Date: Spring, 1987. +;;; MODIFICATIONS: +;;; 10/89: approximately optimized the choice of register vars on SPARCS. +;;; 6/96: Switched array types to double float. +;;; 2/97: made more robust and readable. Added STOP arguments. +;;; 8/97: Bug: when calling internal_reduce with edges in {reflect1,repeat, +;;; extend} and an even filter dimension. Solution: embed the filter +;;; in the upper-left corner of a filter with odd Y and X dimensions. +;;; ---------------------------------------------------------------- +;;; Object-Based Vision and Image Understanding System (OBVIUS), +;;; Copyright 1988, Vision Science Group, Media Laboratory, +;;; Massachusetts Institute of Technology. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +*/ + +#include +#include +#include "convolve.h" + +/* + -------------------------------------------------------------------- + Correlate FILT with IMAGE, subsampling according to START, STEP, and + STOP parameters, with values placed into RESULT array. RESULT + dimensions should be ceil((stop-start)/step). TEMP should be a + pointer to a temporary double array the size of the filter. + EDGES is a string specifying how to handle boundaries -- see edges.c. + The convolution is done in 9 sections, where the border sections use + specially computed edge-handling filters (see edges.c). The origin + of the filter is assumed to be (floor(x_fdim/2), floor(y_fdim/2)). +------------------------------------------------------------------------ */ + +/* abstract out the inner product computation */ +#define INPROD(XCNR,YCNR) \ + { \ + sum=0.0; \ + for (im_pos=YCNR*x_dim+XCNR, filt_pos=0, x_filt_stop=x_fdim; \ + x_filt_stop<=filt_size; \ + im_pos+=(x_dim-x_fdim), x_filt_stop+=x_fdim) \ + for (; \ + filt_pos