Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/audio/src/src_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
LOG_MODULE_REGISTER(src, CONFIG_SOF_LOG_LEVEL);

/* Calculates buffers to allocate for a SRC mode */
static int src_buffer_lengths(struct comp_dev *dev, struct comp_data *cd, int nch)
static int src_buffer_lengths(struct comp_dev *dev, struct comp_data *cd, unsigned int nch)
{
const struct src_stage *stage1;
const struct src_stage *stage2;
struct src_param *a;
int fs_in, fs_out;
int source_frames;
size_t source_frames;
int r1, n;

a = &cd->param;
Expand Down Expand Up @@ -240,13 +240,13 @@ static int src_2s(struct comp_data *cd,
void *sbuf_end_addr = &cd->delay_lines[cd->param.sbuf_length];
size_t sbuf_size = cd->param.sbuf_length * sizeof(int32_t);
/* chan sink == chan src therefore we only need to use one*/
int nch = source_get_channels(source);
unsigned int nch = source_get_channels(source);
int sbuf_free = cd->param.sbuf_length - cd->sbuf_avail;
int avail_b = source_get_data_available(source);
int free_b = sink_get_free_size(sink);
int sz = cd->sample_container_bytes;
uint32_t source_frag_size = cd->param.blk_in * source_get_frame_bytes(source);
uint32_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink);
size_t avail_b = source_get_data_available(source);
size_t free_b = sink_get_free_size(sink);
size_t sz = cd->sample_container_bytes;
size_t source_frag_size = cd->param.blk_in * source_get_frame_bytes(source);
size_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink);
Comment on lines +245 to +249

ret = source_get_data(source, source_frag_size,
&s1.x_rptr, (void const **)&source_buffer_start, &s1.x_size);
Expand Down Expand Up @@ -333,8 +333,8 @@ static int src_1s(struct comp_data *cd, struct sof_source *source,
int ret;
uint8_t const *source_buffer_start;
uint8_t *sink_buffer_start;
uint32_t source_frag_size = cd->param.blk_in * source_get_frame_bytes(source);
uint32_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink);
size_t source_frag_size = cd->param.blk_in * source_get_frame_bytes(source);
size_t sink_frag_size = cd->param.blk_out * sink_get_frame_bytes(sink);

