Skip to content

Class drift::WaveletBuffer

ClassList > drift > WaveletBuffer

More...

  • #include <wavelet_buffer.h>

Public Functions

Type Name
bool Compose (SignalN2D * data, int scale_factor=0) const
bool Compose (Signal1D * data, int scale_factor=0) const
bool Decompose (const SignalN2D & data, const DenoiseAlgorithm< DataType > & denoiser)
bool Decompose (const Signal1D & data, const DenoiseAlgorithm< DataType > & denoiser)
std::pair< DataType, DataType > GetValueRange (size_t index) const
bool IsEmpty () const
bool Serialize (std::string * blob, uint8_t sf_compression=0) const
WaveletBuffer (const WaveletParameters & parameters)
Initialize buffer.
WaveletBuffer (const WaveletParameters & parameters, const NWaveletDecomposition & decompositions)
WaveletBuffer (WaveletBuffer && buffer) noexcept
WaveletBuffer (const WaveletBuffer & buffer)
NWaveletDecomposition & decompositions ()
const NWaveletDecomposition & decompositions () const
bool operator!= (const WaveletBuffer & rhs) const
WaveletBufferView operator() (int index, int count)
WaveletBufferView operator() (int index, int count) const
WaveletBuffer & operator= (const WaveletBuffer & rhs)
WaveletBuffer & operator= (WaveletBuffer && rhs) noexcept
bool operator== (const WaveletBuffer & rhs) const
WaveletDecomposition & operator[] (int index)
const WaveletDecomposition & operator[] (int index) const
const WaveletParameters & parameters () const
~WaveletBuffer ()

Public Static Functions

Type Name
std::unique_ptr< WaveletBuffer > Parse (const std::string & blob)

Detailed Description

Universal buffer for the wavelet decomposition

Public Functions Documentation

function Compose [1/2]

bool drift::WaveletBuffer::Compose (
    SignalN2D * data,
    int scale_factor=0
) const

Composes the intrnal subbands into a signal

Parameters:

  • data the signal
  • scale_factor wavelet scale factor 0 - all the steps of the decomposition recomposed and the output has size of the original signal. If factor N - all the step - N are recomposed and output has size 2^N smaller

Returns:

true if it has no errors

function Compose [2/2]

bool drift::WaveletBuffer::Compose (
    Signal1D * data,
    int scale_factor=0
) const

Composes the intrnal subbands into a signal

Parameters:

  • data the signal
  • scale_factor wavelet scale factor 0 - all the steps of the decomposition recomposed and the output has size of the original signal. If factor N - all the step - N are recomposed and output has size 2^N smaller

Returns:

true if it has no errors

function Decompose [1/2]

bool drift::WaveletBuffer::Decompose (
    const SignalN2D & data,
    const DenoiseAlgorithm < DataType > & denoiser
) 

Decomposes the signal into the subbands and saves it internally

Parameters:

  • data the signal
  • denoiser algorithm to clean the small values in Hi-freq subbands

Returns:

true if it has no errors

function Decompose [2/2]

bool drift::WaveletBuffer::Decompose (
    const Signal1D & data,
    const DenoiseAlgorithm < DataType > & denoiser
) 

Decomposes the signal into the subbands and saves it internally

Parameters:

  • data the signal
  • denoiser algorithm to clean the small values in Hi-freq subbands

Returns:

true if it has no errors

function GetValueRange

std::pair< DataType, DataType > drift::WaveletBuffer::GetValueRange (
    size_t index
) const

Gets min and max factors of values in subband example: if your signal has values in interval 0..5, so the pair (-2, 2) means that you a subband has values in interval -10..10

Parameters:

  • index the index of the subband

Returns:

a pair of min and max factors

function IsEmpty

bool drift::WaveletBuffer::IsEmpty () const

Check that buffer have decomposed data

Returns:

function Serialize

bool drift::WaveletBuffer::Serialize (
    std::string * blob,
    uint8_t sf_compression=0
) const

Serialize the buffer into the blob for saving in a file or sending via network

Parameters:

  • blob the blob to serialize
  • sf_compression - 0 - switch off, 16 - max compression(bfloat).

Returns:

return true if it has no error

function WaveletBuffer [1/5]

Initialize buffer.

explicit drift::WaveletBuffer::WaveletBuffer (
    const WaveletParameters & parameters
) 

Parameters:

  • parameters the parameters of the wavelet decomposition

function WaveletBuffer [2/5]

drift::WaveletBuffer::WaveletBuffer (
    const WaveletParameters & parameters,
    const NWaveletDecomposition & decompositions
) 

Initialize buffer with decompositions

Parameters:

  • parameters the parameters of the wavelet decomposition
  • decompositions

function WaveletBuffer [3/5]

drift::WaveletBuffer::WaveletBuffer (
    WaveletBuffer && buffer
) noexcept

Parameters:

  • buffer

function WaveletBuffer [4/5]

drift::WaveletBuffer::WaveletBuffer (
    const WaveletBuffer & buffer
) 

Parameters:

  • buffer

function decompositions [1/2]

NWaveletDecomposition & drift::WaveletBuffer::decompositions () 

function decompositions [2/2]

const NWaveletDecomposition & drift::WaveletBuffer::decompositions () const

function operator!=

bool drift::WaveletBuffer::operator!= (
    const WaveletBuffer & rhs
) const

function operator() [1/2]

WaveletBufferView drift::WaveletBuffer::operator() (
    int index,
    int count
) 

Makes a view for (index, index+count) signals

Parameters:

  • index
  • count

Returns:

function operator() [2/2]

WaveletBufferView drift::WaveletBuffer::operator() (
    int index,
    int count
) const

Makes a const view for (index, index+count) signals

Parameters:

  • index
  • count

Returns:

function operator=

WaveletBuffer & drift::WaveletBuffer::operator= (
    const WaveletBuffer & rhs
) 

function operator=

WaveletBuffer & drift::WaveletBuffer::operator= (
    WaveletBuffer && rhs
) noexcept

function operator==

bool drift::WaveletBuffer::operator== (
    const WaveletBuffer & rhs
) const

function operator[]

WaveletDecomposition & drift::WaveletBuffer::operator[] (
    int index
) 

Access to the decomposition by channels NOTE: the last element is always an abstraction

Parameters:

  • index the index of the channel

Returns:

the decomposition as a list of the subbands

function operator[]

const WaveletDecomposition & drift::WaveletBuffer::operator[] (
    int index
) const

Const access to the decomposition by channels

Parameters:

  • index the index of the channel

Returns:

the decomposition as a list of the subbands

function parameters

const WaveletParameters & drift::WaveletBuffer::parameters () const

Parameters of the decomposition

function ~WaveletBuffer

drift::WaveletBuffer::~WaveletBuffer () 

Destructor, required by std::unique_ptr and PImpl

Public Static Functions Documentation

function Parse

static std::unique_ptr< WaveletBuffer > drift::WaveletBuffer::Parse (
    const std::string & blob
) 

Parses subbands from a blob of data and creates a new buffer

Parameters:

  • blob the blob of subbands

Returns:

nullptr if it failed to parse the buffer

    ## Friends Documentation

friend operator<<

std::ostream & drift::WaveletBuffer::operator<< (
    std::ostream &,
    const WaveletBuffer & wb
) 

The documentation for this class was generated from the following file wavelet_buffer/wavelet_buffer.h