upload
This commit is contained in:
38
libs/vslam_web/include/vslam/rle.h
Normal file
38
libs/vslam_web/include/vslam/rle.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef VSLAM_RLE_H
|
||||
#define VSLAM_RLE_H
|
||||
|
||||
// Ma hoa do dai loat cho occupancy grid.
|
||||
//
|
||||
// Moi run la {u16 count, i8 value} = 3 byte, hang-chinh.
|
||||
// `count` la u16 nen run > 65535 phai TACH -- de quen cho nay la bug im lang
|
||||
// tren ban do lon.
|
||||
//
|
||||
// Do tren du lieu that (tools/probe_rtabmap):
|
||||
// map_house.db 323x356 -> 5705 run, 17 kB (6.7x)
|
||||
// map_hospital.db 526x1162 -> 21242 run, 62 kB (9.6x)
|
||||
//
|
||||
// Luu y: ban do trong nha o day chi 16-42% la o "chua biet", KHONG phai >90%
|
||||
// nhu uoc luong ban dau. Ti le nen thuc te vi vay thap hon du kien, nhung
|
||||
// 62 kB cho ban do lon nhat van du nho de gui mot lan luc ket noi.
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace vslam {
|
||||
|
||||
// Noi them vao `out`. Tra ve so run da ghi.
|
||||
size_t RleEncode(const std::vector<int8_t>& data, std::string* out);
|
||||
|
||||
// Doc `count` run tu `buf` bat dau tu `offset`, ghi vao `out`.
|
||||
// Tra false neu du lieu cut hoac kich thuoc khong khop `expected_size`.
|
||||
bool RleDecode(const std::string& buf, size_t offset, size_t run_count,
|
||||
size_t expected_size, std::vector<int8_t>* out);
|
||||
|
||||
// So byte can de ma hoa `data` (= so run * 3). Dung de quyet dinh gui
|
||||
// MAP_FULL hay MAP_PATCH ma khong phai ma hoa hai lan.
|
||||
size_t RleEncodedSize(const std::vector<int8_t>& data);
|
||||
|
||||
} // namespace vslam
|
||||
|
||||
#endif // VSLAM_RLE_H
|
||||
Reference in New Issue
Block a user