jsseng / herbie_rtabmap

BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Optimize the loop to store the visual words #1

Open jsseng opened 3 years ago

jsseng commented 3 years ago

The visual words are stored in memory as 256 floats, where each float is a 0 or 1. It needs to be stored in memory this way to work, but when saving to disk, it will save space to store them as 32 bytes. Each byte has 8 bits, so 8*32 gives the 256 binary values.

Here is the store and load loops. Right now, the store is just a single command, but it should convert to bytes for speed and to save space. The loading loop should convert the bytes back into 256 floats.

https://github.com/jsseng/herbie_rtabmap/blob/b53a328882997fdb8be8b5dd9b4684af1b78f321/corelib/src/rtflann/algorithms/kdtree_index.h#L1380

https://github.com/jsseng/herbie_rtabmap/blob/b53a328882997fdb8be8b5dd9b4684af1b78f321/corelib/src/rtflann/algorithms/kdtree_index.h#L1412-L1418

Rockjack00 commented 3 years ago

In the save_index function, a starting address is specified for the virtual memory map. Is this related to Herie's hardware requirements?

https://github.com/jsseng/herbie_rtabmap/blob/b53a328882997fdb8be8b5dd9b4684af1b78f321/corelib/src/rtflann/algorithms/kdtree_index.h#L1215

Secondly, the address returned by mmap() is checked to be valid, but then starting_addr is indexed off of to write the visual words. Shouldn't addr be used when referencing the virtual memory map rather than starting_addr (since the kernel could return a different location)?

https://github.com/jsseng/herbie_rtabmap/blob/b53a328882997fdb8be8b5dd9b4684af1b78f321/corelib/src/rtflann/algorithms/kdtree_index.h#L1215-L1239