Skip to content

Conversation

@singalsu
Copy link
Collaborator

WIP, not yet good quality audio


# C & ASM flags
target_compile_options(sof_options INTERFACE -g -O3 -fPIC -DPIC -std=c99 -std=gnu99 -fgnu89-inline
target_compile_options(sof_options INTERFACE -g -fPIC -DPIC -std=c99 -std=gnu99 -fgnu89-inline
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Og?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't planning to keep this to not slow down our CI. I've never used -Og, I wonder if would be a a good compromise between speed and debug-ability on x86,

But then, the xtensa build should have all optimization to know the MCPS performance of modules.

struct module_data *md = &mod->priv;
struct comp_dev *dev = mod->dev;
struct stft_comp_data *cd;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert_can_be_cold()

static void debug_print_to_file_complex(FILE *fh, struct icomplex32 *c, int n)
{
for (int i = 0; i < n; i++)
fprintf(fh, "%d %d\n", c[i].real, c[i].imag);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%d+i%d?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data is not for humans to read. An Octave script reads it with raw ascii numbers load(), so I don't want to include formatting.

y += samples_without_wrap;

/* Check for wrap */
y = (y >= y_end) ? y - y_size : y;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, this keeps hitting me as if (y < y_end) y = y;...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. I liked the one line look for wraps but this relies on a smart compiler that is not ensured. I'll change those.


/* Allocate buffers for FFT input and output data */
fft->fft_buffer_size = fft->fft_padded_size * sizeof(struct icomplex32);
fft->fft_buf = rzalloc(SOF_MEM_FLAG_USER, fft->fft_buffer_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not rballoc()? same below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'll fix these after the component works well. I should also increse the max size of FFT Liam's vmalloc is the way to go?

Also if I increase the max size of FFT there would be quite large twiddle factors data to be moved to DRAM like SRC coefficients.


# C & ASM flags
target_compile_options(sof_options INTERFACE -g -O3 -fPIC -DPIC -std=c99 -std=gnu99 -fgnu89-inline
target_compile_options(sof_options INTERFACE -g -fPIC -DPIC -std=c99 -std=gnu99 -fgnu89-inline
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't planning to keep this to not slow down our CI. I've never used -Og, I wonder if would be a a good compromise between speed and debug-ability on x86,

But then, the xtensa build should have all optimization to know the MCPS performance of modules.

static void debug_print_to_file_complex(FILE *fh, struct icomplex32 *c, int n)
{
for (int i = 0; i < n; i++)
fprintf(fh, "%d %d\n", c[i].real, c[i].imag);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data is not for humans to read. An Octave script reads it with raw ascii numbers load(), so I don't want to include formatting.

y += samples_without_wrap;

/* Check for wrap */
y = (y >= y_end) ? y - y_size : y;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. I liked the one line look for wraps but this relies on a smart compiler that is not ensured. I'll change those.


/* Allocate buffers for FFT input and output data */
fft->fft_buffer_size = fft->fft_padded_size * sizeof(struct icomplex32);
fft->fft_buf = rzalloc(SOF_MEM_FLAG_USER, fft->fft_buffer_size);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'll fix these after the component works well. I should also increse the max size of FFT Liam's vmalloc is the way to go?

Also if I increase the max size of FFT there would be quite large twiddle factors data to be moved to DRAM like SRC coefficients.

* | 16 bits, e.g. x23 -> 46 bytes | 16 bits, e.g. 13x -> 26 bytes |
* +----------------------------------+----------------------------------+
*
*/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, these are not updated from how it was in MFCC. Need to figure out these and document.

This patch adds error check to not silently accept too large
FFT configuration request. Traced error messages are also
added to quickly see what is wrong.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch updates the headers document style to preferred
style in SOF. The similar partial documentation comments
are removed from window.c.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds 32 bit Q1.31 format window functions for better
precision in audio processing.

The constant define for Blackman is suffixed with Q15 to help
avoid using it with new 32 bit window and it's similar
constant.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds the Hann window. It provides higher attenuation
of side lobes vs. similar family Hamming window. Hann window
is suitable for use in STFT overlap-add procedure.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds build of topology
sof-hda-benchmark-stft_process16.tplg for first tests with the
new module.

Signed-off-by: Seppo Ingalsuo <[email protected]>
WIP - currently this is the same as with MFCC. Should remove
unsupported features and add more options for STFT transform
domain audio format.

Signed-off-by: Seppo Ingalsuo <[email protected]>
This module provides analysis and synthesis filters for
frequency domain processing. The used technique is short term
Fourier transform (STFT) and inverse STFT. The FFT length,
hop, and window type are configured with the bytes control
configuration blob.

WIP - the audio quality is not yet good enough

Signed-off-by: Seppo Ingalsuo <[email protected]>
@singalsu
Copy link
Collaborator Author

Improved audio quality with 32 bit window functions and switch to Hann window type.

@lgirdwood
Copy link
Member

@singalsu can you also add a Readme.md to the module directory describing usage/tuning. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants