Fir formatting
This commit is contained in:
@@ -63,9 +63,8 @@ static gboolean gst_fastspectrum_stop (GstBaseTransform * trans);
|
|||||||
static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in);
|
static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform * trans, GstBuffer * in);
|
||||||
static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInfo * info);
|
static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInfo * info);
|
||||||
|
|
||||||
static void
|
static void gst_fastspectrum_class_init (GstFastSpectrumClass * klass) {
|
||||||
gst_fastspectrum_class_init (GstFastSpectrumClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||||
@@ -103,6 +102,7 @@ gst_fastspectrum_class_init (GstFastSpectrumClass * klass)
|
|||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
klass->fftw_lock = new QMutex;
|
klass->fftw_lock = new QMutex;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_init (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_init (GstFastSpectrum * spectrum) {
|
||||||
@@ -365,8 +365,7 @@ static void gst_fastspectrum_run_fft (GstFastSpectrum * spectrum, guint input_po
|
|||||||
guint nfft = 2 * bands - 2;
|
guint nfft = 2 * bands - 2;
|
||||||
|
|
||||||
for (i = 0; i < nfft; i++)
|
for (i = 0; i < nfft; i++)
|
||||||
spectrum->fft_input[i] =
|
spectrum->fft_input[i] = spectrum->input_ring_buffer[(input_pos + i) % nfft];
|
||||||
spectrum->input_ring_buffer[(input_pos + i) % nfft];
|
|
||||||
|
|
||||||
// Should be safe to execute the same plan multiple times in parallel.
|
// Should be safe to execute the same plan multiple times in parallel.
|
||||||
fftw_execute(spectrum->plan);
|
fftw_execute(spectrum->plan);
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
// - Removed all properties except interval and band.
|
// - Removed all properties except interval and band.
|
||||||
|
|
||||||
|
|
||||||
#ifndef GST_MOODBAR_FASTSPECTRUM_H_
|
#ifndef GST_MOODBAR_FASTSPECTRUM_H
|
||||||
#define GST_MOODBAR_FASTSPECTRUM_H_
|
#define GST_MOODBAR_FASTSPECTRUM_H
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -45,8 +45,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
class QMutex;
|
class QMutex;
|
||||||
|
|
||||||
typedef void (*GstFastSpectrumInputData)(const guint8* in, double* out,
|
typedef void (*GstFastSpectrumInputData)(const guint8* in, double* out, guint len, double max_value, guint op, guint nfft);
|
||||||
guint len, double max_value, guint op, guint nfft);
|
|
||||||
|
|
||||||
typedef std::function<void(double* magnitudes, int size)> OutputCallback;
|
typedef std::function<void(double* magnitudes, int size)> OutputCallback;
|
||||||
|
|
||||||
@@ -95,4 +94,4 @@ GType gst_fastspectrum_get_type (void);
|
|||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif // GST_MOODBAR_FASTSPECTRUM_H_
|
#endif // GST_MOODBAR_FASTSPECTRUM_H
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ namespace {
|
|||||||
|
|
||||||
static const int sBarkBands[] = {
|
static const int sBarkBands[] = {
|
||||||
100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720,
|
100, 200, 300, 400, 510, 630, 770, 920, 1080, 1270, 1480, 1720,
|
||||||
2000, 2320, 2700, 3150, 3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500};
|
2000, 2320, 2700, 3150, 3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500
|
||||||
|
};
|
||||||
|
|
||||||
static const int sBarkBandCount = arraysize(sBarkBands);
|
static const int sBarkBandCount = arraysize(sBarkBands);
|
||||||
|
|
||||||
@@ -99,12 +100,10 @@ void MoodbarBuilder::Normalize(QList<Rgb>* vals, double Rgb::*member) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double avg = 0;
|
double avg = 0;
|
||||||
int t = 0;
|
|
||||||
for (const Rgb& rgb : *vals) {
|
for (const Rgb& rgb : *vals) {
|
||||||
const double value = rgb.*member;
|
const double value = rgb.*member;
|
||||||
if (value != mini && value != maxi) {
|
if (value != mini && value != maxi) {
|
||||||
avg += value / vals->count();
|
avg += value / vals->count();
|
||||||
t++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user