From 25d94aa8aabb8ac3e8bbea0bc439ea6148444cc8 Mon Sep 17 00:00:00 2001 From: leochanj Date: Wed, 21 Oct 2020 01:52:54 -0400 Subject: debug libextra and remove matlab --- .../texture_synthesis/src/matlab/MEX/-MacReadMe | 1 - .../src/matlab/MEX/.AppleDouble/.Parent | Bin 589 -> 0 bytes .../texture_synthesis/src/matlab/MEX/.FBCIndex | Bin 258048 -> 0 bytes .../matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile | Bin 6 -> 0 bytes .../src/matlab/MEX/Makefile-linux | 39 -- .../src/matlab/MEX/Makefile-ml6-linux | 39 -- .../texture_synthesis/src/matlab/MEX/Makefile-osx | 39 -- .../src/matlab/MEX/Makefile-solaris | 38 -- .../texture_synthesis/src/matlab/MEX/Makefile-sun4 | 39 -- .../texture_synthesis/src/matlab/MEX/convolve.c | 325 ----------- .../texture_synthesis/src/matlab/MEX/convolve.h | 55 -- .../src/matlab/MEX/convolve.mexglx | Bin 13605 -> 0 bytes .../texture_synthesis/src/matlab/MEX/corrDn.c | 145 ----- .../texture_synthesis/src/matlab/MEX/edges.c | 647 --------------------- .../texture_synthesis/src/matlab/MEX/edges.mexa64 | Bin 16059 -> 0 bytes .../texture_synthesis/src/matlab/MEX/histo.c | 140 ----- .../texture_synthesis/src/matlab/MEX/innerProd.c | 52 -- .../texture_synthesis/src/matlab/MEX/innerProd.dll | Bin 41984 -> 0 bytes .../src/matlab/MEX/innerProd.mexa64 | Bin 7725 -> 0 bytes .../src/matlab/MEX/innerProd.mexglx | Bin 17704 -> 0 bytes .../src/matlab/MEX/innerProd.mexlx | Bin 4479 -> 0 bytes .../src/matlab/MEX/innerProd.mexmac | Bin 21600 -> 0 bytes .../src/matlab/MEX/innerProd.mexsol | Bin 3948 -> 0 bytes .../texture_synthesis/src/matlab/MEX/pointOp.c | 126 ---- .../texture_synthesis/src/matlab/MEX/range2.c | 56 -- .../texture_synthesis/src/matlab/MEX/upConv.c | 195 ------- .../texture_synthesis/src/matlab/MEX/wrap.c | 281 --------- 27 files changed, 2217 deletions(-) delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4 delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.h delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.mexa64 delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/histo.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.dll delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexa64 delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexglx delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexlx delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexmac delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.mexsol delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/pointOp.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/range2.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c delete mode 100755 SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c (limited to 'SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX') diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe deleted file mode 100755 index 898dc0c..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/-MacReadMe +++ /dev/null @@ -1 +0,0 @@ -MacReadMe How to compile a MEX file for Macintosh (Based on a similar note written by David Brainard and Denis Pelli to accompany the Psychophysics Toolbox.) A MEX file (short for "MATLAB extension") contains code that implements a new MATLAB function, allowing users to use the full power of the C language and the Macintosh hardware and operating system in implementing a new MATLAB function. This document explains how to produce a MEX file that is "fat" (i.e. will run as native code on both 68K and PowerPC Macs) and is compatible with both MATLAB 4 and 5. 1) To produce a MATLAB MEX file with PowerPC code you must have the Metrowerks CodeWarrior C compiler (version 10 or better, abbreviated as CW below). To produce 68K code we still use the Symantec THINK C compiler (version from Symantec C++ 8 CD-ROM release 5), but we will soon be switching to Metrowerks CodeWarrior. (See note A below.) 2) Place a copy of the MATLAB 4:Extern folder, supplied by Mathworks, on your compiler's search path. We suggest that you name the copy "MEX V4". (See notes B and C, below.) 3) Build any of the MEX files simply by opening its project file and asking your compiler to "Build Code Resource" (in THINK C) or to "Make" it (in CW). For each MEX file, e.g. histo.mex, there are two associated projects, e.g. histo.µ for CW, and histo.¹.4 for THINK C. To build a "fat" MEX, that runs native on both 68K and PowerPC, you should first compile in THINK C, and then in CW. (See note A, below.) Denis Pelli April 2, 1997 Notes A) The Mathworks support only the THINK C compiler to make 68K MEX code for MATLAB version 4 and only the CW compiler to make PPC MEX files for MATLAB 4 and both 68K and PPC for MATLAB 5. This archive includes THINK and CW projects. To build a fat MEX file for MATLAB 4, first "make" the THINK C version (e.g. histo.¹.4), producing a file with a .rsrc extension (e.g. histo.µ.rsrc). This is the 68K MEX file. When you then "make" histo.µ, the CW project incorporates the .rsrc file and generates a "fat" MEX file that will run native (i.e. fast) on both 68K and PowerPC. To make a 68K-only MEX file, simply rename, e.g., histo.µ.rsrc to histo.mex after you make the THINK project, and set the file type and creator to match the other MEX files. THINK C is slow and hard to work with. Symantec hasn't significantly upgraded in it many years. There is an error in the math.h header (version from Symantec C++ 8 CD-ROM release 5). We fix that error by some tricky preprocessor defines and undefines in the THINK C Prefix in each of the THINK projects. B) The easiest way to put a folder on your compilerÕs search path is simply to put the folder in the same folder as the compiler itself. If you want to use both CW and THINK C, then put the folder under CW, make an alias of it, and put the alias in THINK C's "Aliases" folder. C) Happily, MATLAB 5 is capable of running both V4 and V5 MEX files. Thus we are currently distributing sources that compile into V4 MEX files. The resulting MEX files run both under V4 and V5. In the future we will drop support for V4 and THINK C. (See note A above.) \ No newline at end of file diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent deleted file mode 100755 index f242a99..0000000 Binary files a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.AppleDouble/.Parent and /dev/null differ diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex deleted file mode 100755 index 848736b..0000000 Binary files a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCIndex and /dev/null differ diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile deleted file mode 100755 index ab2c684..0000000 Binary files a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/.FBCLockFolder/.FBCSemaphoreFile and /dev/null differ diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux deleted file mode 100755 index 726dd31..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-linux +++ /dev/null @@ -1,39 +0,0 @@ -MLAB = /usr/local/matlab5.1 - -MXSFX = mexlx -MEX = ${MLAB}/bin/mex - -MFLAGS = -V4 -INC = -I ${MLAB}/extern/include -LIB = -L ${MLAB}/extern/lib - -CC = gcc -Wall -pedantic -C_OPTIMIZE_SWITCH = -O2 ## For GCC -CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} - -all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ - histo.${MXSFX} range2.${MXSFX} - -clean: - /bin/rm *.o - -corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o - -upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o - -pointOp.${MXSFX}: pointOp.o - ${MEX} ${MFLAGS} pointOp.o - -histo.${MXSFX}: histo.o - ${MEX} ${MFLAGS} histo.o - -range2.${MXSFX}: range2.o - ${MEX} ${MFLAGS} range2.o - -convolve.o wrap.o edges.o: convolve.h - -%.o : %.c - ${CC} -c ${CFLAGS} $< - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux deleted file mode 100755 index f596ad7..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-ml6-linux +++ /dev/null @@ -1,39 +0,0 @@ -MLAB = /usr/local/matlab6.0 - -MXSFX = mexglx -MEX = ${MLAB}/bin/mex - -MFLAGS = -V4 -INC = -I ${MLAB}/extern/include -LIB = -L ${MLAB}/extern/lib - -CC = gcc -Wall -pedantic -C_OPTIMIZE_SWITCH = -O2 ## For GCC -CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} - -all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ - histo.${MXSFX} range2.${MXSFX} - -clean: - /bin/rm *.o - -corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o - -upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o - -pointOp.${MXSFX}: pointOp.o - ${MEX} ${MFLAGS} pointOp.o - -histo.${MXSFX}: histo.o - ${MEX} ${MFLAGS} histo.o - -range2.${MXSFX}: range2.o - ${MEX} ${MFLAGS} range2.o - -convolve.o wrap.o edges.o: convolve.h - -%.o : %.c - ${CC} -c ${CFLAGS} $< - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx deleted file mode 100755 index 352d15b..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-osx +++ /dev/null @@ -1,39 +0,0 @@ -MLAB = /share/wotan/matlab13 - -MXSFX = mexosx -MEX = ${MLAB}/bin/mex - -MFLAGS = -INC = -I ${MLAB}/extern/include -LIB = -L ${MLAB}/extern/lib - -CC = cc -Wall -pedantic -no-cpp-precomp -C_OPTIMIZE_SWITCH = -O2 ## For GCC -CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} - -all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ - histo.${MXSFX} range2.${MXSFX} - -clean: - /bin/rm *.o - -corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o - -upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o - -pointOp.${MXSFX}: pointOp.o - ${MEX} ${MFLAGS} pointOp.o - -histo.${MXSFX}: histo.o - ${MEX} ${MFLAGS} histo.o - -range2.${MXSFX}: range2.o - ${MEX} ${MFLAGS} range2.o - -convolve.o wrap.o edges.o: convolve.h - -%.o : %.c - ${CC} -c ${CFLAGS} $< - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris deleted file mode 100755 index 2be2bdb..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-solaris +++ /dev/null @@ -1,38 +0,0 @@ -MLAB = /export/home/Solaris2/matlab5.1 - -MXSFX = mexsol -MEX = ${MLAB}/bin/mex - -MFLAGS = -V4 -INC = -I ${MLAB}/extern/include -LIB = -L ${MLAB}/extern/lib - -CC = gcc -Wall -pedantic -C_OPTIMIZE_SWITCH = -O2 ## For GCC -CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} - -all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ - histo.${MXSFX} range2.${MXSFX} - -clean: - /bin/rm *.o - -corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o - -upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o - -pointOp.${MXSFX}: pointOp.o - ${MEX} ${MFLAGS} pointOp.o - -histo.${MXSFX}: histo.o - ${MEX} ${MFLAGS} histo.o - -range2.${MXSFX}: range2.o - ${MEX} ${MFLAGS} range2.o - -convolve.o wrap.o edges.o: convolve.h - -%.o : %.c - ${CC} -c ${CFLAGS} $< diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4 b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4 deleted file mode 100755 index 432b181..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/Makefile-sun4 +++ /dev/null @@ -1,39 +0,0 @@ -MLAB = /home/alberich/matlab4 - -MXSFX = mex4 -MEX = ${MLAB}/bin/cmex - -MFLAGS = -INC = -I ${MLAB}/extern/include -LIB = -L ${MLAB}/extern/lib/sun4 - -CC = gcc -C_OPTIMIZE_SWITCH = -O2 ## For GCC -CFLAGS = ${C_OPTIMIZE_SWITCH} ${INC} ${LIB} - -all: corrDn.${MXSFX} upConv.${MXSFX} pointOp.${MXSFX} \ - histo.${MXSFX} range2.${MXSFX} - -clean: - /bin/rm *.o - -corrDn.${MXSFX}: corrDn.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} corrDn.o wrap.o convolve.o edges.o - -upConv.${MXSFX}: upConv.o wrap.o convolve.o edges.o - ${MEX} ${MFLAGS} upConv.o wrap.o convolve.o edges.o - -pointOp.${MXSFX}: pointOp.o - ${MEX} ${MFLAGS} pointOp.o - -histo.${MXSFX}: histo.o - ${MEX} ${MFLAGS} histo.o - -range2.${MXSFX}: range2.o - ${MEX} ${MFLAGS} range2.o - -convolve.o wrap.o edges.o: convolve.h - -%.o : %.c - ${CC} -c ${CFLAGS} $< - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c deleted file mode 100755 index 60a11a4..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.c +++ /dev/null @@ -1,325 +0,0 @@ -/* -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; 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 -#include - -#define ABS(x) (((x)>=0) ? (x) : (-(x))) -#define ROOT2 1.4142135623730951 -#define REDUCE 0 -#define EXPAND 1 -#define IS == -#define ISNT != -#define AND && -#define OR || - -typedef int (*fptr)(); - -typedef struct - { - char *name; - fptr func; - } EDGE_HANDLER; - -typedef double image_type; - -fptr edge_function(char *edges); -int internal_reduce(image_type *image, int x_idim, int y_idim, - image_type *filt, image_type *temp, int x_fdim, int y_fdim, - int x_start, int x_step, int x_stop, - int y_start, int y_step, int y_stop, - image_type *result, char *edges); -int internal_expand(image_type *image, - image_type *filt, image_type *temp, int x_fdim, int y_fdim, - int x_start, int x_step, int x_stop, - int y_start, int y_step, int y_stop, - image_type *result, int x_rdim, int y_rdim, char *edges); -int internal_wrap_reduce(image_type *image, int x_idim, int y_idim, - image_type *filt, int x_fdim, int y_fdim, - int x_start, int x_step, int x_stop, - int y_start, int y_step, int y_stop, - image_type *result); -int internal_wrap_expand(image_type *image, image_type *filt, int x_fdim, int y_fdim, - int x_start, int x_step, int x_stop, - int y_start, int y_step, int y_stop, - image_type *result, int x_rdim, int y_rdim); diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx deleted file mode 100755 index 2dea157..0000000 Binary files a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/convolve.mexglx and /dev/null differ diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c deleted file mode 100755 index c74df1f..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/corrDn.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -RES = corrDn(IM, FILT, EDGES, STEP, START, STOP); - >>> See corrDn.m for documentation <<< - This is a matlab interface to the internal_reduce function. - EPS, 7/96. -*/ - -#define V4_COMPAT -#include /* Matlab matrices */ -#include - -#include "convolve.h" - -#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it)) - -void mexFunction(int nlhs, /* Num return vals on lhs */ - mxArray *plhs[], /* Matrices on lhs */ - int nrhs, /* Num args on rhs */ - const mxArray *prhs[] /* Matrices on rhs */ - ) - { - double *image,*filt, *temp, *result; - int x_fdim, y_fdim, x_idim, y_idim; - int x_rdim, y_rdim; - int x_start = 1; - int x_step = 1; - int y_start = 1; - int y_step = 1; - int x_stop, y_stop; - mxArray *arg; - double *mxMat; - char edges[15] = "reflect1"; - - if (nrhs<2) mexErrMsgTxt("requres at least 2 args."); - - /* ARG 1: IMAGE */ - arg = prhs[0]; - if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a non-sparse double float matrix."); - image = mxGetPr(arg); - x_idim = (int) mxGetM(arg); /* X is inner index! */ - y_idim = (int) mxGetN(arg); - - /* ARG 2: FILTER */ - arg = prhs[1]; - if notDblMtx(arg) mexErrMsgTxt("FILTER arg must be non-sparse double float matrix."); - filt = mxGetPr(arg); - x_fdim = (int) mxGetM(arg); - y_fdim = (int) mxGetN(arg); - - if ((x_fdim > x_idim) || (y_fdim > y_idim)) - { - mexPrintf("Filter: [%d %d], Image: [%d %d]\n",x_fdim,y_fdim,x_idim,y_idim); - mexErrMsgTxt("FILTER dimensions larger than IMAGE dimensions."); - } - - /* ARG 3 (optional): EDGES */ - if (nrhs>2) - { - if (!mxIsChar(prhs[2])) - mexErrMsgTxt("EDGES arg must be a string."); - mxGetString(prhs[2],edges,15); - } - - /* ARG 4 (optional): STEP */ - if (nrhs>3) - { - arg = prhs[3]; - if notDblMtx(arg) mexErrMsgTxt("STEP arg must be a double float matrix."); - if (mxGetM(arg) * mxGetN(arg) != 2) - mexErrMsgTxt("STEP arg must contain two elements."); - mxMat = mxGetPr(arg); - x_step = (int) mxMat[0]; - y_step = (int) mxMat[1]; - if ((x_step<1) || (y_step<1)) - mexErrMsgTxt("STEP values must be greater than zero."); - } - - /* ARG 5 (optional): START */ - if (nrhs>4) - { - arg = prhs[4]; - if notDblMtx(arg) mexErrMsgTxt("START arg must be a double float matrix."); - if (mxGetM(arg) * mxGetN(arg) != 2) - mexErrMsgTxt("START arg must contain two elements."); - mxMat = mxGetPr(arg); - x_start = (int) mxMat[0]; - y_start = (int) mxMat[1]; - if ((x_start<1) || (x_start>x_idim) || - (y_start<1) || (y_start>y_idim)) - mexErrMsgTxt("START values must lie between 1 and the image dimensions."); - } - x_start--; /* convert from Matlab to standard C indexes */ - y_start--; - - /* ARG 6 (optional): STOP */ - if (nrhs>5) - { - if notDblMtx(prhs[5]) mexErrMsgTxt("STOP arg must be double float matrix."); - if (mxGetM(prhs[5]) * mxGetN(prhs[5]) != 2) - mexErrMsgTxt("STOP arg must contain two elements."); - mxMat = mxGetPr(prhs[5]); - x_stop = (int) mxMat[0]; - y_stop = (int) mxMat[1]; - if ((x_stopx_idim) || - (y_stopy_idim)) - mexErrMsgTxt("STOP values must lie between START and the image dimensions."); - } - else - { - x_stop = x_idim; - y_stop = y_idim; - } - - x_rdim = (x_stop-x_start+x_step-1) / x_step; - y_rdim = (y_stop-y_start+y_step-1) / y_step; - - /* mxFreeMatrix(plhs[0]); */ - plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_rdim,y_rdim,mxREAL); - if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix"); - result = mxGetPr(plhs[0]); - - temp = mxCalloc(x_fdim*y_fdim, sizeof(double)); - if (temp == NULL) - mexErrMsgTxt("Cannot allocate necessary temporary space"); - - /* - printf("i(%d, %d), f(%d, %d), r(%d, %d), X(%d, %d, %d), Y(%d, %d, %d), %s\n", - x_idim,y_idim,x_fdim,y_fdim,x_rdim,y_rdim, - x_start,x_step,x_stop,y_start,y_step,y_stop,edges); - */ - - if (strcmp(edges,"circular") == 0) - internal_wrap_reduce(image, x_idim, y_idim, filt, x_fdim, y_fdim, - x_start, x_step, x_stop, y_start, y_step, y_stop, - result); - else internal_reduce(image, x_idim, y_idim, filt, temp, x_fdim, y_fdim, - x_start, x_step, x_stop, y_start, y_step, y_stop, - result, edges); - - mxFree((char *) temp); - return; - } - - - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c deleted file mode 100755 index 98b377d..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/edges.c +++ /dev/null @@ -1,647 +0,0 @@ -/* -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; File: edges.c -;;; Author: Eero Simoncelli -;;; Description: Boundary handling routines for use with convolve.c -;;; Creation Date: Spring 1987. -;;; MODIFIED, 6/96, to operate on double float arrays. -;;; MODIFIED by dgp, 4/1/97, to support THINK C. -;;; MODIFIED, 8/97: reflect1, reflect2, repeat, extend upgraded to -;;; work properly for non-symmetric filters. Added qreflect2 to handle -;;; even-length QMF's which broke under the reflect2 modification. -;;; ---------------------------------------------------------------- -;;; Object-Based Vision and Image Understanding System (OBVIUS), -;;; Copyright 1988, Vision Science Group, Media Laboratory, -;;; Massachusetts Institute of Technology. -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -*/ - -/* This file contains functions which determine how edges are to be -handled when performing convolutions of images with linear filters. -Any edge handling function which is local and linear may be defined, -except (unfortunately) constants cannot be added. So to treat the -edges as if the image is surrounded by a gray field, you must paste it -into a gray image, convolve, and crop it out... The main convolution -functions are called internal_reduce and internal_expand and are -defined in the file convolve.c. The idea is that the convolution -function calls the edge handling function which computes a new filter -based on the old filter and the distance to the edge of the image. -For example, reflection is done by reflecting the filter through the -appropriate axis and summing. Currently defined functions are listed -below. -*/ - - -#include -#include -#include -#include "convolve.h" - -#define sgn(a) ( ((a)>0)?1:(((a)<0)?-1:0) ) -#define clip(a,mn,mx) ( ((a)<(mn))?(mn):(((a)>=(mx))?(mx-1):(a)) ) - -int reflect1(), reflect2(), qreflect2(), repeat(), zero(), Extend(), nocompute(); -int ereflect(), predict(); - -/* Lookup table matching a descriptive string to the edge-handling function */ -#if !THINK_C - static EDGE_HANDLER edge_foos[] = - { - { "dont-compute", nocompute }, /* zero output for filter touching edge */ - { "zero", zero }, /* zero outside of image */ - { "repeat", repeat }, /* repeat edge pixel */ - { "reflect1", reflect1 }, /* reflect about edge pixels */ - { "reflect2", reflect2 }, /* reflect image, including edge pixels */ - { "qreflect2", qreflect2 }, /* reflect image, including edge pixels - for even-length QMF decompositions */ - { "extend", Extend }, /* extend (reflect & invert) */ - { "ereflect", ereflect }, /* orthogonal QMF reflection */ - }; -#else - /* - This is really stupid, but THINK C won't allow initialization of static variables in - a code resource with string addresses. So we do it this way. - The 68K code for a MATLAB 4 MEX file can only be created by THINK C. - However, for MATLAB 5, we'll be able to use Metrowerks CodeWarrior for both 68K and PPC, so this - cludge can be dropped when we drop support for MATLAB 4. - Denis Pelli, 4/1/97. - */ - static EDGE_HANDLER edge_foos[8]; - - void InitializeTable(EDGE_HANDLER edge_foos[]) - { - static int i=0; - - if(i>0) return; - edge_foos[i].name="dont-compute"; - edge_foos[i++].func=nocompute; - edge_foos[i].name="zero"; - edge_foos[i++].func=zero; - edge_foos[i].name="repeat"; - edge_foos[i++].func=repeat; - edge_foos[i].name="reflect1"; - edge_foos[i++].func=reflect1; - edge_foos[i].name="reflect2"; - edge_foos[i++].func=reflect2; - edge_foos[i].name="qreflect2"; - edge_foos[i++].func=qreflect2; - edge_foos[i].name="extend"; - edge_foos[i++].func=Extend; - edge_foos[i].name="ereflect"; - edge_foos[i++].func=ereflect; - } -#endif - -/* -Function looks up an edge handler id string in the structure above, and -returns the associated function -*/ -fptr edge_function(char *edges) - { - int i; - -#if THINK_C - InitializeTable(edge_foos); -#endif - for (i = 0; i1) OR (x_pos<-1) OR (y_pos>1) OR (y_pos<-1) ) - for (i=0; i0)?(x_pos-1):((x_pos<0)?(x_pos+1):0)); - int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0)); - int i; - - for (i=0; i= 0) AND (y_res < filt_sz)) - for (x_filt=y_filt, x_res=x_start; - x_filt= 0) AND (x_res < x_dim)) - result[y_res+x_res] = filt[x_filt]; - return(0); - } - - -/* -------------------------------------------------------------------- -reflect1() - Reflection through the edge pixels. Continuous, but -discontinuous first derivative. This is the right thing to do if you -are subsampling by 2, since it maintains parity (even pixels positions -remain even, odd ones remain odd). -*/ - -int reflect1(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e) - register double *filt, *result; - register int x_dim; - int y_dim, x_pos, y_pos, r_or_e; - { - int filt_sz = x_dim*y_dim; - register int y_filt,x_filt, y_res, x_res; - register int x_base = (x_pos>0)?(x_dim-1):0; - register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0); - int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0); - int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0)); - int i; - int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2); - int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2)); - - for (i=0; i y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - if ((x_overhang ISNT mx_pos) AND (x_pos ISNT 0)) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - } - if ((y_overhang ISNT my_pos) AND (y_pos ISNT 0)) - for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang; - y_filt > y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - if ((x_overhang ISNT mx_pos) AND (x_pos ISNT 0)) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - } - } - - return(0); - } - -/* -------------------------------------------------------------------- -reflect2() - Reflect image at boundary. The edge pixel is repeated, -then the next pixel, etc. Continuous, but discontinuous first -derivative. -*/ - -int reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e) - register double *filt, *result; - register int x_dim; - int y_dim, x_pos, y_pos, r_or_e; - { - int filt_sz = x_dim*y_dim; - register int y_filt,x_filt, y_res, x_res; - register int x_base = (x_pos>0)?(x_dim-1):0; - register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0); - int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0); - int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0)); - int i; - int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2); - int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2)); - - for (i=0; i0)?x_dim:0); - y_filt0)?1:0); - x_filt y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - if (x_pos ISNT 0) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - } - if (y_pos ISNT 0) - for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang-x_dim; - y_filt > y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - if (x_pos ISNT 0) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - } - } - - return(0); - } - - -/* -------------------------------------------------------------------- -qreflect2() - Modified version of reflect2 that works properly for -even-length QMF filters. -*/ - -int qreflect2(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e) - double *filt, *result; - int x_dim, y_dim, x_pos, y_pos, r_or_e; - { - reflect2(filt,x_dim,y_dim,x_pos,y_pos,result,0); - return(0); - } - -/* -------------------------------------------------------------------- -repeat() - repeat edge pixel. Continuous, with discontinuous first -derivative. -*/ - -int repeat(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e) - register double *filt, *result; - register int x_dim; - int y_dim, x_pos, y_pos, r_or_e; - { - register int y_filt,x_filt, y_res,x_res, y_tmp, x_tmp; - register int x_base = (x_pos>0)?(x_dim-1):0; - register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0); - int x_overhang = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0)); - int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0)); - int filt_sz = x_dim*y_dim; - int mx_pos = (x_dim/2); - int my_pos = x_dim * (y_dim/2); - int i; - - for (i=0; i=0)?((y_res=0)?((x_res y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - if ((x_base-x_overhang) ISNT mx_pos) - for (x_res=x_base, x_filt=x_base-ABS(x_overhang); - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - else /* ((x_base-x_overhang) IS mx_pos) */ - for (x_res=x_base, x_filt=x_base-ABS(x_overhang); - x_filt > x_base-x_dim; - x_filt--, x_res--) - for(x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_tmp)]; - else /* ((y_base-y_overhang) IS my_pos) */ - for (y_res=y_base, y_filt=y_base-ABS(y_overhang); - y_filt > y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - for (y_tmp=y_filt; y_tmp > y_base-filt_sz; y_tmp-=x_dim) - if ((x_base-x_overhang) ISNT mx_pos) - for (x_res=x_base, x_filt=x_base-ABS(x_overhang); - x_filt > x_base-x_dim; - x_filt--, x_res--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_tmp)+ABS(x_filt)]; - else /* ((x_base-x_overhang) IS mx_pos) */ - for (x_res=x_base, x_filt=x_base-ABS(x_overhang); - x_filt > x_base-x_dim; - x_filt--, x_res--) - for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_tmp)+ABS(x_tmp)]; - } /* End, if r_or_e IS EXPAND */ - - return(0); - } - -/* -------------------------------------------------------------------- -extend() - Extend image by reflecting and inverting about edge pixel -value. Maintains continuity in intensity AND first derivative (but -not higher derivs). -*/ - -int Extend(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e) - register double *filt, *result; - register int x_dim; - int y_dim, x_pos, y_pos, r_or_e; - { - int filt_sz = x_dim*y_dim; - register int y_filt,x_filt, y_res,x_res, y_tmp, x_tmp; - register int x_base = (x_pos>0)?(x_dim-1):0; - register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0); - int x_overhang = (x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0); - int y_overhang = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0)); - int mx_pos = (x_pos<0)?(x_dim/2):((x_dim-1)/2); - int my_pos = x_dim * ((y_pos<0)?(y_dim/2):((y_dim-1)/2)); - int i; - - for (i=0; i=0) AND (y_res=0) AND (x_res=0) AND (x_res y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += filt[ABS(y_filt)+ABS(x_filt)]; - if (x_pos ISNT 0) - if (x_overhang ISNT mx_pos) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)]; - else /* x_overhang IS mx_pos */ - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1; - x_filt > x_base-x_dim; - x_res--, x_filt--) - for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--) - result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_filt)+ABS(x_tmp)]; - } - if (y_pos ISNT 0) - if (y_overhang ISNT my_pos) - for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang; - y_filt > y_base-filt_sz; - y_filt-=x_dim, y_res-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)]; - if ((x_pos ISNT 0) AND (x_overhang ISNT mx_pos)) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] -= filt[ABS(y_filt)+ABS(x_filt)]; - } - else /* y_overhang IS my_pos */ - for (y_res=y_base, y_filt = y_base-2*my_pos+y_overhang-x_dim; - y_filt > y_base-filt_sz; - y_res-=x_dim, y_filt-=x_dim) - for (y_tmp=y_filt; y_tmp > y_base-filt_sz; y_tmp-=x_dim) - { - for (x_res=x_base, x_filt=x_base-x_overhang; - x_filt > x_base-x_dim; - x_res--, x_filt--) - result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_tmp)+ABS(x_filt)]; - if ((x_pos ISNT 0) AND (x_overhang IS mx_pos)) - for (x_res=x_base, x_filt=x_base-2*mx_pos+x_overhang-1; - x_filt > x_base-x_dim; - x_res--, x_filt--) - for (x_tmp=x_filt; x_tmp > x_base-x_dim; x_tmp--) - result[ABS(y_res)+ABS(x_res)] += 2*filt[ABS(y_tmp)+ABS(x_tmp)]; - } - } /* r_or_e ISNT REDUCE */ - - return(0); - } - -/* -------------------------------------------------------------------- -predict() - Simple prediction. Like zero, but multiplies the result -by the reciprocal of the percentage of filter being used. (i.e. if -50% of the filter is hanging over the edge of the image, multiply the -taps being used by 2). */ - -int predict(filt,x_dim,y_dim,x_pos,y_pos,result,r_or_e) - register double *filt, *result; - register int x_dim; - int y_dim, x_pos, y_pos, r_or_e; - { - register int y_filt,x_filt, y_res,x_res; - register double taps_used = 0.0; /* int *** */ - register double fraction = 0.0; - int filt_sz = x_dim*y_dim; - int x_start = ((x_pos>0)?(x_pos-1):((x_pos<0)?(x_pos+1):0)); - int y_start = x_dim * ((y_pos>0)?(y_pos-1):((y_pos<0)?(y_pos+1):0)); - int i; - - for (i=0; i= 0) AND (y_res < filt_sz)) - for (x_filt=y_filt, x_res=x_start; - x_filt= 0) AND (x_res < x_dim)) - { - result[y_res+x_res] = filt[x_filt]; - taps_used += ABS(filt[x_filt]); - } - - if (r_or_e IS REDUCE) - { - /* fraction = ( (double) filt_sz ) / ( (double) taps_used ); */ - for (i=0; i0)?(x_dim-1):0; - register int y_base = x_dim * ((y_pos>0)?(y_dim-1):0); - int filt_sz = x_dim*y_dim; - int x_overhang = (x_pos>1)?(x_pos-x_dim):((x_pos<-1)?(x_pos+1):0); - int y_overhang = x_dim * ( (y_pos>1)?(y_pos-y_dim):((y_pos<-1)?(y_pos+1):0) ); - int i; - double norm,onorm; - - for (i=0; i>> See histo.m for documentation <<< - EPS, ported from OBVIUS, 3/97. -*/ - -#define V4_COMPAT -#include /* Matlab matrices */ -#include - -#include /* NULL */ -#include /* ceil */ - -#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it)) - -#define PAD 0.49999 /* A hair below 1/2, to avoid roundoff errors */ -#define MAXBINS 20000 - -void mexFunction(int nlhs, /* Num return vals on lhs */ - mxArray *plhs[], /* Matrices on lhs */ - int nrhs, /* Num args on rhs */ - const mxArray *prhs[] /* Matrices on rhs */ - ) - { - register double temp; - register int binnum, i, size; - register double *im, binsize; - register double origin, *hist, mn, mx, mean; - register int nbins; - double *bincenters; - mxArray *arg; - double *mxMat; - - if (nrhs < 1 ) mexErrMsgTxt("requires at least 1 argument."); - - /* ARG 1: MATRIX */ - arg = prhs[0]; - if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix."); - im = mxGetPr(arg); - size = (int) mxGetM(arg) * mxGetN(arg); - - /* FIND min, max, mean values of MTX */ - mn = *im; mx = *im; binsize = 0; - for (i=1; i mx) - mx = temp; - binsize += temp; - } - mean = binsize / size; - - /* ARG 3: BIN_CENTER */ - if (nrhs > 2) - { - arg = prhs[2]; - if notDblMtx(arg) mexErrMsgTxt("BIN_CENTER arg must be a real scalar."); - if (mxGetM(arg) * mxGetN(arg) != 1) - mexErrMsgTxt("BIN_CENTER must be a real scalar."); - mxMat= mxGetPr(arg); - origin = *mxMat; - } - else - origin = mean; - - /* ARG 2: If positive, NBINS. If negative, -BINSIZE. */ - if (nrhs > 1) - { - arg = prhs[1]; - if notDblMtx(arg) mexErrMsgTxt("NBINS_OR_BINSIZE arg must be a real scalar."); - if (mxGetM(arg) * mxGetN(arg) != 1) - mexErrMsgTxt("NBINS_OR_BINSIZE must be a real scalar."); - mxMat= mxGetPr(arg); - binsize = *mxMat; - } - else - { - binsize = 101; /* DEFAULT: 101 bins */ - } - - /* -------------------------------------------------- - Adjust origin, binsize, nbins such that - mx <= origin + (nbins-1)*binsize + PAD*binsize - mn >= origin - PAD*binsize - -------------------------------------------------- */ - if (binsize < 0) /* user specified BINSIZE */ - { - binsize = -binsize; - origin -= binsize * ceil((origin-mn-PAD*binsize)/binsize); - nbins = (int) ceil((mx-origin-PAD*binsize)/binsize) + 1; - } - else /* user specified NBINS */ - { - nbins = (int) (binsize + 0.5); /* round to int */ - if (nbins == 0) - mexErrMsgTxt("NBINS must be greater than zero."); - binsize = (mx-mn)/(nbins-1+2*PAD); /* start with lower bound */ - i = ceil((origin-mn-binsize/2)/binsize); - if ( mn < (origin-i*binsize-PAD*binsize) ) - binsize = (origin-mn)/(i+PAD); - else if ( mx > (origin+(nbins-1-i)*binsize+PAD*binsize) ) - binsize = (mx-origin)/((nbins-1-i)+PAD); - origin -= binsize * ceil((origin-mn-PAD*binsize)/binsize); - } - - if (nbins > MAXBINS) - { - mexPrintf("nbins: %d, MAXBINS: %d\n",nbins,MAXBINS); - mexErrMsgTxt("Number of histo bins has exceeded maximum"); - } - - /* Allocate hist and xvals */ - plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,nbins,mxREAL); - if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix"); - hist = mxGetPr(plhs[0]); - - if (nlhs > 1) - { - plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,nbins,mxREAL); - if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix"); - bincenters = mxGetPr(plhs[1]); - for (i=0, temp=origin; i= 0)) - (hist[binnum]) += 1.0; - else - printf("HISTO warning: value %f outside of range [%f,%f]\n", - im[i], origin-0.5*binsize, origin+(nbins-0.5)*binsize); - } - - return; - } - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c deleted file mode 100755 index 8fa1224..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/innerProd.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -RES = innerProd(MAT); - Computes mat'*mat - Odelia Schwartz, 8/97. -*/ - -#define V4_COMPAT -#include - -#include -#include -#include -#include -#include - -void mexFunction(int nlhs, /* Num return vals on lhs */ - mxArray *plhs[], /* Matrices on lhs */ - int nrhs, /* Num args on rhs */ - const mxArray *prhs[] /* Matrices on rhs */ - ) -{ - register double *res, *mat, tmp; - register int len, wid, i, k, j, jlen, ilen, imat, jmat; - mxArray *arg; - - /* get matrix input argument */ - /* should be matrix in which num rows >= num columns */ - arg=prhs[0]; - mat= mxGetPr(arg); - len = (int) mxGetM(arg); - wid = (int) mxGetN(arg); - if ( wid > len ) - printf("innerProd: Warning: width %d is greater than length %d.\n",wid,len); - plhs[0] = (mxArray *) mxCreateDoubleMatrix(wid,wid,mxREAL); - if (plhs[0] == NULL) - mexErrMsgTxt(sprintf("Error allocating %dx%d result matrix",wid,wid)); - res = mxGetPr(plhs[0]); - - for(i=0, ilen=0; i>> See pointOp.m for documentation <<< - EPS, ported from OBVIUS, 7/96. -*/ - -#define V4_COMPAT -#include /* Matlab matrices */ -#include - -#include /* NULL */ - -#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it)) - -void internal_pointop(); - -void mexFunction(int nlhs, /* Num return vals on lhs */ - mxArray *plhs[], /* Matrices on lhs */ - int nrhs, /* Num args on rhs */ - const mxArray *prhs[] /* Matrices on rhs */ - ) - { - double *image, *lut, *res; - double origin, increment; - int x_dim, y_dim, lx_dim, ly_dim; - int warnings = 1; - mxArray *arg; - double *mxMat; - - if (nrhs < 4 ) mexErrMsgTxt("requres at least 4 args."); - - /* ARG 1: IMAGE */ - arg = prhs[0]; - if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a real non-sparse matrix."); - image = mxGetPr(arg); - x_dim = (int) mxGetM(arg); /* X is inner index! */ - y_dim = (int) mxGetN(arg); - - /* ARG 2: Lookup table */ - arg = prhs[1]; - if notDblMtx(arg) mexErrMsgTxt("LUT arg must be a real non-sparse matrix."); - lut = mxGetPr(arg); - lx_dim = (int) mxGetM(arg); /* X is inner index! */ - ly_dim = (int) mxGetN(arg); - if ( (lx_dim != 1) && (ly_dim != 1) ) - mexErrMsgTxt("Lookup table must be a row or column vector."); - - /* ARG 3: ORIGIN */ - arg = prhs[2]; - if notDblMtx(arg) mexErrMsgTxt("ORIGIN arg must be a real scalar."); - if (mxGetM(arg) * mxGetN(arg) != 1) - mexErrMsgTxt("ORIGIN arg must be a real scalar."); - mxMat = mxGetPr(arg); - origin = *mxMat; - - /* ARG 4: INCREMENT */ - arg = prhs[3]; - if notDblMtx(arg) mexErrMsgTxt("INCREMENT arg must be a real scalar."); - if (mxGetM(arg) * mxGetN(arg) != 1) - mexErrMsgTxt("INCREMENT arg must be a real scalar."); - mxMat = mxGetPr(arg); - increment = *mxMat; - - /* ARG 5: WARNINGS */ - if (nrhs>4) - { - arg = prhs[4]; - if notDblMtx(arg) mexErrMsgTxt("WARINGS arg must be a real scalar."); - if (mxGetM(arg) * mxGetN(arg) != 1) - mexErrMsgTxt("WARNINGS arg must be a real scalar."); - mxMat = mxGetPr(arg); - warnings = (int) *mxMat; - } - - plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_dim,y_dim,mxREAL); - if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix"); - res = mxGetPr(plhs[0]); - - internal_pointop(image, res, x_dim*y_dim, lut, lx_dim*ly_dim, - origin, increment, warnings); - return; - } - - -/* Use linear interpolation on a lookup table. - Taken from OBVIUS. EPS, Spring, 1987. - */ -void internal_pointop (im, res, size, lut, lutsize, origin, increment, warnings) - register double *im, *res, *lut; - register double origin, increment; - register int size, lutsize, warnings; - { - register int i, index; - register double pos; - register int l_unwarned = warnings; - register int r_unwarned = warnings; - - lutsize = lutsize - 2; /* Maximum index value */ - if (increment > 0) - for (i=0; i lutsize) - { - index = lutsize; - if (r_unwarned) - { - mexPrintf("Warning: Extrapolating to right of lookup table...\n"); - r_unwarned = 0; - } - } - res[i] = lut[index] + (lut[index+1] - lut[index]) * (pos - index); - } - else - for (i=0; i>> See range2.m for documentation <<< - EPS, 3/97. -*/ - -#define V4_COMPAT -#include /* Matlab matrices */ -#include - -#include /* NULL */ - -#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it)) - -void mexFunction(int nlhs, /* Num return vals on lhs */ - mxArray *plhs[], /* Matrices on lhs */ - int nrhs, /* Num args on rhs */ - const mxArray *prhs[] /* Matrices on rhs */ - ) - { - register double temp, mn, mx; - register double *mtx; - register int i, size; - mxArray *arg; - - if (nrhs != 1) mexErrMsgTxt("requires 1 argument."); - - /* ARG 1: MATRIX */ - arg = prhs[0]; - if notDblMtx(arg) mexErrMsgTxt("MTX arg must be a real non-sparse matrix."); - mtx = mxGetPr(arg); - size = (int) mxGetM(arg) * mxGetN(arg); - - /* FIND min, max values of MTX */ - mn = *mtx; mx = *mtx; - for (i=1; i mx) - mx = temp; - } - - plhs[0] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL); - if (plhs[0] == NULL) mexErrMsgTxt("Error allocating result matrix"); - plhs[1] = (mxArray *) mxCreateDoubleMatrix(1,1,mxREAL); - if (plhs[1] == NULL) mexErrMsgTxt("Error allocating result matrix"); - mtx = mxGetPr(plhs[0]); - mtx[0] = mn; - mtx = mxGetPr(plhs[1]); - mtx[0] = mx; - - return; - } - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c deleted file mode 100755 index 3708f8a..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/upConv.c +++ /dev/null @@ -1,195 +0,0 @@ -/* -RES = upConv(IM, FILT, EDGES, STEP, START, STOP, RES); - >>> See upConv.m for documentation <<< - This is a matlab interface to the internal_expand function. - EPS, 7/96. -*/ - -#define V4_COMPAT -#include /* Matlab matrices */ -#include - -#include "convolve.h" - -#define notDblMtx(it) (!mxIsNumeric(it) || !mxIsDouble(it) || mxIsSparse(it) || mxIsComplex(it)) - -void mexFunction(int nlhs, /* Num return vals on lhs */ - mxArray *plhs[], /* Matrices on lhs */ - int nrhs, /* Num args on rhs */ - const mxArray *prhs[] /* Matrices on rhs */ - ) - { - double *image,*filt, *temp, *result, *orig_filt; - int x_fdim, y_fdim, x_idim, y_idim; - int orig_x = 0, orig_y, x, y; - int x_rdim, y_rdim; - int x_start = 1; - int x_step = 1; - int y_start = 1; - int y_step = 1; - int x_stop, y_stop; - mxArray *arg; - double *mxMat; - char edges[15] = "reflect1"; - - if (nrhs<2) mexErrMsgTxt("requres at least 2 args."); - - /* ARG 1: IMAGE */ - arg = prhs[0]; - if notDblMtx(arg) mexErrMsgTxt("IMAGE arg must be a non-sparse double float matrix."); - image = mxGetPr(arg); - x_idim = (int) mxGetM(arg); /* X is inner index! */ - y_idim = (int) mxGetN(arg); - - /* ARG 2: FILTER */ - arg = prhs[1]; - if notDblMtx(arg) mexErrMsgTxt("FILTER arg must be non-sparse double float matrix."); filt = mxGetPr(arg); - x_fdim = (int) mxGetM(arg); - y_fdim = (int) mxGetN(arg); - - /* ARG 3 (optional): EDGES */ - if (nrhs>2) - { - if (!mxIsChar(prhs[2])) - mexErrMsgTxt("EDGES arg must be a string."); - mxGetString(prhs[2],edges,15); - } - - /* ARG 4 (optional): STEP */ - if (nrhs>3) - { - arg = prhs[3]; - if notDblMtx(arg) mexErrMsgTxt("STEP arg must be double float matrix."); - if (mxGetM(arg) * mxGetN(arg) != 2) - mexErrMsgTxt("STEP arg must contain two elements."); - mxMat = mxGetPr(arg); - x_step = (int) mxMat[0]; - y_step = (int) mxMat[1]; - if ((x_step<1) || (y_step<1)) - mexErrMsgTxt("STEP values must be greater than zero."); - } - - /* ARG 5 (optional): START */ - if (nrhs>4) - { - arg = prhs[4]; - if notDblMtx(arg) mexErrMsgTxt("START arg must be double float matrix."); - if (mxGetM(arg) * mxGetN(arg) != 2) - mexErrMsgTxt("START arg must contain two elements."); - mxMat = mxGetPr(arg); - x_start = (int) mxMat[0]; - y_start = (int) mxMat[1]; - if ((x_start<1) || (y_start<1)) - mexErrMsgTxt("START values must be greater than zero."); - } - x_start--; /* convert to standard C indexes */ - y_start--; - - /* ARG 6 (optional): STOP */ - if (nrhs>5) - { - if notDblMtx(prhs[5]) mexErrMsgTxt("STOP arg must be double float matrix."); - if (mxGetM(prhs[5]) * mxGetN(prhs[5]) != 2) - mexErrMsgTxt("STOP arg must contain two elements."); - mxMat = mxGetPr(prhs[5]); - x_stop = (int) mxMat[0]; - y_stop = (int) mxMat[1]; - if ((x_stop6) - { - arg = prhs[6]; - if notDblMtx(arg) mexErrMsgTxt("RES arg must be double float matrix."); - - /* 7/10/97: Returning one of the args causes problems with Matlab's memory - manager, so we don't return anything if the result image is passed */ - /* plhs[0] = arg; */ - result = mxGetPr(arg); - x_rdim = (int) mxGetM(arg); /* X is inner index! */ - y_rdim = (int) mxGetN(arg); - if ((x_stop>x_rdim) || (y_stop>y_rdim)) - mexErrMsgTxt("STOP values must within image dimensions."); - } - else - { - x_rdim = x_stop; - y_rdim = y_stop; - /* x_rdim = x_step * ((x_stop+x_step-1)/x_step); - y_rdim = y_step * ((y_stop+y_step-1)/y_step); */ - - plhs[0] = (mxArray *) mxCreateDoubleMatrix(x_rdim,y_rdim,mxREAL); - if (plhs[0] == NULL) mexErrMsgTxt("Cannot allocate result matrix"); - result = mxGetPr(plhs[0]); - } - - if ( (((x_stop-x_start+x_step-1) / x_step) != x_idim) || - (((y_stop-y_start+y_step-1) / y_step) != y_idim) ) - { - mexPrintf("Im dims: [%d %d]\n",x_idim,y_idim); - mexPrintf("Start: [%d %d]\n",x_start,y_start); - mexPrintf("Step: [%d %d]\n",x_step,y_step); - mexPrintf("Stop: [%d %d]\n",x_stop,y_stop); - mexPrintf("Res dims: [%d %d]\n",x_rdim,y_rdim); - mexErrMsgTxt("Image sizes and upsampling args are incompatible!"); - } - - /* upConv has a bug for even-length kernels when using the - reflect1, extend, or repeat edge-handlers */ - if ((!strcmp(edges,"reflect1") || !strcmp(edges,"extend") || !strcmp(edges,"repeat")) - && - ((x_fdim%2 == 0) || (y_fdim%2 == 0))) - { - orig_filt = filt; - orig_x = x_fdim; - orig_y = y_fdim; - x_fdim = 2*(orig_x/2)+1; - y_fdim = 2*(orig_y/2)+1; - filt = mxCalloc(x_fdim*y_fdim, sizeof(double)); - if (filt == NULL) - mexErrMsgTxt("Cannot allocate necessary temporary space"); - for (y=0; y x_rdim) || (y_fdim > y_rdim)) - { - mexPrintf("Filter: [%d %d], ",x_fdim,y_fdim); - mexPrintf("Result: [%d %d]\n",x_rdim,y_rdim); - mexErrMsgTxt("FILTER dimensions larger than RESULT dimensions."); - } - - temp = mxCalloc(x_fdim*y_fdim, sizeof(double)); - if (temp == NULL) - mexErrMsgTxt("Cannot allocate necessary temporary space"); - - /* - printf("(%d, %d), (%d, %d), (%d, %d), (%d, %d), (%d, %d), %s\n", - x_idim,y_idim,x_fdim,y_fdim,x_rdim,y_rdim, - x_start,x_step,y_start,y_step,edges); - */ - - if (strcmp(edges,"circular") == 0) - internal_wrap_expand(image, filt, x_fdim, y_fdim, - x_start, x_step, x_stop, y_start, y_step, y_stop, - result, x_rdim, y_rdim); - else internal_expand(image, filt, temp, x_fdim, y_fdim, - x_start, x_step, x_stop, y_start, y_step, y_stop, - result, x_rdim, y_rdim, edges); - - if (orig_x) mxFree((char *) filt); - mxFree((char *) temp); - - return; - } - - - diff --git a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c b/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c deleted file mode 100755 index a081123..0000000 --- a/SD-VBS/benchmarks/texture_synthesis/src/matlab/MEX/wrap.c +++ /dev/null @@ -1,281 +0,0 @@ -/* -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; 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