diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/benchmarks/texture_synthesis/src | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src')
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd | bin | 0 -> 12222 bytes | |||
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.c | 52 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.ctf | bin | 0 -> 174395 bytes | |||
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.prj | 233 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_main.c | 103 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_mcc_component_data.c | 151 | ||||
| -rwxr-xr-x | SD-VBS/benchmarks/texture_synthesis/src/MEX/mccExcludedFiles.log | 12 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c | 197 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/texture_synthesis/src/c/texture.c | 396 | ||||
| -rw-r--r-- | SD-VBS/benchmarks/texture_synthesis/src/c/texture.h | 48 |
10 files changed, 1192 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd new file mode 100755 index 0000000..e3b1f28 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd | |||
| Binary files differ | |||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.c b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.c new file mode 100755 index 0000000..9649dda --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.c | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* | ||
| 2 | RES = innerProd(MAT); | ||
| 3 | Computes mat'*mat | ||
| 4 | Odelia Schwartz, 8/97. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #define V4_COMPAT | ||
| 8 | #include <mex.h> | ||
| 9 | |||
| 10 | #include <stdio.h> | ||
| 11 | #include <ctype.h> | ||
| 12 | #include <math.h> | ||
| 13 | #include <strings.h> | ||
| 14 | #include <stdlib.h> | ||
| 15 | |||
| 16 | void mexFunction(int nlhs, /* Num return vals on lhs */ | ||
| 17 | Matrix *plhs[], /* Matrices on lhs */ | ||
| 18 | int nrhs, /* Num args on rhs */ | ||
| 19 | Matrix *prhs[] /* Matrices on rhs */ | ||
| 20 | ) | ||
| 21 | { | ||
| 22 | register double *res, *mat, tmp; | ||
| 23 | register int len, wid, i, k, j, jlen, ilen, imat, jmat; | ||
| 24 | Matrix *arg; | ||
| 25 | |||
| 26 | /* get matrix input argument */ | ||
| 27 | /* should be matrix in which num rows >= num columns */ | ||
| 28 | arg=prhs[0]; | ||
| 29 | mat= mxGetPr(arg); | ||
| 30 | len = (int) mxGetM(arg); | ||
| 31 | wid = (int) mxGetN(arg); | ||
| 32 | if ( wid > len ) | ||
| 33 | printf("innerProd: Warning: width %d is greater than length %d.\n",wid,len); | ||
| 34 | plhs[0] = (Matrix *) mxCreateFull(wid,wid,REAL); | ||
| 35 | if (plhs[0] == NULL) | ||
| 36 | mexErrMsgTxt(sprintf("Error allocating %dx%d result matrix",wid,wid)); | ||
| 37 | res = mxGetPr(plhs[0]); | ||
| 38 | |||
| 39 | for(i=0, ilen=0; i<wid; i++, ilen+=len) | ||
| 40 | { | ||
| 41 | for(j=i, jlen=ilen; j<wid; j++, jlen+=len) | ||
| 42 | { | ||
| 43 | tmp = 0.0; | ||
| 44 | for(k=0, imat=ilen, jmat=jlen; k<len; k++, imat++, jmat++) | ||
| 45 | tmp += mat[imat]*mat[jmat]; | ||
| 46 | res[i*wid+j] = tmp; | ||
| 47 | res[j*wid+i] = tmp; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | return; | ||
| 51 | |||
| 52 | } | ||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.ctf b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.ctf new file mode 100755 index 0000000..c6bf079 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.ctf | |||
| Binary files differ | |||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.prj b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.prj new file mode 100755 index 0000000..deba3f8 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd.prj | |||
| @@ -0,0 +1,233 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| 2 | |||
| 3 | <project> | ||
| 4 | |||
| 5 | <MATLABPath> | ||
| 6 | <Directory>/u/kvs/VisionBenchmark/texture_synthesis/src</Directory> | ||
| 7 | <Directory>/pkg/matlab/toolbox/compiler/deploy</Directory> | ||
| 8 | <Directory>/pkg/matlab/toolbox/matlab/general</Directory> | ||
| 9 | <Directory>/pkg/matlab/toolbox/matlab/ops</Directory> | ||
| 10 | <Directory>/pkg/matlab/toolbox/matlab/lang</Directory> | ||
| 11 | <Directory>/pkg/matlab/toolbox/matlab/elmat</Directory> | ||
| 12 | <Directory>/pkg/matlab/toolbox/matlab/elfun</Directory> | ||
| 13 | <Directory>/pkg/matlab/toolbox/matlab/specfun</Directory> | ||
| 14 | <Directory>/pkg/matlab/toolbox/matlab/matfun</Directory> | ||
| 15 | <Directory>/pkg/matlab/toolbox/matlab/datafun</Directory> | ||
| 16 | <Directory>/pkg/matlab/toolbox/matlab/polyfun</Directory> | ||
| 17 | <Directory>/pkg/matlab/toolbox/matlab/funfun</Directory> | ||
| 18 | <Directory>/pkg/matlab/toolbox/matlab/sparfun</Directory> | ||
| 19 | <Directory>/pkg/matlab/toolbox/matlab/scribe</Directory> | ||
| 20 | <Directory>/pkg/matlab/toolbox/matlab/graph2d</Directory> | ||
| 21 | <Directory>/pkg/matlab/toolbox/matlab/graph3d</Directory> | ||
| 22 | <Directory>/pkg/matlab/toolbox/matlab/specgraph</Directory> | ||
| 23 | <Directory>/pkg/matlab/toolbox/matlab/graphics</Directory> | ||
| 24 | <Directory>/pkg/matlab/toolbox/matlab/uitools</Directory> | ||
| 25 | <Directory>/pkg/matlab/toolbox/matlab/strfun</Directory> | ||
| 26 | <Directory>/pkg/matlab/toolbox/matlab/imagesci</Directory> | ||
| 27 | <Directory>/pkg/matlab/toolbox/matlab/iofun</Directory> | ||
| 28 | <Directory>/pkg/matlab/toolbox/matlab/audiovideo</Directory> | ||
| 29 | <Directory>/pkg/matlab/toolbox/matlab/timefun</Directory> | ||
| 30 | <Directory>/pkg/matlab/toolbox/matlab/datatypes</Directory> | ||
| 31 | <Directory>/pkg/matlab/toolbox/matlab/verctrl</Directory> | ||
| 32 | <Directory>/pkg/matlab/toolbox/matlab/codetools</Directory> | ||
| 33 | <Directory>/pkg/matlab/toolbox/matlab/helptools</Directory> | ||
| 34 | <Directory>/pkg/matlab/toolbox/matlab/demos</Directory> | ||
| 35 | <Directory>/pkg/matlab/toolbox/matlab/timeseries</Directory> | ||
| 36 | <Directory>/pkg/matlab/toolbox/matlab/hds</Directory> | ||
| 37 | <Directory>/pkg/matlab/toolbox/matlab/guide</Directory> | ||
| 38 | <Directory>/pkg/matlab/toolbox/matlab/plottools</Directory> | ||
| 39 | <Directory>/pkg/matlab/toolbox/local</Directory> | ||
| 40 | <Directory>/pkg/matlab/toolbox/shared/controllib</Directory> | ||
| 41 | <Directory>/pkg/matlab/toolbox/simulink/simulink</Directory> | ||
| 42 | <Directory>/pkg/matlab/toolbox/simulink/blocks</Directory> | ||
| 43 | <Directory>/pkg/matlab/toolbox/simulink/components</Directory> | ||
| 44 | <Directory>/pkg/matlab/toolbox/simulink/fixedandfloat</Directory> | ||
| 45 | <Directory>/pkg/matlab/toolbox/simulink/fixedandfloat/fxpdemos</Directory> | ||
| 46 | <Directory>/pkg/matlab/toolbox/simulink/fixedandfloat/obsolete</Directory> | ||
| 47 | <Directory>/pkg/matlab/toolbox/simulink/simdemos</Directory> | ||
| 48 | <Directory>/pkg/matlab/toolbox/simulink/simdemos/aerospace</Directory> | ||
| 49 | <Directory>/pkg/matlab/toolbox/simulink/simdemos/automotive</Directory> | ||
| 50 | <Directory>/pkg/matlab/toolbox/simulink/simdemos/simfeatures</Directory> | ||
| 51 | <Directory>/pkg/matlab/toolbox/simulink/simdemos/simgeneral</Directory> | ||
| 52 | <Directory>/pkg/matlab/toolbox/simulink/dee</Directory> | ||
| 53 | <Directory>/pkg/matlab/toolbox/shared/dastudio</Directory> | ||
| 54 | <Directory>/pkg/matlab/toolbox/shared/glue</Directory> | ||
| 55 | <Directory>/pkg/matlab/toolbox/stateflow/stateflow</Directory> | ||
| 56 | <Directory>/pkg/matlab/toolbox/rtw/rtw</Directory> | ||
| 57 | <Directory>/pkg/matlab/toolbox/simulink/simulink/modeladvisor</Directory> | ||
| 58 | <Directory>/pkg/matlab/toolbox/simulink/simulink/modeladvisor/fixpt</Directory> | ||
| 59 | <Directory>/pkg/matlab/toolbox/simulink/simulink/MPlayIO</Directory> | ||
| 60 | <Directory>/pkg/matlab/toolbox/simulink/simulink/dataobjectwizard</Directory> | ||
| 61 | <Directory>/pkg/matlab/toolbox/shared/fixedpointlib</Directory> | ||
| 62 | <Directory>/pkg/matlab/toolbox/simulink/dataimportexport</Directory> | ||
| 63 | <Directory>/pkg/matlab/toolbox/shared/hdlshared</Directory> | ||
| 64 | <Directory>/pkg/matlab/toolbox/rtw/rtwdemos</Directory> | ||
| 65 | <Directory>/pkg/matlab/toolbox/rtw/rtwdemos/rsimdemos</Directory> | ||
| 66 | <Directory>/pkg/matlab/toolbox/rtw/targets/asap2/asap2</Directory> | ||
| 67 | <Directory>/pkg/matlab/toolbox/rtw/targets/asap2/asap2/user</Directory> | ||
| 68 | <Directory>/pkg/matlab/toolbox/rtw/targets/common/can/blocks</Directory> | ||
| 69 | <Directory>/pkg/matlab/toolbox/rtw/targets/common/configuration/resource</Directory> | ||
| 70 | <Directory>/pkg/matlab/toolbox/rtw/targets/common/tgtcommon</Directory> | ||
| 71 | <Directory>/pkg/matlab/toolbox/stateflow/sfdemos</Directory> | ||
| 72 | <Directory>/pkg/matlab/toolbox/stateflow/coder</Directory> | ||
| 73 | <Directory>/pkg/matlab/toolbox/bioinfo/bioinfo</Directory> | ||
| 74 | <Directory>/pkg/matlab/toolbox/bioinfo/biolearning</Directory> | ||
| 75 | <Directory>/pkg/matlab/toolbox/bioinfo/microarray</Directory> | ||
| 76 | <Directory>/pkg/matlab/toolbox/bioinfo/mass_spec</Directory> | ||
| 77 | <Directory>/pkg/matlab/toolbox/bioinfo/proteins</Directory> | ||
| 78 | <Directory>/pkg/matlab/toolbox/bioinfo/biomatrices</Directory> | ||
| 79 | <Directory>/pkg/matlab/toolbox/bioinfo/biodemos</Directory> | ||
| 80 | <Directory>/pkg/matlab/toolbox/bioinfo/graphtheory</Directory> | ||
| 81 | <Directory>/pkg/matlab/toolbox/commblks/commblks</Directory> | ||
| 82 | <Directory>/pkg/matlab/toolbox/commblks/commmasks</Directory> | ||
| 83 | <Directory>/pkg/matlab/toolbox/commblks/commmex</Directory> | ||
| 84 | <Directory>/pkg/matlab/toolbox/commblks/commblksdemos</Directory> | ||
| 85 | <Directory>/pkg/matlab/toolbox/commblks/commblksobsolete/v3</Directory> | ||
| 86 | <Directory>/pkg/matlab/toolbox/commblks/commblksobsolete/v2p5</Directory> | ||
| 87 | <Directory>/pkg/matlab/toolbox/commblks/commblksobsolete/v2</Directory> | ||
| 88 | <Directory>/pkg/matlab/toolbox/comm/comm</Directory> | ||
| 89 | <Directory>/pkg/matlab/toolbox/comm/commdemos</Directory> | ||
| 90 | <Directory>/pkg/matlab/toolbox/comm/commdemos/commdocdemos</Directory> | ||
| 91 | <Directory>/pkg/matlab/toolbox/comm/commobsolete</Directory> | ||
| 92 | <Directory>/pkg/matlab/toolbox/compiler</Directory> | ||
| 93 | <Directory>/pkg/matlab/toolbox/control/control</Directory> | ||
| 94 | <Directory>/pkg/matlab/toolbox/control/ctrlguis</Directory> | ||
| 95 | <Directory>/pkg/matlab/toolbox/control/ctrlobsolete</Directory> | ||
| 96 | <Directory>/pkg/matlab/toolbox/control/ctrlutil</Directory> | ||
| 97 | <Directory>/pkg/matlab/toolbox/control/ctrldemos</Directory> | ||
| 98 | <Directory>/pkg/matlab/toolbox/shared/slcontrollib</Directory> | ||
| 99 | <Directory>/pkg/matlab/toolbox/curvefit/curvefit</Directory> | ||
| 100 | <Directory>/pkg/matlab/toolbox/curvefit/cftoolgui</Directory> | ||
| 101 | <Directory>/pkg/matlab/toolbox/shared/optimlib</Directory> | ||
| 102 | <Directory>/pkg/matlab/toolbox/database/database</Directory> | ||
| 103 | <Directory>/pkg/matlab/toolbox/database/dbdemos</Directory> | ||
| 104 | <Directory>/pkg/matlab/toolbox/database/vqb</Directory> | ||
| 105 | <Directory>/pkg/matlab/toolbox/dspblks/dspblks</Directory> | ||
| 106 | <Directory>/pkg/matlab/toolbox/dspblks/dspmasks</Directory> | ||
| 107 | <Directory>/pkg/matlab/toolbox/dspblks/dspmex</Directory> | ||
| 108 | <Directory>/pkg/matlab/toolbox/dspblks/dspdemos</Directory> | ||
| 109 | <Directory>/pkg/matlab/toolbox/shared/filterdesignlib</Directory> | ||
| 110 | <Directory>/pkg/matlab/toolbox/rtw/targets/ecoder</Directory> | ||
| 111 | <Directory>/pkg/matlab/toolbox/rtw/targets/ecoder/ecoderdemos</Directory> | ||
| 112 | <Directory>/pkg/matlab/toolbox/rtw/targets/mpt</Directory> | ||
| 113 | <Directory>/pkg/matlab/toolbox/rtw/targets/mpt/mpt</Directory> | ||
| 114 | <Directory>/pkg/matlab/toolbox/rtw/targets/mpt/user_specific</Directory> | ||
| 115 | <Directory>/pkg/matlab/toolbox/fixedpoint/fixedpoint</Directory> | ||
| 116 | <Directory>/pkg/matlab/toolbox/fixedpoint/fidemos</Directory> | ||
| 117 | <Directory>/pkg/matlab/toolbox/fixedpoint/fimex</Directory> | ||
| 118 | <Directory>/pkg/matlab/toolbox/fixpoint</Directory> | ||
| 119 | <Directory>/pkg/matlab/toolbox/gads</Directory> | ||
| 120 | <Directory>/pkg/matlab/toolbox/gads/gads</Directory> | ||
| 121 | <Directory>/pkg/matlab/toolbox/gads/gadsdemos</Directory> | ||
| 122 | <Directory>/pkg/matlab/toolbox/ident/ident</Directory> | ||
| 123 | <Directory>/pkg/matlab/toolbox/ident/idobsolete</Directory> | ||
| 124 | <Directory>/pkg/matlab/toolbox/ident/idguis</Directory> | ||
| 125 | <Directory>/pkg/matlab/toolbox/ident/idutils</Directory> | ||
| 126 | <Directory>/pkg/matlab/toolbox/ident/iddemos</Directory> | ||
| 127 | <Directory>/pkg/matlab/toolbox/ident/idhelp</Directory> | ||
| 128 | <Directory>/pkg/matlab/toolbox/images/images</Directory> | ||
| 129 | <Directory>/pkg/matlab/toolbox/images/imuitools</Directory> | ||
| 130 | <Directory>/pkg/matlab/toolbox/images/imdemos</Directory> | ||
| 131 | <Directory>/pkg/matlab/toolbox/images/iptutils</Directory> | ||
| 132 | <Directory>/pkg/matlab/toolbox/shared/imageslib</Directory> | ||
| 133 | <Directory>/pkg/matlab/toolbox/images/medformats</Directory> | ||
| 134 | <Directory>/pkg/matlab/toolbox/instrument/instrument</Directory> | ||
| 135 | <Directory>/pkg/matlab/toolbox/instrument/instrumentdemos</Directory> | ||
| 136 | <Directory>/pkg/matlab/toolbox/map/map</Directory> | ||
| 137 | <Directory>/pkg/matlab/toolbox/map/mapdemos</Directory> | ||
| 138 | <Directory>/pkg/matlab/toolbox/map/mapdisp</Directory> | ||
| 139 | <Directory>/pkg/matlab/toolbox/map/mapformats</Directory> | ||
| 140 | <Directory>/pkg/matlab/toolbox/map/mapproj</Directory> | ||
| 141 | <Directory>/pkg/matlab/toolbox/shared/mapgeodesy</Directory> | ||
| 142 | <Directory>/pkg/matlab/toolbox/slvnv/simcoverage</Directory> | ||
| 143 | <Directory>/pkg/matlab/toolbox/nnet</Directory> | ||
| 144 | <Directory>/pkg/matlab/toolbox/nnet/nncontrol</Directory> | ||
| 145 | <Directory>/pkg/matlab/toolbox/nnet/nndemos</Directory> | ||
| 146 | <Directory>/pkg/matlab/toolbox/nnet/nnet</Directory> | ||
| 147 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnanalyze</Directory> | ||
| 148 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nncustom</Directory> | ||
| 149 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nndistance</Directory> | ||
| 150 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnformat</Directory> | ||
| 151 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nninit</Directory> | ||
| 152 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnlearn</Directory> | ||
| 153 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnnetinput</Directory> | ||
| 154 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnnetwork</Directory> | ||
| 155 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnperformance</Directory> | ||
| 156 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnplot</Directory> | ||
| 157 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnprocess</Directory> | ||
| 158 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnsearch</Directory> | ||
| 159 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nntopology</Directory> | ||
| 160 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nntrain</Directory> | ||
| 161 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nntransfer</Directory> | ||
| 162 | <Directory>/pkg/matlab/toolbox/nnet/nnet/nnweight</Directory> | ||
| 163 | <Directory>/pkg/matlab/toolbox/nnet/nnguis</Directory> | ||
| 164 | <Directory>/pkg/matlab/toolbox/nnet/nnguis/nftool</Directory> | ||
| 165 | <Directory>/pkg/matlab/toolbox/nnet/nnguis/nntool</Directory> | ||
| 166 | <Directory>/pkg/matlab/toolbox/nnet/nnobsolete</Directory> | ||
| 167 | <Directory>/pkg/matlab/toolbox/nnet/nnresource</Directory> | ||
| 168 | <Directory>/pkg/matlab/toolbox/nnet/nnutils</Directory> | ||
| 169 | <Directory>/pkg/matlab/toolbox/optim</Directory> | ||
| 170 | <Directory>/pkg/matlab/toolbox/pde</Directory> | ||
| 171 | <Directory>/pkg/matlab/toolbox/robust/robust</Directory> | ||
| 172 | <Directory>/pkg/matlab/toolbox/robust/rctlmi</Directory> | ||
| 173 | <Directory>/pkg/matlab/toolbox/robust/rctutil</Directory> | ||
| 174 | <Directory>/pkg/matlab/toolbox/robust/rctdemos</Directory> | ||
| 175 | <Directory>/pkg/matlab/toolbox/robust/rctobsolete/robust</Directory> | ||
| 176 | <Directory>/pkg/matlab/toolbox/robust/rctobsolete/lmi</Directory> | ||
| 177 | <Directory>/pkg/matlab/toolbox/robust/rctobsolete/mutools/commands</Directory> | ||
| 178 | <Directory>/pkg/matlab/toolbox/robust/rctobsolete/mutools/subs</Directory> | ||
| 179 | <Directory>/pkg/matlab/toolbox/signal/signal</Directory> | ||
| 180 | <Directory>/pkg/matlab/toolbox/signal/sigtools</Directory> | ||
| 181 | <Directory>/pkg/matlab/toolbox/signal/sptoolgui</Directory> | ||
| 182 | <Directory>/pkg/matlab/toolbox/signal/sigdemos</Directory> | ||
| 183 | <Directory>/pkg/matlab/toolbox/shared/spcuilib</Directory> | ||
| 184 | <Directory>/pkg/matlab/toolbox/slcontrol/slcontrol</Directory> | ||
| 185 | <Directory>/pkg/matlab/toolbox/slcontrol/slctrlguis</Directory> | ||
| 186 | <Directory>/pkg/matlab/toolbox/slcontrol/slctrlutil</Directory> | ||
| 187 | <Directory>/pkg/matlab/toolbox/slcontrol/slctrldemos</Directory> | ||
| 188 | <Directory>/pkg/matlab/toolbox/splines</Directory> | ||
| 189 | <Directory>/pkg/matlab/toolbox/stats</Directory> | ||
| 190 | <Directory>/pkg/matlab/toolbox/symbolic</Directory> | ||
| 191 | <Directory>/pkg/matlab/toolbox/vipblks/vipblks</Directory> | ||
| 192 | <Directory>/pkg/matlab/toolbox/vipblks/vipmasks</Directory> | ||
| 193 | <Directory>/pkg/matlab/toolbox/vipblks/vipmex</Directory> | ||
| 194 | <Directory>/pkg/matlab/toolbox/vipblks/vipdemos</Directory> | ||
| 195 | <Directory>/pkg/matlab/toolbox/wavelet/wavelet</Directory> | ||
| 196 | <Directory>/pkg/matlab/toolbox/wavelet/wmultisig1d</Directory> | ||
| 197 | <Directory>/pkg/matlab/toolbox/wavelet/wavedemo</Directory> | ||
| 198 | <Directory>/pkg/matlab/work</Directory> | ||
| 199 | <Directory>/pkg/matlab/toolbox/vr/vr</Directory> | ||
| 200 | <Directory>/pkg/matlab/toolbox/vr/vrdemos</Directory> | ||
| 201 | </MATLABPath> | ||
| 202 | |||
| 203 | <MCCProperties> | ||
| 204 | <output/> | ||
| 205 | <wrapper> | ||
| 206 | <type>main</type> | ||
| 207 | <component_name>innerProd</component_name> | ||
| 208 | </wrapper> | ||
| 209 | <link>exe</link> | ||
| 210 | <create_vb_wrapper>false</create_vb_wrapper> | ||
| 211 | <intermediate_dir>../MEX</intermediate_dir> | ||
| 212 | <output_dir>../MEX</output_dir> | ||
| 213 | <generate_code_only>false</generate_code_only> | ||
| 214 | <verbose>false</verbose> | ||
| 215 | <MCR_runtime_options> | ||
| 216 | <share_mcr>false</share_mcr> | ||
| 217 | </MCR_runtime_options> | ||
| 218 | <options_file/> | ||
| 219 | <toolboxes_on_path shortcut="all"/> | ||
| 220 | <debug>false</debug> | ||
| 221 | <warning shortcut="default"/> | ||
| 222 | <license_file/> | ||
| 223 | </MCCProperties> | ||
| 224 | |||
| 225 | <file_info> | ||
| 226 | <category name="Main function"> | ||
| 227 | <file>/u/kvs/VisionBenchmark/texture_synthesis/src/innerProd.m</file> | ||
| 228 | </category> | ||
| 229 | <category name="Other files"/> | ||
| 230 | <category name="C/C++ files"/> | ||
| 231 | </file_info> | ||
| 232 | |||
| 233 | </project> | ||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_main.c b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_main.c new file mode 100755 index 0000000..3c828de --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_main.c | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | /* | ||
| 2 | * MATLAB Compiler: 4.4 (R2006a) | ||
| 3 | * Date: Thu Jul 24 17:19:07 2008 | ||
| 4 | * Arguments: "-B" "macro_default" "-m" "-W" "main" "-T" "link:exe" "-d" | ||
| 5 | * "../MEX" "innerProd.m" | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <stdio.h> | ||
| 9 | #include "mclmcr.h" | ||
| 10 | #ifdef __cplusplus | ||
| 11 | extern "C" { | ||
| 12 | #endif | ||
| 13 | |||
| 14 | extern mclComponentData __MCC_innerProd_component_data; | ||
| 15 | |||
| 16 | #ifdef __cplusplus | ||
| 17 | } | ||
| 18 | #endif | ||
| 19 | |||
| 20 | static HMCRINSTANCE _mcr_inst = NULL; | ||
| 21 | |||
| 22 | |||
| 23 | static int mclDefaultPrintHandler(const char *s) | ||
| 24 | { | ||
| 25 | return fwrite(s, sizeof(char), strlen(s), stdout); | ||
| 26 | } | ||
| 27 | |||
| 28 | static int mclDefaultErrorHandler(const char *s) | ||
| 29 | { | ||
| 30 | int written = 0, len = 0; | ||
| 31 | len = strlen(s); | ||
| 32 | written = fwrite(s, sizeof(char), len, stderr); | ||
| 33 | if (len > 0 && s[ len-1 ] != '\n') | ||
| 34 | written += fwrite("\n", sizeof(char), 1, stderr); | ||
| 35 | return written; | ||
| 36 | } | ||
| 37 | |||
| 38 | |||
| 39 | /* This symbol is defined in shared libraries. Define it here | ||
| 40 | * (to nothing) in case this isn't a shared library. | ||
| 41 | */ | ||
| 42 | #ifndef LIB_innerProd_C_API | ||
| 43 | #define LIB_innerProd_C_API /* No special import/export declaration */ | ||
| 44 | #endif | ||
| 45 | |||
| 46 | LIB_innerProd_C_API | ||
| 47 | bool MW_CALL_CONV innerProdInitializeWithHandlers( | ||
| 48 | mclOutputHandlerFcn error_handler, | ||
| 49 | mclOutputHandlerFcn print_handler | ||
| 50 | ) | ||
| 51 | { | ||
| 52 | if (_mcr_inst != NULL) | ||
| 53 | return true; | ||
| 54 | if (!mclmcrInitialize()) | ||
| 55 | return false; | ||
| 56 | if (!mclInitializeComponentInstance(&_mcr_inst, | ||
| 57 | &__MCC_innerProd_component_data, | ||
| 58 | true, NoObjectType, ExeTarget, | ||
| 59 | error_handler, print_handler)) | ||
| 60 | return false; | ||
| 61 | return true; | ||
| 62 | } | ||
| 63 | |||
| 64 | LIB_innerProd_C_API | ||
| 65 | bool MW_CALL_CONV innerProdInitialize(void) | ||
| 66 | { | ||
| 67 | return innerProdInitializeWithHandlers(mclDefaultErrorHandler, | ||
| 68 | mclDefaultPrintHandler); | ||
| 69 | } | ||
| 70 | |||
| 71 | LIB_innerProd_C_API | ||
| 72 | void MW_CALL_CONV innerProdTerminate(void) | ||
| 73 | { | ||
| 74 | if (_mcr_inst != NULL) | ||
| 75 | mclTerminateInstance(&_mcr_inst); | ||
| 76 | } | ||
| 77 | |||
| 78 | int run_main(int argc, const char **argv) | ||
| 79 | { | ||
| 80 | int _retval; | ||
| 81 | /* Generate and populate the path_to_component. */ | ||
| 82 | char path_to_component[(PATH_MAX*2)+1]; | ||
| 83 | separatePathName(argv[0], path_to_component, (PATH_MAX*2)+1); | ||
| 84 | __MCC_innerProd_component_data.path_to_component = path_to_component; | ||
| 85 | if (!innerProdInitialize()) { | ||
| 86 | return -1; | ||
| 87 | } | ||
| 88 | _retval = mclMain(_mcr_inst, argc, argv, "innerProd", 1); | ||
| 89 | if (_retval == 0 /* no error */) mclWaitForFiguresToDie(NULL); | ||
| 90 | innerProdTerminate(); | ||
| 91 | mclTerminateApplication(); | ||
| 92 | return _retval; | ||
| 93 | } | ||
| 94 | |||
| 95 | int main(int argc, const char **argv) | ||
| 96 | { | ||
| 97 | if (!mclInitializeApplication( | ||
| 98 | __MCC_innerProd_component_data.runtime_options, | ||
| 99 | __MCC_innerProd_component_data.runtime_option_count)) | ||
| 100 | return 0; | ||
| 101 | |||
| 102 | return mclRunMain(run_main, argc, argv); | ||
| 103 | } | ||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_mcc_component_data.c b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_mcc_component_data.c new file mode 100755 index 0000000..df204ee --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/innerProd_mcc_component_data.c | |||
| @@ -0,0 +1,151 @@ | |||
| 1 | /* | ||
| 2 | * MATLAB Compiler: 4.4 (R2006a) | ||
| 3 | * Date: Thu Jul 24 17:19:07 2008 | ||
| 4 | * Arguments: "-B" "macro_default" "-m" "-W" "main" "-T" "link:exe" "-d" | ||
| 5 | * "../MEX" "innerProd.m" | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include "mclmcr.h" | ||
| 9 | |||
| 10 | #ifdef __cplusplus | ||
| 11 | extern "C" { | ||
| 12 | #endif | ||
| 13 | const unsigned char __MCC_innerProd_session_key[] = { | ||
| 14 | 'B', 'C', 'C', '8', 'A', 'E', 'C', 'F', '0', '7', '5', '2', 'D', 'F', | ||
| 15 | 'F', '9', '4', '2', '0', 'B', '6', 'F', '5', 'B', 'E', 'A', 'E', '4', | ||
| 16 | 'C', '2', 'F', '5', '4', 'D', '1', '4', '6', '3', 'B', 'A', '5', '1', | ||
| 17 | 'D', '8', '3', '7', 'F', '5', '4', '6', 'C', '1', 'D', 'B', '9', '3', | ||
| 18 | 'C', 'D', 'A', 'D', 'F', '3', '5', 'F', '5', 'A', '2', 'D', '9', 'A', | ||
| 19 | '4', '4', '6', 'D', 'C', '5', '3', '7', '7', '5', '7', '2', '3', '0', | ||
| 20 | 'E', '2', 'E', '7', '0', 'F', '7', '4', 'B', 'A', '8', 'B', '9', '8', | ||
| 21 | '5', '8', 'D', 'D', '3', '3', '3', '7', '9', 'E', '8', '1', '3', '9', | ||
| 22 | '1', '2', 'A', '6', 'B', '0', '4', '8', 'F', 'D', '9', 'D', '3', '5', | ||
| 23 | '2', '8', '4', '3', '7', '3', '1', 'D', '7', '0', 'E', '0', '0', '3', | ||
| 24 | 'D', '9', '7', '3', '0', 'F', '8', '7', '0', 'C', 'A', 'B', '4', '1', | ||
| 25 | 'F', '0', '4', '5', 'E', '1', '7', '4', 'C', 'E', '6', 'A', 'C', 'D', | ||
| 26 | 'C', '6', 'F', '8', '6', '5', 'F', '5', '1', 'A', '6', '9', 'F', 'E', | ||
| 27 | '7', '9', 'A', '3', 'E', '7', 'C', '6', '2', '3', '7', 'C', 'E', '9', | ||
| 28 | 'A', '0', '6', '3', '5', '9', '3', '4', '1', '5', '9', 'D', '9', '2', | ||
| 29 | '4', 'B', '1', '0', '6', '0', 'A', '3', '5', '8', '2', '1', '8', '4', | ||
| 30 | 'E', 'B', 'C', 'D', 'B', '6', '4', '7', 'F', 'D', '9', 'A', '3', '3', | ||
| 31 | 'D', '0', '1', '5', 'C', '2', '1', 'B', '5', 'C', '1', '5', '9', '3', | ||
| 32 | '0', '4', '6', '1', '\0'}; | ||
| 33 | |||
| 34 | const unsigned char __MCC_innerProd_public_key[] = { | ||
| 35 | '3', '0', '8', '1', '9', 'D', '3', '0', '0', 'D', '0', '6', '0', '9', | ||
| 36 | '2', 'A', '8', '6', '4', '8', '8', '6', 'F', '7', '0', 'D', '0', '1', | ||
| 37 | '0', '1', '0', '1', '0', '5', '0', '0', '0', '3', '8', '1', '8', 'B', | ||
| 38 | '0', '0', '3', '0', '8', '1', '8', '7', '0', '2', '8', '1', '8', '1', | ||
| 39 | '0', '0', 'C', '4', '9', 'C', 'A', 'C', '3', '4', 'E', 'D', '1', '3', | ||
| 40 | 'A', '5', '2', '0', '6', '5', '8', 'F', '6', 'F', '8', 'E', '0', '1', | ||
| 41 | '3', '8', 'C', '4', '3', '1', '5', 'B', '4', '3', '1', '5', '2', '7', | ||
| 42 | '7', 'E', 'D', '3', 'F', '7', 'D', 'A', 'E', '5', '3', '0', '9', '9', | ||
| 43 | 'D', 'B', '0', '8', 'E', 'E', '5', '8', '9', 'F', '8', '0', '4', 'D', | ||
| 44 | '4', 'B', '9', '8', '1', '3', '2', '6', 'A', '5', '2', 'C', 'C', 'E', | ||
| 45 | '4', '3', '8', '2', 'E', '9', 'F', '2', 'B', '4', 'D', '0', '8', '5', | ||
| 46 | 'E', 'B', '9', '5', '0', 'C', '7', 'A', 'B', '1', '2', 'E', 'D', 'E', | ||
| 47 | '2', 'D', '4', '1', '2', '9', '7', '8', '2', '0', 'E', '6', '3', '7', | ||
| 48 | '7', 'A', '5', 'F', 'E', 'B', '5', '6', '8', '9', 'D', '4', 'E', '6', | ||
| 49 | '0', '3', '2', 'F', '6', '0', 'C', '4', '3', '0', '7', '4', 'A', '0', | ||
| 50 | '4', 'C', '2', '6', 'A', 'B', '7', '2', 'F', '5', '4', 'B', '5', '1', | ||
| 51 | 'B', 'B', '4', '6', '0', '5', '7', '8', '7', '8', '5', 'B', '1', '9', | ||
| 52 | '9', '0', '1', '4', '3', '1', '4', 'A', '6', '5', 'F', '0', '9', '0', | ||
| 53 | 'B', '6', '1', 'F', 'C', '2', '0', '1', '6', '9', '4', '5', '3', 'B', | ||
| 54 | '5', '8', 'F', 'C', '8', 'B', 'A', '4', '3', 'E', '6', '7', '7', '6', | ||
| 55 | 'E', 'B', '7', 'E', 'C', 'D', '3', '1', '7', '8', 'B', '5', '6', 'A', | ||
| 56 | 'B', '0', 'F', 'A', '0', '6', 'D', 'D', '6', '4', '9', '6', '7', 'C', | ||
| 57 | 'B', '1', '4', '9', 'E', '5', '0', '2', '0', '1', '1', '1', '\0'}; | ||
| 58 | |||
| 59 | static const char * MCC_innerProd_matlabpath_data[] = | ||
| 60 | { "innerProd/", "toolbox/compiler/deploy/", "$TOOLBOXMATLABDIR/general/", | ||
| 61 | "$TOOLBOXMATLABDIR/ops/", "$TOOLBOXMATLABDIR/lang/", | ||
| 62 | "$TOOLBOXMATLABDIR/elmat/", "$TOOLBOXMATLABDIR/elfun/", | ||
| 63 | "$TOOLBOXMATLABDIR/specfun/", "$TOOLBOXMATLABDIR/matfun/", | ||
| 64 | "$TOOLBOXMATLABDIR/datafun/", "$TOOLBOXMATLABDIR/polyfun/", | ||
| 65 | "$TOOLBOXMATLABDIR/funfun/", "$TOOLBOXMATLABDIR/sparfun/", | ||
| 66 | "$TOOLBOXMATLABDIR/scribe/", "$TOOLBOXMATLABDIR/graph2d/", | ||
| 67 | "$TOOLBOXMATLABDIR/graph3d/", "$TOOLBOXMATLABDIR/specgraph/", | ||
| 68 | "$TOOLBOXMATLABDIR/graphics/", "$TOOLBOXMATLABDIR/uitools/", | ||
| 69 | "$TOOLBOXMATLABDIR/strfun/", "$TOOLBOXMATLABDIR/imagesci/", | ||
| 70 | "$TOOLBOXMATLABDIR/iofun/", "$TOOLBOXMATLABDIR/audiovideo/", | ||
| 71 | "$TOOLBOXMATLABDIR/timefun/", "$TOOLBOXMATLABDIR/datatypes/", | ||
| 72 | "$TOOLBOXMATLABDIR/verctrl/", "$TOOLBOXMATLABDIR/codetools/", | ||
| 73 | "$TOOLBOXMATLABDIR/helptools/", "$TOOLBOXMATLABDIR/demos/", | ||
| 74 | "$TOOLBOXMATLABDIR/timeseries/", "$TOOLBOXMATLABDIR/hds/", | ||
| 75 | "$TOOLBOXMATLABDIR/guide/", "$TOOLBOXMATLABDIR/plottools/", | ||
| 76 | "toolbox/local/", "toolbox/compiler/", "toolbox/database/database/" }; | ||
| 77 | |||
| 78 | static const char * MCC_innerProd_classpath_data[] = | ||
| 79 | { "java/jar/toolbox/database.jar" }; | ||
| 80 | |||
| 81 | static const char * MCC_innerProd_libpath_data[] = | ||
| 82 | { "" }; | ||
| 83 | |||
| 84 | static const char * MCC_innerProd_app_opts_data[] = | ||
| 85 | { "" }; | ||
| 86 | |||
| 87 | static const char * MCC_innerProd_run_opts_data[] = | ||
| 88 | { "" }; | ||
| 89 | |||
| 90 | static const char * MCC_innerProd_warning_state_data[] = | ||
| 91 | { "" }; | ||
| 92 | |||
| 93 | |||
| 94 | mclComponentData __MCC_innerProd_component_data = { | ||
| 95 | |||
| 96 | /* Public key data */ | ||
| 97 | __MCC_innerProd_public_key, | ||
| 98 | |||
| 99 | /* Component name */ | ||
| 100 | "innerProd", | ||
| 101 | |||
| 102 | /* Component Root */ | ||
| 103 | "", | ||
| 104 | |||
| 105 | /* Application key data */ | ||
| 106 | __MCC_innerProd_session_key, | ||
| 107 | |||
| 108 | /* Component's MATLAB Path */ | ||
| 109 | MCC_innerProd_matlabpath_data, | ||
| 110 | |||
| 111 | /* Number of directories in the MATLAB Path */ | ||
| 112 | 36, | ||
| 113 | |||
| 114 | /* Component's Java class path */ | ||
| 115 | MCC_innerProd_classpath_data, | ||
| 116 | /* Number of directories in the Java class path */ | ||
| 117 | 1, | ||
| 118 | |||
| 119 | /* Component's load library path (for extra shared libraries) */ | ||
| 120 | MCC_innerProd_libpath_data, | ||
| 121 | /* Number of directories in the load library path */ | ||
| 122 | 0, | ||
| 123 | |||
| 124 | /* MCR instance-specific runtime options */ | ||
| 125 | MCC_innerProd_app_opts_data, | ||
| 126 | /* Number of MCR instance-specific runtime options */ | ||
| 127 | 0, | ||
| 128 | |||
| 129 | /* MCR global runtime options */ | ||
| 130 | MCC_innerProd_run_opts_data, | ||
| 131 | /* Number of MCR global runtime options */ | ||
| 132 | 0, | ||
| 133 | |||
| 134 | /* Component preferences directory */ | ||
| 135 | "innerProd_EEEFF7AADF2C5D8569D4742763DAC0AB", | ||
| 136 | |||
| 137 | /* MCR warning status data */ | ||
| 138 | MCC_innerProd_warning_state_data, | ||
| 139 | /* Number of MCR warning status modifiers */ | ||
| 140 | 0, | ||
| 141 | |||
| 142 | /* Path to component - evaluated at runtime */ | ||
| 143 | NULL | ||
| 144 | |||
| 145 | }; | ||
| 146 | |||
| 147 | #ifdef __cplusplus | ||
| 148 | } | ||
| 149 | #endif | ||
| 150 | |||
| 151 | |||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/MEX/mccExcludedFiles.log b/SD-VBS/benchmarks/texture_synthesis/src/MEX/mccExcludedFiles.log new file mode 100755 index 0000000..981940f --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/MEX/mccExcludedFiles.log | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | This file contains the list of various toolbox functions that are not | ||
| 2 | included in the CTF file. An error will be thrown if any of these functions | ||
| 3 | are called at run-time. Some of these functions may be from toolboxes | ||
| 4 | that you are not using in your application. The reason for this is that | ||
| 5 | these toolboxes have overloaded some methods that are called by your code. | ||
| 6 | If you know which toolboxes are being used by your code, you can use the -p | ||
| 7 | flag with the -N flag to list these toolboxes explicitly. This will | ||
| 8 | cause MATLAB Compiler to only look for functions in the specified toolbox | ||
| 9 | directories in addition to the MATLAB directories. Refer to the MCC | ||
| 10 | documentation for more information on this. | ||
| 11 | |||
| 12 | 0 item(s) excluded by M-file compilabilty rules. | ||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c b/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c new file mode 100644 index 0000000..01ddefd --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c | |||
| @@ -0,0 +1,197 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include "texture.h" | ||
| 6 | #include <malloc.h> | ||
| 7 | #include "extra.h" | ||
| 8 | #define TEXTURE_MEM 1<<28 | ||
| 9 | int WIDTHin,HEIGHTin; | ||
| 10 | F2D *target, *result; | ||
| 11 | int WIDTH,HEIGHT; | ||
| 12 | int localx, localy,targetin=0; | ||
| 13 | int *atlas; | ||
| 14 | int *xloopin, *yloopin; | ||
| 15 | int *xloopout, *yloopout; | ||
| 16 | |||
| 17 | int main(int argc, char **argv) | ||
| 18 | { | ||
| 19 | SET_UP | ||
| 20 | mallopt(M_TOP_PAD, TEXTURE_MEM); | ||
| 21 | mallopt(M_MMAP_MAX, 0); | ||
| 22 | params* data; | ||
| 23 | I2D *im; | ||
| 24 | F2D* image; | ||
| 25 | data = malloc(sizeof(params)); | ||
| 26 | im = parse_flags(argc, argv); | ||
| 27 | image = fiDeepCopy(im); | ||
| 28 | init_params(data); | ||
| 29 | |||
| 30 | printf("start.\n"); | ||
| 31 | for_each_job{ | ||
| 32 | create_texture(image, data); | ||
| 33 | } | ||
| 34 | printf("end..\n"); | ||
| 35 | #ifdef CHECK | ||
| 36 | { | ||
| 37 | int ret=0; | ||
| 38 | #ifdef GENERATE_OUTPUT | ||
| 39 | fWriteMatrix(result, argv[1]); | ||
| 40 | #endif | ||
| 41 | ret = fSelfCheck(result, "expected_C.txt", 1.0); | ||
| 42 | if(ret < 0) | ||
| 43 | printf("Error in Texture Synthesis\n"); | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | iFreeHandle(im); | ||
| 47 | fFreeHandle(image); | ||
| 48 | free(data); | ||
| 49 | fFreeHandle(target); | ||
| 50 | fFreeHandle(result); | ||
| 51 | free(atlas); | ||
| 52 | WRITE_TO_FILE | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | I2D* parse_flags(int argc, char ** argv) | ||
| 57 | { | ||
| 58 | int i, tsx,tsy; | ||
| 59 | I2D* image; | ||
| 60 | char fileNm[256]; | ||
| 61 | |||
| 62 | printf("Input image: "); | ||
| 63 | scanf("%s", fileNm); | ||
| 64 | image = readImage(fileNm); | ||
| 65 | WIDTHin = image->width; | ||
| 66 | HEIGHTin = image->height; | ||
| 67 | |||
| 68 | localx = 3; | ||
| 69 | localy = 3; | ||
| 70 | |||
| 71 | #ifdef test | ||
| 72 | WIDTH = WIDTHin*2; | ||
| 73 | HEIGHT = HEIGHTin*2; | ||
| 74 | localx = 2; | ||
| 75 | localy = 2; | ||
| 76 | #endif | ||
| 77 | #ifdef sim_fast | ||
| 78 | WIDTH = WIDTHin*2; | ||
| 79 | HEIGHT = HEIGHTin*2; | ||
| 80 | localx = 3; | ||
| 81 | localy = 3; | ||
| 82 | #endif | ||
| 83 | #ifdef sim | ||
| 84 | WIDTH = WIDTHin*3; | ||
| 85 | HEIGHT = HEIGHTin*3; | ||
| 86 | localx = 2; | ||
| 87 | localy = 2; | ||
| 88 | #endif | ||
| 89 | #ifdef sqcif | ||
| 90 | WIDTH = WIDTHin*6; | ||
| 91 | HEIGHT = HEIGHTin*6; | ||
| 92 | localx = 2; | ||
| 93 | localy = 2; | ||
| 94 | #endif | ||
| 95 | #ifdef qcif | ||
| 96 | WIDTH = WIDTHin*10; | ||
| 97 | HEIGHT = HEIGHTin*10; | ||
| 98 | localx = 2; | ||
| 99 | localy = 2; | ||
| 100 | #endif | ||
| 101 | #ifdef cif | ||
| 102 | WIDTH = WIDTHin*10; | ||
| 103 | HEIGHT = HEIGHTin*10; | ||
| 104 | localx = 3; | ||
| 105 | localy = 3; | ||
| 106 | #endif | ||
| 107 | #ifdef vga | ||
| 108 | WIDTH = WIDTHin*20; | ||
| 109 | HEIGHT = HEIGHTin*20; | ||
| 110 | localx = 3; | ||
| 111 | localy = 3; | ||
| 112 | #endif | ||
| 113 | #ifdef fullhd | ||
| 114 | WIDTH = WIDTHin*20; | ||
| 115 | HEIGHT = HEIGHTin*20; | ||
| 116 | localx = 15; | ||
| 117 | localy = 15; | ||
| 118 | #endif | ||
| 119 | #ifdef wuxga | ||
| 120 | WIDTH = WIDTHin*20; | ||
| 121 | HEIGHT = HEIGHTin*20; | ||
| 122 | localx = 5; | ||
| 123 | localy = 5; | ||
| 124 | #endif | ||
| 125 | printf("Input size\t\t- (%dx%d)\n", HEIGHTin, WIDTHin); | ||
| 126 | |||
| 127 | // xloopin = malloc(2*WIDTHin*sizeof(int)); | ||
| 128 | // yloopin = malloc(2*HEIGHTin*sizeof(int)); | ||
| 129 | // | ||
| 130 | // for(i=-WIDTHin/2;i<WIDTHin+WIDTHin/2;i++) | ||
| 131 | // { | ||
| 132 | // arrayref(xloopin,i+WIDTHin/2) = (WIDTHin+i)%WIDTHin; | ||
| 133 | // } | ||
| 134 | // | ||
| 135 | // for(i=-HEIGHTin/2;i<HEIGHTin+HEIGHTin/2;i++) | ||
| 136 | // { | ||
| 137 | // arrayref(yloopin,i+HEIGHTin/2) = (HEIGHTin+i)%HEIGHTin; | ||
| 138 | // } | ||
| 139 | // xloopin += WIDTHin/2; yloopin += HEIGHTin/2; | ||
| 140 | |||
| 141 | result = fMallocHandle(1,HEIGHT*WIDTH); | ||
| 142 | target = fMallocHandle(1, WIDTH*HEIGHT); | ||
| 143 | |||
| 144 | atlas = malloc(2*WIDTH*HEIGHT*sizeof(int)); | ||
| 145 | xloopout = malloc(2*WIDTH*sizeof(int)); | ||
| 146 | yloopout = malloc(2*HEIGHT*sizeof(int)); | ||
| 147 | |||
| 148 | for(i=-WIDTH/2;i<WIDTH+WIDTH/2;i++) | ||
| 149 | { | ||
| 150 | arrayref(xloopout,i+WIDTH/2) = (WIDTH+i)%WIDTH; | ||
| 151 | } | ||
| 152 | for(i=-HEIGHT/2;i<HEIGHT+HEIGHT/2;i++) | ||
| 153 | { | ||
| 154 | arrayref(yloopout,i+HEIGHT/2) = (HEIGHT+i)%HEIGHT; | ||
| 155 | } | ||
| 156 | xloopout += WIDTH/2; yloopout += HEIGHT/2; | ||
| 157 | |||
| 158 | if (result == NULL) | ||
| 159 | { | ||
| 160 | printf("Can't allocate %dx%d image. Exiting.\n",WIDTH,HEIGHT); | ||
| 161 | exit(1); | ||
| 162 | } | ||
| 163 | |||
| 164 | return image; | ||
| 165 | } | ||
| 166 | |||
| 167 | void init_params(params *data) | ||
| 168 | { | ||
| 169 | int i,j; | ||
| 170 | data->localx = localx; data->localy = localy; | ||
| 171 | data->widthin = WIDTHin; data->widthout = WIDTH; | ||
| 172 | data->heightin = HEIGHTin; data->heightout = HEIGHT; | ||
| 173 | |||
| 174 | |||
| 175 | if(!targetin) | ||
| 176 | { | ||
| 177 | for(i=0;i<data->heightout;i++) | ||
| 178 | { | ||
| 179 | for(j=0;j<data->widthout;j++) | ||
| 180 | { | ||
| 181 | asubsref(target,a(j,i,data->widthout)+R) = 1.0; | ||
| 182 | // asubsref(target,a(j,i,data->widthout)+G) = 1.0; | ||
| 183 | // asubsref(target,a(j,i,data->widthout)+B) = 1.0; | ||
| 184 | } | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 188 | for(i=0;i<data->heightout;i++) | ||
| 189 | { | ||
| 190 | for(j=0;j<data->widthout;j++) | ||
| 191 | { | ||
| 192 | asubsref(result,a(j,i,data->widthout)+R) = 1.0; | ||
| 193 | // asubsref(result,a(j,i,data->widthout)+G) = 1.0; | ||
| 194 | // asubsref(result,a(j,i,data->widthout)+B) = 1.0; | ||
| 195 | } | ||
| 196 | } | ||
| 197 | } | ||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/c/texture.c b/SD-VBS/benchmarks/texture_synthesis/src/c/texture.c new file mode 100644 index 0000000..fb0f1ae --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/c/texture.c | |||
| @@ -0,0 +1,396 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #include "texture.h" | ||
| 6 | #include <math.h> | ||
| 7 | |||
| 8 | int vrstartx, vrfinishx, vrstarty, vrfinishy; | ||
| 9 | extern params data; | ||
| 10 | int* candlistx, *candlisty; | ||
| 11 | int *atlas; | ||
| 12 | int anotherpass=0,maxcand = 40; | ||
| 13 | F2D *target, *result; | ||
| 14 | int *xloopout, *yloopout; | ||
| 15 | int *xloopin, *yloopin; | ||
| 16 | |||
| 17 | double compare_rest(F2D *image,int x, int y, F2D *tar,int x1, int y1, params* data); | ||
| 18 | |||
| 19 | /********************************* | ||
| 20 | This is the main texture synthesis function. Called just once | ||
| 21 | from main to generate image from 'image' into 'result'. | ||
| 22 | Synthesis parameters (image and neighborhood sizes) are in global | ||
| 23 | 'data-> structure. | ||
| 24 | *********************************/ | ||
| 25 | |||
| 26 | //void create_texture(F2D *image, F2D *result, params *data) | ||
| 27 | void create_texture(F2D *image, params *data) | ||
| 28 | { | ||
| 29 | |||
| 30 | int i,j,k, ncand, bestx,besty; | ||
| 31 | double diff,curdiff; | ||
| 32 | int tsx,tsy; | ||
| 33 | srand48(1); | ||
| 34 | candlistx = (int*)malloc(sizeof(int)*(data->localx*(data->localy+1)+1)); | ||
| 35 | candlisty = (int*)malloc(sizeof(int)*(data->localx*(data->localy+1)+1)); | ||
| 36 | // if(!anotherpass) init(result, image,data); | ||
| 37 | if(!anotherpass) init(image,data); | ||
| 38 | |||
| 39 | for(i=0;i<data->heightout-data->localy/2;i++) | ||
| 40 | { | ||
| 41 | for(j=0;j<data->widthout;j++) | ||
| 42 | { | ||
| 43 | // First, create a list of candidates for particular pixel. | ||
| 44 | if(anotherpass) ncand = create_all_candidates(j,i, data); | ||
| 45 | else ncand = create_candidates(j,i, data); | ||
| 46 | |||
| 47 | // If there are multiple candidates, choose the best based on L_2 norm | ||
| 48 | |||
| 49 | if(ncand > 1) | ||
| 50 | { | ||
| 51 | diff = 1e10; | ||
| 52 | for(k=0;k<ncand;k++) | ||
| 53 | { | ||
| 54 | curdiff = compare_neighb(image, arrayref(candlistx,k),arrayref(candlisty,k),result,j,i, data); | ||
| 55 | curdiff += compare_rest(image,arrayref(candlistx,k),arrayref(candlisty,k),target,j,i,data); | ||
| 56 | if(curdiff < diff) | ||
| 57 | { | ||
| 58 | diff = curdiff; | ||
| 59 | bestx = arrayref(candlistx,k); | ||
| 60 | besty = arrayref(candlisty,k); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
| 64 | else | ||
| 65 | { | ||
| 66 | bestx = arrayref(candlistx,0); | ||
| 67 | besty = arrayref(candlisty,0); | ||
| 68 | } | ||
| 69 | |||
| 70 | // Copy the best candidate to the output image and record its position | ||
| 71 | // in the atlas (atlas is used to create candidates) | ||
| 72 | |||
| 73 | asubsref(result,a(j,i,data->widthout)+R) = asubsref(image,a(bestx,besty,data->widthin)+R); | ||
| 74 | // asubsref(result,a(j,i,data->widthout)+G) = asubsref(image,a(bestx,besty,data->widthin)+G); | ||
| 75 | // asubsref(result,a(j,i,data->widthout)+B) = asubsref(image,a(bestx,besty,data->widthin)+B); | ||
| 76 | arrayref(atlas,aa(j,i)) = bestx; | ||
| 77 | arrayref(atlas,aa(j,i)+1) = besty; | ||
| 78 | } | ||
| 79 | } | ||
| 80 | |||
| 81 | // Use full neighborhoods for the last few rows. This is a small | ||
| 82 | // fraction of total area - can be ignored for optimization purposes. | ||
| 83 | |||
| 84 | for(;i<data->heightout;i++) | ||
| 85 | { | ||
| 86 | for(j=0;j<data->widthout;j++) | ||
| 87 | { | ||
| 88 | ncand = create_all_candidates(j,i,data); | ||
| 89 | if(ncand > 1) | ||
| 90 | { | ||
| 91 | diff = 1e10; | ||
| 92 | for(k=0;k<ncand;k++) | ||
| 93 | { | ||
| 94 | curdiff = compare_full_neighb(image, arrayref(candlistx,k),arrayref(candlisty,k),result,j,i, data); | ||
| 95 | if(curdiff < diff) | ||
| 96 | { | ||
| 97 | diff = curdiff; | ||
| 98 | bestx = arrayref(candlistx,k); | ||
| 99 | besty = arrayref(candlisty,k); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | } | ||
| 103 | else | ||
| 104 | { | ||
| 105 | bestx = arrayref(candlistx,0); | ||
| 106 | besty = arrayref(candlisty,0); | ||
| 107 | } | ||
| 108 | |||
| 109 | asubsref(result,a(j,i,data->widthout)+R) = asubsref(image,a(bestx,besty,data->widthin)+R); | ||
| 110 | // asubsref(result,a(j,i,data->widthout)+G) = asubsref(image,a(bestx,besty,data->widthin)+G); | ||
| 111 | // asubsref(result,a(j,i,data->widthout)+B) = asubsref(image,a(bestx,besty,data->widthin)+B); | ||
| 112 | arrayref(atlas,aa(j,i)) = bestx; | ||
| 113 | arrayref(atlas,aa(j,i)+1) = besty; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | /********************************* | ||
| 118 | End of main texture synthesis loop | ||
| 119 | *********************************/ | ||
| 120 | |||
| 121 | for(i=0;i<data->localy/2;i++) | ||
| 122 | { | ||
| 123 | for(j=0;j<data->widthout;j++) | ||
| 124 | { | ||
| 125 | ncand = create_all_candidates(j,i,data); | ||
| 126 | if(ncand > 1) | ||
| 127 | { | ||
| 128 | diff = 1e10; | ||
| 129 | for(k=0;k<ncand;k++) | ||
| 130 | { | ||
| 131 | curdiff = compare_full_neighb(image,arrayref(candlistx,k),arrayref(candlisty,k),result,j,i, data); | ||
| 132 | if(curdiff < diff) | ||
| 133 | { | ||
| 134 | diff = curdiff; | ||
| 135 | bestx = arrayref(candlistx,k); | ||
| 136 | besty = arrayref(candlisty,k); | ||
| 137 | } | ||
| 138 | } | ||
| 139 | } | ||
| 140 | else | ||
| 141 | { | ||
| 142 | bestx = arrayref(candlistx,0); | ||
| 143 | besty = arrayref(candlisty,0); | ||
| 144 | } | ||
| 145 | |||
| 146 | asubsref(result,a(j,i,data->widthout)+R) = asubsref(image,a(bestx,besty,data->widthin)+R); | ||
| 147 | // asubsref(result,a(j,i,data->widthout)+G) = asubsref(image,a(bestx,besty,data->widthin)+G); | ||
| 148 | // asubsref(result,a(j,i,data->widthout)+B) = asubsref(image,a(bestx,besty,data->widthin)+B); | ||
| 149 | arrayref(atlas,aa(j,i)) = bestx; | ||
| 150 | arrayref(atlas,aa(j,i)+1) = besty; | ||
| 151 | } | ||
| 152 | } | ||
| 153 | } | ||
| 154 | |||
| 155 | // Creates a list of valid candidates for given pixel using only L-shaped causal area | ||
| 156 | |||
| 157 | int create_candidates(int x,int y, params* data) | ||
| 158 | { | ||
| 159 | int address,i,j,k,n = 0; | ||
| 160 | for(i=0;i<=data->localy/2;i++) | ||
| 161 | { | ||
| 162 | for(j=-data->localx/2;j<=data->localx/2;j++) | ||
| 163 | { | ||
| 164 | if(i==0 && j>=0) | ||
| 165 | continue; | ||
| 166 | address = aa( arrayref(xloopout,x+j), arrayref(yloopout,y-i) ); | ||
| 167 | arrayref(candlistx,n) = arrayref(atlas,address) - j; | ||
| 168 | arrayref(candlisty,n) = arrayref(atlas,address+1) + i; | ||
| 169 | |||
| 170 | if( arrayref(candlistx,n) >= vrfinishx || arrayref(candlistx,n) < vrstartx) | ||
| 171 | { | ||
| 172 | arrayref(candlistx,n) = vrstartx + (int)(drand48()*(vrfinishx-vrstartx)); | ||
| 173 | arrayref(candlisty,n) = vrstarty + (int)(drand48()*(vrfinishy-vrstarty)); | ||
| 174 | n++; | ||
| 175 | continue; | ||
| 176 | } | ||
| 177 | |||
| 178 | if( arrayref(candlisty,n) >= vrfinishy ) | ||
| 179 | { | ||
| 180 | arrayref(candlisty,n) = vrstarty + (int)(drand48()*(vrfinishy-vrstarty)); | ||
| 181 | arrayref(candlistx,n) = vrstartx + (int)(drand48()*(vrfinishx-vrstartx)); | ||
| 182 | n++; | ||
| 183 | continue; | ||
| 184 | } | ||
| 185 | |||
| 186 | for(k=0;k<n;k++) | ||
| 187 | { | ||
| 188 | if( arrayref(candlistx,n) == arrayref(candlistx,k) && arrayref(candlisty,n) == arrayref(candlisty,k)) | ||
| 189 | { | ||
| 190 | n--; | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | n++; | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | return n; | ||
| 199 | } | ||
| 200 | |||
| 201 | // Created a list of candidates using the complete square around the pixel | ||
| 202 | |||
| 203 | int create_all_candidates(int x,int y, params* data) | ||
| 204 | { | ||
| 205 | int address,i,j,k,n = 0; | ||
| 206 | for(i=-data->localy/2;i<=data->localy/2;i++) | ||
| 207 | { | ||
| 208 | for(j=-data->localx/2;j<=data->localx/2;j++) | ||
| 209 | { | ||
| 210 | if(i==0 && j>=0) | ||
| 211 | continue; | ||
| 212 | // printf("Entering = (%d,%d)\n", i,j); | ||
| 213 | address = aa( arrayref(xloopout,x+j), arrayref(yloopout,y-i) ); | ||
| 214 | arrayref(candlistx,n) = arrayref(atlas,address)-j; | ||
| 215 | arrayref(candlisty,n) = arrayref(atlas,address+1)+i; | ||
| 216 | |||
| 217 | if( arrayref(candlistx,n) >= vrfinishx || arrayref(candlistx,n) < vrstartx) | ||
| 218 | { | ||
| 219 | arrayref(candlistx,n) = vrstartx + (int)(drand48()*(vrfinishx-vrstartx)); | ||
| 220 | arrayref(candlisty,n) = vrstarty + (int)(drand48()*(vrfinishy-vrstarty)); | ||
| 221 | n++; | ||
| 222 | // printf("1: (%d,%d)\t%d\n", i,j,n); | ||
| 223 | continue; | ||
| 224 | } | ||
| 225 | |||
| 226 | if( arrayref(candlisty,n) >= vrfinishy || arrayref(candlisty,n) < vrstarty) | ||
| 227 | { | ||
| 228 | arrayref(candlisty,n) = vrstarty + (int)(drand48()*(vrfinishy-vrstarty)); | ||
| 229 | arrayref(candlistx,n) = vrstartx + (int)(drand48()*(vrfinishx-vrstartx)); | ||
| 230 | n++; | ||
| 231 | // printf("2: (%d,%d)\t%d\n", i,j,n); | ||
| 232 | continue; | ||
| 233 | } | ||
| 234 | |||
| 235 | for(k=0;k<n;k++) | ||
| 236 | { | ||
| 237 | if( arrayref(candlistx,n) == arrayref(candlistx,k) && arrayref(candlisty,n) == arrayref(candlisty,k) ) | ||
| 238 | { | ||
| 239 | n--; | ||
| 240 | // printf("3: (%d,%d)\t%d\n", i,j,n); | ||
| 241 | break; | ||
| 242 | } | ||
| 243 | } | ||
| 244 | n++; | ||
| 245 | // printf("4: (%d,%d)\t%d\n", i,j,n); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | |||
| 249 | return n; | ||
| 250 | } | ||
| 251 | |||
| 252 | // Initializes the output image and atlases to a random collection of pixels | ||
| 253 | |||
| 254 | //void init(F2D *result, F2D *image, params* data) | ||
| 255 | void init(F2D *image, params* data) | ||
| 256 | { | ||
| 257 | int i,j,tmpx,tmpy; | ||
| 258 | vrstartx = data->localx/2; vrstarty = data->localy/2; | ||
| 259 | vrfinishx = data->widthin-data->localx/2; | ||
| 260 | vrfinishy = data->heightin-data->localy/2; | ||
| 261 | for(i=0;i<data->heightout;i++) | ||
| 262 | { | ||
| 263 | for(j=0;j<data->widthout;j++) | ||
| 264 | { | ||
| 265 | if( | ||
| 266 | asubsref(target,a(j,i,data->widthout)+R) == 1.0 | ||
| 267 | // && asubsref(target,a(j,i,data->widthout)+G) == 1.0 | ||
| 268 | // && asubsref(target,a(j,i,data->widthout)+B) == 1.0 | ||
| 269 | ) | ||
| 270 | { | ||
| 271 | tmpx = vrstartx + (int)(drand48()*(vrfinishx-vrstartx)); | ||
| 272 | tmpy = vrstarty + (int)(drand48()*(vrfinishy-vrstarty)); | ||
| 273 | if(!anotherpass) | ||
| 274 | { | ||
| 275 | arrayref(atlas,aa(j,i)) = tmpx; | ||
| 276 | arrayref(atlas,aa(j,i)+1) = tmpy; | ||
| 277 | asubsref(result,a(j,i,data->widthout)+R) = asubsref(image,a(tmpx,tmpy,data->widthin)+R); | ||
| 278 | // asubsref(result,a(j,i,data->widthout)+G) = asubsref(image,a(tmpx,tmpy,data->widthin)+G); | ||
| 279 | // asubsref(result,a(j,i,data->widthout)+B) = asubsref(image,a(tmpx,tmpy,data->widthin)+B); | ||
| 280 | } | ||
| 281 | } | ||
| 282 | } | ||
| 283 | } | ||
| 284 | |||
| 285 | return; | ||
| 286 | } | ||
| 287 | |||
| 288 | |||
| 289 | // Compares two square neighborhoods, returns L_2 difference | ||
| 290 | |||
| 291 | double compare_full_neighb(F2D *image,int x, int y, F2D *image1,int x1, int y1, params* data) | ||
| 292 | { | ||
| 293 | double tmp,res = 0; | ||
| 294 | int i,j,addr,addr1; | ||
| 295 | for(i=-(data->localy/2);i<=data->localy/2;i++) | ||
| 296 | { | ||
| 297 | for(j=-(data->localx/2);j<=data->localx/2;j++) | ||
| 298 | { | ||
| 299 | if( !( i > 0 && y1 > data->localy && y1+i < data->heightout) ) | ||
| 300 | { | ||
| 301 | addr = a(x+j,y+i,data->widthin); | ||
| 302 | addr1 = a( arrayref(xloopout,x1+j), arrayref(yloopout,y1+i), data->widthout); | ||
| 303 | |||
| 304 | tmp = asubsref(image,addr+R) - asubsref(image1,addr1+R); | ||
| 305 | res += tmp*tmp; | ||
| 306 | // tmp = asubsref(image,addr+G) - asubsref(image1,addr1+G); | ||
| 307 | // res += tmp*tmp; | ||
| 308 | // tmp = asubsref(image,addr+B) - asubsref(image1,addr1+B); | ||
| 309 | // res += tmp*tmp; | ||
| 310 | } | ||
| 311 | } | ||
| 312 | } | ||
| 313 | |||
| 314 | return res; | ||
| 315 | } | ||
| 316 | |||
| 317 | // Compares two L-shaped neighborhoods, returns L_2 difference | ||
| 318 | |||
| 319 | double compare_neighb(F2D *image,int x, int y, F2D *image1,int x1, int y1, params* data) | ||
| 320 | { | ||
| 321 | double tmp,res = 0; | ||
| 322 | int i,j,addr1,addr; | ||
| 323 | for(i=-(data->localy/2);i<0;i++) | ||
| 324 | { | ||
| 325 | for(j=-(data->localx/2);j<=data->localx/2;j++) | ||
| 326 | { | ||
| 327 | addr = a(x+j,y+i,data->widthin); | ||
| 328 | addr1 = a( arrayref(xloopout,x1+j), arrayref(yloopout,y1+i), data->widthout); | ||
| 329 | |||
| 330 | tmp = asubsref(image,addr+R) - asubsref(image1,addr1+R); | ||
| 331 | res += tmp*tmp; | ||
| 332 | // tmp = asubsref(image,addr+G) - asubsref(image1,addr1+G); | ||
| 333 | // res += tmp*tmp; | ||
| 334 | // tmp = asubsref(image,addr+B) - asubsref(image1,addr1+B); | ||
| 335 | // res += tmp*tmp; | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | for(j=-(data->localx/2);j<0;j++) | ||
| 340 | { | ||
| 341 | addr = a(x+j,y,data->widthin); | ||
| 342 | addr1 = a( arrayref(xloopout,x1+j), y1, data->widthout); | ||
| 343 | |||
| 344 | tmp = asubsref(image,addr+R) - asubsref(image1,addr1+R); | ||
| 345 | res += tmp*tmp; | ||
| 346 | // tmp = asubsref(image,addr+G) - asubsref(image1,addr1+G); | ||
| 347 | // res += tmp*tmp; | ||
| 348 | // tmp = asubsref(image,addr+B) - asubsref(image1,addr1+B); | ||
| 349 | // res += tmp*tmp; | ||
| 350 | } | ||
| 351 | |||
| 352 | return res; | ||
| 353 | } | ||
| 354 | |||
| 355 | double compare_rest(F2D *image,int x, int y, F2D *tar,int x1, int y1, params* data) | ||
| 356 | { | ||
| 357 | double tmp,res = 0; | ||
| 358 | int i,j,addr,addr1; | ||
| 359 | |||
| 360 | for(i=(data->localy/2);i>0;i--) | ||
| 361 | { | ||
| 362 | for(j=-(data->localx/2);j<=data->localx/2;j++) | ||
| 363 | { | ||
| 364 | addr = a(x+j,y+i,data->widthin); | ||
| 365 | addr1 = a( arrayref(xloopout,x1+j), arrayref(yloopout,y1+i), data->widthout); | ||
| 366 | |||
| 367 | if( asubsref(tar,addr1+R) != 1.0) //KVS? | ||
| 368 | { | ||
| 369 | tmp = asubsref(image,addr+R) - asubsref(tar,addr1+R); | ||
| 370 | res += tmp*tmp; | ||
| 371 | // tmp = asubsref(image,addr+G) - asubsref(tar,addr1+G); | ||
| 372 | // res += tmp*tmp; | ||
| 373 | // tmp = asubsref(image,addr+B) - asubsref(tar,addr1+B); | ||
| 374 | // res += tmp*tmp; | ||
| 375 | } | ||
| 376 | } | ||
| 377 | } | ||
| 378 | |||
| 379 | for(j=(data->localx/2);j>0;j--) | ||
| 380 | { | ||
| 381 | addr = a(x+j,y,data->widthin); | ||
| 382 | addr1 = a( arrayref(xloopout,x1+j), y1, data->widthout); | ||
| 383 | if( asubsref(tar,addr1+R) != 1.0) // KVS? | ||
| 384 | { | ||
| 385 | tmp = asubsref(image,addr+R) - asubsref(tar,addr1+R); | ||
| 386 | res += tmp*tmp; | ||
| 387 | // tmp = asubsref(image,addr+G) - asubsref(tar,addr1+G); | ||
| 388 | // res += tmp*tmp; | ||
| 389 | // tmp = asubsref(image,addr+B) - asubsref(tar,addr1+B); | ||
| 390 | // res += tmp*tmp; | ||
| 391 | } | ||
| 392 | } | ||
| 393 | |||
| 394 | return res; | ||
| 395 | } | ||
| 396 | |||
diff --git a/SD-VBS/benchmarks/texture_synthesis/src/c/texture.h b/SD-VBS/benchmarks/texture_synthesis/src/c/texture.h new file mode 100644 index 0000000..9819c03 --- /dev/null +++ b/SD-VBS/benchmarks/texture_synthesis/src/c/texture.h | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | /******************************** | ||
| 2 | Author: Sravanthi Kota Venkata | ||
| 3 | ********************************/ | ||
| 4 | |||
| 5 | #ifndef _TEXTURE_ | ||
| 6 | #define _TEXTURE_ | ||
| 7 | |||
| 8 | #include "sdvbs_common.h" | ||
| 9 | |||
| 10 | #define R 0 | ||
| 11 | #define G 1 | ||
| 12 | #define B 2 | ||
| 13 | #define a(x,y,W) (1*((y)*(W)+(x))) | ||
| 14 | #define aa(x,y) (2*((y)*data->widthout+(x))) | ||
| 15 | |||
| 16 | typedef float pixelvalue; | ||
| 17 | |||
| 18 | typedef struct | ||
| 19 | { | ||
| 20 | double sign, diff; | ||
| 21 | int x,y; | ||
| 22 | int secondx, secondy; | ||
| 23 | }signature; | ||
| 24 | |||
| 25 | typedef struct{ | ||
| 26 | int localx, localy, localz; | ||
| 27 | int widthin, widthout; | ||
| 28 | int heightin, heightout; | ||
| 29 | int nfin, nfout; | ||
| 30 | }params; | ||
| 31 | |||
| 32 | void *SIGNATURES; | ||
| 33 | |||
| 34 | //void create_texture(F2D *image, F2D *result, params *data); | ||
| 35 | void create_texture(F2D *image, params *data); | ||
| 36 | I2D* parse_flags(int argc, char ** argv); | ||
| 37 | void init_params(params *data); | ||
| 38 | //void init(F2D *result, F2D *image, params* data); | ||
| 39 | void init(F2D *image, params* data); | ||
| 40 | double compare_full_neighb(F2D *image,int x, int y, F2D *image1,int x1, int y1, params* data); | ||
| 41 | double compare_neighb(F2D *image,int x, int y, F2D *image1,int x1, int y1, params* data); | ||
| 42 | int create_candidates(int x,int y, params* data); | ||
| 43 | int create_all_candidates(int x,int y, params* data); | ||
| 44 | |||
| 45 | #endif | ||
| 46 | |||
| 47 | |||
| 48 | |||
