kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
knf::RecyclingVector Class Reference

This class serves as a storage for feature vectors with an option to limit the memory usage by removing old elements. More...

#include <online-feature.h>

Public Member Functions

 RecyclingVector (int32_t items_to_hold=-1)
 By default it does not remove any elements.
 ~RecyclingVector ()=default
 Destructor.
 RecyclingVector (const RecyclingVector &)=delete
 Copy construction is not allowed.
RecyclingVector & operator= (const RecyclingVector &)=delete
 Assignment is not allowed.
const float * At (int32_t index) const
 Return a pointer to the feature vector at the given index.
void PushBack (std::vector< float > item)
 Append one feature vector to the end.
int32_t Size () const
 This method returns the size as if no "recycling" had happened, i.e.
void Pop (int32_t n)
 Discard the first n frames.

Detailed Description

This class serves as a storage for feature vectors with an option to limit the memory usage by removing old elements.

The deleted frames indices are "remembered" so that regardless of the MAX_ITEMS setting, the user always provides the indices as if no deletion was being performed. This is useful when processing very long recordings which would otherwise cause the memory to eventually blow up when the features are not being removed.

Used by:
OnlineGenericBaseFeature stores the computed frames in a RecyclingVector.

Constructor & Destructor Documentation

◆ RecyclingVector() [1/2]

knf::RecyclingVector::RecyclingVector ( int32_t items_to_hold = -1)
explicit

By default it does not remove any elements.

◆ ~RecyclingVector()

knf::RecyclingVector::~RecyclingVector ( )
default

Destructor.

◆ RecyclingVector() [2/2]

knf::RecyclingVector::RecyclingVector ( const RecyclingVector & )
delete

Copy construction is not allowed.

Member Function Documentation

◆ At()

const float * knf::RecyclingVector::At ( int32_t index) const

Return a pointer to the feature vector at the given index.

The pointer is owned by RecyclingVector; users should not free it.

◆ operator=()

RecyclingVector & knf::RecyclingVector::operator= ( const RecyclingVector & )
delete

Assignment is not allowed.

◆ Pop()

void knf::RecyclingVector::Pop ( int32_t n)

Discard the first n frames.

◆ PushBack()

void knf::RecyclingVector::PushBack ( std::vector< float > item)

Append one feature vector to the end.

If items_to_hold_ is exceeded, the oldest vector is deleted.

◆ Size()

int32_t knf::RecyclingVector::Size ( ) const

This method returns the size as if no "recycling" had happened, i.e.

equivalent to the number of times the PushBack method has been called.


The documentation for this class was generated from the following file:
  • /home/runner/work/kaldi-native-fbank/kaldi-native-fbank/kaldi-native-fbank/csrc/online-feature.h