kaldi-native-fbank C++ API
Kaldi-compatible feature extraction C++ API
Loading...
Searching...
No Matches
feature-transform.h
Go to the documentation of this file.
1
2//
3// Copyright (c) 2026 Xiaomi Corporation
4//
5// This file is copied/modified from kaldi/src/featbin/transform-feats.cc
6//
8//
9// See ../../LICENSE for more information
10
29
30#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_TRANSFORM_H_
31#define KALDI_NATIVE_FBANK_CSRC_FEATURE_TRANSFORM_H_
32
33#include <stdint.h>
34
35#include <string>
36
37#include "Eigen/Core"
39
40namespace knf {
41
68 public:
77 static FeatureTransform Read(const std::string &filename);
78
84 explicit FeatureTransform(const MatrixF &mat);
85
90 int32_t InputDim() const;
91
93 int32_t OutputDim() const;
94
104 bool IsAffine(int32_t input_dim) const;
105
121 MatrixF Apply(const MatrixF &feats) const;
122
133 void Apply(const float *feat, int32_t dim, float *out) const;
134
135 private:
136 MatrixF mat_;
137};
138
139} // namespace knf
140
141#endif // KALDI_NATIVE_FBANK_CSRC_FEATURE_TRANSFORM_H_
int32_t InputDim() const
Number of columns of the stored matrix.
void Apply(const float *feat, int32_t dim, float *out) const
Apply the transform to a single feature frame.
static FeatureTransform Read(const std::string &filename)
Read a transform matrix from a kaldi matrix file.
FeatureTransform(const MatrixF &mat)
Construct a transform from a matrix directly.
bool IsAffine(int32_t input_dim) const
True if the transform is affine for inputs of dimension input_dim.
MatrixF Apply(const MatrixF &feats) const
Apply the transform to a feature matrix.
int32_t OutputDim() const
Number of rows of the stored matrix (the output dimension).
kaldi-native-fbank/kaldi-native-fbank/csrc/feature-matrix.h
This file is part of kaldi-native-fbank.
Definition feature-cmvn.h:42
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > MatrixF
Row-major feature matrix: rows are frames, columns are features.
Definition feature-matrix.h:26