-
Notifications
You must be signed in to change notification settings - Fork 8
Fix small-marker detection under downsampling (AKAZE) — #53 #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
18
commits into
dev
Choose a base branch
from
copilot/investigate-small-marker-detection-issue
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+300
−33
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9ddc65d
fix for issue https://github.com/webarkit/jsartoolkitNFT/issues/364
kalwalt 0110870
improved log with emscripten_log uilities
kalwalt a21f659
fix for issue https://github.com/webarkit/jsartoolkitNFT/issues/363
kalwalt 70537cd
check workspace to fix the issue
kalwalt 1bfc1b2
add WebARKitVideoLuma module for luma conversion with SIMD support
kalwalt 3fb79f9
refactor: encapsulate WebARKitVideoLuma functions within webarkit nam…
kalwalt 597d1a0
refactor: replace raw memory management with smart pointers in WebARK…
kalwalt 59cad46
refactor: rename ARVideoLumaInfo to WebARKitLumaInfo and update relat…
kalwalt b2dd75e
refactor: rename functions in WebARKitVideoLuma for consistency and c…
kalwalt d60dd39
refactor: update SIMD preprocessor directives from EMSCRIPTEN_SIMD128…
kalwalt 1dbeab5
refactor: replace printf statements with logging functions for better…
kalwalt 656436e
version 1.7.6
kalwalt 2c9f630
fix(kpm/matcher): use std::map for deterministic iteration in vote ta…
kalwalt ce5c280
Merge pull request #60 from webarkit/dev
kalwalt 0289782
Initial plan
Copilot 10b9ca3
Fix small-marker detection: full-res retry + OCVT-aligned AKAZE params
Copilot f9c68a8
Address review: fix float/double literal inconsistency and retry thre…
Copilot cbfbc74
fix: close AKAZE retry boundary gap and correct threshold comment
kalwalt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
WebARKit/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| #include <WebARKitVideoLuma.h> | ||
|
|
||
| namespace webarkit { | ||
|
|
||
| WebARKitLumaInfo *webarkitVideoLumaInit(int xsize, int ysize, bool simd128) { | ||
| WebARKitLumaInfo *vli = new WebARKitLumaInfo; | ||
|
|
||
| if (!vli) { | ||
| webarkitLOGe("Out of memory!!"); | ||
| return nullptr; | ||
| } | ||
| vli->xsize = xsize; | ||
| vli->ysize = ysize; | ||
| vli->buffSize = xsize * ysize; | ||
| vli->simd128 = simd128; | ||
| vli->buff = std::make_unique<uint8_t[]>(vli->buffSize); | ||
| if (!vli->buff) { | ||
| webarkitLOGe("Out of memory!!\n"); | ||
| delete vli; | ||
| return nullptr; | ||
| } | ||
|
|
||
| return vli; | ||
| } | ||
|
|
||
| uint8_t *__restrict webarkitVideoLuma(WebARKitLumaInfo *vli, | ||
| const uint8_t *__restrict dataPtr) { | ||
| //unsigned int p, q; | ||
|
|
||
| if (vli->simd128 == true) { | ||
| #ifdef __wasm_simd128__ | ||
| webarkitVideoLumaRGBAtoLuma_Emscripten_simd128( | ||
| vli->buff.get(), (unsigned char *__restrict)dataPtr, vli->buffSize); | ||
| return vli->buff.get(); | ||
| #else | ||
| webarkitVideoLuma_default(vli->buff.get(), (unsigned char *__restrict)dataPtr, vli->buffSize); | ||
| return vli->buff.get(); | ||
| #endif | ||
| } else { | ||
| webarkitVideoLuma_default(vli->buff.get(), (unsigned char *__restrict)dataPtr, vli->buffSize); | ||
| return vli->buff.get(); | ||
| } | ||
| } | ||
|
|
||
| int webarkitVideoLumaFinal(WebARKitLumaInfo **vli_p) { | ||
| if (!vli_p) | ||
| return -1; | ||
| if (!*vli_p) | ||
| return 0; | ||
|
|
||
| delete *vli_p; | ||
| *vli_p = nullptr; | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| static void webarkitVideoLuma_default(uint8_t *__restrict dest, | ||
| uint8_t *__restrict src, int32_t numPixels) { | ||
| unsigned int p, q; | ||
| webarkitLOGd("Using webarkitVideoLuma_default for luma conversion!!!"); | ||
| q = 0; | ||
| for (p = 0; p < numPixels; p++) { | ||
| dest[p] = (R8_CCIR601 * src[q + 0] + G8_CCIR601 * src[q + 1] + | ||
| B8_CCIR601 * src[q + 2]) >> | ||
| 8; | ||
| q += 4; | ||
| } | ||
| } | ||
|
|
||
| #ifdef __wasm_simd128__ | ||
| static void webarkitVideoLumaRGBAtoLuma_Emscripten_simd128(uint8_t *__restrict dest, | ||
| uint8_t *__restrict src, | ||
| int32_t numPixels) { | ||
|
|
||
| webarkitLOGd("Using webarkitVideoLumaRGBAtoLuma_Emscripten_simd128 for Luma conversion !!!"); | ||
|
|
||
| v128_t *pin = (v128_t *)src; | ||
| int64_t *pout = (int64_t *)dest; | ||
| int numPixelsDiv8 = numPixels / 8; | ||
|
|
||
| v128_t maskRedBlue = wasm_i32x4_splat(0x00FF00FF); | ||
| v128_t scaleRedBlue = | ||
| wasm_i32x4_splat((uint32_t)B8_CCIR601 << 16 | R8_CCIR601); | ||
| v128_t scaleGreen = wasm_i32x4_splat(G8_CCIR601); | ||
| do { | ||
| v128_t pixels1 = wasm_v128_load(pin); // Load 16 bytes (4 pixels) from src | ||
| v128_t pixels2 = wasm_v128_load(pin + 1); | ||
| pin += 2; | ||
|
|
||
| v128_t g1 = wasm_u16x8_shr(pixels1, 8); | ||
| v128_t g2 = wasm_u16x8_shr(pixels2, 8); | ||
|
|
||
| v128_t rb1 = wasm_v128_and(pixels1, maskRedBlue); | ||
| v128_t rb2 = wasm_v128_and(pixels2, maskRedBlue); | ||
|
|
||
| g1 = wasm_i32x4_dot_i16x8(g1, scaleGreen); | ||
| g2 = wasm_i32x4_dot_i16x8(g2, scaleGreen); | ||
| rb1 = wasm_i32x4_dot_i16x8(rb1, scaleRedBlue); | ||
| rb2 = wasm_i32x4_dot_i16x8(rb2, scaleRedBlue); | ||
|
|
||
| v128_t y1 = wasm_i32x4_add(g1, rb1); | ||
| v128_t y2 = wasm_i32x4_add(g2, rb2); | ||
|
|
||
| y1 = wasm_u32x4_shr(y1, 8); | ||
| y2 = wasm_u32x4_shr(y2, 8); | ||
|
|
||
| v128_t y = wasm_i16x8_narrow_i32x4(y1, y2); | ||
| y = wasm_u8x16_narrow_i16x8(y, y); | ||
|
|
||
| *pout = wasm_i64x2_extract_lane(y, 0); | ||
|
|
||
| pout++; | ||
| numPixelsDiv8--; | ||
| } while (numPixelsDiv8); | ||
| } | ||
| #endif | ||
|
|
||
| } // namespace webarkit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #ifndef WEBARKITVIDEOLUMA_H | ||
| #define WEBARKITVIDEOLUMA_H | ||
|
|
||
| #include <cstdint> | ||
| #include <cstdbool> | ||
| #include <memory> | ||
| #include <WebARKit/WebARKitLog.h> | ||
|
|
||
| #ifdef __wasm_simd128__ | ||
| #include <wasm_simd128.h> // For SIMD operations | ||
| #endif | ||
|
|
||
| namespace webarkit { | ||
|
|
||
| // CCIR 601 recommended values. See | ||
| // http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC11 . | ||
| const uint8_t R8_CCIR601 = 77; | ||
| const uint8_t G8_CCIR601 = 150; | ||
| const uint8_t B8_CCIR601 = 29; | ||
|
|
||
| struct WebARKitLumaInfo { | ||
| int xsize; | ||
| int ysize; | ||
| int buffSize; | ||
| bool simd128; | ||
| std::unique_ptr<uint8_t[]> buff; | ||
| }; | ||
|
|
||
| #ifdef __wasm_simd128__ | ||
| static void webarkitVideoLumaRGBAtoLuma_Emscripten_simd128(uint8_t *__restrict dest, | ||
| uint8_t *__restrict src, | ||
| int32_t numPixels); | ||
| #endif | ||
|
|
||
| static void webarkitVideoLuma_default(uint8_t *__restrict dest, uint8_t *__restrict src, | ||
| int32_t numPixels); | ||
|
|
||
| WebARKitLumaInfo *webarkitVideoLumaInit(int xsize, int ysize, bool simd128); | ||
|
|
||
| uint8_t *__restrict webarkitVideoLuma(WebARKitLumaInfo *vli, | ||
| const uint8_t *__restrict dataPtr); | ||
|
|
||
| int webarkitVideoLumaFinal(WebARKitLumaInfo **vli_p); | ||
|
|
||
| } // namespace webarkit | ||
|
|
||
| #endif // WEBARKITVIDEOLUMA_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.