diff options
Diffstat (limited to 'SD-VBS/common')
35 files changed, 9 insertions, 1624 deletions
diff --git a/SD-VBS/common/c/extra.h b/SD-VBS/common/c/extra.h index 3215951..8c67b33 100644 --- a/SD-VBS/common/c/extra.h +++ b/SD-VBS/common/c/extra.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /** | 1 | /** |
| 2 | * Copyright 2019 Sims Hill Osborne and Joshua Bakita | 2 | * Copyright 2019 Sims Hill Osborne and 2020 Joshua Bakita |
| 3 | * | 3 | * |
| 4 | * This header provides facilities by which to separably run and time TACLeBench | 4 | * This header provides facilities by which to separably run and time TACLeBench |
| 5 | * To use this for paired task timing, define PAIRED (pass CFLAGS=-DPAIRED to make) | 5 | * To use this for paired task timing, define PAIRED (pass CFLAGS=-DPAIRED to make) |
| @@ -29,7 +29,7 @@ extern int sched_getcpu(); | |||
| 29 | #include <sys/syscall.h> | 29 | #include <sys/syscall.h> |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #define LITMUS 0 | 32 | #define LITMUS 1 |
| 33 | #define MC2 0 | 33 | #define MC2 0 |
| 34 | #define MMDC_PROF 0 | 34 | #define MMDC_PROF 0 |
| 35 | 35 | ||
| @@ -200,20 +200,6 @@ static void _rt_load_params_itrl(int argc, char **argv) { | |||
| 200 | perror("Unable to migrate to specified CPU"); \ | 200 | perror("Unable to migrate to specified CPU"); \ |
| 201 | exit(1); \ | 201 | exit(1); \ |
| 202 | } \ | 202 | } \ |
| 203 | struct reservation_config res; \ | ||
| 204 | res.id = gettid(); \ | ||
| 205 | res.cpu = cpu; \ | ||
| 206 | res.priority = LITMUS_HIGHEST_PRIORITY; \ | ||
| 207 | /* we take over half the CPU time (these are ns) */ \ | ||
| 208 | res.polling_params.budget = ms2ns(3000); \ | ||
| 209 | res.polling_params.period = ms2ns(3000); \ | ||
| 210 | res.polling_params.offset = 0; \ | ||
| 211 | res.polling_params.relative_deadline = ms2ns(3000); \ | ||
| 212 | /* Not 100% sure that we should use periodic polling */ \ | ||
| 213 | if (reservation_create(PERIODIC_POLLING, &res) < 0) { \ | ||
| 214 | perror("Unable to create reservation"); \ | ||
| 215 | exit(1); \ | ||
| 216 | } \ | ||
| 217 | struct rt_task rt_param; \ | 203 | struct rt_task rt_param; \ |
| 218 | init_rt_task_param(&rt_param); \ | 204 | init_rt_task_param(&rt_param); \ |
| 219 | /* Supposedly the next two parameters are irrelevant when reservations are enabled, but I'm leaving them anyway... */ \ | 205 | /* Supposedly the next two parameters are irrelevant when reservations are enabled, but I'm leaving them anyway... */ \ |
| @@ -223,7 +209,7 @@ static void _rt_load_params_itrl(int argc, char **argv) { | |||
| 223 | rt_param.cls = RT_CLASS_HARD; \ | 209 | rt_param.cls = RT_CLASS_HARD; \ |
| 224 | rt_param.release_policy = TASK_PERIODIC; \ | 210 | rt_param.release_policy = TASK_PERIODIC; \ |
| 225 | rt_param.budget_policy = NO_ENFORCEMENT; \ | 211 | rt_param.budget_policy = NO_ENFORCEMENT; \ |
| 226 | rt_param.cpu = cpu; \ | 212 | rt_param.cpu = _rt_core; \ |
| 227 | if (set_rt_task_param(gettid(), &rt_param) < 0) { \ | 213 | if (set_rt_task_param(gettid(), &rt_param) < 0) { \ |
| 228 | perror("Unable to set real-time parameters"); \ | 214 | perror("Unable to set real-time parameters"); \ |
| 229 | exit(1); \ | 215 | exit(1); \ |
| @@ -244,13 +230,7 @@ static void _rt_load_params_itrl(int argc, char **argv) { | |||
| 244 | 230 | ||
| 245 | #if MC2 | 231 | #if MC2 |
| 246 | #define MC2_SETUP \ | 232 | #define MC2_SETUP \ |
| 247 | struct mc2_task mc2_param; \ | 233 | |
| 248 | mc2_param.res_id = gettid(); \ | ||
| 249 | mc2_param.crit = CRIT_LEVEL_A; \ | ||
| 250 | if (set_mc2_task_param(gettid(), &mc2_param) < 0) { \ | ||
| 251 | perror("Unable to set MC^2 task params"); \ | ||
| 252 | exit(1); \ | ||
| 253 | } \ | ||
| 254 | set_page_color(rt_param.cpu); | 234 | set_page_color(rt_param.cpu); |
| 255 | #else | 235 | #else |
| 256 | #define MC2_SETUP | 236 | #define MC2_SETUP |
| @@ -261,7 +241,6 @@ static void _rt_load_params_itrl(int argc, char **argv) { | |||
| 261 | perror("Unable to become a real-time task"); \ | 241 | perror("Unable to become a real-time task"); \ |
| 262 | exit(1); \ | 242 | exit(1); \ |
| 263 | } \ | 243 | } \ |
| 264 | reservation_destroy(gettid(), rt_param.cpu); | ||
| 265 | 244 | ||
| 266 | #if __arm__ | 245 | #if __arm__ |
| 267 | // On ARM, manually flush the cache | 246 | // On ARM, manually flush the cache |
diff --git a/SD-VBS/common/makefiles/Makefile.common b/SD-VBS/common/makefiles/Makefile.common index 7fc8824..144adb2 100644 --- a/SD-VBS/common/makefiles/Makefile.common +++ b/SD-VBS/common/makefiles/Makefile.common | |||
| @@ -18,8 +18,7 @@ endif | |||
| 18 | endif | 18 | endif |
| 19 | 19 | ||
| 20 | CC=gcc | 20 | CC=gcc |
| 21 | override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK | 21 | override CFLAGS += -DGCC -D$(INPUT) -pthread -DCHECK |
| 22 | |||
| 23 | COMMON_DIR := $(TOP_DIR)/common/c | 22 | COMMON_DIR := $(TOP_DIR)/common/c |
| 24 | M_COMMON := $(TOP_DIR)/common/matlab | 23 | M_COMMON := $(TOP_DIR)/common/matlab |
| 25 | M_TOOLBOX=$(TOP_DIR)/common/toolbox | 24 | M_TOOLBOX=$(TOP_DIR)/common/toolbox |
| @@ -29,7 +28,7 @@ PRELOAD_TIMES_DIR := $(TOP_DIR)/preload-times/$(BMARK) | |||
| 29 | MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) | 28 | MTIMING_DIR := $(TOP_DIR)/cycles/$(BMARK) |
| 30 | BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) | 29 | BMARK_DIR := $(TOP_DIR)/benchmarks/$(BMARK) |
| 31 | TOOL_DIR := $(TOP_DIR)/tools | 30 | TOOL_DIR := $(TOP_DIR)/tools |
| 32 | 31 | LIBLITMUS := /home/litmus/liblitmus | |
| 33 | #The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =. | 32 | #The options set below and specific to each benchmark. Disparity takes 2 input images, whereas Tracking can take any >1 input images =. |
| 34 | 33 | ||
| 35 | # Variables exported from the benchmark specific Makefiles: | 34 | # Variables exported from the benchmark specific Makefiles: |
| @@ -56,8 +55,8 @@ COMMON_SRC := $(wildcard $(COMMON_DIR)/*.c) | |||
| 56 | # RULES | 55 | # RULES |
| 57 | 56 | ||
| 58 | EXE = | 57 | EXE = |
| 59 | INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) | 58 | INCLUDES = -I$(COMMON_DIR) -I$(C_DIR) -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include |
| 60 | COMPILE_C = $(CC) $(CFLAGS) -lm -O2 $(INCLUDES) | 59 | COMPILE_C = $(CC) $(CFLAGS) $(INCLUDES) -O2 |
| 61 | #COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES) | 60 | #COMPILE_C = $(CC) $(CFLAGS) -DGENERATE_OUTPUT -lm -O2 $(INCLUDES) |
| 62 | COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES) | 61 | COMPILE_G = $(CC) $(CFLAGS) -g -lm $(INCLUDES) |
| 63 | COMPILE_PG = $(COMPILE_G) -pg | 62 | COMPILE_PG = $(COMPILE_G) -pg |
| @@ -108,7 +107,7 @@ compile-preload: | |||
| 108 | compile: $(C_SRC) | 107 | compile: $(C_SRC) |
| 109 | @echo | 108 | @echo |
| 110 | @echo -e "Benchmark\t\t- $(BMARK)" | 109 | @echo -e "Benchmark\t\t- $(BMARK)" |
| 111 | @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -lm -w -o $(BMARK)$(EXE) | 110 | @$(COMPILE_C) $(COMMON_SRC) $(C_SRC) -lrt -L$(LIBLITMUS) -llitmus -lm -w -o $(BMARK)$(EXE) |
| 112 | 111 | ||
| 113 | compile-prof: $(C_SRC) | 112 | compile-prof: $(C_SRC) |
| 114 | @echo | 113 | @echo |
diff --git a/SD-VBS/common/matlab/README.txt b/SD-VBS/common/matlab/README.txt deleted file mode 100755 index 0513aaa..0000000 --- a/SD-VBS/common/matlab/README.txt +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | This folder contains Matlab implementation of the common functions used across the suite. | ||
| 2 | The currently supported functions include: | ||
| 3 | |||
| 4 | read_image8u_bmp.m : This function is similar to imread() in Matlab. It supports file read of a .bmp file. | ||
| 5 | write_image8u_bmp.m : This function is similar to imwrite() in Matlab. It supports file read of a .bmp file. | ||
| 6 | reshapeMatrix.m : Similar to reshape(X, SIZ) built-in Matlab function | ||
| 7 | product.m : Similar to prod(X, DIM) built-in Matlab function \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/cycle.h b/SD-VBS/common/matlab/cycle.h deleted file mode 100644 index 2652a04..0000000 --- a/SD-VBS/common/matlab/cycle.h +++ /dev/null | |||
| @@ -1,514 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2003, 2007-8 Matteo Frigo | ||
| 3 | * Copyright (c) 2003, 2007-8 Massachusetts Institute of Technology | ||
| 4 | * | ||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining | ||
| 6 | * a copy of this software and associated documentation files (the | ||
| 7 | * "Software"), to deal in the Software without restriction, including | ||
| 8 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 9 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 10 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 11 | * the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice shall be | ||
| 14 | * included in all copies or substantial portions of the Software. | ||
| 15 | * | ||
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | |||
| 27 | /* machine-dependent cycle counters code. Needs to be inlined. */ | ||
| 28 | |||
| 29 | /***************************************************************************/ | ||
| 30 | /* To use the cycle counters in your code, simply #include "cycle.h" (this | ||
| 31 | file), and then use the functions/macros: | ||
| 32 | |||
| 33 | ticks getticks(void); | ||
| 34 | |||
| 35 | ticks is an opaque typedef defined below, representing the current time. | ||
| 36 | You extract the elapsed time between two calls to gettick() via: | ||
| 37 | |||
| 38 | double elapsed(ticks t1, ticks t0); | ||
| 39 | |||
| 40 | which returns a double-precision variable in arbitrary units. You | ||
| 41 | are not expected to convert this into human units like seconds; it | ||
| 42 | is intended only for *comparisons* of time intervals. | ||
| 43 | |||
| 44 | (In order to use some of the OS-dependent timer routines like | ||
| 45 | Solaris' gethrtime, you need to paste the autoconf snippet below | ||
| 46 | into your configure.ac file and #include "config.h" before cycle.h, | ||
| 47 | or define the relevant macros manually if you are not using autoconf.) | ||
| 48 | */ | ||
| 49 | |||
| 50 | /***************************************************************************/ | ||
| 51 | /* This file uses macros like HAVE_GETHRTIME that are assumed to be | ||
| 52 | defined according to whether the corresponding function/type/header | ||
| 53 | is available on your system. The necessary macros are most | ||
| 54 | conveniently defined if you are using GNU autoconf, via the tests: | ||
| 55 | |||
| 56 | dnl --------------------------------------------------------------------- | ||
| 57 | |||
| 58 | AC_C_INLINE | ||
| 59 | AC_HEADER_TIME | ||
| 60 | AC_CHECK_HEADERS([sys/time.h c_asm.h intrinsics.h mach/mach_time.h]) | ||
| 61 | |||
| 62 | AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t is defined in <sys/time.h>])],,[#if HAVE_SYS_TIME_H | ||
| 63 | #include <sys/time.h> | ||
| 64 | #endif]) | ||
| 65 | |||
| 66 | AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time]) | ||
| 67 | |||
| 68 | dnl Cray UNICOS _rtc() (real-time clock) intrinsic | ||
| 69 | AC_MSG_CHECKING([for _rtc intrinsic]) | ||
| 70 | rtc_ok=yes | ||
| 71 | AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H | ||
| 72 | #include <intrinsics.h> | ||
| 73 | #endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no]) | ||
| 74 | AC_MSG_RESULT($rtc_ok) | ||
| 75 | |||
| 76 | dnl --------------------------------------------------------------------- | ||
| 77 | */ | ||
| 78 | |||
| 79 | /***************************************************************************/ | ||
| 80 | |||
| 81 | #if TIME_WITH_SYS_TIME | ||
| 82 | # include <sys/time.h> | ||
| 83 | # include <time.h> | ||
| 84 | #else | ||
| 85 | # if HAVE_SYS_TIME_H | ||
| 86 | # include <sys/time.h> | ||
| 87 | # else | ||
| 88 | # include <time.h> | ||
| 89 | # endif | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #define INLINE_ELAPSED(INL) static INL double elapsed(ticks t1, ticks t0) \ | ||
| 93 | { \ | ||
| 94 | return (double)t1 - (double)t0; \ | ||
| 95 | } | ||
| 96 | |||
| 97 | /*----------------------------------------------------------------*/ | ||
| 98 | /* Solaris */ | ||
| 99 | #if defined(HAVE_GETHRTIME) && defined(HAVE_HRTIME_T) && !defined(HAVE_TICK_COUNTER) | ||
| 100 | typedef hrtime_t ticks; | ||
| 101 | |||
| 102 | #define getticks gethrtime | ||
| 103 | |||
| 104 | INLINE_ELAPSED(inline) | ||
| 105 | |||
| 106 | #define HAVE_TICK_COUNTER | ||
| 107 | #endif | ||
| 108 | |||
| 109 | /*----------------------------------------------------------------*/ | ||
| 110 | /* AIX v. 4+ routines to read the real-time clock or time-base register */ | ||
| 111 | #if defined(HAVE_READ_REAL_TIME) && defined(HAVE_TIME_BASE_TO_TIME) && !defined(HAVE_TICK_COUNTER) | ||
| 112 | typedef timebasestruct_t ticks; | ||
| 113 | |||
| 114 | static __inline ticks getticks(void) | ||
| 115 | { | ||
| 116 | ticks t; | ||
| 117 | read_real_time(&t, TIMEBASE_SZ); | ||
| 118 | return t; | ||
| 119 | } | ||
| 120 | |||
| 121 | static __inline double elapsed(ticks t1, ticks t0) /* time in nanoseconds */ | ||
| 122 | { | ||
| 123 | time_base_to_time(&t1, TIMEBASE_SZ); | ||
| 124 | time_base_to_time(&t0, TIMEBASE_SZ); | ||
| 125 | return (((double)t1.tb_high - (double)t0.tb_high) * 1.0e9 + | ||
| 126 | ((double)t1.tb_low - (double)t0.tb_low)); | ||
| 127 | } | ||
| 128 | |||
| 129 | #define HAVE_TICK_COUNTER | ||
| 130 | #endif | ||
| 131 | |||
| 132 | /*----------------------------------------------------------------*/ | ||
| 133 | /* | ||
| 134 | * PowerPC ``cycle'' counter using the time base register. | ||
| 135 | */ | ||
| 136 | #if ((((defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))) || (defined(__MWERKS__) && defined(macintosh)))) || (defined(__IBM_GCC_ASM) && (defined(__powerpc__) || defined(__ppc__)))) && !defined(HAVE_TICK_COUNTER) | ||
| 137 | typedef unsigned long long ticks; | ||
| 138 | |||
| 139 | static __inline__ ticks getticks(void) | ||
| 140 | { | ||
| 141 | unsigned int tbl, tbu0, tbu1; | ||
| 142 | |||
| 143 | do { | ||
| 144 | __asm__ __volatile__ ("mftbu %0" : "=r"(tbu0)); | ||
| 145 | __asm__ __volatile__ ("mftb %0" : "=r"(tbl)); | ||
| 146 | __asm__ __volatile__ ("mftbu %0" : "=r"(tbu1)); | ||
| 147 | } while (tbu0 != tbu1); | ||
| 148 | |||
| 149 | return (((unsigned long long)tbu0) << 32) | tbl; | ||
| 150 | } | ||
| 151 | |||
| 152 | INLINE_ELAPSED(__inline__) | ||
| 153 | |||
| 154 | #define HAVE_TICK_COUNTER | ||
| 155 | #endif | ||
| 156 | |||
| 157 | /* MacOS/Mach (Darwin) time-base register interface (unlike UpTime, | ||
| 158 | from Carbon, requires no additional libraries to be linked). */ | ||
| 159 | #if defined(HAVE_MACH_ABSOLUTE_TIME) && defined(HAVE_MACH_MACH_TIME_H) && !defined(HAVE_TICK_COUNTER) | ||
| 160 | #include <mach/mach_time.h> | ||
| 161 | typedef uint64_t ticks; | ||
| 162 | #define getticks mach_absolute_time | ||
| 163 | INLINE_ELAPSED(__inline__) | ||
| 164 | #define HAVE_TICK_COUNTER | ||
| 165 | #endif | ||
| 166 | |||
| 167 | /*----------------------------------------------------------------*/ | ||
| 168 | /* | ||
| 169 | * Pentium cycle counter | ||
| 170 | */ | ||
| 171 | #if (defined(__GNUC__) || defined(__ICC)) && defined(__i386__) && !defined(HAVE_TICK_COUNTER) | ||
| 172 | typedef unsigned long long ticks; | ||
| 173 | |||
| 174 | static __inline__ ticks getticks(void) | ||
| 175 | { | ||
| 176 | ticks ret; | ||
| 177 | |||
| 178 | __asm__ __volatile__("rdtsc": "=A" (ret)); | ||
| 179 | /* no input, nothing else clobbered */ | ||
| 180 | return ret; | ||
| 181 | } | ||
| 182 | |||
| 183 | INLINE_ELAPSED(__inline__) | ||
| 184 | |||
| 185 | #define HAVE_TICK_COUNTER | ||
| 186 | #define TIME_MIN 5000.0 /* unreliable pentium IV cycle counter */ | ||
| 187 | #endif | ||
| 188 | |||
| 189 | /* Visual C++ -- thanks to Morten Nissov for his help with this */ | ||
| 190 | #if _MSC_VER >= 1200 && _M_IX86 >= 500 && !defined(HAVE_TICK_COUNTER) | ||
| 191 | #include <windows.h> | ||
| 192 | typedef LARGE_INTEGER ticks; | ||
| 193 | #define RDTSC __asm __emit 0fh __asm __emit 031h /* hack for VC++ 5.0 */ | ||
| 194 | |||
| 195 | static __inline ticks getticks(void) | ||
| 196 | { | ||
| 197 | ticks retval; | ||
| 198 | |||
| 199 | __asm { | ||
| 200 | RDTSC | ||
| 201 | mov retval.HighPart, edx | ||
| 202 | mov retval.LowPart, eax | ||
| 203 | } | ||
| 204 | return retval; | ||
| 205 | } | ||
| 206 | |||
| 207 | static __inline double elapsed(ticks t1, ticks t0) | ||
| 208 | { | ||
| 209 | return (double)t1.QuadPart - (double)t0.QuadPart; | ||
| 210 | } | ||
| 211 | |||
| 212 | #define HAVE_TICK_COUNTER | ||
| 213 | #define TIME_MIN 5000.0 /* unreliable pentium IV cycle counter */ | ||
| 214 | #endif | ||
| 215 | |||
| 216 | /*----------------------------------------------------------------*/ | ||
| 217 | /* | ||
| 218 | * X86-64 cycle counter | ||
| 219 | */ | ||
| 220 | #if (defined(__GNUC__) || defined(__ICC) || defined(__SUNPRO_C)) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER) | ||
| 221 | typedef unsigned long long ticks; | ||
| 222 | |||
| 223 | static __inline__ ticks getticks(void) | ||
| 224 | { | ||
| 225 | unsigned a, d; | ||
| 226 | asm volatile("rdtsc" : "=a" (a), "=d" (d)); | ||
| 227 | return ((ticks)a) | (((ticks)d) << 32); | ||
| 228 | } | ||
| 229 | |||
| 230 | INLINE_ELAPSED(__inline__) | ||
| 231 | |||
| 232 | #define HAVE_TICK_COUNTER | ||
| 233 | #endif | ||
| 234 | |||
| 235 | /* PGI compiler, courtesy Cristiano Calonaci, Andrea Tarsi, & Roberto Gori. | ||
| 236 | NOTE: this code will fail to link unless you use the -Masmkeyword compiler | ||
| 237 | option (grrr). */ | ||
| 238 | #if defined(__PGI) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER) | ||
| 239 | typedef unsigned long long ticks; | ||
| 240 | static ticks getticks(void) | ||
| 241 | { | ||
| 242 | asm(" rdtsc; shl $0x20,%rdx; mov %eax,%eax; or %rdx,%rax; "); | ||
| 243 | } | ||
| 244 | INLINE_ELAPSED(__inline__) | ||
| 245 | #define HAVE_TICK_COUNTER | ||
| 246 | #endif | ||
| 247 | |||
| 248 | /* Visual C++, courtesy of Dirk Michaelis */ | ||
| 249 | #if _MSC_VER >= 1400 && (defined(_M_AMD64) || defined(_M_X64)) && !defined(HAVE_TICK_COUNTER) | ||
| 250 | |||
| 251 | #include <intrin.h> | ||
| 252 | #pragma intrinsic(__rdtsc) | ||
| 253 | typedef unsigned __int64 ticks; | ||
| 254 | #define getticks __rdtsc | ||
| 255 | INLINE_ELAPSED(__inline) | ||
| 256 | |||
| 257 | #define HAVE_TICK_COUNTER | ||
| 258 | #endif | ||
| 259 | |||
| 260 | /*----------------------------------------------------------------*/ | ||
| 261 | /* | ||
| 262 | * IA64 cycle counter | ||
| 263 | */ | ||
| 264 | |||
| 265 | /* intel's icc/ecc compiler */ | ||
| 266 | #if (defined(__EDG_VERSION) || defined(__ECC)) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER) | ||
| 267 | typedef unsigned long ticks; | ||
| 268 | #include <ia64intrin.h> | ||
| 269 | |||
| 270 | static __inline__ ticks getticks(void) | ||
| 271 | { | ||
| 272 | return __getReg(_IA64_REG_AR_ITC); | ||
| 273 | } | ||
| 274 | |||
| 275 | INLINE_ELAPSED(__inline__) | ||
| 276 | |||
| 277 | #define HAVE_TICK_COUNTER | ||
| 278 | #endif | ||
| 279 | |||
| 280 | /* gcc */ | ||
| 281 | #if defined(__GNUC__) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER) | ||
| 282 | typedef unsigned long ticks; | ||
| 283 | |||
| 284 | static __inline__ ticks getticks(void) | ||
| 285 | { | ||
| 286 | ticks ret; | ||
| 287 | |||
| 288 | __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret)); | ||
| 289 | return ret; | ||
| 290 | } | ||
| 291 | |||
| 292 | INLINE_ELAPSED(__inline__) | ||
| 293 | |||
| 294 | #define HAVE_TICK_COUNTER | ||
| 295 | #endif | ||
| 296 | |||
| 297 | /* HP/UX IA64 compiler, courtesy Teresa L. Johnson: */ | ||
| 298 | #if defined(__hpux) && defined(__ia64) && !defined(HAVE_TICK_COUNTER) | ||
| 299 | #include <machine/sys/inline.h> | ||
| 300 | typedef unsigned long ticks; | ||
| 301 | |||
| 302 | static inline ticks getticks(void) | ||
| 303 | { | ||
| 304 | ticks ret; | ||
| 305 | |||
| 306 | ret = _Asm_mov_from_ar (_AREG_ITC); | ||
| 307 | return ret; | ||
| 308 | } | ||
| 309 | |||
| 310 | INLINE_ELAPSED(inline) | ||
| 311 | |||
| 312 | #define HAVE_TICK_COUNTER | ||
| 313 | #endif | ||
| 314 | |||
| 315 | /* Microsoft Visual C++ */ | ||
| 316 | #if defined(_MSC_VER) && defined(_M_IA64) && !defined(HAVE_TICK_COUNTER) | ||
| 317 | typedef unsigned __int64 ticks; | ||
| 318 | |||
| 319 | # ifdef __cplusplus | ||
| 320 | extern "C" | ||
| 321 | # endif | ||
| 322 | ticks __getReg(int whichReg); | ||
| 323 | #pragma intrinsic(__getReg) | ||
| 324 | |||
| 325 | static __inline ticks getticks(void) | ||
| 326 | { | ||
| 327 | volatile ticks temp; | ||
| 328 | temp = __getReg(3116); | ||
| 329 | return temp; | ||
| 330 | } | ||
| 331 | |||
| 332 | INLINE_ELAPSED(inline) | ||
| 333 | |||
| 334 | #define HAVE_TICK_COUNTER | ||
| 335 | #endif | ||
| 336 | |||
| 337 | /*----------------------------------------------------------------*/ | ||
| 338 | /* | ||
| 339 | * PA-RISC cycle counter | ||
| 340 | */ | ||
| 341 | #if defined(__hppa__) || defined(__hppa) && !defined(HAVE_TICK_COUNTER) | ||
| 342 | typedef unsigned long ticks; | ||
| 343 | |||
| 344 | # ifdef __GNUC__ | ||
| 345 | static __inline__ ticks getticks(void) | ||
| 346 | { | ||
| 347 | ticks ret; | ||
| 348 | |||
| 349 | __asm__ __volatile__("mfctl 16, %0": "=r" (ret)); | ||
| 350 | /* no input, nothing else clobbered */ | ||
| 351 | return ret; | ||
| 352 | } | ||
| 353 | # else | ||
| 354 | # include <machine/inline.h> | ||
| 355 | static inline unsigned long getticks(void) | ||
| 356 | { | ||
| 357 | register ticks ret; | ||
| 358 | _MFCTL(16, ret); | ||
| 359 | return ret; | ||
| 360 | } | ||
| 361 | # endif | ||
| 362 | |||
| 363 | INLINE_ELAPSED(inline) | ||
| 364 | |||
| 365 | #define HAVE_TICK_COUNTER | ||
| 366 | #endif | ||
| 367 | |||
| 368 | /*----------------------------------------------------------------*/ | ||
| 369 | /* S390, courtesy of James Treacy */ | ||
| 370 | #if defined(__GNUC__) && defined(__s390__) && !defined(HAVE_TICK_COUNTER) | ||
| 371 | typedef unsigned long long ticks; | ||
| 372 | |||
| 373 | static __inline__ ticks getticks(void) | ||
| 374 | { | ||
| 375 | ticks cycles; | ||
| 376 | __asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc"); | ||
| 377 | return cycles; | ||
| 378 | } | ||
| 379 | |||
| 380 | INLINE_ELAPSED(__inline__) | ||
| 381 | |||
| 382 | #define HAVE_TICK_COUNTER | ||
| 383 | #endif | ||
| 384 | /*----------------------------------------------------------------*/ | ||
| 385 | #if defined(__GNUC__) && defined(__alpha__) && !defined(HAVE_TICK_COUNTER) | ||
| 386 | /* | ||
| 387 | * The 32-bit cycle counter on alpha overflows pretty quickly, | ||
| 388 | * unfortunately. A 1GHz machine overflows in 4 seconds. | ||
| 389 | */ | ||
| 390 | typedef unsigned int ticks; | ||
| 391 | |||
| 392 | static __inline__ ticks getticks(void) | ||
| 393 | { | ||
| 394 | unsigned long cc; | ||
| 395 | __asm__ __volatile__ ("rpcc %0" : "=r"(cc)); | ||
| 396 | return (cc & 0xFFFFFFFF); | ||
| 397 | } | ||
| 398 | |||
| 399 | INLINE_ELAPSED(__inline__) | ||
| 400 | |||
| 401 | #define HAVE_TICK_COUNTER | ||
| 402 | #endif | ||
| 403 | |||
| 404 | /*----------------------------------------------------------------*/ | ||
| 405 | #if defined(__GNUC__) && defined(__sparc_v9__) && !defined(HAVE_TICK_COUNTER) | ||
| 406 | typedef unsigned long ticks; | ||
| 407 | |||
| 408 | static __inline__ ticks getticks(void) | ||
| 409 | { | ||
| 410 | ticks ret; | ||
| 411 | __asm__ __volatile__("rd %%tick, %0" : "=r" (ret)); | ||
| 412 | return ret; | ||
| 413 | } | ||
| 414 | |||
| 415 | INLINE_ELAPSED(__inline__) | ||
| 416 | |||
| 417 | #define HAVE_TICK_COUNTER | ||
| 418 | #endif | ||
| 419 | |||
| 420 | /*----------------------------------------------------------------*/ | ||
| 421 | #if (defined(__DECC) || defined(__DECCXX)) && defined(__alpha) && defined(HAVE_C_ASM_H) && !defined(HAVE_TICK_COUNTER) | ||
| 422 | # include <c_asm.h> | ||
| 423 | typedef unsigned int ticks; | ||
| 424 | |||
| 425 | static __inline ticks getticks(void) | ||
| 426 | { | ||
| 427 | unsigned long cc; | ||
| 428 | cc = asm("rpcc %v0"); | ||
| 429 | return (cc & 0xFFFFFFFF); | ||
| 430 | } | ||
| 431 | |||
| 432 | INLINE_ELAPSED(__inline) | ||
| 433 | |||
| 434 | #define HAVE_TICK_COUNTER | ||
| 435 | #endif | ||
| 436 | /*----------------------------------------------------------------*/ | ||
| 437 | /* SGI/Irix */ | ||
| 438 | #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE) && !defined(HAVE_TICK_COUNTER) | ||
| 439 | typedef struct timespec ticks; | ||
| 440 | |||
| 441 | static inline ticks getticks(void) | ||
| 442 | { | ||
| 443 | struct timespec t; | ||
| 444 | clock_gettime(CLOCK_SGI_CYCLE, &t); | ||
| 445 | return t; | ||
| 446 | } | ||
| 447 | |||
| 448 | static inline double elapsed(ticks t1, ticks t0) | ||
| 449 | { | ||
| 450 | return ((double)t1.tv_sec - (double)t0.tv_sec) * 1.0E9 + | ||
| 451 | ((double)t1.tv_nsec - (double)t0.tv_nsec); | ||
| 452 | } | ||
| 453 | #define HAVE_TICK_COUNTER | ||
| 454 | #endif | ||
| 455 | |||
| 456 | /*----------------------------------------------------------------*/ | ||
| 457 | /* Cray UNICOS _rtc() intrinsic function */ | ||
| 458 | #if defined(HAVE__RTC) && !defined(HAVE_TICK_COUNTER) | ||
| 459 | #ifdef HAVE_INTRINSICS_H | ||
| 460 | # include <intrinsics.h> | ||
| 461 | #endif | ||
| 462 | |||
| 463 | typedef long long ticks; | ||
| 464 | |||
| 465 | #define getticks _rtc | ||
| 466 | |||
| 467 | INLINE_ELAPSED(inline) | ||
| 468 | |||
| 469 | #define HAVE_TICK_COUNTER | ||
| 470 | #endif | ||
| 471 | |||
| 472 | /*----------------------------------------------------------------*/ | ||
| 473 | /* MIPS ZBus */ | ||
| 474 | #if HAVE_MIPS_ZBUS_TIMER | ||
| 475 | #if defined(__mips__) && !defined(HAVE_TICK_COUNTER) | ||
| 476 | #include <sys/mman.h> | ||
| 477 | #include <unistd.h> | ||
| 478 | #include <fcntl.h> | ||
| 479 | |||
| 480 | typedef uint64_t ticks; | ||
| 481 | |||
| 482 | static inline ticks getticks(void) | ||
| 483 | { | ||
| 484 | static uint64_t* addr = 0; | ||
| 485 | |||
| 486 | if (addr == 0) | ||
| 487 | { | ||
| 488 | uint32_t rq_addr = 0x10030000; | ||
| 489 | int fd; | ||
| 490 | int pgsize; | ||
| 491 | |||
| 492 | pgsize = getpagesize(); | ||
| 493 | fd = open ("/dev/mem", O_RDONLY | O_SYNC, 0); | ||
| 494 | if (fd < 0) { | ||
| 495 | perror("open"); | ||
| 496 | return NULL; | ||
| 497 | } | ||
| 498 | addr = mmap(0, pgsize, PROT_READ, MAP_SHARED, fd, rq_addr); | ||
| 499 | close(fd); | ||
| 500 | if (addr == (uint64_t *)-1) { | ||
| 501 | perror("mmap"); | ||
| 502 | return NULL; | ||
| 503 | } | ||
| 504 | } | ||
| 505 | |||
| 506 | return *addr; | ||
| 507 | } | ||
| 508 | |||
| 509 | INLINE_ELAPSED(inline) | ||
| 510 | |||
| 511 | #define HAVE_TICK_COUNTER | ||
| 512 | #endif | ||
| 513 | #endif /* HAVE_MIPS_ZBUS_TIMER */ | ||
| 514 | |||
diff --git a/SD-VBS/common/matlab/fSelfCheck.m b/SD-VBS/common/matlab/fSelfCheck.m deleted file mode 100644 index 0288328..0000000 --- a/SD-VBS/common/matlab/fSelfCheck.m +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | function ret = fSelfCheck(in1, path, tol) | ||
| 2 | |||
| 3 | r1 = size(in1, 1); | ||
| 4 | c1 = size(in1, 2); | ||
| 5 | |||
| 6 | ret = 1; | ||
| 7 | |||
| 8 | file = [path, '/expected.m']; | ||
| 9 | fd = fopen(file, 'r'); | ||
| 10 | |||
| 11 | [in2, count] = fscanf(fd, '%f'); | ||
| 12 | |||
| 13 | if(count ~= (r1*c1) ) | ||
| 14 | fprintf(1, 'Dimensions mismatch: Expected %d\t Observed %d\n', count, (r1*c1)); | ||
| 15 | ret = -1; | ||
| 16 | else | ||
| 17 | ret = 1; | ||
| 18 | for i=1:(r1*c1) | ||
| 19 | if( (abs(in1(i)) - abs(in2(i)) > tol) || (abs(in2(i)) - abs(in1(i))) > tol) | ||
| 20 | fprintf(1, 'Checking Error: Index %d\tExpected %f\tObserved %f\n', i, in2(i), in1(i)); | ||
| 21 | ret = -1; | ||
| 22 | break; | ||
| 23 | end | ||
| 24 | end | ||
| 25 | |||
| 26 | end | ||
| 27 | |||
diff --git a/SD-VBS/common/matlab/fWriteMatrix.m b/SD-VBS/common/matlab/fWriteMatrix.m deleted file mode 100644 index 3995aa6..0000000 --- a/SD-VBS/common/matlab/fWriteMatrix.m +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | function fWriteMatrix(input, inpath) | ||
| 2 | |||
| 3 | file = [inpath '/expected.m']; | ||
| 4 | disp(file); | ||
| 5 | fd = fopen(file, 'w'); | ||
| 6 | |||
| 7 | [rows, cols] = size(input); | ||
| 8 | |||
| 9 | for j=1:rows | ||
| 10 | for i=1:cols | ||
| 11 | fprintf(fd, '%f\t', input(j,i)); | ||
| 12 | end | ||
| 13 | fprintf(fd, '\n'); | ||
| 14 | end | ||
| 15 | fclose(fd); | ||
| 16 | end | ||
| 17 | |||
| 18 | |||
diff --git a/SD-VBS/common/matlab/photonEndTiming.c b/SD-VBS/common/matlab/photonEndTiming.c deleted file mode 100644 index bbf5231..0000000 --- a/SD-VBS/common/matlab/photonEndTiming.c +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #include"mex.h" | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdint.h> | ||
| 5 | #include <math.h> | ||
| 6 | |||
| 7 | void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | ||
| 8 | { | ||
| 9 | uint32_t* cycles; | ||
| 10 | plhs[0] = mxCreateNumericMatrix(1, 2, mxUINT32_CLASS, mxREAL); | ||
| 11 | cycles = (uint32_t*)mxGetPr(plhs[0]); | ||
| 12 | __asm__ __volatile__( "rdtsc": "=a" (cycles[0]), "=d" (cycles[1])); | ||
| 13 | |||
| 14 | return; | ||
| 15 | } | ||
diff --git a/SD-VBS/common/matlab/photonEndTiming.mexa64 b/SD-VBS/common/matlab/photonEndTiming.mexa64 deleted file mode 100755 index e41dd3e..0000000 --- a/SD-VBS/common/matlab/photonEndTiming.mexa64 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/SD-VBS/common/matlab/photonEndTiming.mexglx b/SD-VBS/common/matlab/photonEndTiming.mexglx deleted file mode 100755 index fa9d4b6..0000000 --- a/SD-VBS/common/matlab/photonEndTiming.mexglx +++ /dev/null | |||
| Binary files differ | |||
diff --git a/SD-VBS/common/matlab/photonPrintTiming.m b/SD-VBS/common/matlab/photonPrintTiming.m deleted file mode 100644 index b7c2abb..0000000 --- a/SD-VBS/common/matlab/photonPrintTiming.m +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | %! _photonPrintTiming_NA_i2 | ||
| 2 | |||
| 3 | function photonPrintTiming(elapsed) | ||
| 4 | if(elapsed(2) == 0) | ||
| 5 | fprintf(1,'Cycles elapsed\t\t- %u\n',elapsed(1)); | ||
| 6 | else | ||
| 7 | fprintf(1,'Cycles elapsed\t\t- %u%\u\n',elapsed(2),elapsed(1)); | ||
| 8 | end | ||
| 9 | end | ||
| 10 | |||
| 11 | |||
diff --git a/SD-VBS/common/matlab/photonReportTiming.m b/SD-VBS/common/matlab/photonReportTiming.m deleted file mode 100644 index e991175..0000000 --- a/SD-VBS/common/matlab/photonReportTiming.m +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | %! _photonReportTiming_i2_i2i2 | ||
| 2 | |||
| 3 | function elapsed = photonReportTiming(startCycles, endCycles) | ||
| 4 | elapsed = zeros(1,2); | ||
| 5 | elapsed(1) = endCycles(1) - startCycles(1); | ||
| 6 | elapsed(2) = endCycles(2) - startCycles(2); | ||
| 7 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/photonStartTiming.c b/SD-VBS/common/matlab/photonStartTiming.c deleted file mode 100644 index bbf5231..0000000 --- a/SD-VBS/common/matlab/photonStartTiming.c +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #include"mex.h" | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdint.h> | ||
| 5 | #include <math.h> | ||
| 6 | |||
| 7 | void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | ||
| 8 | { | ||
| 9 | uint32_t* cycles; | ||
| 10 | plhs[0] = mxCreateNumericMatrix(1, 2, mxUINT32_CLASS, mxREAL); | ||
| 11 | cycles = (uint32_t*)mxGetPr(plhs[0]); | ||
| 12 | __asm__ __volatile__( "rdtsc": "=a" (cycles[0]), "=d" (cycles[1])); | ||
| 13 | |||
| 14 | return; | ||
| 15 | } | ||
diff --git a/SD-VBS/common/matlab/photonStartTiming.mexa64 b/SD-VBS/common/matlab/photonStartTiming.mexa64 deleted file mode 100755 index 58e0d06..0000000 --- a/SD-VBS/common/matlab/photonStartTiming.mexa64 +++ /dev/null | |||
| Binary files differ | |||
diff --git a/SD-VBS/common/matlab/photonStartTiming.mexglx b/SD-VBS/common/matlab/photonStartTiming.mexglx deleted file mode 100755 index 8b55b98..0000000 --- a/SD-VBS/common/matlab/photonStartTiming.mexglx +++ /dev/null | |||
| Binary files differ | |||
diff --git a/SD-VBS/common/matlab/product.m b/SD-VBS/common/matlab/product.m deleted file mode 100755 index 65548b4..0000000 --- a/SD-VBS/common/matlab/product.m +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | function [matrixOut] = product(matrixIn, direction) | ||
| 2 | |||
| 3 | % Initialize matrices | ||
| 4 | inputDim = size(matrixIn); | ||
| 5 | |||
| 6 | % For input matrix (m,n), we need to multiply horizontally if output matrix | ||
| 7 | %is (m). Else, we multiply vertically. | ||
| 8 | |||
| 9 | %if direction is 1, we multiply vertically. | ||
| 10 | if direction == 1 | ||
| 11 | matrixOut = zeros(1, inputDim(2)); %initialize the output matrix | ||
| 12 | for cols = 1:inputDim(2) | ||
| 13 | val = 1; | ||
| 14 | for rows = 1:inputDim(1) | ||
| 15 | val = matrixIn(rows, cols) * val; | ||
| 16 | end | ||
| 17 | matrixOut(cols) = val; | ||
| 18 | end | ||
| 19 | |||
| 20 | % else multiply horizontally | ||
| 21 | else | ||
| 22 | matrixOut = zeros(inputDim(1), 1); %initialize the output matrix | ||
| 23 | for rows = 1:inputDim(1) | ||
| 24 | val = 1; | ||
| 25 | for cols = 1:inputDim(2) | ||
| 26 | val = matrixIn(rows, cols) * val; | ||
| 27 | end | ||
| 28 | matrixOut(rows) = val; | ||
| 29 | end | ||
| 30 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/randWrapper.m b/SD-VBS/common/matlab/randWrapper.m deleted file mode 100644 index dbef132..0000000 --- a/SD-VBS/common/matlab/randWrapper.m +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | function out = randWrapper(m,n) | ||
| 2 | |||
| 3 | out = zeros(m,n); | ||
| 4 | |||
| 5 | seed = 0.9; | ||
| 6 | for i=1:m | ||
| 7 | for j=1:n | ||
| 8 | if(i<j) | ||
| 9 | out(i,j) = seed * (i/j); | ||
| 10 | else | ||
| 11 | out(i,j) = seed * (j/i); | ||
| 12 | end | ||
| 13 | end | ||
| 14 | end | ||
| 15 | |||
| 16 | end | ||
| 17 | |||
diff --git a/SD-VBS/common/matlab/randn.m b/SD-VBS/common/matlab/randn.m deleted file mode 100644 index e8eb473..0000000 --- a/SD-VBS/common/matlab/randn.m +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | %! _randn_f2_i1i1 | ||
| 2 | |||
| 3 | function retRand = randn(m,n) | ||
| 4 | |||
| 5 | retRand = ones(m,n); | ||
| 6 | |||
| 7 | for i=1:m | ||
| 8 | for j=1:n | ||
| 9 | w = 10; | ||
| 10 | while(w>=1.0) | ||
| 11 | x1 = 2.0 * rand(1,1) - 1.0; | ||
| 12 | x2 = 2.0 * rand(1,1) - 1.0; | ||
| 13 | w = x1*x1 + x2*x2; | ||
| 14 | end | ||
| 15 | w = sqrt((-2.0*log(w))/w); | ||
| 16 | retRand(i,j) = x1*w; | ||
| 17 | end | ||
| 18 | end | ||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
diff --git a/SD-VBS/common/matlab/randnWrapper.m b/SD-VBS/common/matlab/randnWrapper.m deleted file mode 100644 index 1755957..0000000 --- a/SD-VBS/common/matlab/randnWrapper.m +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | function out = randnWrapper(m, n) | ||
| 2 | |||
| 3 | out = ones(m,n); | ||
| 4 | temp = randWrapper(m,n); | ||
| 5 | |||
| 6 | for i=1:m | ||
| 7 | for j=1:n | ||
| 8 | w = temp(i,j); | ||
| 9 | x1 = 1; | ||
| 10 | %w = sqrt((-2.0*log(w))/w); | ||
| 11 | w = ((-2.0*log(w))/w); | ||
| 12 | out(i,j) = x1*w; | ||
| 13 | end | ||
| 14 | end | ||
| 15 | |||
| 16 | end | ||
| 17 | |||
diff --git a/SD-VBS/common/matlab/readFile.m b/SD-VBS/common/matlab/readFile.m deleted file mode 100644 index 4888103..0000000 --- a/SD-VBS/common/matlab/readFile.m +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | function fid = readFile(path) | ||
| 2 | |||
| 3 | file = fopen(path, 'r'); | ||
| 4 | |||
| 5 | full = fscanf(file,'%f'); | ||
| 6 | elapsed = zeros(1,2); | ||
| 7 | |||
| 8 | rows = full(1); | ||
| 9 | cols = full(2); | ||
| 10 | fid = zeros(rows, cols); | ||
| 11 | |||
| 12 | k = 3; | ||
| 13 | for i=1:rows | ||
| 14 | for j =1:cols | ||
| 15 | fid(i,j) = full(k); | ||
| 16 | k = k+1; | ||
| 17 | end | ||
| 18 | end | ||
| 19 | fclose(file); | ||
| 20 | |||
| 21 | end | ||
| 22 | |||
diff --git a/SD-VBS/common/matlab/readImage.m b/SD-VBS/common/matlab/readImage.m deleted file mode 100644 index c70222d..0000000 --- a/SD-VBS/common/matlab/readImage.m +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | function srcImage = readImage(pathName) | ||
| 2 | |||
| 3 | %Reading BMP image | ||
| 4 | input = fopen(pathName,'r'); | ||
| 5 | %start of header information | ||
| 6 | signature = fread(input, 2, 'uchar'); | ||
| 7 | file_size = fread(input, 1, 'uint32'); | ||
| 8 | reserved1 = fread(input, 1, 'uint16'); | ||
| 9 | reserved2 = fread(input, 1, 'uint16'); | ||
| 10 | loc_of_bitmap = fread(input, 1, 'uint32'); | ||
| 11 | |||
| 12 | size_of_infoheader = fread(input, 1, 'uint32'); | ||
| 13 | width = fread(input, 1, 'uint32'); | ||
| 14 | height = fread(input, 1, 'uint32'); | ||
| 15 | number_of_planes = fread(input, 1, 'uint16'); | ||
| 16 | bits_per_pixel = fread(input, 1, 'uint16'); | ||
| 17 | compression_method = fread(input, 1, 'uint32'); | ||
| 18 | bytes_of_bitmap = fread(input, 1, 'uint32'); | ||
| 19 | |||
| 20 | hori_reso = fread(input, 1, 'uint32'); | ||
| 21 | vert_reso = fread(input, 1, 'uint32'); | ||
| 22 | no_of_colors = fread(input, 1, 'uint32'); | ||
| 23 | no_of_imp_colors = fread(input, 1, 'uint32'); | ||
| 24 | |||
| 25 | %end of header information | ||
| 26 | |||
| 27 | srcImage = zeros(height, width); | ||
| 28 | |||
| 29 | % Conditions to check whether the BMP is interleaved and handling few exceptions | ||
| 30 | if (height <= 0 || width <= 0 || signature(1) ~= 'B' || signature(2) ~= 'M' || ( bits_per_pixel ==16)) | ||
| 31 | disp('Error in file format'); | ||
| 32 | srcImage = 0; | ||
| 33 | end | ||
| 34 | |||
| 35 | status = fseek(input,loc_of_bitmap,-1); | ||
| 36 | |||
| 37 | nI = 0; | ||
| 38 | nJ = 0; | ||
| 39 | |||
| 40 | if(bits_per_pixel == 24) | ||
| 41 | for nI=height:-1:1 | ||
| 42 | for nJ=1:width | ||
| 43 | tempb = fread(input, 1,'uchar'); | ||
| 44 | tempg = fread(input, 1,'uchar'); | ||
| 45 | tempr = fread(input, 1,'uchar'); | ||
| 46 | srcImage(nI,nJ) = uint8((tempb + 6*tempg + 3*tempr)/10); | ||
| 47 | srcImage(nI,nJ) = uint8(tempg); | ||
| 48 | end | ||
| 49 | end | ||
| 50 | else | ||
| 51 | for nI=height:-1:1 | ||
| 52 | for nJ=1:width | ||
| 53 | tempg = fread(input, 1,'uchar'); | ||
| 54 | srcImage(nI,nJ) = tempg; | ||
| 55 | end | ||
| 56 | end | ||
| 57 | end | ||
| 58 | |||
| 59 | fclose(input); | ||
| 60 | end | ||
diff --git a/SD-VBS/common/matlab/read_image8u_bmp.m b/SD-VBS/common/matlab/read_image8u_bmp.m deleted file mode 100755 index 28e5834..0000000 --- a/SD-VBS/common/matlab/read_image8u_bmp.m +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | function image = read_image8u_bmp(pathName) | ||
| 2 | |||
| 3 | fid = fopen (pathName,'r'); %FILE *input; | ||
| 4 | % //check for the input FILE pointer | ||
| 5 | if(fid == 0) | ||
| 6 | |||
| 7 | disp('File pointer error'); | ||
| 8 | |||
| 9 | else | ||
| 10 | % start of header information | ||
| 11 | BYTES_PER_PIXEL=3; | ||
| 12 | signature = fread(fid,2,'char=>char'); | ||
| 13 | file_size = fread(fid,1,'int=>int'); | ||
| 14 | reserved1 = fread(fid,1,'short=>short'); | ||
| 15 | reserved2 = fread(fid,1,'short=>short'); | ||
| 16 | loc_of_bitmap = fread(fid, 1, 'int=>double'); | ||
| 17 | size_of_infoheader = fread(fid,1,'int=>int'); | ||
| 18 | width = fread(fid,1,'int=>double'); | ||
| 19 | height = fread(fid,1,'int=>double'); | ||
| 20 | number_of_planes = fread(fid,1,'short=>short'); | ||
| 21 | bits_per_pixel = fread(fid,1,'short=>short'); | ||
| 22 | compression_method = fread(fid,1,'int=>int'); | ||
| 23 | bytes_of_bitmap = fread(fid,1,'int=>int'); | ||
| 24 | hori_reso = fread(fid,1,'int=>int'); | ||
| 25 | vert_reso = fread(fid,1,'int=>int'); | ||
| 26 | no_of_colors = fread(fid,1,'int=>int'); | ||
| 27 | no_of_imp_colors = fread(fid,1,'int=>int'); | ||
| 28 | |||
| 29 | nRows = height; | ||
| 30 | nCols = width; | ||
| 31 | nPitch = nCols; | ||
| 32 | pad = 4 - (nCols*BYTES_PER_PIXEL - 4*floor(nCols*BYTES_PER_PIXEL/4)); %bitmap multiple-of-4 requirement | ||
| 33 | |||
| 34 | pixSize=nRows *nCols * 3; | ||
| 35 | |||
| 36 | % Conditions to check whether the BMP is interleaved and handling few exceptions | ||
| 37 | if (nRows <= 0 || nCols <= 0 || signature(1) ~= 'B' || signature(2) ~= 'M' || bits_per_pixel ~=24) | ||
| 38 | disp ('Error'); | ||
| 39 | return; | ||
| 40 | else | ||
| 41 | |||
| 42 | %read image | ||
| 43 | % fseek(fid,loc_of_bitmap,'bof'); | ||
| 44 | |||
| 45 | for nI = nRows:-1:1 | ||
| 46 | for nJ=1:nCols | ||
| 47 | |||
| 48 | image(nI,nJ,3) = fread(fid,1,'char=>uint8'); %B | ||
| 49 | image(nI,nJ,2) = fread(fid,1,'char=>uint8'); %G | ||
| 50 | image(nI,nJ,1) = fread(fid,1,'char=>uint8'); %R | ||
| 51 | |||
| 52 | end | ||
| 53 | if pad~=4 | ||
| 54 | for i=1:pad | ||
| 55 | fread(fid,1); | ||
| 56 | end | ||
| 57 | end | ||
| 58 | end | ||
| 59 | imshow(image); | ||
| 60 | imwrite(image,'image.bmp'); | ||
| 61 | fclose(fid); | ||
| 62 | |||
| 63 | end | ||
| 64 | |||
| 65 | end | ||
| 66 | \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/reshapeMatrix.m b/SD-VBS/common/matlab/reshapeMatrix.m deleted file mode 100755 index f355828..0000000 --- a/SD-VBS/common/matlab/reshapeMatrix.m +++ /dev/null | |||
| @@ -1,13 +0,0 @@ | |||
| 1 | function [outputMatrix] = reshapeMatrix(inputMatrix, outputSize) | ||
| 2 | |||
| 3 | inputDim = size(inputMatrix); | ||
| 4 | outputMatrix = zeros(outputSize(1), outputSize(2)); | ||
| 5 | |||
| 6 | k = 1; | ||
| 7 | |||
| 8 | for i = 1:outputSize(2) | ||
| 9 | for j = 1:outputSize(1) | ||
| 10 | outputMatrix(j, i) = inputMatrix(k); | ||
| 11 | k = k+1; | ||
| 12 | end | ||
| 13 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/selfCheck.m b/SD-VBS/common/matlab/selfCheck.m deleted file mode 100644 index 55c8de8..0000000 --- a/SD-VBS/common/matlab/selfCheck.m +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | function ret = selfCheck(in1, path, tol) | ||
| 2 | |||
| 3 | r1 = size(in1, 1); | ||
| 4 | c1 = size(in1, 2); | ||
| 5 | |||
| 6 | ret = 1; | ||
| 7 | |||
| 8 | file = [path, '/expected.m']; | ||
| 9 | fd = fopen(file, 'r'); | ||
| 10 | |||
| 11 | [in2, count] = fscanf(fd, '%d'); | ||
| 12 | |||
| 13 | if(count ~= (r1*c1) ) | ||
| 14 | fprintf(1, 'Dimensions mismatch: Expected %d\t Observed %d\n', count, (r1*c1)); | ||
| 15 | ret = -1; | ||
| 16 | else | ||
| 17 | ret = 1; | ||
| 18 | for i=1:(r1*c1) | ||
| 19 | if( (abs(in1(i)) - abs(in2(i)) > tol) || (abs(in2(i)) - abs(in1(i))) > tol) | ||
| 20 | fprintf(1, 'Checking Error: Index %d\tExpected %d\tObserved %d\n', i, in2(i), in1(i)); | ||
| 21 | ret = -1; | ||
| 22 | break; | ||
| 23 | end | ||
| 24 | end | ||
| 25 | |||
| 26 | end | ||
| 27 | |||
diff --git a/SD-VBS/common/matlab/testProductFunction.m b/SD-VBS/common/matlab/testProductFunction.m deleted file mode 100755 index 682a005..0000000 --- a/SD-VBS/common/matlab/testProductFunction.m +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | function testProductFunction | ||
| 2 | |||
| 3 | matrixSize = zeros(1, 2); | ||
| 4 | matrixSize(1) = 4; | ||
| 5 | matrixSize(2) = 5; | ||
| 6 | inputMatrix = zeros(matrixSize(1), matrixSize(2)); | ||
| 7 | |||
| 8 | for i=1:matrixSize(1) | ||
| 9 | for j=1:matrixSize(2) | ||
| 10 | inputMatrix(i,j) = i+j; | ||
| 11 | end | ||
| 12 | end | ||
| 13 | |||
| 14 | outputMatrix = product(inputMatrix, 1); | ||
| 15 | actualOut = prod(inputMatrix, 1); | ||
| 16 | |||
| 17 | if outputMatrix == actualOut | ||
| 18 | disp('SUCCESS'); | ||
| 19 | else | ||
| 20 | disp('ERROR'); | ||
| 21 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/testReshapeFunction.m b/SD-VBS/common/matlab/testReshapeFunction.m deleted file mode 100755 index 1dac432..0000000 --- a/SD-VBS/common/matlab/testReshapeFunction.m +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | function testReshapeFunction | ||
| 2 | |||
| 3 | matrixSize = zeros(1, 2); | ||
| 4 | matrixSize(1) = 4; | ||
| 5 | matrixSize(2) = 5; | ||
| 6 | inputMatrix = zeros(matrixSize(1), matrixSize(2)); | ||
| 7 | |||
| 8 | for i=1:matrixSize(1) | ||
| 9 | for j=1:matrixSize(2) | ||
| 10 | inputMatrix(i,j) = i+j; | ||
| 11 | end | ||
| 12 | end | ||
| 13 | |||
| 14 | outputMatrix = reshapeMatrix(inputMatrix, matrixSize); | ||
| 15 | actualOut = reshape(inputMatrix, matrixSize); | ||
| 16 | |||
| 17 | if outputMatrix == actualOut | ||
| 18 | disp('SUCCESS'); | ||
| 19 | else | ||
| 20 | disp('ERROR'); | ||
| 21 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/timingFuncs/cycle.h b/SD-VBS/common/matlab/timingFuncs/cycle.h deleted file mode 100644 index 2652a04..0000000 --- a/SD-VBS/common/matlab/timingFuncs/cycle.h +++ /dev/null | |||
| @@ -1,514 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2003, 2007-8 Matteo Frigo | ||
| 3 | * Copyright (c) 2003, 2007-8 Massachusetts Institute of Technology | ||
| 4 | * | ||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining | ||
| 6 | * a copy of this software and associated documentation files (the | ||
| 7 | * "Software"), to deal in the Software without restriction, including | ||
| 8 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 9 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 10 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 11 | * the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice shall be | ||
| 14 | * included in all copies or substantial portions of the Software. | ||
| 15 | * | ||
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
| 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
| 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
| 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | |||
| 26 | |||
| 27 | /* machine-dependent cycle counters code. Needs to be inlined. */ | ||
| 28 | |||
| 29 | /***************************************************************************/ | ||
| 30 | /* To use the cycle counters in your code, simply #include "cycle.h" (this | ||
| 31 | file), and then use the functions/macros: | ||
| 32 | |||
| 33 | ticks getticks(void); | ||
| 34 | |||
| 35 | ticks is an opaque typedef defined below, representing the current time. | ||
| 36 | You extract the elapsed time between two calls to gettick() via: | ||
| 37 | |||
| 38 | double elapsed(ticks t1, ticks t0); | ||
| 39 | |||
| 40 | which returns a double-precision variable in arbitrary units. You | ||
| 41 | are not expected to convert this into human units like seconds; it | ||
| 42 | is intended only for *comparisons* of time intervals. | ||
| 43 | |||
| 44 | (In order to use some of the OS-dependent timer routines like | ||
| 45 | Solaris' gethrtime, you need to paste the autoconf snippet below | ||
| 46 | into your configure.ac file and #include "config.h" before cycle.h, | ||
| 47 | or define the relevant macros manually if you are not using autoconf.) | ||
| 48 | */ | ||
| 49 | |||
| 50 | /***************************************************************************/ | ||
| 51 | /* This file uses macros like HAVE_GETHRTIME that are assumed to be | ||
| 52 | defined according to whether the corresponding function/type/header | ||
| 53 | is available on your system. The necessary macros are most | ||
| 54 | conveniently defined if you are using GNU autoconf, via the tests: | ||
| 55 | |||
| 56 | dnl --------------------------------------------------------------------- | ||
| 57 | |||
| 58 | AC_C_INLINE | ||
| 59 | AC_HEADER_TIME | ||
| 60 | AC_CHECK_HEADERS([sys/time.h c_asm.h intrinsics.h mach/mach_time.h]) | ||
| 61 | |||
| 62 | AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t is defined in <sys/time.h>])],,[#if HAVE_SYS_TIME_H | ||
| 63 | #include <sys/time.h> | ||
| 64 | #endif]) | ||
| 65 | |||
| 66 | AC_CHECK_FUNCS([gethrtime read_real_time time_base_to_time clock_gettime mach_absolute_time]) | ||
| 67 | |||
| 68 | dnl Cray UNICOS _rtc() (real-time clock) intrinsic | ||
| 69 | AC_MSG_CHECKING([for _rtc intrinsic]) | ||
| 70 | rtc_ok=yes | ||
| 71 | AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H | ||
| 72 | #include <intrinsics.h> | ||
| 73 | #endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no]) | ||
| 74 | AC_MSG_RESULT($rtc_ok) | ||
| 75 | |||
| 76 | dnl --------------------------------------------------------------------- | ||
| 77 | */ | ||
| 78 | |||
| 79 | /***************************************************************************/ | ||
| 80 | |||
| 81 | #if TIME_WITH_SYS_TIME | ||
| 82 | # include <sys/time.h> | ||
| 83 | # include <time.h> | ||
| 84 | #else | ||
| 85 | # if HAVE_SYS_TIME_H | ||
| 86 | # include <sys/time.h> | ||
| 87 | # else | ||
| 88 | # include <time.h> | ||
| 89 | # endif | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #define INLINE_ELAPSED(INL) static INL double elapsed(ticks t1, ticks t0) \ | ||
| 93 | { \ | ||
| 94 | return (double)t1 - (double)t0; \ | ||
| 95 | } | ||
| 96 | |||
| 97 | /*----------------------------------------------------------------*/ | ||
| 98 | /* Solaris */ | ||
| 99 | #if defined(HAVE_GETHRTIME) && defined(HAVE_HRTIME_T) && !defined(HAVE_TICK_COUNTER) | ||
| 100 | typedef hrtime_t ticks; | ||
| 101 | |||
| 102 | #define getticks gethrtime | ||
| 103 | |||
| 104 | INLINE_ELAPSED(inline) | ||
| 105 | |||
| 106 | #define HAVE_TICK_COUNTER | ||
| 107 | #endif | ||
| 108 | |||
| 109 | /*----------------------------------------------------------------*/ | ||
| 110 | /* AIX v. 4+ routines to read the real-time clock or time-base register */ | ||
| 111 | #if defined(HAVE_READ_REAL_TIME) && defined(HAVE_TIME_BASE_TO_TIME) && !defined(HAVE_TICK_COUNTER) | ||
| 112 | typedef timebasestruct_t ticks; | ||
| 113 | |||
| 114 | static __inline ticks getticks(void) | ||
| 115 | { | ||
| 116 | ticks t; | ||
| 117 | read_real_time(&t, TIMEBASE_SZ); | ||
| 118 | return t; | ||
| 119 | } | ||
| 120 | |||
| 121 | static __inline double elapsed(ticks t1, ticks t0) /* time in nanoseconds */ | ||
| 122 | { | ||
| 123 | time_base_to_time(&t1, TIMEBASE_SZ); | ||
| 124 | time_base_to_time(&t0, TIMEBASE_SZ); | ||
| 125 | return (((double)t1.tb_high - (double)t0.tb_high) * 1.0e9 + | ||
| 126 | ((double)t1.tb_low - (double)t0.tb_low)); | ||
| 127 | } | ||
| 128 | |||
| 129 | #define HAVE_TICK_COUNTER | ||
| 130 | #endif | ||
| 131 | |||
| 132 | /*----------------------------------------------------------------*/ | ||
| 133 | /* | ||
| 134 | * PowerPC ``cycle'' counter using the time base register. | ||
| 135 | */ | ||
| 136 | #if ((((defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))) || (defined(__MWERKS__) && defined(macintosh)))) || (defined(__IBM_GCC_ASM) && (defined(__powerpc__) || defined(__ppc__)))) && !defined(HAVE_TICK_COUNTER) | ||
| 137 | typedef unsigned long long ticks; | ||
| 138 | |||
| 139 | static __inline__ ticks getticks(void) | ||
| 140 | { | ||
| 141 | unsigned int tbl, tbu0, tbu1; | ||
| 142 | |||
| 143 | do { | ||
| 144 | __asm__ __volatile__ ("mftbu %0" : "=r"(tbu0)); | ||
| 145 | __asm__ __volatile__ ("mftb %0" : "=r"(tbl)); | ||
| 146 | __asm__ __volatile__ ("mftbu %0" : "=r"(tbu1)); | ||
| 147 | } while (tbu0 != tbu1); | ||
| 148 | |||
| 149 | return (((unsigned long long)tbu0) << 32) | tbl; | ||
| 150 | } | ||
| 151 | |||
| 152 | INLINE_ELAPSED(__inline__) | ||
| 153 | |||
| 154 | #define HAVE_TICK_COUNTER | ||
| 155 | #endif | ||
| 156 | |||
| 157 | /* MacOS/Mach (Darwin) time-base register interface (unlike UpTime, | ||
| 158 | from Carbon, requires no additional libraries to be linked). */ | ||
| 159 | #if defined(HAVE_MACH_ABSOLUTE_TIME) && defined(HAVE_MACH_MACH_TIME_H) && !defined(HAVE_TICK_COUNTER) | ||
| 160 | #include <mach/mach_time.h> | ||
| 161 | typedef uint64_t ticks; | ||
| 162 | #define getticks mach_absolute_time | ||
| 163 | INLINE_ELAPSED(__inline__) | ||
| 164 | #define HAVE_TICK_COUNTER | ||
| 165 | #endif | ||
| 166 | |||
| 167 | /*----------------------------------------------------------------*/ | ||
| 168 | /* | ||
| 169 | * Pentium cycle counter | ||
| 170 | */ | ||
| 171 | #if (defined(__GNUC__) || defined(__ICC)) && defined(__i386__) && !defined(HAVE_TICK_COUNTER) | ||
| 172 | typedef unsigned long long ticks; | ||
| 173 | |||
| 174 | static __inline__ ticks getticks(void) | ||
| 175 | { | ||
| 176 | ticks ret; | ||
| 177 | |||
| 178 | __asm__ __volatile__("rdtsc": "=A" (ret)); | ||
| 179 | /* no input, nothing else clobbered */ | ||
| 180 | return ret; | ||
| 181 | } | ||
| 182 | |||
| 183 | INLINE_ELAPSED(__inline__) | ||
| 184 | |||
| 185 | #define HAVE_TICK_COUNTER | ||
| 186 | #define TIME_MIN 5000.0 /* unreliable pentium IV cycle counter */ | ||
| 187 | #endif | ||
| 188 | |||
| 189 | /* Visual C++ -- thanks to Morten Nissov for his help with this */ | ||
| 190 | #if _MSC_VER >= 1200 && _M_IX86 >= 500 && !defined(HAVE_TICK_COUNTER) | ||
| 191 | #include <windows.h> | ||
| 192 | typedef LARGE_INTEGER ticks; | ||
| 193 | #define RDTSC __asm __emit 0fh __asm __emit 031h /* hack for VC++ 5.0 */ | ||
| 194 | |||
| 195 | static __inline ticks getticks(void) | ||
| 196 | { | ||
| 197 | ticks retval; | ||
| 198 | |||
| 199 | __asm { | ||
| 200 | RDTSC | ||
| 201 | mov retval.HighPart, edx | ||
| 202 | mov retval.LowPart, eax | ||
| 203 | } | ||
| 204 | return retval; | ||
| 205 | } | ||
| 206 | |||
| 207 | static __inline double elapsed(ticks t1, ticks t0) | ||
| 208 | { | ||
| 209 | return (double)t1.QuadPart - (double)t0.QuadPart; | ||
| 210 | } | ||
| 211 | |||
| 212 | #define HAVE_TICK_COUNTER | ||
| 213 | #define TIME_MIN 5000.0 /* unreliable pentium IV cycle counter */ | ||
| 214 | #endif | ||
| 215 | |||
| 216 | /*----------------------------------------------------------------*/ | ||
| 217 | /* | ||
| 218 | * X86-64 cycle counter | ||
| 219 | */ | ||
| 220 | #if (defined(__GNUC__) || defined(__ICC) || defined(__SUNPRO_C)) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER) | ||
| 221 | typedef unsigned long long ticks; | ||
| 222 | |||
| 223 | static __inline__ ticks getticks(void) | ||
| 224 | { | ||
| 225 | unsigned a, d; | ||
| 226 | asm volatile("rdtsc" : "=a" (a), "=d" (d)); | ||
| 227 | return ((ticks)a) | (((ticks)d) << 32); | ||
| 228 | } | ||
| 229 | |||
| 230 | INLINE_ELAPSED(__inline__) | ||
| 231 | |||
| 232 | #define HAVE_TICK_COUNTER | ||
| 233 | #endif | ||
| 234 | |||
| 235 | /* PGI compiler, courtesy Cristiano Calonaci, Andrea Tarsi, & Roberto Gori. | ||
| 236 | NOTE: this code will fail to link unless you use the -Masmkeyword compiler | ||
| 237 | option (grrr). */ | ||
| 238 | #if defined(__PGI) && defined(__x86_64__) && !defined(HAVE_TICK_COUNTER) | ||
| 239 | typedef unsigned long long ticks; | ||
| 240 | static ticks getticks(void) | ||
| 241 | { | ||
| 242 | asm(" rdtsc; shl $0x20,%rdx; mov %eax,%eax; or %rdx,%rax; "); | ||
| 243 | } | ||
| 244 | INLINE_ELAPSED(__inline__) | ||
| 245 | #define HAVE_TICK_COUNTER | ||
| 246 | #endif | ||
| 247 | |||
| 248 | /* Visual C++, courtesy of Dirk Michaelis */ | ||
| 249 | #if _MSC_VER >= 1400 && (defined(_M_AMD64) || defined(_M_X64)) && !defined(HAVE_TICK_COUNTER) | ||
| 250 | |||
| 251 | #include <intrin.h> | ||
| 252 | #pragma intrinsic(__rdtsc) | ||
| 253 | typedef unsigned __int64 ticks; | ||
| 254 | #define getticks __rdtsc | ||
| 255 | INLINE_ELAPSED(__inline) | ||
| 256 | |||
| 257 | #define HAVE_TICK_COUNTER | ||
| 258 | #endif | ||
| 259 | |||
| 260 | /*----------------------------------------------------------------*/ | ||
| 261 | /* | ||
| 262 | * IA64 cycle counter | ||
| 263 | */ | ||
| 264 | |||
| 265 | /* intel's icc/ecc compiler */ | ||
| 266 | #if (defined(__EDG_VERSION) || defined(__ECC)) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER) | ||
| 267 | typedef unsigned long ticks; | ||
| 268 | #include <ia64intrin.h> | ||
| 269 | |||
| 270 | static __inline__ ticks getticks(void) | ||
| 271 | { | ||
| 272 | return __getReg(_IA64_REG_AR_ITC); | ||
| 273 | } | ||
| 274 | |||
| 275 | INLINE_ELAPSED(__inline__) | ||
| 276 | |||
| 277 | #define HAVE_TICK_COUNTER | ||
| 278 | #endif | ||
| 279 | |||
| 280 | /* gcc */ | ||
| 281 | #if defined(__GNUC__) && defined(__ia64__) && !defined(HAVE_TICK_COUNTER) | ||
| 282 | typedef unsigned long ticks; | ||
| 283 | |||
| 284 | static __inline__ ticks getticks(void) | ||
| 285 | { | ||
| 286 | ticks ret; | ||
| 287 | |||
| 288 | __asm__ __volatile__ ("mov %0=ar.itc" : "=r"(ret)); | ||
| 289 | return ret; | ||
| 290 | } | ||
| 291 | |||
| 292 | INLINE_ELAPSED(__inline__) | ||
| 293 | |||
| 294 | #define HAVE_TICK_COUNTER | ||
| 295 | #endif | ||
| 296 | |||
| 297 | /* HP/UX IA64 compiler, courtesy Teresa L. Johnson: */ | ||
| 298 | #if defined(__hpux) && defined(__ia64) && !defined(HAVE_TICK_COUNTER) | ||
| 299 | #include <machine/sys/inline.h> | ||
| 300 | typedef unsigned long ticks; | ||
| 301 | |||
| 302 | static inline ticks getticks(void) | ||
| 303 | { | ||
| 304 | ticks ret; | ||
| 305 | |||
| 306 | ret = _Asm_mov_from_ar (_AREG_ITC); | ||
| 307 | return ret; | ||
| 308 | } | ||
| 309 | |||
| 310 | INLINE_ELAPSED(inline) | ||
| 311 | |||
| 312 | #define HAVE_TICK_COUNTER | ||
| 313 | #endif | ||
| 314 | |||
| 315 | /* Microsoft Visual C++ */ | ||
| 316 | #if defined(_MSC_VER) && defined(_M_IA64) && !defined(HAVE_TICK_COUNTER) | ||
| 317 | typedef unsigned __int64 ticks; | ||
| 318 | |||
| 319 | # ifdef __cplusplus | ||
| 320 | extern "C" | ||
| 321 | # endif | ||
| 322 | ticks __getReg(int whichReg); | ||
| 323 | #pragma intrinsic(__getReg) | ||
| 324 | |||
| 325 | static __inline ticks getticks(void) | ||
| 326 | { | ||
| 327 | volatile ticks temp; | ||
| 328 | temp = __getReg(3116); | ||
| 329 | return temp; | ||
| 330 | } | ||
| 331 | |||
| 332 | INLINE_ELAPSED(inline) | ||
| 333 | |||
| 334 | #define HAVE_TICK_COUNTER | ||
| 335 | #endif | ||
| 336 | |||
| 337 | /*----------------------------------------------------------------*/ | ||
| 338 | /* | ||
| 339 | * PA-RISC cycle counter | ||
| 340 | */ | ||
| 341 | #if defined(__hppa__) || defined(__hppa) && !defined(HAVE_TICK_COUNTER) | ||
| 342 | typedef unsigned long ticks; | ||
| 343 | |||
| 344 | # ifdef __GNUC__ | ||
| 345 | static __inline__ ticks getticks(void) | ||
| 346 | { | ||
| 347 | ticks ret; | ||
| 348 | |||
| 349 | __asm__ __volatile__("mfctl 16, %0": "=r" (ret)); | ||
| 350 | /* no input, nothing else clobbered */ | ||
| 351 | return ret; | ||
| 352 | } | ||
| 353 | # else | ||
| 354 | # include <machine/inline.h> | ||
| 355 | static inline unsigned long getticks(void) | ||
| 356 | { | ||
| 357 | register ticks ret; | ||
| 358 | _MFCTL(16, ret); | ||
| 359 | return ret; | ||
| 360 | } | ||
| 361 | # endif | ||
| 362 | |||
| 363 | INLINE_ELAPSED(inline) | ||
| 364 | |||
| 365 | #define HAVE_TICK_COUNTER | ||
| 366 | #endif | ||
| 367 | |||
| 368 | /*----------------------------------------------------------------*/ | ||
| 369 | /* S390, courtesy of James Treacy */ | ||
| 370 | #if defined(__GNUC__) && defined(__s390__) && !defined(HAVE_TICK_COUNTER) | ||
| 371 | typedef unsigned long long ticks; | ||
| 372 | |||
| 373 | static __inline__ ticks getticks(void) | ||
| 374 | { | ||
| 375 | ticks cycles; | ||
| 376 | __asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc"); | ||
| 377 | return cycles; | ||
| 378 | } | ||
| 379 | |||
| 380 | INLINE_ELAPSED(__inline__) | ||
| 381 | |||
| 382 | #define HAVE_TICK_COUNTER | ||
| 383 | #endif | ||
| 384 | /*----------------------------------------------------------------*/ | ||
| 385 | #if defined(__GNUC__) && defined(__alpha__) && !defined(HAVE_TICK_COUNTER) | ||
| 386 | /* | ||
| 387 | * The 32-bit cycle counter on alpha overflows pretty quickly, | ||
| 388 | * unfortunately. A 1GHz machine overflows in 4 seconds. | ||
| 389 | */ | ||
| 390 | typedef unsigned int ticks; | ||
| 391 | |||
| 392 | static __inline__ ticks getticks(void) | ||
| 393 | { | ||
| 394 | unsigned long cc; | ||
| 395 | __asm__ __volatile__ ("rpcc %0" : "=r"(cc)); | ||
| 396 | return (cc & 0xFFFFFFFF); | ||
| 397 | } | ||
| 398 | |||
| 399 | INLINE_ELAPSED(__inline__) | ||
| 400 | |||
| 401 | #define HAVE_TICK_COUNTER | ||
| 402 | #endif | ||
| 403 | |||
| 404 | /*----------------------------------------------------------------*/ | ||
| 405 | #if defined(__GNUC__) && defined(__sparc_v9__) && !defined(HAVE_TICK_COUNTER) | ||
| 406 | typedef unsigned long ticks; | ||
| 407 | |||
| 408 | static __inline__ ticks getticks(void) | ||
| 409 | { | ||
| 410 | ticks ret; | ||
| 411 | __asm__ __volatile__("rd %%tick, %0" : "=r" (ret)); | ||
| 412 | return ret; | ||
| 413 | } | ||
| 414 | |||
| 415 | INLINE_ELAPSED(__inline__) | ||
| 416 | |||
| 417 | #define HAVE_TICK_COUNTER | ||
| 418 | #endif | ||
| 419 | |||
| 420 | /*----------------------------------------------------------------*/ | ||
| 421 | #if (defined(__DECC) || defined(__DECCXX)) && defined(__alpha) && defined(HAVE_C_ASM_H) && !defined(HAVE_TICK_COUNTER) | ||
| 422 | # include <c_asm.h> | ||
| 423 | typedef unsigned int ticks; | ||
| 424 | |||
| 425 | static __inline ticks getticks(void) | ||
| 426 | { | ||
| 427 | unsigned long cc; | ||
| 428 | cc = asm("rpcc %v0"); | ||
| 429 | return (cc & 0xFFFFFFFF); | ||
| 430 | } | ||
| 431 | |||
| 432 | INLINE_ELAPSED(__inline) | ||
| 433 | |||
| 434 | #define HAVE_TICK_COUNTER | ||
| 435 | #endif | ||
| 436 | /*----------------------------------------------------------------*/ | ||
| 437 | /* SGI/Irix */ | ||
| 438 | #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_SGI_CYCLE) && !defined(HAVE_TICK_COUNTER) | ||
| 439 | typedef struct timespec ticks; | ||
| 440 | |||
| 441 | static inline ticks getticks(void) | ||
| 442 | { | ||
| 443 | struct timespec t; | ||
| 444 | clock_gettime(CLOCK_SGI_CYCLE, &t); | ||
| 445 | return t; | ||
| 446 | } | ||
| 447 | |||
| 448 | static inline double elapsed(ticks t1, ticks t0) | ||
| 449 | { | ||
| 450 | return ((double)t1.tv_sec - (double)t0.tv_sec) * 1.0E9 + | ||
| 451 | ((double)t1.tv_nsec - (double)t0.tv_nsec); | ||
| 452 | } | ||
| 453 | #define HAVE_TICK_COUNTER | ||
| 454 | #endif | ||
| 455 | |||
| 456 | /*----------------------------------------------------------------*/ | ||
| 457 | /* Cray UNICOS _rtc() intrinsic function */ | ||
| 458 | #if defined(HAVE__RTC) && !defined(HAVE_TICK_COUNTER) | ||
| 459 | #ifdef HAVE_INTRINSICS_H | ||
| 460 | # include <intrinsics.h> | ||
| 461 | #endif | ||
| 462 | |||
| 463 | typedef long long ticks; | ||
| 464 | |||
| 465 | #define getticks _rtc | ||
| 466 | |||
| 467 | INLINE_ELAPSED(inline) | ||
| 468 | |||
| 469 | #define HAVE_TICK_COUNTER | ||
| 470 | #endif | ||
| 471 | |||
| 472 | /*----------------------------------------------------------------*/ | ||
| 473 | /* MIPS ZBus */ | ||
| 474 | #if HAVE_MIPS_ZBUS_TIMER | ||
| 475 | #if defined(__mips__) && !defined(HAVE_TICK_COUNTER) | ||
| 476 | #include <sys/mman.h> | ||
| 477 | #include <unistd.h> | ||
| 478 | #include <fcntl.h> | ||
| 479 | |||
| 480 | typedef uint64_t ticks; | ||
| 481 | |||
| 482 | static inline ticks getticks(void) | ||
| 483 | { | ||
| 484 | static uint64_t* addr = 0; | ||
| 485 | |||
| 486 | if (addr == 0) | ||
| 487 | { | ||
| 488 | uint32_t rq_addr = 0x10030000; | ||
| 489 | int fd; | ||
| 490 | int pgsize; | ||
| 491 | |||
| 492 | pgsize = getpagesize(); | ||
| 493 | fd = open ("/dev/mem", O_RDONLY | O_SYNC, 0); | ||
| 494 | if (fd < 0) { | ||
| 495 | perror("open"); | ||
| 496 | return NULL; | ||
| 497 | } | ||
| 498 | addr = mmap(0, pgsize, PROT_READ, MAP_SHARED, fd, rq_addr); | ||
| 499 | close(fd); | ||
| 500 | if (addr == (uint64_t *)-1) { | ||
| 501 | perror("mmap"); | ||
| 502 | return NULL; | ||
| 503 | } | ||
| 504 | } | ||
| 505 | |||
| 506 | return *addr; | ||
| 507 | } | ||
| 508 | |||
| 509 | INLINE_ELAPSED(inline) | ||
| 510 | |||
| 511 | #define HAVE_TICK_COUNTER | ||
| 512 | #endif | ||
| 513 | #endif /* HAVE_MIPS_ZBUS_TIMER */ | ||
| 514 | |||
diff --git a/SD-VBS/common/matlab/timingFuncs/photonEndTiming.c b/SD-VBS/common/matlab/timingFuncs/photonEndTiming.c deleted file mode 100644 index bbf5231..0000000 --- a/SD-VBS/common/matlab/timingFuncs/photonEndTiming.c +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #include"mex.h" | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdint.h> | ||
| 5 | #include <math.h> | ||
| 6 | |||
| 7 | void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | ||
| 8 | { | ||
| 9 | uint32_t* cycles; | ||
| 10 | plhs[0] = mxCreateNumericMatrix(1, 2, mxUINT32_CLASS, mxREAL); | ||
| 11 | cycles = (uint32_t*)mxGetPr(plhs[0]); | ||
| 12 | __asm__ __volatile__( "rdtsc": "=a" (cycles[0]), "=d" (cycles[1])); | ||
| 13 | |||
| 14 | return; | ||
| 15 | } | ||
diff --git a/SD-VBS/common/matlab/timingFuncs/photonEndTiming.mexglx b/SD-VBS/common/matlab/timingFuncs/photonEndTiming.mexglx deleted file mode 100755 index fa9d4b6..0000000 --- a/SD-VBS/common/matlab/timingFuncs/photonEndTiming.mexglx +++ /dev/null | |||
| Binary files differ | |||
diff --git a/SD-VBS/common/matlab/timingFuncs/photonPrintTiming.m b/SD-VBS/common/matlab/timingFuncs/photonPrintTiming.m deleted file mode 100644 index b9c7b22..0000000 --- a/SD-VBS/common/matlab/timingFuncs/photonPrintTiming.m +++ /dev/null | |||
| @@ -1,5 +0,0 @@ | |||
| 1 | %! _photonPrintTiming_NA_i2 | ||
| 2 | |||
| 3 | function photonPrintTiming(elapsed) | ||
| 4 | disp(elapsed); | ||
| 5 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/timingFuncs/photonReportTiming.m b/SD-VBS/common/matlab/timingFuncs/photonReportTiming.m deleted file mode 100644 index e991175..0000000 --- a/SD-VBS/common/matlab/timingFuncs/photonReportTiming.m +++ /dev/null | |||
| @@ -1,7 +0,0 @@ | |||
| 1 | %! _photonReportTiming_i2_i2i2 | ||
| 2 | |||
| 3 | function elapsed = photonReportTiming(startCycles, endCycles) | ||
| 4 | elapsed = zeros(1,2); | ||
| 5 | elapsed(1) = endCycles(1) - startCycles(1); | ||
| 6 | elapsed(2) = endCycles(2) - startCycles(2); | ||
| 7 | end \ No newline at end of file | ||
diff --git a/SD-VBS/common/matlab/timingFuncs/photonStartTiming.c b/SD-VBS/common/matlab/timingFuncs/photonStartTiming.c deleted file mode 100644 index bbf5231..0000000 --- a/SD-VBS/common/matlab/timingFuncs/photonStartTiming.c +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #include"mex.h" | ||
| 2 | #include <stdio.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdint.h> | ||
| 5 | #include <math.h> | ||
| 6 | |||
| 7 | void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | ||
| 8 | { | ||
| 9 | uint32_t* cycles; | ||
| 10 | plhs[0] = mxCreateNumericMatrix(1, 2, mxUINT32_CLASS, mxREAL); | ||
| 11 | cycles = (uint32_t*)mxGetPr(plhs[0]); | ||
| 12 | __asm__ __volatile__( "rdtsc": "=a" (cycles[0]), "=d" (cycles[1])); | ||
| 13 | |||
| 14 | return; | ||
| 15 | } | ||
diff --git a/SD-VBS/common/matlab/timingFuncs/photonStartTiming.mexglx b/SD-VBS/common/matlab/timingFuncs/photonStartTiming.mexglx deleted file mode 100755 index 8b55b98..0000000 --- a/SD-VBS/common/matlab/timingFuncs/photonStartTiming.mexglx +++ /dev/null | |||
| Binary files differ | |||
diff --git a/SD-VBS/common/matlab/writeMatrix.m b/SD-VBS/common/matlab/writeMatrix.m deleted file mode 100644 index ec2bbae..0000000 --- a/SD-VBS/common/matlab/writeMatrix.m +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | function writeMatrix(input, inpath) | ||
| 2 | |||
| 3 | file = [inpath '/expected.m']; | ||
| 4 | disp(file); | ||
| 5 | fd = fopen(file, 'w'); | ||
| 6 | |||
| 7 | [rows, cols] = size(input); | ||
| 8 | |||
| 9 | for j=1:rows | ||
| 10 | for i=1:cols | ||
| 11 | fprintf(fd, '%d\t', input(j,i)-1); | ||
| 12 | end | ||
| 13 | fprintf(fd, '\n'); | ||
| 14 | end | ||
| 15 | fclose(fd); | ||
| 16 | |||
| 17 | end | ||
| 18 | |||
| 19 | |||
diff --git a/SD-VBS/common/matlab/write_image8u_bmp.m b/SD-VBS/common/matlab/write_image8u_bmp.m deleted file mode 100755 index 71b48ef..0000000 --- a/SD-VBS/common/matlab/write_image8u_bmp.m +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | function image = write_image8u_bmp(inpImage, pathName) % this is matlab's sequence, removed width, height since they can be inferred from image | ||
| 2 | |||
| 3 | BYTES_PER_PIXEL = 3; | ||
| 4 | |||
| 5 | fid = fopen (pathName,'w'); %FILE *input; | ||
| 6 | % //check for the input FILE pointer | ||
| 7 | if(fid == 0) | ||
| 8 | disp('File pointer error'); | ||
| 9 | else | ||
| 10 | height = size(inpImage,1); | ||
| 11 | width=size(inpImage,2); | ||
| 12 | signature(1) = 'B'; | ||
| 13 | signature(2) = 'M'; | ||
| 14 | |||
| 15 | reserved1 = 0; | ||
| 16 | reserved2 = 0; | ||
| 17 | file_size = (height*width*BYTES_PER_PIXEL)+54; | ||
| 18 | offset=54; | ||
| 19 | size_of_infoheader=40; | ||
| 20 | number_of_planes=1; | ||
| 21 | bits_per_pixel= 8*BYTES_PER_PIXEL ; | ||
| 22 | compression_method=0; | ||
| 23 | hori_reso=2835; | ||
| 24 | vert_reso=2835; | ||
| 25 | no_of_colors=0; | ||
| 26 | no_of_imp_colors=0; | ||
| 27 | |||
| 28 | % start of header information | ||
| 29 | fwrite(fid,signature(1),'char'); | ||
| 30 | fwrite(fid,signature(2),'char'); | ||
| 31 | fwrite(fid,file_size,'int'); | ||
| 32 | fwrite(fid,reserved1,'short'); | ||
| 33 | fwrite(fid,reserved2,'short'); | ||
| 34 | fwrite(fid,offset,'int'); | ||
| 35 | fwrite(fid,size_of_infoheader,'int'); | ||
| 36 | fwrite(fid,width,'int'); | ||
| 37 | fwrite(fid,height,'int'); | ||
| 38 | fwrite(fid,number_of_planes,'short'); | ||
| 39 | fwrite(fid,bits_per_pixel,'short'); | ||
| 40 | fwrite(fid,compression_method,'int'); | ||
| 41 | |||
| 42 | bytes_of_bitmap=width*height*BYTES_PER_PIXEL; | ||
| 43 | |||
| 44 | fwrite(fid,bytes_of_bitmap,'int'); | ||
| 45 | fwrite(fid,hori_reso,'int'); | ||
| 46 | fwrite(fid,vert_reso,'int'); | ||
| 47 | fwrite(fid,no_of_colors,'int'); | ||
| 48 | fwrite(fid,no_of_imp_colors,'int'); | ||
| 49 | |||
| 50 | % Conditions to check whether the BMP is gray scaled and handling few exceptions | ||
| 51 | |||
| 52 | if (width <= 0 || height <= 0 || signature(1) ~= 'B' || signature(2) ~= 'M') | ||
| 53 | return; | ||
| 54 | end | ||
| 55 | |||
| 56 | % total size of pixels | ||
| 57 | % pixSize=srcImage->height * srcImage->width * NO_OF_BYTE_PER_PIXEL; //*3 is done as it is a 3 channel image | ||
| 58 | %reverse the image back | ||
| 59 | |||
| 60 | for nI=1:height | ||
| 61 | count = 0; | ||
| 62 | for nJ=1:width | ||
| 63 | temp = inpImage((height - nI+1),nJ,3); | ||
| 64 | fwrite(fid,temp,'char'); | ||
| 65 | temp = inpImage((height - nI+1),nJ,2); | ||
| 66 | fwrite(fid,temp,'char'); | ||
| 67 | temp = inpImage((height - nI+1),nJ,1); | ||
| 68 | fwrite(fid,temp,'char'); | ||
| 69 | |||
| 70 | end | ||
| 71 | pad = 4 - (width*BYTES_PER_PIXEL - (4*floor(width*BYTES_PER_PIXEL/4))); %bitmap multiple-of-4 requirement | ||
| 72 | if pad ~= 0 | ||
| 73 | temp=0; | ||
| 74 | for cnt = 1:pad | ||
| 75 | fwrite(fid,temp,'char'); | ||
| 76 | % fwrite(fid,temp,'char'); | ||
| 77 | % fwrite(fid,temp,'char'); | ||
| 78 | end | ||
| 79 | end | ||
| 80 | end | ||
| 81 | |||
| 82 | outImage = imread(pathName); | ||
| 83 | imshow(outImage); | ||
| 84 | fclose(fid); | ||
| 85 | |||
| 86 | end | ||
| 87 | |||
| 88 | \ No newline at end of file | ||
diff --git a/SD-VBS/common/toolbox/toolbox_basic/matlab_tools.zip b/SD-VBS/common/toolbox/toolbox_basic/matlab_tools.zip deleted file mode 100755 index 3b95cb3..0000000 --- a/SD-VBS/common/toolbox/toolbox_basic/matlab_tools.zip +++ /dev/null | |||
| Binary files differ | |||
