gstfastspectrum: Change guint to guint64

This commit is contained in:
Jonas Kvinge 2024-09-17 22:13:11 +02:00
parent f44839137c
commit 98cfef3306
2 changed files with 15 additions and 15 deletions

View File

@ -263,49 +263,49 @@ static gboolean gst_strawberry_fastspectrum_stop(GstBaseTransform *transform) {
// Mixing data readers // Mixing data readers
static void gst_strawberry_fastspectrum_input_data_mixed_float(const guint8 *_in, double *out, const guint len, const double max_value, guint op, const guint nfft) { static void gst_strawberry_fastspectrum_input_data_mixed_float(const guint8 *_in, double *out, const guint64 len, const double max_value, guint op, const guint nfft) {
(void) max_value; (void) max_value;
const gfloat *in = reinterpret_cast<const gfloat*>(_in); const gfloat *in = reinterpret_cast<const gfloat*>(_in);
guint ip = 0; guint ip = 0;
for (guint j = 0; j < len; j++) { for (guint64 j = 0; j < len; j++) {
out[op] = in[ip++]; out[op] = in[ip++];
op = (op + 1) % nfft; op = (op + 1) % nfft;
} }
} }
static void gst_strawberry_fastspectrum_input_data_mixed_double(const guint8 *_in, double *out, const guint len, const double max_value, guint op, const guint nfft) { static void gst_strawberry_fastspectrum_input_data_mixed_double(const guint8 *_in, double *out, const guint64 len, const double max_value, guint op, const guint nfft) {
(void) max_value; (void) max_value;
const gdouble *in = reinterpret_cast<const gdouble*>(_in); const gdouble *in = reinterpret_cast<const gdouble*>(_in);
guint ip = 0; guint ip = 0;
for (guint j = 0; j < len; j++) { for (guint64 j = 0; j < len; j++) {
out[op] = in[ip++]; out[op] = in[ip++];
op = (op + 1) % nfft; op = (op + 1) % nfft;
} }
} }
static void gst_strawberry_fastspectrum_input_data_mixed_int32_max(const guint8 *_in, double *out, const guint len, const double max_value, guint op, const guint nfft) { static void gst_strawberry_fastspectrum_input_data_mixed_int32_max(const guint8 *_in, double *out, const guint64 len, const double max_value, guint op, const guint nfft) {
const gint32 *in = reinterpret_cast<const gint32*>(_in); const gint32 *in = reinterpret_cast<const gint32*>(_in);
guint ip = 0; guint ip = 0;
for (guint j = 0; j < len; j++) { for (guint64 j = 0; j < len; j++) {
out[op] = in[ip++] / max_value; out[op] = in[ip++] / max_value;
op = (op + 1) % nfft; op = (op + 1) % nfft;
} }
} }
static void gst_strawberry_fastspectrum_input_data_mixed_int24_max(const guint8 *_in, double *out, const guint len, const double max_value, guint op, const guint nfft) { static void gst_strawberry_fastspectrum_input_data_mixed_int24_max(const guint8 *_in, double *out, const guint64 len, const double max_value, guint op, const guint nfft) {
for (guint j = 0; j < len; j++) { for (guint64 j = 0; j < len; j++) {
#if G_BYTE_ORDER == G_BIG_ENDIAN #if G_BYTE_ORDER == G_BIG_ENDIAN
guint32 value = GST_READ_UINT24_BE(_in); guint32 value = GST_READ_UINT24_BE(_in);
#else #else
@ -322,12 +322,12 @@ static void gst_strawberry_fastspectrum_input_data_mixed_int24_max(const guint8
} }
static void gst_strawberry_fastspectrum_input_data_mixed_int16_max(const guint8 *_in, double *out, const guint len, const double max_value, guint op, const guint nfft) { static void gst_strawberry_fastspectrum_input_data_mixed_int16_max(const guint8 *_in, double *out, const guint64 len, const double max_value, guint op, const guint nfft) {
const gint16 *in = reinterpret_cast<const gint16*>(_in); const gint16 *in = reinterpret_cast<const gint16*>(_in);
guint ip = 0; guint ip = 0;
for (guint j = 0; j < len; j++) { for (guint64 j = 0; j < len; j++) {
out[op] = in[ip++] / max_value; out[op] = in[ip++] / max_value;
op = (op + 1) % nfft; op = (op + 1) % nfft;
} }
@ -397,7 +397,7 @@ static GstFlowReturn gst_strawberry_fastspectrum_transform_ip(GstBaseTransform *
const guint rate = GST_AUDIO_FILTER_RATE(fastspectrum); const guint rate = GST_AUDIO_FILTER_RATE(fastspectrum);
const guint bps = GST_AUDIO_FILTER_BPS(fastspectrum); const guint bps = GST_AUDIO_FILTER_BPS(fastspectrum);
const guint bpf = GST_AUDIO_FILTER_BPF(fastspectrum); const guint64 bpf = GST_AUDIO_FILTER_BPF(fastspectrum);
const double max_value = static_cast<double>((1UL << ((bps << 3) - 1)) - 1); const double max_value = static_cast<double>((1UL << ((bps << 3) - 1)) - 1);
const guint bands = fastspectrum->bands; const guint bands = fastspectrum->bands;
const guint nfft = 2 * bands - 2; const guint nfft = 2 * bands - 2;
@ -447,10 +447,10 @@ static GstFlowReturn gst_strawberry_fastspectrum_transform_ip(GstBaseTransform *
while (size >= bpf) { while (size >= bpf) {
// Run input_data for a chunk of data // Run input_data for a chunk of data
guint fft_todo = nfft - (fastspectrum->num_frames % nfft); guint64 fft_todo = nfft - (fastspectrum->num_frames % nfft);
guint msg_todo = fastspectrum->frames_todo - fastspectrum->num_frames; guint64 msg_todo = fastspectrum->frames_todo - fastspectrum->num_frames;
GST_LOG_OBJECT(fastspectrum, "message frames todo: %u, fft frames todo: %u, input frames %" G_GSIZE_FORMAT, msg_todo, fft_todo, (size / bpf)); GST_LOG_OBJECT(fastspectrum, "message frames todo: %u, fft frames todo: %u, input frames %" G_GSIZE_FORMAT, msg_todo, fft_todo, (size / bpf));
guint block_size = msg_todo; guint64 block_size = msg_todo;
if (block_size > (size / bpf)) { if (block_size > (size / bpf)) {
block_size = (size / bpf); block_size = (size / bpf);
} }

View File

@ -43,7 +43,7 @@ G_BEGIN_DECLS
#define GST_STRAWBERRY_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_FASTSPECTRUM, GstStrawberryFastSpectrumClass)) #define GST_STRAWBERRY_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_FASTSPECTRUM, GstStrawberryFastSpectrumClass))
#define GST_IS_STRAWBERRY_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_FASTSPECTRUM)) #define GST_IS_STRAWBERRY_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_FASTSPECTRUM))
typedef void (*GstStrawberryFastSpectrumInputData)(const guint8 *in, double *out, guint len, double max_value, guint op, guint nfft); typedef void (*GstStrawberryFastSpectrumInputData)(const guint8 *in, double *out, guint64 len, double max_value, guint op, guint nfft);
using GstStrawberryFastSpectrumOutputCallback = std::function<void(double *magnitudes, int size)>; using GstStrawberryFastSpectrumOutputCallback = std::function<void(double *magnitudes, int size)>;