Skip to content

Commit a9f4ce4

Browse files
committed
frontend itf
1 parent 36df70c commit a9f4ce4

15 files changed

+36
-62
lines changed

speechx/examples/feat/linear_spectrogram_main.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "frontend/audio_cache.h"
2121
#include "frontend/data_cache.h"
2222
#include "frontend/feature_cache.h"
23-
#include "frontend/feature_extractor_interface.h"
23+
#include "frontend/frontend_itf.h"
2424
#include "frontend/normalizer.h"
2525
#include "kaldi/feat/wave-reader.h"
2626
#include "kaldi/util/kaldi-io.h"
@@ -170,13 +170,13 @@ int main(int argc, char* argv[]) {
170170
// feature pipeline: wave cache --> decibel_normalizer --> hanning
171171
// window -->linear_spectrogram --> global cmvn -> feat cache
172172

173-
// std::unique_ptr<ppspeech::FeatureExtractorInterface> data_source(new
173+
// std::unique_ptr<ppspeech::FrontendInterface> data_source(new
174174
// ppspeech::DataCache());
175-
std::unique_ptr<ppspeech::FeatureExtractorInterface> data_source(
175+
std::unique_ptr<ppspeech::FrontendInterface> data_source(
176176
new ppspeech::AudioCache());
177177

178178
ppspeech::DecibelNormalizerOptions db_norm_opt;
179-
std::unique_ptr<ppspeech::FeatureExtractorInterface> db_norm(
179+
std::unique_ptr<ppspeech::FrontendInterface> db_norm(
180180
new ppspeech::DecibelNormalizer(db_norm_opt, std::move(data_source)));
181181

182182
ppspeech::LinearSpectrogramOptions opt;
@@ -185,10 +185,10 @@ int main(int argc, char* argv[]) {
185185
LOG(INFO) << "frame length (ms): " << opt.frame_opts.frame_length_ms;
186186
LOG(INFO) << "frame shift (ms): " << opt.frame_opts.frame_shift_ms;
187187

188-
std::unique_ptr<ppspeech::FeatureExtractorInterface> linear_spectrogram(
188+
std::unique_ptr<ppspeech::FrontendInterface> linear_spectrogram(
189189
new ppspeech::LinearSpectrogram(opt, std::move(db_norm)));
190190

191-
std::unique_ptr<ppspeech::FeatureExtractorInterface> cmvn(
191+
std::unique_ptr<ppspeech::FrontendInterface> cmvn(
192192
new ppspeech::CMVN(FLAGS_cmvn_write_path,
193193
std::move(linear_spectrogram)));
194194

speechx/speechx/frontend/audio_cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
#pragma once
1717

1818
#include "base/common.h"
19-
#include "frontend/feature_extractor_interface.h"
19+
#include "frontend/frontend_itf.h"
2020

2121
namespace ppspeech {
2222

2323
// waves cache
24-
class AudioCache : public FeatureExtractorInterface {
24+
class AudioCache : public FrontendInterface {
2525
public:
2626
explicit AudioCache(int buffer_size = kint16max);
2727

speechx/speechx/frontend/data_cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818

1919
#include "base/common.h"
20-
#include "frontend/feature_extractor_interface.h"
20+
#include "frontend/frontend_itf.h"
2121

2222

2323
namespace ppspeech {
2424
// A data source for testing different frontend module.
2525
// It accepts waves or feats.
26-
class DataCache : public FeatureExtractorInterface {
26+
class DataCache : public FrontendInterface {
2727
public:
2828
explicit DataCache() { finished_ = false; }
2929

speechx/speechx/frontend/fbank.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
namespace ppspeech {
2222

23-
class FbankExtractor : FeatureExtractorInterface {
23+
class FbankExtractor : FrontendInterface {
2424
public:
2525
explicit FbankExtractor(const FbankOptions& opts,
26-
share_ptr<FeatureExtractorInterface> pre_extractor);
26+
share_ptr<FrontendInterface> pre_extractor);
2727
virtual void AcceptWaveform(
2828
const kaldi::Vector<kaldi::BaseFloat>& input) = 0;
2929
virtual void Read(kaldi::Vector<kaldi::BaseFloat>* feat) = 0;

speechx/speechx/frontend/feature_cache.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ using kaldi::SubVector;
2424
using std::unique_ptr;
2525

2626
FeatureCache::FeatureCache(
27-
int max_size, unique_ptr<FeatureExtractorInterface> base_extractor) {
27+
int max_size, unique_ptr<FrontendInterface> base_extractor) {
2828
max_size_ = max_size;
2929
base_extractor_ = std::move(base_extractor);
3030
}

speechx/speechx/frontend/feature_cache.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
#pragma once
1616

1717
#include "base/common.h"
18-
#include "frontend/feature_extractor_interface.h"
18+
#include "frontend/frontend_itf.h"
1919

2020
namespace ppspeech {
2121

22-
class FeatureCache : public FeatureExtractorInterface {
22+
class FeatureCache : public FrontendInterface {
2323
public:
2424
explicit FeatureCache(
2525
int32 max_size = kint16max,
26-
std::unique_ptr<FeatureExtractorInterface> base_extractor = NULL);
26+
std::unique_ptr<FrontendInterface> base_extractor = NULL);
2727

2828
// Feed feats or waves
2929
virtual void Accept(const kaldi::VectorBase<kaldi::BaseFloat>& inputs);
@@ -53,7 +53,7 @@ class FeatureCache : public FeatureExtractorInterface {
5353
bool Compute();
5454

5555
size_t max_size_;
56-
std::unique_ptr<FeatureExtractorInterface> base_extractor_;
56+
std::unique_ptr<FrontendInterface> base_extractor_;
5757

5858
std::mutex mutex_;
5959
std::queue<kaldi::Vector<BaseFloat>> cache_;

speechx/speechx/frontend/feature_extractor_controller.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

speechx/speechx/frontend/feature_extractor_controller_impl.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

speechx/speechx/frontend/feature_extractor_interface.h renamed to speechx/speechx/frontend/frontend_itf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
namespace ppspeech {
2121

22-
class FeatureExtractorInterface {
22+
class FrontendInterface {
2323
public:
2424
// Feed inputs: features(2D saved in 1D) or waveforms(1D).
2525
virtual void Accept(const kaldi::VectorBase<kaldi::BaseFloat>& inputs) = 0;

speechx/speechx/frontend/linear_spectrogram.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using std::vector;
2727

2828
LinearSpectrogram::LinearSpectrogram(
2929
const LinearSpectrogramOptions& opts,
30-
std::unique_ptr<FeatureExtractorInterface> base_extractor) {
30+
std::unique_ptr<FrontendInterface> base_extractor) {
3131
opts_ = opts;
3232
base_extractor_ = std::move(base_extractor);
3333
int32 window_size = opts.frame_opts.WindowSize();

0 commit comments

Comments
 (0)