Remove some unused files

This commit is contained in:
Arun Raghavan
2024-12-30 12:48:46 -05:00
parent 6119c05d7d
commit ecb8817972
30 changed files with 0 additions and 2295 deletions

View File

@ -4,8 +4,6 @@ common_audio_sources = [
'channel_buffer.cc',
'fir_filter_c.cc',
'fir_filter_factory.cc',
'real_fourier.cc',
'real_fourier_ooura.cc',
'resampler/push_resampler.cc',
'resampler/push_sinc_resampler.cc',
'resampler/resampler.cc',
@ -55,7 +53,6 @@ common_audio_sources = [
'vad/vad_gmm.c',
'vad/vad_sp.c',
'vad/webrtc_vad.c',
'window_generator.cc',
]
arch_libs = []

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/real_fourier.h"
#include "common_audio/real_fourier_ooura.h"
#include "common_audio/signal_processing/include/signal_processing_library.h"
#include "rtc_base/checks.h"
namespace webrtc {
using std::complex;
const size_t RealFourier::kFftBufferAlignment = 32;
std::unique_ptr<RealFourier> RealFourier::Create(int fft_order) {
return std::unique_ptr<RealFourier>(new RealFourierOoura(fft_order));
}
int RealFourier::FftOrder(size_t length) {
RTC_CHECK_GT(length, 0U);
return WebRtcSpl_GetSizeInBits(static_cast<uint32_t>(length - 1));
}
size_t RealFourier::FftLength(int order) {
RTC_CHECK_GE(order, 0);
return size_t{1} << order;
}
size_t RealFourier::ComplexLength(int order) {
return FftLength(order) / 2 + 1;
}
RealFourier::fft_real_scoper RealFourier::AllocRealBuffer(int count) {
return fft_real_scoper(static_cast<float*>(
AlignedMalloc(sizeof(float) * count, kFftBufferAlignment)));
}
RealFourier::fft_cplx_scoper RealFourier::AllocCplxBuffer(int count) {
return fft_cplx_scoper(static_cast<complex<float>*>(
AlignedMalloc(sizeof(complex<float>) * count, kFftBufferAlignment)));
}
} // namespace webrtc

View File

@ -1,76 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_REAL_FOURIER_H_
#define COMMON_AUDIO_REAL_FOURIER_H_
#include <stddef.h>
#include <complex>
#include <memory>
#include "rtc_base/memory/aligned_malloc.h"
// Uniform interface class for the real DFT and its inverse, for power-of-2
// input lengths. Also contains helper functions for buffer allocation, taking
// care of any memory alignment requirements the underlying library might have.
namespace webrtc {
class RealFourier {
public:
// Shorthand typenames for the scopers used by the buffer allocation helpers.
typedef std::unique_ptr<float[], AlignedFreeDeleter> fft_real_scoper;
typedef std::unique_ptr<std::complex<float>[], AlignedFreeDeleter>
fft_cplx_scoper;
// The alignment required for all input and output buffers, in bytes.
static const size_t kFftBufferAlignment;
// Construct a wrapper instance for the given input order, which must be
// between 1 and kMaxFftOrder, inclusively.
static std::unique_ptr<RealFourier> Create(int fft_order);
virtual ~RealFourier() {}
// Helper to compute the smallest FFT order (a power of 2) which will contain
// the given input length.
static int FftOrder(size_t length);
// Helper to compute the input length from the FFT order.
static size_t FftLength(int order);
// Helper to compute the exact length, in complex floats, of the transform
// output (i.e. |2^order / 2 + 1|).
static size_t ComplexLength(int order);
// Buffer allocation helpers. The buffers are large enough to hold `count`
// floats/complexes and suitably aligned for use by the implementation.
// The returned scopers are set up with proper deleters; the caller owns
// the allocated memory.
static fft_real_scoper AllocRealBuffer(int count);
static fft_cplx_scoper AllocCplxBuffer(int count);
// Main forward transform interface. The output array need only be big
// enough for |2^order / 2 + 1| elements - the conjugate pairs are not
// returned. Input and output must be properly aligned (e.g. through
// AllocRealBuffer and AllocCplxBuffer) and input length must be
// |2^order| (same as given at construction time).
virtual void Forward(const float* src, std::complex<float>* dest) const = 0;
// Inverse transform. Same input format as output above, conjugate pairs
// not needed.
virtual void Inverse(const std::complex<float>* src, float* dest) const = 0;
virtual int order() const = 0;
};
} // namespace webrtc
#endif // COMMON_AUDIO_REAL_FOURIER_H_

View File

@ -1,91 +0,0 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "common_audio/real_fourier_ooura.h"
#include <algorithm>
#include <cmath>
#include "common_audio/third_party/ooura/fft_size_256/fft4g.h"
#include "rtc_base/checks.h"
namespace webrtc {
using std::complex;
namespace {
void Conjugate(complex<float>* array, size_t complex_length) {
std::for_each(array, array + complex_length,
[=](complex<float>& v) { v = std::conj(v); });
}
size_t ComputeWorkIpSize(size_t fft_length) {
return static_cast<size_t>(
2 + std::ceil(std::sqrt(static_cast<float>(fft_length))));
}
} // namespace
RealFourierOoura::RealFourierOoura(int fft_order)
: order_(fft_order),
length_(FftLength(order_)),
complex_length_(ComplexLength(order_)),
// Zero-initializing work_ip_ will cause rdft to initialize these work
// arrays on the first call.
work_ip_(new size_t[ComputeWorkIpSize(length_)]()),
work_w_(new float[complex_length_]()) {
RTC_CHECK_GE(fft_order, 1);
}
RealFourierOoura::~RealFourierOoura() = default;
void RealFourierOoura::Forward(const float* src, complex<float>* dest) const {
{
// This cast is well-defined since C++11. See "Non-static data members" at:
// http://en.cppreference.com/w/cpp/numeric/complex
auto* dest_float = reinterpret_cast<float*>(dest);
std::copy(src, src + length_, dest_float);
WebRtc_rdft(length_, 1, dest_float, work_ip_.get(), work_w_.get());
}
// Ooura places real[n/2] in imag[0].
dest[complex_length_ - 1] = complex<float>(dest[0].imag(), 0.0f);
dest[0] = complex<float>(dest[0].real(), 0.0f);
// Ooura returns the conjugate of the usual Fourier definition.
Conjugate(dest, complex_length_);
}
void RealFourierOoura::Inverse(const complex<float>* src, float* dest) const {
{
auto* dest_complex = reinterpret_cast<complex<float>*>(dest);
// The real output array is shorter than the input complex array by one
// complex element.
const size_t dest_complex_length = complex_length_ - 1;
std::copy(src, src + dest_complex_length, dest_complex);
// Restore Ooura's conjugate definition.
Conjugate(dest_complex, dest_complex_length);
// Restore real[n/2] to imag[0].
dest_complex[0] =
complex<float>(dest_complex[0].real(), src[complex_length_ - 1].real());
}
WebRtc_rdft(length_, -1, dest, work_ip_.get(), work_w_.get());
// Ooura returns a scaled version.
const float scale = 2.0f / length_;
std::for_each(dest, dest + length_, [scale](float& v) { v *= scale; });
}
int RealFourierOoura::order() const {
return order_;
}
} // namespace webrtc

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_REAL_FOURIER_OOURA_H_
#define COMMON_AUDIO_REAL_FOURIER_OOURA_H_
#include <stddef.h>
#include <complex>
#include <memory>
#include "common_audio/real_fourier.h"
namespace webrtc {
class RealFourierOoura : public RealFourier {
public:
explicit RealFourierOoura(int fft_order);
~RealFourierOoura() override;
void Forward(const float* src, std::complex<float>* dest) const override;
void Inverse(const std::complex<float>* src, float* dest) const override;
int order() const override;
private:
const int order_;
const size_t length_;
const size_t complex_length_;
// These are work arrays for Ooura. The names are based on the comments in
// common_audio/third_party/ooura/fft_size_256/fft4g.cc.
const std::unique_ptr<size_t[]> work_ip_;
const std::unique_ptr<float[]> work_w_;
};
} // namespace webrtc
#endif // COMMON_AUDIO_REAL_FOURIER_OOURA_H_

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_COMMON_AUDIO_REAL_FOURIER_OPENMAX_H_
#define WEBRTC_COMMON_AUDIO_REAL_FOURIER_OPENMAX_H_
#include <complex>
#include "webrtc/common_audio/real_fourier.h"
namespace webrtc {
class RealFourierOpenmax : public RealFourier {
public:
explicit RealFourierOpenmax(int fft_order);
~RealFourierOpenmax() override;
void Forward(const float* src, std::complex<float>* dest) const override;
void Inverse(const std::complex<float>* src, float* dest) const override;
int order() const override {
return order_;
}
private:
// Basically a forward declare of OMXFFTSpec_R_F32. To get rid of the
// dependency on openmax.
typedef void OMXFFTSpec_R_F32_;
const int order_;
OMXFFTSpec_R_F32_* const omx_spec_;
};
} // namespace webrtc
#endif // WEBRTC_COMMON_AUDIO_REAL_FOURIER_OPENMAX_H_

View File

@ -1,71 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#define _USE_MATH_DEFINES
#include "common_audio/window_generator.h"
#include <cmath>
#include <complex>
#include "rtc_base/checks.h"
using std::complex;
namespace {
// Modified Bessel function of order 0 for complex inputs.
complex<float> I0(complex<float> x) {
complex<float> y = x / 3.75f;
y *= y;
return 1.0f + y * (3.5156229f +
y * (3.0899424f +
y * (1.2067492f +
y * (0.2659732f +
y * (0.360768e-1f + y * 0.45813e-2f)))));
}
} // namespace
namespace webrtc {
void WindowGenerator::Hanning(int length, float* window) {
RTC_CHECK_GT(length, 1);
RTC_CHECK(window != nullptr);
for (int i = 0; i < length; ++i) {
window[i] =
0.5f * (1 - cosf(2 * static_cast<float>(M_PI) * i / (length - 1)));
}
}
void WindowGenerator::KaiserBesselDerived(float alpha,
size_t length,
float* window) {
RTC_CHECK_GT(length, 1U);
RTC_CHECK(window != nullptr);
const size_t half = (length + 1) / 2;
float sum = 0.0f;
for (size_t i = 0; i <= half; ++i) {
complex<float> r = (4.0f * i) / length - 1.0f;
sum += I0(static_cast<float>(M_PI) * alpha * sqrt(1.0f - r * r)).real();
window[i] = sum;
}
for (size_t i = length - 1; i >= half; --i) {
window[length - i - 1] = sqrtf(window[length - i - 1] / sum);
window[i] = window[length - i - 1];
}
if (length % 2 == 1) {
window[half - 1] = sqrtf(window[half - 1] / sum);
}
}
} // namespace webrtc

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_AUDIO_WINDOW_GENERATOR_H_
#define COMMON_AUDIO_WINDOW_GENERATOR_H_
#include <stddef.h>
namespace webrtc {
// Helper class with generators for various signal transform windows.
class WindowGenerator {
public:
WindowGenerator() = delete;
WindowGenerator(const WindowGenerator&) = delete;
WindowGenerator& operator=(const WindowGenerator&) = delete;
static void Hanning(int length, float* window);
static void KaiserBesselDerived(float alpha, size_t length, float* window);
};
} // namespace webrtc
#endif // COMMON_AUDIO_WINDOW_GENERATOR_H_