OLD | NEW |
(Empty) | |
| 1 diff --git opencv-v2.4.7/XCompile-nacl.txt opencv-v2.4.7.nacl/XCompile-nacl.txt |
| 2 new file mode 100644 |
| 3 index 0000000..c651a2a |
| 4 --- /dev/null |
| 5 +++ opencv-2.4.7.nacl/XCompile-nacl.txt |
| 6 @@ -0,0 +1,17 @@ |
| 7 +# the name of the target operating system |
| 8 +SET(CMAKE_SYSTEM_NAME Linux) |
| 9 + |
| 10 +SET(NACL_CROSS_PREFIX nacl) |
| 11 + |
| 12 +# which compilers to use for C and C++ |
| 13 +SET(CMAKE_C_COMPILER "${NACLCC}") |
| 14 +SET(CMAKE_CXX_COMPILER "${NACLCXX}") |
| 15 +set(CMAKE_AR ${NACLAR} CACHE FILEPATH "Archiver") |
| 16 +SET(CMAKE_LINKER "${NACLLD}") |
| 17 +SET(_CMAKE_TOOLCHAIN_PREFIX ${NACL_CROSS_PREFIX}) |
| 18 + |
| 19 +# here is the target environment located |
| 20 +SET(CMAKE_FIND_ROOT_PATH ${NACL_TOOLCHAIN_ROOT}) |
| 21 + |
| 22 +# nacl abi says 32bits little endian |
| 23 +set(CMAKE_SIZEOF_VOID_P 4) |
| 24 diff -Naur opencv-2.4.7/modules/contrib/src/inputoutput.cpp opencv-2.4.7.nacl/mo
dules/contrib/src/inputoutput.cpp |
| 25 --- opencv-2.4.7/modules/contrib/src/inputoutput.cpp 2013-11-06 15:26:39.0000
00000 +0100 |
| 26 +++ opencv-2.4.7.nacl/modules/contrib/src/inputoutput.cpp 2013-11-19 21:00
:51.000000000 +0100 |
| 27 @@ -76,7 +76,8 @@ |
| 28 { |
| 29 return list; |
| 30 } |
| 31 - |
| 32 +// NaCl does not define struct fields to deal with folders. |
| 33 +#ifndef __native_client__ |
| 34 while ((dirp = readdir(dp)) != NULL) |
| 35 { |
| 36 if (dirp->d_type == DT_REG) |
| 37 @@ -89,6 +90,7 @@ |
| 38 } |
| 39 } |
| 40 closedir(dp); |
| 41 +#endif //#ifndef __native__client__ |
| 42 #endif |
| 43 |
| 44 return list; |
| 45 @@ -166,7 +168,8 @@ |
| 46 { |
| 47 return list; |
| 48 } |
| 49 - |
| 50 +// NaCl does not define struct fields to deal with folders. |
| 51 +#ifndef __native_client__ |
| 52 while ((dirp = readdir(dp)) != NULL) |
| 53 { |
| 54 if (dirp->d_type == DT_DIR && |
| 55 @@ -181,6 +184,8 @@ |
| 56 } |
| 57 } |
| 58 closedir(dp); |
| 59 +#endif //#ifndef __native__client__ |
| 60 + |
| 61 #endif |
| 62 |
| 63 return list; |
| 64 diff -Naur opencv-2.4.7/modules/core/include/opencv2/core/operations.hpp opencv-
2.4.7.nacl/modules/core/include/opencv2/core/operations.hpp |
| 65 --- opencv-2.4.7/modules/core/include/opencv2/core/operations.hpp 2013-11-
06 15:26:39.000000000 +0100 |
| 66 +++ opencv-2.4.7.nacl/modules/core/include/opencv2/core/operations.hpp 2013-11-
19 21:03:40.000000000 +0100 |
| 67 @@ -58,7 +58,13 @@ |
| 68 |
| 69 #if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ |
| 70 #ifdef __ATOMIC_SEQ_CST |
| 71 + // Clang in NaCl "cannot compile this atomic library call yet": use |
| 72 + // instead a programmatic atomic fetch. |
| 73 + #ifndef __native_client__ |
| 74 #define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(add
r), (delta), __ATOMIC_SEQ_CST) |
| 75 + #else |
| 76 + int CV_XADD(int* addr, int delta) { int tmp = *addr; *addr += delta; re
turn tmp; } |
| 77 +#endif //#ifndef __native_client__ |
| 78 #else |
| 79 #define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr),
(delta), 5) |
| 80 #endif |
| 81 diff -Naur opencv-2.4.7/modules/flann/include/opencv2/flann/allocator.h opencv-2
.4.7.nacl/modules/flann/include/opencv2/flann/allocator.h |
| 82 --- opencv-2.4.7/modules/flann/include/opencv2/flann/allocator.h 2013-11-
06 15:26:39.000000000 +0100 |
| 83 +++ opencv-2.4.7.nacl/modules/flann/include/opencv2/flann/allocator.h 2013-11-
19 21:04:57.000000000 +0100 |
| 84 @@ -68,7 +68,10 @@ |
| 85 * |
| 86 */ |
| 87 |
| 88 +// In NaCl newlib, this variable is declared elsewhere non-const. |
| 89 +#if defined(__native_client__) && defined(__GLIBC__) |
| 90 const size_t WORDSIZE=16; |
| 91 +#endif //#ifndef __native__client__ |
| 92 const size_t BLOCKSIZE=8192; |
| 93 |
| 94 class PooledAllocator |
| 95 diff -Naur opencv-2.4.7/modules/legacy/include/opencv2/legacy/legacy.hpp opencv-
2.4.7.nacl/modules/legacy/include/opencv2/legacy/legacy.hpp |
| 96 --- opencv-2.4.7/modules/legacy/include/opencv2/legacy/legacy.hpp 2013-11
-06 15:26:39.000000000 +0100 |
| 97 +++ opencv-2.4.7.nacl/modules/legacy/include/opencv2/legacy/legacy.hpp 2013-11
-19 23:22:11.000000000 +0100 |
| 98 @@ -519,8 +519,8 @@ |
| 99 |
| 100 /* New part for stereo */ |
| 101 CvPoint3D32f epipole[2]; |
| 102 - CvPoint2D32f quad[2][4]; /* coordinates of destination quadrangle after |
| 103 - epipolar geometry rectification */ |
| 104 + CvPoint2D32f quads[2][4]; /* coordinates of destination quadrangle after |
| 105 + epipolar geometry rectification */ |
| 106 double coeffs[2][3][3];/* coefficients for transformation */ |
| 107 CvPoint2D32f border[2][4]; |
| 108 CvSize warpSize; |
| 109 diff -Naur opencv-2.4.7/modules/legacy/src/calibfilter.cpp opencv-2.4.7.nacl/mod
ules/legacy/src/calibfilter.cpp |
| 110 --- opencv-2.4.7/modules/legacy/src/calibfilter.cpp 2013-11-06 15:26:39.0
00000000 +0100 |
| 111 +++ opencv-2.4.7.nacl/modules/legacy/src/calibfilter.cpp 2013-11-19 23:22:42.0
00000000 +0100 |
| 112 @@ -42,7 +42,10 @@ |
| 113 #include "precomp.hpp" |
| 114 #include <stdio.h> |
| 115 |
| 116 +// PNaCl likes this preprocessor definition active, to use a struct field. |
| 117 +#ifndef __native_client__ |
| 118 #undef quad |
| 119 +#endif //#ifndef __native_client__ |
| 120 |
| 121 CvCalibFilter::CvCalibFilter() |
| 122 { |
| 123 @@ -686,8 +689,8 @@ |
| 124 { |
| 125 for( j = 0; j < 4; j++ ) |
| 126 { |
| 127 - fprintf(f, "%15.10f ", stereo.quad[i][j].x ); |
| 128 - fprintf(f, "%15.10f ", stereo.quad[i][j].y ); |
| 129 + fprintf(f, "%15.10f ", stereo.quads[i][j].x ); |
| 130 + fprintf(f, "%15.10f ", stereo.quads[i][j].y ); |
| 131 } |
| 132 fprintf(f, "\n"); |
| 133 } |
| 134 @@ -743,9 +746,9 @@ |
| 135 { |
| 136 for( j = 0; j < 4; j++ ) |
| 137 { |
| 138 - int values_read = fscanf(f, "%f ", &(stereo.quad[i][j].x) ); |
| 139 + int values_read = fscanf(f, "%f ", &(stereo.quads[i][j].x) ); |
| 140 CV_Assert(values_read == 1); |
| 141 - values_read = fscanf(f, "%f ", &(stereo.quad[i][j].y) ); |
| 142 + values_read = fscanf(f, "%f ", &(stereo.quads[i][j].y) ); |
| 143 CV_Assert(values_read == 1); |
| 144 } |
| 145 } |
| 146 diff -Naur opencv-2.4.7/modules/legacy/src/epilines.cpp opencv-2.4.7.nacl/module
s/legacy/src/epilines.cpp |
| 147 --- opencv-2.4.7/modules/legacy/src/epilines.cpp 2013-11-06 15:26:39.0000
00000 +0100 |
| 148 +++ opencv-2.4.7.nacl/modules/legacy/src/epilines.cpp 2013-11-19 23:22:56.0000
00000 +0100 |
| 149 @@ -46,7 +46,10 @@ |
| 150 |
| 151 /* Valery Mosyagin */ |
| 152 |
| 153 +// PNaCl likes this preprocessor definition active, to use a struct field. |
| 154 +#ifndef __native_client__ |
| 155 #undef quad |
| 156 +#endif //#ifndef __native_client__ |
| 157 |
| 158 #define EPS64D 1e-9 |
| 159 |
| 160 @@ -312,11 +315,11 @@ |
| 161 int i; |
| 162 for( i = 0; i < 4; i++ ) |
| 163 { |
| 164 - quad1[i][0] = stereoCamera->quad[0][i].x; |
| 165 - quad1[i][1] = stereoCamera->quad[0][i].y; |
| 166 + quad1[i][0] = stereoCamera->quads[0][i].x; |
| 167 + quad1[i][1] = stereoCamera->quads[0][i].y; |
| 168 |
| 169 - quad2[i][0] = stereoCamera->quad[1][i].x; |
| 170 - quad2[i][1] = stereoCamera->quad[1][i].y; |
| 171 + quad2[i][0] = stereoCamera->quads[1][i].x; |
| 172 + quad2[i][1] = stereoCamera->quads[1][i].y; |
| 173 } |
| 174 |
| 175 icvComputeCoeffForStereoNew( quad1, |
| 176 @@ -1761,8 +1764,8 @@ |
| 177 int i; |
| 178 for( i = 0; i < 4; i++ ) |
| 179 { |
| 180 - stereoCamera->quad[0][i] = cvPoint2D32f(quad1[i][0],quad1[i][1]); |
| 181 - stereoCamera->quad[1][i] = cvPoint2D32f(quad2[i][0],quad2[i][1]); |
| 182 + stereoCamera->quads[0][i] = cvPoint2D32f(quad1[i][0],quad1[i][1]); |
| 183 + stereoCamera->quads[1][i] = cvPoint2D32f(quad2[i][0],quad2[i][1]); |
| 184 } |
| 185 |
| 186 return; |
| 187 @@ -3067,12 +3070,12 @@ |
| 188 icvGetQuadsTransformStruct(stereoparams); |
| 189 |
| 190 cvInitPerspectiveTransform( stereoparams->warpSize, |
| 191 - stereoparams->quad[0], |
| 192 + stereoparams->quads[0], |
| 193 stereoparams->coeffs[0], |
| 194 0); |
| 195 |
| 196 cvInitPerspectiveTransform( stereoparams->warpSize, |
| 197 - stereoparams->quad[1], |
| 198 + stereoparams->quads[1], |
| 199 stereoparams->coeffs[1], |
| 200 0); |
| 201 |
| 202 diff -Naur opencv-2.4.7/modules/core/src/system.cpp opencv-2.4.7.nacl/modules/co
re/src/system.cpp |
| 203 --- opencv-2.4.7/modules/core/src/system.cpp 2013-11-06 15:26:39.00000000
0 +0100 |
| 204 +++ opencv-2.4.7.nacl/modules/core/src/system.cpp 2013-11-19 22:18:14.00000000
0 +0100 |
| 205 @@ -460,6 +460,10 @@ |
| 206 const int fd = mkstemp((char*)fname.c_str()); |
| 207 if (fd == -1) return string(); |
| 208 |
| 209 +# ifndef __native_client__ |
| 210 close(fd); |
| 211 +# else |
| 212 + fclose((FILE*)fd); |
| 213 +# endif //#ifndef __native_client__ |
| 214 remove(fname.c_str()); |
| 215 # endif |
OLD | NEW |