summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/texture_synthesis/src/c
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/texture_synthesis/src/c')
-rw-r--r--SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c195
-rw-r--r--SD-VBS/benchmarks/texture_synthesis/src/c/texture.c396
-rw-r--r--SD-VBS/benchmarks/texture_synthesis/src/c/texture.h48
3 files changed, 0 insertions, 639 deletions
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
deleted file mode 100644
index 2ebb423..0000000
--- a/SD-VBS/benchmarks/texture_synthesis/src/c/script_texture_synthesis.c
+++ /dev/null
@@ -1,195 +0,0 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "texture.h"
6#include <malloc.h>
7#include "extra.h"
8#define TEXTURE_MEM 1<<28
9int WIDTHin,HEIGHTin;
10F2D *target, *result;
11int WIDTH,HEIGHT;
12int localx, localy,targetin=0;
13int *atlas;
14int *xloopin, *yloopin;
15int *xloopout, *yloopout;
16
17int 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 for_each_job {
31 create_texture(image, data);
32 }
33
34#ifdef CHECK
35{
36 int ret=0;
37#ifdef GENERATE_OUTPUT
38 fWriteMatrix(result, argv[1]);
39#endif
40 ret = fSelfCheck(result, "expected_C.txt", 1.0);
41 if(ret < 0)
42 printf("Error in Texture Synthesis\n");
43}
44#endif
45 iFreeHandle(im);
46 fFreeHandle(image);
47 free(data);
48 fFreeHandle(target);
49 fFreeHandle(result);
50 free(atlas);
51 WRITE_TO_FILE
52 return 0;
53}
54
55I2D* parse_flags(int argc, char ** argv)
56{
57 int i, tsx,tsy;
58 I2D* image;
59 char fileNm[256];
60
61 scanf("%s", fileNm);
62 image = readImage(fileNm);
63 WIDTHin = image->width;
64 HEIGHTin = image->height;
65
66 localx = 3;
67 localy = 3;
68
69#ifdef test
70 WIDTH = WIDTHin*2;
71 HEIGHT = HEIGHTin*2;
72 localx = 2;
73 localy = 2;
74#endif
75#ifdef sim_fast
76 WIDTH = WIDTHin*2;
77 HEIGHT = HEIGHTin*2;
78 localx = 3;
79 localy = 3;
80#endif
81#ifdef sim
82 WIDTH = WIDTHin*3;
83 HEIGHT = HEIGHTin*3;
84 localx = 2;
85 localy = 2;
86#endif
87#ifdef sqcif
88 WIDTH = WIDTHin*6;
89 HEIGHT = HEIGHTin*6;
90 localx = 2;
91 localy = 2;
92#endif
93#ifdef qcif
94 WIDTH = WIDTHin*10;
95 HEIGHT = HEIGHTin*10;
96 localx = 2;
97 localy = 2;
98#endif
99#ifdef cif
100 WIDTH = WIDTHin*10;
101 HEIGHT = HEIGHTin*10;
102 localx = 3;
103 localy = 3;
104#endif
105#ifdef vga
106 WIDTH = WIDTHin*20;
107 HEIGHT = HEIGHTin*20;
108 localx = 3;
109 localy = 3;
110#endif
111#ifdef fullhd
112 WIDTH = WIDTHin*20;
113 HEIGHT = HEIGHTin*20;
114 localx = 15;
115 localy = 15;
116#endif
117#ifdef wuxga
118 WIDTH = WIDTHin*20;
119 HEIGHT = HEIGHTin*20;
120 localx = 5;
121 localy = 5;
122#endif
123// printf("Input size\t\t- (%dx%d)\n", HEIGHTin, WIDTHin);
124
125// xloopin = malloc(2*WIDTHin*sizeof(int));
126// yloopin = malloc(2*HEIGHTin*sizeof(int));
127//
128// for(i=-WIDTHin/2;i<WIDTHin+WIDTHin/2;i++)
129// {
130// arrayref(xloopin,i+WIDTHin/2) = (WIDTHin+i)%WIDTHin;
131// }
132//
133// for(i=-HEIGHTin/2;i<HEIGHTin+HEIGHTin/2;i++)
134// {
135// arrayref(yloopin,i+HEIGHTin/2) = (HEIGHTin+i)%HEIGHTin;
136// }
137// xloopin += WIDTHin/2; yloopin += HEIGHTin/2;
138
139 result = fMallocHandle(1,HEIGHT*WIDTH);
140 target = fMallocHandle(1, WIDTH*HEIGHT);
141
142 atlas = malloc(2*WIDTH*HEIGHT*sizeof(int));
143 xloopout = malloc(2*WIDTH*sizeof(int));
144 yloopout = malloc(2*HEIGHT*sizeof(int));
145
146 for(i=-WIDTH/2;i<WIDTH+WIDTH/2;i++)
147 {
148 arrayref(xloopout,i+WIDTH/2) = (WIDTH+i)%WIDTH;
149 }
150 for(i=-HEIGHT/2;i<HEIGHT+HEIGHT/2;i++)
151 {
152 arrayref(yloopout,i+HEIGHT/2) = (HEIGHT+i)%HEIGHT;
153 }
154 xloopout += WIDTH/2; yloopout += HEIGHT/2;
155
156 if (result == NULL)
157 {
158 printf("Can't allocate %dx%d image. Exiting.\n",WIDTH,HEIGHT);
159 exit(1);
160 }
161
162 return image;
163}
164
165void init_params(params *data)
166{
167 int i,j;
168 data->localx = localx; data->localy = localy;
169 data->widthin = WIDTHin; data->widthout = WIDTH;
170 data->heightin = HEIGHTin; data->heightout = HEIGHT;
171
172
173 if(!targetin)
174 {
175 for(i=0;i<data->heightout;i++)
176 {
177 for(j=0;j<data->widthout;j++)
178 {
179 asubsref(target,a(j,i,data->widthout)+R) = 1.0;
180// asubsref(target,a(j,i,data->widthout)+G) = 1.0;
181// asubsref(target,a(j,i,data->widthout)+B) = 1.0;
182 }
183 }