A universal C++ compression library based on wavelet transformation
Project description
WaveletBuffer
A universal C++ compression library based on wavelet transformation
Features
- Written in Modern C++
- One-side wavelet decomposition for vectors and matrices
- 5 Daubechies Wavelets DB1-DB5
- Different denoising algorithms
- Fast and efficient compression with MatrixCompressor
- Cross-platform
Requirements
- CMake >= 3.16
- C++20 compiler
- conan >= 1.56, < 2.0
Bindings
Usage Example
#include <wavelet_buffer/wavelet_buffer.h>
using drift::Signal1D;
using drift::WaveletBuffer;
using drift::WaveletParameters;
using drift::WaveletTypes;
using DenoiseAlgo = drift::ThresholdAbsDenoiseAlgorithm<float>;
int main() {
Signal1D original = blaze::generate(
1000, [](auto index) { return static_cast<float>(index % 100); });
std::cout << "Original size: " << original.size() * 4 << std::endl;
WaveletBuffer buffer(WaveletParameters{
.signal_shape = {original.size()},
.signal_number = 1,
.decomposition_steps = 3,
.wavelet_type = WaveletTypes::kDB1,
});
// Wavelet decomposition of the signal and denoising
buffer.Decompose(original, DenoiseAlgo(0, 0.3));
// Compress the buffer
std::string arch;
buffer.Serialize(&arch, 16);
std::cout << "Compressed size: " << arch.size() << std::endl;
// Decompress the buffer
auto restored_buffer = WaveletBuffer::Parse(arch);
Signal1D output_signal;
// Restore the signal from wavelet decomposition
restored_buffer->Compose(&output_signal);
std::cout << "Distance between original and restored signal: "
<< blaze::norm(original - output_signal) / original.size()
<< std::endl;
std::cout << "Compression rate: " << original.size() * 4. / arch.size() * 100
<< "%" << std::endl;
}
Build and Installing
On Ubuntu:
git clone https://github.com/panda-official/WaveletBuffer.git
mkdir build && cd build
cmake -DWB_BUILD_TESTS=ON -DWB_BUILD_BENCHMARKS=ON -DWB_BUILD_EXAMPLES=ON -DCODE_COVERAGE=ON ..
cmake --build . --target install
On MacOS:
git clone https://github.com/panda-official/WaveletBuffer.git
mkdir build && cd build
cmake -DWB_BUILD_TESTS=ON -DWB_BUILD_BENCHMARKS=ON -DWB_BUILD_EXAMPLES=ON -DCODE_COVERAGE=ON ..
cmake --build . --target install
On Windows:
git clone https://github.com/panda-official/WaveletBuffer.git
mkdir build && cd build
cmake -DWB_BUILD_TESTS=ON -DWB_BUILD_BENCHMARKS=ON -DWB_BUILD_EXAMPLES=ON -DCODE_COVERAGE=ON ..
cmake --build . --config Release --target install
Integration
Using cmake target
find_package(wavelet_buffer REQUIRED)
add_executable(program program.cpp)
target_link_libraries(program wavelet_buffer::wavelet_buffer)
# WaveletBuffer use blaze as linear algebra library which expects you to have a LAPACK library installed
# (it will still work without LAPACK and will not be reduced in functionality, but performance may be limited)
find_package(LAPACK REQUIRED)
target_link_libraries(program ${LAPACK_LIBRARIES})
References
- Documentation
- Drift Protocol - Protobuf Libraries to encode message in Drift infrastructure
- Drift Python Client - Python Client to access data of PANDA|Drift
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wavelet-buffer-0.7.0.tar.gz
(60.2 kB
view hashes)
Built Distributions
Close
Hashes for wavelet_buffer-0.7.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d776bc9a8165eb830c379d41b730de7f74ddd72586f7a7719004a3d163edcc7a |
|
MD5 | dc2b3a366509590a63298568765d3bd0 |
|
BLAKE2b-256 | d5b4df96cc712f65352cc7194b385f3932037b05fac8d55794895de2838a6971 |
Close
Hashes for wavelet_buffer-0.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4e5f43b5371464f93dbd092b5533757faf2fe28301906e1cf996bc560dc7ed0 |
|
MD5 | a52286cbe2df715612b9fddc1283376a |
|
BLAKE2b-256 | ee7057c26a268599ad97812d3e450d3cef146151a43c45dc639e3aedce01d7b8 |
Close
Hashes for wavelet_buffer-0.7.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf66d6f0734050174b68ce615522ee1ac77974d8988f4fdeab62f1e971aadb9f |
|
MD5 | 0f3d151300f8c5d719765a858803df54 |
|
BLAKE2b-256 | 74dc3c45f28402e7a286c108c650717b2b1c60fe2701c9d5100dbd8accffc3b8 |
Close
Hashes for wavelet_buffer-0.7.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55050b2d1636282687456f6fb2d3f8ade28859d031274578880c282a88ad81a3 |
|
MD5 | b847d3fc4627a1167f3cc93273117424 |
|
BLAKE2b-256 | 1c9b0be51164d86ca56a3a24875208f5e306d74f99c6495f06ff5763330ed410 |
Close
Hashes for wavelet_buffer-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f6144825b5f107313e80c64f8640be04f5ed2f4efefd8af47732762a3c9131 |
|
MD5 | 08eb0c2ed927e8b9a655fd0c3ed57f7c |
|
BLAKE2b-256 | 652b321a385c619af8dfe79749793fbbd94b35144c897794b6fab5bf51d9d623 |
Close
Hashes for wavelet_buffer-0.7.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4da4936cf63f4f52ba694aacf212f11ed25741c0f2e76145d5f2c06bbd403c35 |
|
MD5 | 402d451f9281433fd1f01f692e382c50 |
|
BLAKE2b-256 | 77ebbe6341b4aa8ec51f35ef145035a7431ed0f6b6ed7d88bd3ce70c2d4c38ce |
Close
Hashes for wavelet_buffer-0.7.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21d751ac737d8d0b7406559e00fc42500e8395315d71f4b5e88e50090219c778 |
|
MD5 | 7f2767aa8ef55c183a89df27ddfa7780 |
|
BLAKE2b-256 | a01123a803f18affe4cd40e5d741cae1e4da3f7b9f0712bec8d665fd62b1ee03 |
Close
Hashes for wavelet_buffer-0.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07dcdb20325a880d02dc1f5a166d02795c20bf3d93167fa6b8e23960883b3e82 |
|
MD5 | 2849368eba741032308d50613076404a |
|
BLAKE2b-256 | 58e55c2c3260e613b48d28af719c1313078fd041c67cc86be924cafc5d284d8b |
Close
Hashes for wavelet_buffer-0.7.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddfc6a0f1b63bdfad4ccb7a26fc50be183f9083be59733447b8f82e24c7621f5 |
|
MD5 | 0cef62984c2361af6664bff2e6b80e85 |
|
BLAKE2b-256 | 028bc5820932bb12d3836131e4cf14425fc955b8307f12f4a471b23463a2b795 |