ret = source_get_data(source, source_frag_size,
&s1.x_rptr, (void const **)&source_buffer_start, &s1.x_size);
Expand Down Expand Up @@ -369,7 +369,7 @@ static int src_1s(struct comp_data *cd, struct sof_source *source,
int src_copy_sxx(struct comp_data *cd, struct sof_source *source,
struct sof_sink *sink)
{
int frames = cd->param.blk_in;
size_t frames = cd->param.blk_in;

switch (source_get_frm_fmt(source)) {
case SOF_IPC_FRAME_S16_LE:
Expand Down Expand Up @@ -436,8 +436,8 @@ static bool src_get_copy_limits(struct comp_data *cd,
struct src_param *sp;
const struct src_stage *s1;
const struct src_stage *s2;
int frames_src;
int frames_snk;
size_t frames_src;
size_t frames_snk;

/* Get SRC parameters */
sp = &cd->param;
Expand Down Expand Up @@ -501,7 +501,7 @@ int src_params_general(struct processing_module *mod,

comp_info(dev, "source_rate = %u, sink_rate = %u",
cd->source_rate, cd->sink_rate);
comp_dbg(dev, "sample_container_bytes = %d, channels = %u, dev->frames = %u",
comp_dbg(dev, "sample_container_bytes = %zu, channels = %u, dev->frames = %u",
cd->sample_container_bytes, cd->channels_count, dev->frames);
if (!cd->sink_rate) {
comp_err(dev, "zero sink rate");
Expand Down
20 changes: 10 additions & 10 deletions src/audio/src/src_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ struct src_stage {
int num_of_subfilters;
int subfilter_length;
int filter_length;
int blk_in;
int blk_out;
size_t blk_in;
size_t blk_out;
int halfband;
int shift;
const void *coefs; /* Can be int16_t or int32_t depending on config */
Expand All @@ -38,8 +38,8 @@ struct src_param {
int sbuf_length;
int src_multich;
int total;
int blk_in;
int blk_out;
size_t blk_in;
size_t blk_out;
int stage1_times;
int stage2_times;
int idx_in;
Expand All @@ -48,7 +48,7 @@ struct src_param {
int num_out_fs;
int max_fir_delay_size_xnch;
int max_out_delay_size_xnch;
int nch;
unsigned int nch;
const struct src_stage *stage1;
const struct src_stage *stage2;
const int *in_fs;
Expand All @@ -73,7 +73,7 @@ struct polyphase_src {
};

struct src_stage_prm {
int nch;
unsigned int nch;
int times;
void const *x_rptr;
void const *x_end_addr;
Expand Down Expand Up @@ -160,10 +160,10 @@ struct comp_data {
int32_t const *sbuf_r_ptr;
int sbuf_avail;
int data_shift;
int source_frames;
int sink_frames;
int sample_container_bytes;
int channels_count;
size_t source_frames;
size_t sink_frames;
size_t sample_container_bytes;
unsigned int channels_count;
int (*src_func)(struct comp_data *cd, struct sof_source *source,
struct sof_sink *sink);
void (*polyphase_func)(struct src_stage_prm *s);
Expand Down
64 changes: 32 additions & 32 deletions src/audio/src/src_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@

static inline void fir_filter_generic(int32_t *rp, const void *cp, int32_t *wp0,
int32_t *fir_start, int32_t *fir_end,
const int taps_x_nch,
const size_t taps_x_nch,
const int shift, const int nch)
Comment on lines +25 to 26
{
int64_t y0;
int64_t y1;
int32_t *data;
const int16_t *coef;
int i;
size_t i;
int j;
int n1;
int n2;
int frames;
size_t n1;
size_t n2;
size_t frames;
const int qshift = 15 + shift; /* Q2.46 -> Q2.31 */
const int32_t rnd = 1 << (qshift - 1); /* Half LSB */
int32_t *d = rp;
Expand Down Expand Up @@ -115,19 +115,19 @@ static inline void fir_filter_generic(int32_t *rp, const void *cp, int32_t *wp0,

static inline void fir_filter_generic(int32_t *rp, const void *cp, int32_t *wp0,
int32_t *fir_start, int32_t *fir_end,
const int taps_x_nch, const int shift,
const size_t taps_x_nch, const int shift,
const int nch)
{
int64_t y0;
int64_t y1;
int32_t scaled_coef;
int32_t *data;
const int32_t *coef;
int i;
size_t i;
int j;
int frames;
int n1;
int n2;
size_t frames;
size_t n1;
size_t n2;

const int qshift = 23 + shift; /* Qx.54 -> Qx.31 */
const int32_t rnd = 1 << (qshift - 1); /* Half LSB */
Expand Down Expand Up @@ -212,12 +212,12 @@ static inline void fir_filter_generic(int32_t *rp, const void *cp, int32_t *wp0,
#if CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE
void src_polyphase_stage_cir(struct src_stage_prm *s)
{
int i;
size_t i;
int n;
int m;
int n_wrap_buf;
int n_wrap_fir;
int n_min;
size_t m;
size_t n_wrap_buf;
size_t n_wrap_fir;
size_t n_min;
int32_t *rp;
int32_t *wp;

Expand All @@ -229,13 +229,13 @@ void src_polyphase_stage_cir(struct src_stage_prm *s)
const void *cp; /* Can be int32_t or int16_t */
const size_t out_size = fir->out_delay_size * sizeof(int32_t);
const int nch = s->nch;
const int nch_x_odm = cfg->odm * nch;
const int blk_in_words = nch * cfg->blk_in;
const int blk_out_words = nch * cfg->num_of_subfilters;
const int rewind = nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
const int nch_x_idm = nch * cfg->idm;
const size_t nch_x_odm = cfg->odm * nch;
const size_t blk_in_words = nch * cfg->blk_in;
const size_t blk_out_words = nch * cfg->num_of_subfilters;
const size_t rewind = nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
const size_t nch_x_idm = nch * cfg->idm;
const size_t fir_size = fir->fir_delay_size * sizeof(int32_t);
const int taps_x_nch = cfg->subfilter_length * nch;
const size_t taps_x_nch = cfg->subfilter_length * nch;
Comment on lines +232 to +238
int32_t *x_rptr = (int32_t *)s->x_rptr;
int32_t *y_wptr = (int32_t *)s->y_wptr;
int32_t *x_end_addr = (int32_t *)s->x_end_addr;
Expand Down Expand Up @@ -310,12 +310,12 @@ void src_polyphase_stage_cir(struct src_stage_prm *s)
#if CONFIG_FORMAT_S16LE
void src_polyphase_stage_cir_s16(struct src_stage_prm *s)
{
int i;
size_t i;
int n;
int m;
int n_wrap_buf;
int n_wrap_fir;
int n_min;
size_t m;
size_t n_wrap_buf;
size_t n_wrap_fir;
size_t n_min;
int32_t *rp;
int32_t *wp;

Expand All @@ -327,13 +327,13 @@ void src_polyphase_stage_cir_s16(struct src_stage_prm *s)
const void *cp; /* Can be int32_t or int16_t */
const size_t out_size = fir->out_delay_size * sizeof(int32_t);
const int nch = s->nch;
const int nch_x_odm = cfg->odm * nch;
const int blk_in_words = nch * cfg->blk_in;
const int blk_out_words = nch * cfg->num_of_subfilters;
const int rewind = nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
const int nch_x_idm = nch * cfg->idm;
const size_t nch_x_odm = cfg->odm * nch;
const size_t blk_in_words = nch * cfg->blk_in;
const size_t blk_out_words = nch * cfg->num_of_subfilters;
const size_t rewind = nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
const size_t nch_x_idm = nch * cfg->idm;
const size_t fir_size = fir->fir_delay_size * sizeof(int32_t);
const int taps_x_nch = cfg->subfilter_length * nch;
const size_t taps_x_nch = cfg->subfilter_length * nch;
int16_t *x_rptr = (int16_t *)s->x_rptr;
int16_t *y_wptr = (int16_t *)s->y_wptr;
int16_t *x_end_addr = (int16_t *)s->x_end_addr;
Expand Down
28 changes: 14 additions & 14 deletions src/audio/src/src_hifi2ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,21 @@ void src_polyphase_stage_cir(struct src_stage_prm *s)
ae_q56s q;
ae_q32s *rp;
ae_q32s *wp;
int i;
size_t i;
int n;
int m;
int n_wrap_buf;
int n_min;
size_t m;
size_t n_wrap_buf;
size_t n_min;
struct src_state *fir = s->state;
const struct src_stage *cfg = s->stage;
int32_t *fir_end = &fir->fir_delay[fir->fir_delay_size];
int32_t *out_delay_end = &fir->out_delay[fir->out_delay_size];
const char *cp; /* Can be int32_t or int16_t */
const size_t out_size = fir->out_delay_size * sizeof(int32_t);
const int nch = s->nch;
const int nch_x_odm = cfg->odm * nch;
const int blk_in_words = nch * cfg->blk_in;
const int blk_out_words = nch * cfg->num_of_subfilters;
const size_t nch_x_odm = cfg->odm * nch;
const size_t blk_in_words = nch * cfg->blk_in;
const size_t blk_out_words = nch * cfg->num_of_subfilters;
const int sz = sizeof(int32_t);
const int n_sz = -sizeof(int32_t);
const int rewind_sz = sz * nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
Expand Down Expand Up @@ -432,21 +432,21 @@ void src_polyphase_stage_cir_s16(struct src_stage_prm *s)
ae_p24x2s d;
ae_q32s *rp;
ae_q32s *wp;
int i;
size_t i;
int n;
int m;
int n_wrap_buf;
int n_min;
size_t m;
size_t n_wrap_buf;
size_t n_min;
struct src_state *fir = s->state;
const struct src_stage *cfg = s->stage;
int32_t *fir_end = &fir->fir_delay[fir->fir_delay_size];
int32_t *out_delay_end = &fir->out_delay[fir->out_delay_size];
const char *cp; /* Can be int32_t or int16_t */
const size_t out_size = fir->out_delay_size * sizeof(int32_t);
const int nch = s->nch;
const int nch_x_odm = cfg->odm * nch;
const int blk_in_words = nch * cfg->blk_in;
const int blk_out_words = nch * cfg->num_of_subfilters;
const size_t nch_x_odm = cfg->odm * nch;
const size_t blk_in_words = nch * cfg->blk_in;
const size_t blk_out_words = nch * cfg->num_of_subfilters;
const int sz = sizeof(int32_t);
const int n_sz = -sizeof(int32_t);
const int rewind_sz = sz * nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
Expand Down
28 changes: 14 additions & 14 deletions src/audio/src/src_hifi3.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,21 @@ void src_polyphase_stage_cir(struct src_stage_prm *s)
ae_int32x2 q = AE_ZERO32();
ae_f32 *rp;
ae_f32 *wp;
int i;
size_t i;
int n;
int m;
int n_wrap_buf;
int n_min;
size_t m;
size_t n_wrap_buf;
size_t n_min;
struct src_state *fir = s->state;
const struct src_stage *cfg = s->stage;
int32_t *fir_end = &fir->fir_delay[fir->fir_delay_size];
int32_t *out_delay_end = &fir->out_delay[fir->out_delay_size];
const void *cp; /* Can be int32_t or int16_t */
const size_t out_size = fir->out_delay_size * sizeof(int32_t);
const int nch = s->nch;
const int nch_x_odm = cfg->odm * nch;
const int blk_in_words = nch * cfg->blk_in;
const int blk_out_words = nch * cfg->num_of_subfilters;
const size_t nch_x_odm = cfg->odm * nch;
const size_t blk_in_words = nch * cfg->blk_in;
const size_t blk_out_words = nch * cfg->num_of_subfilters;
const int sz = sizeof(int32_t);
const int n_sz = -sizeof(int32_t);
const int rewind_sz = sz * nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
Expand Down Expand Up @@ -436,11 +436,11 @@ void src_polyphase_stage_cir_s16(struct src_stage_prm *s)
ae_int16x4 d = AE_ZERO16();
ae_f32 *rp;
ae_f32 *wp;
int i;
size_t i;
int n;
int m;
int n_wrap_buf;
int n_min;
size_t m;
size_t n_wrap_buf;
size_t n_min;

struct src_state *fir = s->state;
const struct src_stage *cfg = s->stage;
Expand All @@ -449,9 +449,9 @@ void src_polyphase_stage_cir_s16(struct src_stage_prm *s)
const void *cp; /* Can be int32_t or int16_t */
const size_t out_size = fir->out_delay_size * sizeof(int32_t);
const int nch = s->nch;
const int nch_x_odm = cfg->odm * nch;
const int blk_in_words = nch * cfg->blk_in;
const int blk_out_words = nch * cfg->num_of_subfilters;
const size_t nch_x_odm = cfg->odm * nch;
const size_t blk_in_words = nch * cfg->blk_in;
const size_t blk_out_words = nch * cfg->num_of_subfilters;
const int sz = sizeof(int32_t);
const int n_sz = -sizeof(int32_t);
const int rewind_sz = sz * nch * (cfg->blk_in + (cfg->num_of_subfilters - 1) * cfg->idm);
Expand Down
Loading
Loading