Skip to content

Commit

Permalink
rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
takenori-y committed Oct 11, 2022
1 parent 1f0f26d commit 6e41960
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ set(CC_SOURCES
${SOURCE_DIR}/math/two_dimensional_inverse_fast_fourier_transform.cc
${SOURCE_DIR}/math/two_dimensional_real_valued_fast_fourier_transform.cc
${SOURCE_DIR}/math/vandermonde_system_solver.cc
${SOURCE_DIR}/postfilter/mel_cepstrum_postfilter.cc
${SOURCE_DIR}/utils/data_symmetrizing.cc
${SOURCE_DIR}/utils/mel_cepstrum_postfiltering.cc
${SOURCE_DIR}/utils/misc_utils.cc
${SOURCE_DIR}/utils/sptk_utils.cc
${SOURCE_DIR}/window/chebyshev_window.cc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// limitations under the License. //
// ------------------------------------------------------------------------ //

#ifndef SPTK_UTILS_MEL_CEPSTRUM_POSTFILTERING_H_
#define SPTK_UTILS_MEL_CEPSTRUM_POSTFILTERING_H_
#ifndef SPTK_POSTFILTER_MEL_CEPSTRUM_POSTFILTER_H_
#define SPTK_POSTFILTER_MEL_CEPSTRUM_POSTFILTER_H_

#include <vector> // std::vector

Expand Down Expand Up @@ -50,10 +50,10 @@ namespace sptk {
* synthesis,&quot; Systems and Computers in Japan, vol. 36, no. 12,
* pp. 43-50, 2005.
*/
class MelCepstrumPostfiltering {
class MelCepstrumPostfilter {
public:
/**
* Buffer for MelCepstrumPostfiltering class.
* Buffer for MelCepstrumPostfilter class.
*/
class Buffer {
public:
Expand All @@ -72,7 +72,7 @@ class MelCepstrumPostfiltering {
FrequencyTransform::Buffer buffer_for_frequency_transform_;
CepstrumToAutocorrelation::Buffer buffer_for_cepstrum_to_autocorrelation_;

friend class MelCepstrumPostfiltering;
friend class MelCepstrumPostfilter;
DISALLOW_COPY_AND_ASSIGN(Buffer);
};

Expand All @@ -84,10 +84,10 @@ class MelCepstrumPostfiltering {
* @param[in] alpha All-pass constant, @f$\alpha@f$.
* @param[in] beta Intensity of postfiltering, @f$\beta@f$.
*/
MelCepstrumPostfiltering(int num_order, int impulse_response_length,
int onset_index, double alpha, double beta);
MelCepstrumPostfilter(int num_order, int impulse_response_length,
int onset_index, double alpha, double beta);

virtual ~MelCepstrumPostfiltering() {
virtual ~MelCepstrumPostfilter() {
}

/**
Expand Down Expand Up @@ -140,15 +140,15 @@ class MelCepstrumPostfiltering {
*/
bool Run(const std::vector<double>& mel_cepstrum,
std::vector<double>* postfiltered_mel_cepstrum,
MelCepstrumPostfiltering::Buffer* buffer) const;
MelCepstrumPostfilter::Buffer* buffer) const;

/**
* @param[in,out] input_and_output @f$M@f$-th order mel-cepstral coefficients.
* @param[out] buffer Buffer.
* @return True on success, false on failure.
*/
bool Run(std::vector<double>* input_and_output,
MelCepstrumPostfiltering::Buffer* buffer) const;
MelCepstrumPostfilter::Buffer* buffer) const;

private:
const int onset_index_;
Expand All @@ -163,9 +163,9 @@ class MelCepstrumPostfiltering {

bool is_valid_;

DISALLOW_COPY_AND_ASSIGN(MelCepstrumPostfiltering);
DISALLOW_COPY_AND_ASSIGN(MelCepstrumPostfilter);
};

} // namespace sptk

#endif // SPTK_UTILS_MEL_CEPSTRUM_POSTFILTERING_H_
#endif // SPTK_POSTFILTER_MEL_CEPSTRUM_POSTFILTER_H_
10 changes: 5 additions & 5 deletions src/main/mcpf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <vector> // std::vector

#include "Getopt/getoptwin.h"
#include "SPTK/utils/mel_cepstrum_postfiltering.h"
#include "SPTK/postfilter/mel_cepstrum_postfilter.h"
#include "SPTK/utils/sptk_utils.h"

namespace {
Expand Down Expand Up @@ -190,10 +190,10 @@ int main(int argc, char* argv[]) {
}
std::istream& input_stream(ifs.fail() ? std::cin : ifs);

sptk::MelCepstrumPostfiltering mel_cepstrum_postfiltering(
sptk::MelCepstrumPostfilter mel_cepstrum_postfilter(
num_order, impulse_response_length, onset_index, alpha, beta);
sptk::MelCepstrumPostfiltering::Buffer buffer;
if (!mel_cepstrum_postfiltering.IsValid()) {
sptk::MelCepstrumPostfilter::Buffer buffer;
if (!mel_cepstrum_postfilter.IsValid()) {
std::ostringstream error_message;
error_message << "FFT length must be a power of 2 and greater than 1";
sptk::PrintErrorMessage("mcpf", error_message);
Expand All @@ -205,7 +205,7 @@ int main(int argc, char* argv[]) {

while (sptk::ReadStream(false, 0, 0, length, &mel_cepstrum, &input_stream,
NULL)) {
if (!mel_cepstrum_postfiltering.Run(&mel_cepstrum, &buffer)) {
if (!mel_cepstrum_postfilter.Run(&mel_cepstrum, &buffer)) {
std::ostringstream error_message;
error_message << "Failed to apply postfilter for mel-cepstrum";
sptk::PrintErrorMessage("mcpf", error_message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
// limitations under the License. //
// ------------------------------------------------------------------------ //

#include "SPTK/utils/mel_cepstrum_postfiltering.h"
#include "SPTK/postfilter/mel_cepstrum_postfilter.h"

#include <algorithm> // std::copy, std::transform
#include <cmath> // std::log
#include <cstddef> // std::size_t

namespace sptk {

MelCepstrumPostfiltering::MelCepstrumPostfiltering(int num_order,
int impulse_response_length,
int onset_index,
double alpha, double beta)
MelCepstrumPostfilter::MelCepstrumPostfilter(int num_order,
int impulse_response_length,
int onset_index, double alpha,
double beta)
: onset_index_(onset_index),
beta_(beta),
frequency_transform_(num_order, impulse_response_length - 1, -alpha),
Expand All @@ -45,10 +45,9 @@ MelCepstrumPostfiltering::MelCepstrumPostfiltering(int num_order,
}
}

bool MelCepstrumPostfiltering::Run(
const std::vector<double>& mel_cepstrum,
std::vector<double>* postfiltered_mel_cepstrum,
MelCepstrumPostfiltering::Buffer* buffer) const {
bool MelCepstrumPostfilter::Run(const std::vector<double>& mel_cepstrum,
std::vector<double>* postfiltered_mel_cepstrum,
MelCepstrumPostfilter::Buffer* buffer) const {
// Check inputs.
const int length(GetNumOrder() + 1);
if (!is_valid_ || mel_cepstrum.size() != static_cast<std::size_t>(length) ||
Expand Down Expand Up @@ -127,9 +126,8 @@ bool MelCepstrumPostfiltering::Run(
return true;
}

bool MelCepstrumPostfiltering::Run(
std::vector<double>* input_and_output,
MelCepstrumPostfiltering::Buffer* buffer) const {
bool MelCepstrumPostfilter::Run(std::vector<double>* input_and_output,
MelCepstrumPostfilter::Buffer* buffer) const {
if (NULL == input_and_output) return false;
return Run(*input_and_output, input_and_output, buffer);
}
Expand Down

0 comments on commit 6e41960

Please sign in to comment.