Skip to content

Commit f5694a9

Browse files
committed
adding pthreads also in the bytecode libs
1 parent a3e19c3 commit f5694a9

File tree

7 files changed

+73771
-92389
lines changed

7 files changed

+73771
-92389
lines changed

build/artoolkitNft.debug.js

Lines changed: 73733 additions & 92356 deletions
Large diffs are not rendered by default.

build/artoolkitNft.min.js

Lines changed: 13 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/artoolkitNft_wasm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/artoolkitNft_wasm.wasm

-133 KB
Binary file not shown.

emscripten/ARToolKitJS.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ extern "C" {
112112
//ftmi = arFilterTransMatInit(filterSampleRate, filterCutoffFrequency);
113113
if (arc->threadHandle) {
114114
int ret;
115+
if( arc->detectedPage == -2 ) {
116+
trackingInitStart( arc->threadHandle, arc->videoLuma );
117+
arc->detectedPage = -1;
118+
}
115119
if( arc->detectedPage == -1 ) {
116120
//ARLOGi("arc->detectedPage: %d \n", arc->detectedPage);
117121
ret = trackingInitGetResult( arc->threadHandle, trackingTrans, &pageNo);
@@ -126,25 +130,25 @@ extern "C" {
126130
arc->detectedPage = -2;
127131
}
128132
} else if( ret < 0 ) {
129-
ARLOGd("No page detected.\n");
133+
ARLOGi("No page detected.\n");
130134
arc->detectedPage = -2;
131135
}
132136
}
133137
if( arc->detectedPage >= 0 && arc->detectedPage < arc->surfaceSetCount) {
134138
if( ar2Tracking(arc->ar2Handle, arc->surfaceSet[pageNo], arc->videoLuma, trackingTrans, &err) < 0 ) {
135-
ARLOGd("Tracking lost.\n");
139+
ARLOGi("Tracking lost.\n");
136140
arc->detectedPage = -2;
137141
} else {
138-
ARLOGd("Tracked page %d (max %d).\n", arc->detectedPage, arc->surfaceSetCount - 1);
142+
ARLOGi("Tracked page %d (max %d).\n", arc->detectedPage, arc->surfaceSetCount - 1);
139143
}
140144
}
141145
} else {
142146
ARLOGe("Error: threadHandle\n");
143147
arc->detectedPage = -2;
144148
}
145149

