|
ESP-IDF Firmware
Firmware architecture and call graph
|
Go to the source code of this file.
Data Structures | |
| struct | dsps_resample_mr_s |
| Data struct of f32 multi-rate resampler. More... | |
| struct | dsps_resample_ph_s |
| Data struct of f32 poly-phase resampler. More... | |
Typedefs | |
| typedef struct dsps_resample_mr_s | dsps_resample_mr_t |
| Data struct of f32 multi-rate resampler. | |
| typedef struct dsps_resample_ph_s | dsps_resample_ph_t |
| Data struct of f32 poly-phase resampler. | |
Functions | |
| esp_err_t | dsps_resampler_mr_init (dsps_resample_mr_t *resampler, void *coeffs, int16_t length, int16_t interp, float samplerate_factor, int32_t fixed_point, int16_t shift) |
| Initialize the multi-rate resampler. | |
| int32_t | dsps_resampler_mr_exec (dsps_resample_mr_t *resampler, void *input, void *output, int32_t length, int32_t length_correction) |
| Execute the multi-rate resampler. | |
| void | dsps_resampler_mr_free (dsps_resample_mr_t *resampler) |
| Free the multi-rate resampler. | |
| esp_err_t | dsps_resampler_ph_init (dsps_resample_ph_t *resampler, float samplerate_factor) |
| Initialize the poly-phase resampler. | |
| int32_t | dsps_resampler_ph_exec (dsps_resample_ph_t *resampler, float *input, float *output, int32_t length) |
| Execute the poly-phase resampler. | |
| typedef struct dsps_resample_mr_s dsps_resample_mr_t |
Data struct of f32 multi-rate resampler.
This structure is used by a resampler internally. A user should access this structure only in case of extensions for the DSP Library. To initialize the resampler, use the dsps_resampler_mr_init() function. To execute the resampler, use the dsps_resampler_mr_exec() function. To free the resampler, use the dsps_resampler_mr_free() function.
| typedef struct dsps_resample_ph_s dsps_resample_ph_t |
Data struct of f32 poly-phase resampler.
This structure is used by a poly-phase resampler internally. A user should access this structure only in case of extensions for the DSP Library. To initialize the resampler, use the dsps_resampler_ph_init() function. To execute the resampler, use the dsps_resampler_ph_exec() function.
It is possible to correct the sample rate by adjust the phase parameter "on the fly".
| int32_t dsps_resampler_mr_exec | ( | dsps_resample_mr_t * | resampler, |
| void * | input, | ||
| void * | output, | ||
| int32_t | length, | ||
| int32_t | length_correction ) |
Execute the multi-rate resampler.
This function executes the multi-rate resampler. The input and output buffers can be the same. The function based on multi-rate FIR filter. The decimation factor is updated for each execution. The current decimation factor calculated as division of average input and average output sample rate. To correct the output sample rate, the length_correction parameter is used. To increase the output sample rate, the length_correction parameter should be positive. To decrease the output sample rate, the length_correction parameter should be negative. This parameter is used when the input and output sample rates are comes from different sources.
| resampler | Pointer to the resampler structure |
| input | Pointer to the input buffer |
| output | Pointer to the output buffer |
| length | Length of the input buffers |
| length_correction | Length correction for the current execution. Positive value increases the output sample rate, negative value decreases the output sample rate. |
Definition at line 47 of file dsps_resampler_mr.c.
References dsps_resample_mr_s::active_decim, decim_avg_coeff, dsps_resample_mr_s::decim_avg_in, dsps_resample_mr_s::decim_avg_out, dsps_resample_mr_s::decim_c, dsps_resample_mr_s::decim_f, dsps_resample_mr_s::dsps_firmr, dsps_resample_mr_s::filter, dsps_resample_mr_s::fixed_point, and dsps_resample_mr_s::samplerate_factor.
| void dsps_resampler_mr_free | ( | dsps_resample_mr_t * | resampler | ) |
Free the multi-rate resampler.
| resampler | Pointer to the resampler structure |
Definition at line 70 of file dsps_resampler_mr.c.
References dsps_fir_f32_free(), dsps_fird_s16_aexx_free(), dsps_resample_mr_s::filter, and dsps_resample_mr_s::fixed_point.
| esp_err_t dsps_resampler_mr_init | ( | dsps_resample_mr_t * | resampler, |
| void * | coeffs, | ||
| int16_t | length, | ||
| int16_t | interp, | ||
| float | samplerate_factor, | ||
| int32_t | fixed_point, | ||
| int16_t | shift ) |
Initialize the multi-rate resampler.
| resampler | Pointer to the resampler structure |
| coeffs | Pointer to the filter coefficients (float or int16_t for fixed point) |
| length | Length of the filter coefficients |
| interp | Interpolation factor for the filter |
| samplerate_factor | Sample rate factor |
| fixed_point | Fixed point flag, 0 for float, 1 for fixed point |
| shift | Shift value for fixed point |
Definition at line 12 of file dsps_resampler_mr.c.
References dsps_resample_mr_s::active_decim, coeffs, dsps_resample_mr_s::decim_avg_in, dsps_resample_mr_s::decim_avg_out, dsps_resample_mr_s::decim_c, dsps_resample_mr_s::decim_f, dsps_resample_mr_s::dsps_firmr, dsps_firmr_f32, dsps_firmr_init_f32(), dsps_firmr_init_s16(), dsps_firmr_s16, ESP_ERR_DSP_INVALID_PARAM, ESP_OK, dsps_resample_mr_s::filter, dsps_resample_mr_s::fixed_point, and dsps_resample_mr_s::samplerate_factor.
| int32_t dsps_resampler_ph_exec | ( | dsps_resample_ph_t * | resampler, |
| float * | input, | ||
| float * | output, | ||
| int32_t | length ) |
Execute the poly-phase resampler.
| resampler | Pointer to the resampler structure |
| input | Pointer to the input buffer |
| output | Pointer to the output buffer |
| length | Length of the input buffer |
Definition at line 28 of file dsps_resampler_ph.c.
References dsps_resample_ph_s::delay, dsps_resample_ph_s::delay_pos, dsps_resample_ph_s::phase, and dsps_resample_ph_s::step.
| esp_err_t dsps_resampler_ph_init | ( | dsps_resample_ph_t * | resampler, |
| float | samplerate_factor ) |
Initialize the poly-phase resampler.
The poly-phase resampler is a implementation of the poly-phase Farrow filter that use cubic interpolation with 4 coefficients.
| resampler | Pointer to the resampler structure |
| samplerate_factor | Sample rate factor |
Definition at line 10 of file dsps_resampler_ph.c.
References dsps_resample_ph_s::delay, dsps_resample_ph_s::delay_pos, ESP_ERR_DSP_INVALID_PARAM, ESP_OK, dsps_resample_ph_s::phase, and dsps_resample_ph_s::step.