Repository navigation
feat(nft): move NFT tracking helpers from jsartoolkitNFT into WebARKitNFT (#75) - #76
Conversation
Copy trackingMod, trackingMod2d, trackingSub, markerDecompress and NFTMarkerState from jsartoolkitNFT/emscripten (master) into WebARKit/WebARKitTrackers/WebARKitNFT. Local includes now use <WebARKitTrackers/WebARKitNFT/...>. No functional changes; build integration and fixes follow in separate commits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- rename ar2Tracking2dSub to ar2Tracking2dSubMod: it is public here but static in AR2/tracking2d.c - markerDecompress.c: drop unused <emscripten.h>, use <zlib.h> - markerDecompress.h: add include guard Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#75) - WEBARKIT_BUILD_OPTICAL (ON): the existing OpenCV WebARKitLib target - WEBARKIT_BUILD_NFT (OFF): static WebARKitNFT library with the NFT helpers plus the AR, ARICP, AR2, KPM and ARUtil sources they need (lists mirror jsartoolkitNFT/tools/makem.js); no OpenCV - WEBARKIT_NFT_THREADS (OFF): adds trackingSub and ARUtil/thread_sub Emscripten uses the libjpeg/zlib ports; native builds use find_package. Built with emsdk 4.0.17; linked and smoke-tested with threads on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
decompressMarkers() and extractDataAndSave() killed the whole process on a missing or malformed .zft. They now free their buffers and return -1; extractDataAndSave() returns int. Callers in jsartoolkitNFT already ignore the result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The function is public, but left icpHandle uninitialised, so ar2DeleteHandleMod() freed a garbage pointer on a handle made with it directly (segfault on native builds; wasm memory starts zeroed, so it went unnoticed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FreakMatcher relied on libc++ pulling them in transitively; GCC 13 (libstdc++) fails without them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- webarkit_nft_test: markerDecompress (round trip, missing file, malformed data), NFTMarkerState defaults, ar2 handle create/delete, trackingSub worker start/quit - WebARKitNFT also builds the minizip sources file_utils.c needs (crypt, ioapi, unzip, zip), with USE_FILE32API on Emscripten - CI installs zlib1g-dev and runs webarkit_nft_test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoMove NFT tracking helpers into an independent WebARKitNFT library
AI Description
Diagram
High-Level Assessment
Files changed (16)
|
Code Review by Qodo
1.
|
AR2 handle.c and tracking.c call threadInit()/threadStartSignal() whatever WEBARKIT_NFT_THREADS says, so thread_sub.c is now always compiled and native builds always link Threads. The option now only adds trackingSub (and -pthread on Emscripten). Reported by Qodo on #76. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- check zlib init/inflate results, grow the output buffer past 4 MB and NUL-terminate it before searching it - validate field order and non-empty lengths before writing anything - write marker files in binary mode, check fopen/fwrite/fclose and remove partial output on failure - drop the remove() of the source archive: it built a wrong name and never deleted anything Reported by Qodo on #76. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- trackingInitStart() returns -1 while the previous search is uncollected, instead of overwriting the image the worker reads - trackingInitInit() checks the image allocation and thread creation and frees everything on failure - tests: >4 MB marker, binary bytes, field order, non-zlib data, source archive kept, start rejected until results are collected Reported by Qodo on #76. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- emscripten/WebARKitLib: dfe8570 on WebARKitLib dev, the squash merge of webarkit/WebARKitLib#76 (same tree as the 480fdb9 used so far) - build/ and dist/ rebuilt with emsdk 4.0.17 (npm run build-docker, npm run build-ts) The earlier commits of this PR (0cff312, 3543c45, 00cf36e) changed C/C++, JS and TS sources without committing the rebuilt build/ and dist/; this commit brings them up to date with those changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor: use the NFT helpers from WebARKitLib (#453) trackingMod, trackingMod2d, trackingSub, markerDecompress and NFTMarkerState moved to WebARKitLib (webarkit/WebARKitLib#75, #76) under WebARKit/WebARKitTrackers/WebARKitNFT. - tools/makem.js: take those sources from WebARKitLib and add its include directory - bindings (JS and Python): include <WebARKitTrackers/WebARKitNFT/...> - python-bindings/setup.py: new source and include paths - remove the copies from emscripten/ - bump the WebARKitLib submodule to feat/issue-75-webarkit-nft Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: report a failed .zft decompression through onError decompressMarkers() now returns -1 for a missing or malformed archive instead of exiting. The decompressZFT bindings returned 1 regardless, so loadZFT read temporary files that were never written and threw ENOENT before any callback ran. The bindings now return -1 on failure and loadZFT calls onError(prefix + ".zft"). Reported by Qodo on #687. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf: free the .zft archive from MEMFS once decompressed loadZFT kept /markerNFT_N.zft in the Emscripten filesystem for the whole session; the old C-side remove() built the name without the dot, so it never deleted it either. Suggested by Qodo on #687. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump WebARKitLib to dev and rebuild build/ and dist/ (#453) - emscripten/WebARKitLib: dfe8570 on WebARKitLib dev, the squash merge of webarkit/WebARKitLib#76 (same tree as the 480fdb9 used so far) - build/ and dist/ rebuilt with emsdk 4.0.17 (npm run build-docker, npm run build-ts) The earlier commits of this PR (0cff312, 3543c45, 00cf36e) changed C/C++, JS and TS sources without committing the rebuilt build/ and dist/; this commit brings them up to date with those changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump WebARKitLib to b2d6166 and rebuild build/ and dist/ - emscripten/WebARKitLib: b2d6166 on WebARKitLib dev, which adds webarkit/WebARKitLib#77 (#40: random template index computed in double precision in AR2/selectTemplate.c, fixing the -Wimplicit-const-int-float-conversion warning) - build/ and dist/ rebuilt with emsdk 4.0.17 (npm run build-docker, npm run build-ts); vitest 182 passed / 6 skipped, node 7/7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump WebARKitLib to b5e4770 and rebuild build/ and dist/ - emscripten/WebARKitLib: b5e4770 on WebARKitLib dev, which adds webarkit/WebARKitLib#80 (review fixes before 0.10.0: capped .zft decompression, trackingInitMain null check, explicit #error for AR2_CAPABLE_ADAPTIVE_TEMPLATE) - build/ and dist/ rebuilt with emsdk 4.0.17 (npm run build-docker, npm run build-ts); vitest 182 passed / 6 skipped, node 7/7 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: pin WebARKitLib to the 0.10.0 release tag Move emscripten/WebARKitLib from b5e4770 (dev) to 4fd3034, the merge commit on master tagged 0.10.0, as the 0.9.0 pin pointed at master. Both commits have the same tree, so build/ and dist/ are unchanged and need no rebuild. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Closes #75 (WebARKitLib side; the jsartoolkitNFT switch-over follows in a separate PR and resolves webarkit/jsartoolkitNFT#453).
Summary
trackingMod,trackingMod2d,trackingSub,markerDecompressandNFTMarkerStatefromjsartoolkitNFT/emscriptenintoWebARKit/WebARKitTrackers/WebARKitNFT/(headers underinclude/WebARKitTrackers/WebARKitNFT/).WebARKit/CMakeLists.txt:WEBARKIT_BUILD_OPTICAL(ON, default): the existing OpenCVWebARKitLibtarget, unchangedWEBARKIT_BUILD_NFT(OFF):WebARKitNFTstatic library, no OpenCV; also compiles the ARToolKit5 sources it needs (AR, ARICP, AR2, KPM, ARUtil + minizip), lists mirrorjsartoolkitNFT/tools/makem.jsWEBARKIT_NFT_THREADS(OFF): addstrackingSub+ pthreadsar2Tracking2dSubrenamed toar2Tracking2dSubMod(public here,staticinAR2/tracking2d.c)markerDecompress.c: dropped unused<emscripten.h>,<zlib/zlib.h>→<zlib.h>, include guard; returns-1instead of callingexit()on errorsar2CreateHandleSubModnow initialisesicpHandle/cparamLT(deleting a handle created with it segfaulted natively)lib/SRC/KPM/FreakMatcher: added missing<limits>/<unordered_map>includes, needed for GCC 13 / libstdc++.tests/webarkit_nft_test.cc(6 tests), wired into CI (zlib1g-devadded). README section on the NFT helpers.Test plan
webarkit_nft_test6/6,webarkit_test28/28WebARKitNFTbuilds with threads on; smoke binary links and runs.zftdecompression output byte-identical to jsartoolkitNFT's originalmarkerDecompress.c(examples/DataNFT/zft/pinball.zft)🤖 Generated with Claude Code