A universal C++ compression library based on wavelet transformation
Project description
WaveletBuffer
A universal C++ compression library based on wavelet transformation
Requirements
- CMake >= 3.16
- C++17 compiler
- conan
Bindings
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})
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;
}
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.3.0.tar.gz
(45.5 kB
view hashes)
Built Distributions
Close
Hashes for wavelet_buffer-0.3.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025edac0af0b904622fc36fff3d5c81f8301cda1a28f1e43e6811b716e2cf98c |
|
MD5 | 5a148e2fb0e5af9b1ce7142bca01a6aa |
|
BLAKE2b-256 | 940a83c97192841227dfa15fb0b87273931c4c4cae064b1e76ea72874a85b924 |
Close
Hashes for wavelet_buffer-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f50a1d636f4a5ca1c94b4291feed30e6c8d4550ee926ae50594fbb2bd0f4574 |
|
MD5 | cb6de80ad8f3c4db51828e54bbd448c5 |
|
BLAKE2b-256 | abf91a43236c9cf301a3354523023d44a782e237201850d07956d6ac0249a2bb |
Close
Hashes for wavelet_buffer-0.3.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3473484f3134c828445ce38cf3fb591d88bac398f98dd4d15cd01e6056b79ccb |
|
MD5 | 037cf5adde0c9cb49f801bc23c2609ca |
|
BLAKE2b-256 | d6f4a0938a50d503bf8081540de37731b59995019deb2473375e0e75e79cd5f4 |
Close
Hashes for wavelet_buffer-0.3.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4137e1646dee107d2d898a8f4dbeac51148fd361c4bec4b75f5ceb91872a0c5a |
|
MD5 | a6e023fe2f39c4931c1bce85caccf211 |
|
BLAKE2b-256 | 621ac283a3abaaaf22bed7bce785e0fa663aa66cd4c1f59aa3acabb0bdf39de2 |
Close
Hashes for wavelet_buffer-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 279046dd16396034af236e17e7a67056f3217b3d540958a8cd98166a6515f5be |
|
MD5 | c93af77d3a50d1e0d712ab9ec27855a2 |
|
BLAKE2b-256 | 8680fc84925ea2e0da53d1505548ee23e83472db8d8eb72d7a358c9594cca7a6 |
Close
Hashes for wavelet_buffer-0.3.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22ad0920f4299316b094af033a1333706a092f4d9a679ce167f0a9c0bdfd68e6 |
|
MD5 | fd238601bc0281b70a51b22a001c62ab |
|
BLAKE2b-256 | e7227bdb0f9a1da425954079587e08cb079d6b9f11bf54be67b141bfc9e62718 |
Close
Hashes for wavelet_buffer-0.3.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40a42403ed9fe7bec98f7bedfe44f6a727eb8a2753edd9d03ac66fd3392569ff |
|
MD5 | c8bf3502d1f246f6d94cbb18a5675876 |
|
BLAKE2b-256 | 40292df89fd5f948c2451546d3686bdd367a59b46be993d109b4f1521d42e86d |
Close
Hashes for wavelet_buffer-0.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89732766f10dcec6f81c3dfef65510c824aaf27a92dc1d22bd475881c117f7b1 |
|
MD5 | d4f3995da3d1b2659d44fdda573d062c |
|
BLAKE2b-256 | 7a605679081d50e0ec5808b63166701a7235849c27607e70ed7fcb1d86dc5bbb |
Close
Hashes for wavelet_buffer-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08ceb9cb7ff09461f92166597c9cd5450c5bb7563b01a641a091dcabd19d30e7 |
|
MD5 | 569465964501212782748b01f02a02ce |
|
BLAKE2b-256 | 084fa8515d3e80b1833decf8e83c659378e9f1c49a7584c9e648d096cbb34c02 |