146-
//if (pageNo >= 0 && pageNo == arc->detectedPage) {
147-
if (arc->detectedPage > -1) {
150+
if (arc->detectedPage >= 0 && arc->detectedPage < arc->surfaceSetCount ) {
151+
//if (arc->detectedPage > -1) {
148152
for (j = 0; j < 3; j++) {
149153
for (k = 0; k < 4; k++) {
150154
trans[j][k] = trackingTrans[j][k];
@@ -251,7 +255,7 @@ extern "C" {
251255

252256
//kpmMatching( arc->kpmHandle, arc->videoLuma );
253257
//kpmGetResult( arc->kpmHandle, &kpmResult, &kpmResultNum );
254-
if (arc->threadHandle) {
258+
/*if (arc->threadHandle) {
255259
// Perform NFT tracking.
256260
float err;
257261
int ret;
@@ -261,7 +265,7 @@ extern "C" {
261265
trackingInitStart( arc->threadHandle, arc->videoLuma );
262266
arc->detectedPage = -1;
263267
}
264-
}
268+
}*/
265269
return kpmResultNum;
266270
}
267271

examples/nft_threejs.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ <h1>NFT marker example with Three.js</h1>
2727

2828
<p>&larr; <a href="index.html">Back to examples</a></p>
2929

30-
<script async src="../build/artoolkitNft.min.js"></script>
31-
<!--<script src="../build/artoolkitNft.debug.js"></script>
32-
<script src="../js/artoolkit.api.js"></script>-->
33-
<script async src="js/third_party/three.js/three.min.js"></script>
34-
<script async src="../js/artoolkit.three.js"></script>
30+
<script src="../build/artoolkitNft.min.js"></script>
31+
<!--<script async src="../build/artoolkitNft.debug.js"></script>
32+
<script async src="../js/artoolkit.api.js"></script>-->
33+
<script src="js/third_party/three.js/three.min.js"></script>
34+
<script src="../js/artoolkit.three.js"></script>
3535

3636
<script>
3737

tools/makem.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (!EMSCRIPTEN_ROOT) {
2323

2424
var EMCC = EMSCRIPTEN_ROOT ? path.resolve(EMSCRIPTEN_ROOT, 'emcc') : 'emcc';
2525
var EMPP = EMSCRIPTEN_ROOT ? path.resolve(EMSCRIPTEN_ROOT, 'em++') : 'em++';
26-
var OPTIMIZE_FLAGS = ' -O2 '; // -Oz for smallest size
26+
var OPTIMIZE_FLAGS = ' -Oz '; // -Oz for smallest size
2727
var MEM = 256 * 1024 * 1024; // 64MB
2828

2929

@@ -122,7 +122,9 @@ FLAGS += ' -s USE_ZLIB=1';
122122
FLAGS += ' --memory-init-file 0 '; // for memless file
123123
FLAGS += ' -s BINARYEN_TRAP_MODE=clamp'
124124

125-
var CFLAGS = ' -Wimplicit-function-declaration -DHAVE_NFT=1 -s USE_PTHREADS=1'
125+
var CFLAGS = ' -Wimplicit-function-declaration -DHAVE_NFT=1';
126+
127+
var PTHREADS = ' -s USE_PTHREADS=1 ';
126128

127129
var PRE_FLAGS = ' --pre-js ' + path.resolve(__dirname, '../js/artoolkit.api.js') +' ';
128130

@@ -196,17 +198,17 @@ function clean_builds() {
196198

197199
var compile_arlib = format(EMCC + ' ' + INCLUDES + ' '
198200
+ ar_sources.join(' ')
199-
+ FLAGS + ' ' + DEFINES + ' -o {OUTPUT_PATH}libar.bc ',
201+
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -o {OUTPUT_PATH}libar.bc ',
200202
OUTPUT_PATH);
201203

202204
var compile_kpm = format(EMCC + ' ' + INCLUDES + ' '
203205
+ kpm_sources.join(' ')
204-
+ FLAGS + ' ' + DEFINES + ' -o {OUTPUT_PATH}libkpm.bc ',
206+
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -o {OUTPUT_PATH}libkpm.bc ',
205207
OUTPUT_PATH);
206208

207209
var compile_libjpeg = format(EMCC + ' ' + INCLUDES + ' '
208210
+ path.resolve(__dirname, LIBJPEG_ROOT) + '/' + libjpeg_sources
209-
+ FLAGS + ' ' + DEFINES + ' -o {OUTPUT_PATH}libjpeg.bc ',
211+
+ FLAGS + ' ' + DEFINES + PTHREADS + ' -o {OUTPUT_PATH}libjpeg.bc ',
210212
OUTPUT_PATH);
211213

212214
/*
@@ -233,7 +235,7 @@ var compile_combine_min = format(EMCC + ' ' + INCLUDES + ' '
233235
*/
234236
var compile_combine_min = format(EMCC + ' ' + INCLUDES + ' '
235237
+ ' {OUTPUT_PATH}*.bc ' + MAIN_SOURCES
236-
+ FLAGS + ' -s WASM=0' + ' ' + DEFINES + PRE_FLAGS + CFLAGS + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
238+
+ FLAGS + ' -s WASM=0' + ' ' + DEFINES + PRE_FLAGS + CFLAGS + PTHREADS + ' -o {OUTPUT_PATH}{BUILD_FILE} ',
237239
OUTPUT_PATH, OUTPUT_PATH, BUILD_MIN_FILE);
238240

239241
var compile_wasm = format(EMCC + ' ' + INCLUDES + ' '

0 commit comments

Comments
 (0)