mailman.alsa-project.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

Sound-open-firmware

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
sound-open-firmware@alsa-project.org

  • 1572 discussions
[Sound-open-firmware] [PATCH] component: data: Make component get/set data host API generic
by Liam Girdwood 05 Sep '17

05 Sep '17
Make the host API and IPC to set and get component runtime data and values generic with no bespoke commands at the IPC level. Create a generic structure that descibes the type and size of data and whether that data is appended to the IPC message or is available to be DMAed from host. Update the components to use the new structure. Some components like SRC, tone and tone still require some work to export thier ABI. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/audio/eq_fir.c | 58 ++++++++++++++-------- src/audio/eq_iir.c | 53 +++++++++++++-------- src/audio/src.c | 31 ++++++++---- src/audio/tone.c | 49 +++++++++++++------ src/audio/volume.c | 71 +++++++++++++++------------ src/include/reef/audio/component.h | 25 +++++----- src/include/uapi/ipc.h | 98 +++++++++++++++++++++++--------------- src/ipc/intel-ipc.c | 53 ++++++--------------- 8 files changed, 254 insertions(+), 184 deletions(-) diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index 534a4a1..540c68f 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -299,26 +299,25 @@ static int eq_fir_params(struct comp_dev *dev) return 0; } -/* used to pass standard and bespoke commands (with data) to component */ -static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) +static int fir_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - struct sof_ipc_eq_fir_blob *blob; - struct sof_ipc_eq_fir_switch *assign; - struct eq_fir_update *fir_update; - int i; - int ret = 0; + struct eq_fir_update *fir_update; /* TODO: move this to IPC as it's ABI */ size_t bs; + int i, ret = 0; - trace_src("cmd"); + /* TODO: determine if data is DMAed or appended to cdata */ - switch (cmd) { - case COMP_CMD_EQ_FIR_SWITCH: + switch (cdata->cmd) { + case SOF_CTRL_CMD_EQ_SWITCH: trace_src("EFx"); - assign = (struct sof_ipc_eq_fir_switch *) data; - fir_update = (struct eq_fir_update *) assign->data; + fir_update = (struct eq_fir_update *)cdata->data; ret = eq_fir_switch_response(cd->fir, cd->config, fir_update, PLATFORM_MAX_CHANNELS); + if (ret < 0) { + trace_src_error("ec1"); + return ret; + } /* Print trace information */ tracev_value(fir_update->stream_max_channels); @@ -326,14 +325,13 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) tracev_value(fir_update->assign_response[i]); break; - case COMP_CMD_EQ_FIR_CONFIG: + case SOF_CTRL_CMD_EQ_CONFIG: trace_src("EFc"); /* Check and free old config */ eq_fir_free_parameters(&cd->config); /* Copy new config, need to decode data to know the size */ - blob = (struct sof_ipc_eq_fir_blob *) data; - bs = blob->comp.hdr.size - sizeof(struct sof_ipc_hdr); + bs = cdata->num_elems; if (bs > EQ_FIR_MAX_BLOB_SIZE) return -EINVAL; @@ -341,7 +339,7 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) if (cd->config == NULL) return -EINVAL; - memcpy(cd->config, blob->data, bs); + memcpy(cd->config, cdata->data, bs); ret = eq_fir_setup(cd->fir, cd->config, PLATFORM_MAX_CHANNELS); /* Print trace information */ @@ -349,20 +347,40 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) tracev_value(cd->config->number_of_responses_defined); for (i = 0; i < cd->config->stream_max_channels; i++) tracev_value(cd->config->assign_response[i]); - break; - case COMP_CMD_MUTE: + case SOF_CTRL_CMD_MUTE: trace_src("EFm"); for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) fir_mute(&cd->fir[i]); break; - case COMP_CMD_UNMUTE: + case SOF_CTRL_CMD_UNMUTE: trace_src("EFu"); for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) fir_unmute(&cd->fir[i]); break; + default: + trace_src_error("ec1"); + ret = -EINVAL; + break; + } + + return ret; +} + +/* used to pass standard and bespoke commands (with data) to component */ +static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) +{ + struct sof_ipc_ctrl_data *cdata = data; + int ret = 0; + + trace_src("cmd"); + + switch (cmd) { + case COMP_CMD_SET_DATA: + ret = fir_cmd(dev, cdata); + break; case COMP_CMD_START: trace_src("EFs"); dev->state = COMP_STATE_RUNNING; @@ -389,6 +407,8 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) break; default: trace_src("EDf"); + ret = -EINVAL; + break; } return ret; diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c index 0ac2ef9..f75be71 100644 --- a/src/audio/eq_iir.c +++ b/src/audio/eq_iir.c @@ -303,24 +303,17 @@ static int eq_iir_params(struct comp_dev *dev) return 0; } -/* used to pass standard and bespoke commands (with data) to component */ -static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) +static int iir_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - struct sof_ipc_eq_iir_switch *assign; - struct sof_ipc_eq_iir_blob *blob; - struct eq_iir_update *iir_update; - int i; - int ret = 0; + struct eq_iir_update *iir_update; /* TODO: move to IPC header as part of ABI */ + int i, ret = 0; size_t bs; - trace_eq_iir("cmd"); - - switch (cmd) { - case COMP_CMD_EQ_IIR_SWITCH: + switch (cdata->cmd) { + case SOF_CTRL_CMD_EQ_SWITCH: trace_eq_iir("EFx"); - assign = (struct sof_ipc_eq_iir_switch *) data; - iir_update = (struct eq_iir_update *) assign->data; + iir_update = (struct eq_iir_update *) cdata->data; ret = eq_iir_switch_response(cd->iir, cd->config, iir_update, PLATFORM_MAX_CHANNELS); @@ -330,15 +323,13 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) tracev_value(iir_update->assign_response[i]); break; - case COMP_CMD_EQ_IIR_CONFIG: + case SOF_CTRL_CMD_EQ_CONFIG: trace_eq_iir("EFc"); /* Check and free old config */ eq_iir_free_parameters(&cd->config); /* Copy new config, need to decode data to know the size */ - blob = (struct sof_ipc_eq_iir_blob *) data; - bs = blob->comp.hdr.size - sizeof(struct sof_ipc_hdr) - - sizeof(struct sof_ipc_host_buffer); + bs = cdata->num_elems; if (bs > EQ_IIR_MAX_BLOB_SIZE) return -EINVAL; @@ -347,7 +338,7 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) if (cd->config == NULL) return -EINVAL; - memcpy(cd->config, blob->data, bs); + memcpy(cd->config, cdata->data, bs); /* Initialize all channels, the actual number of channels may * not be set yet. */ @@ -360,18 +351,39 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) tracev_value(cd->config->assign_response[i]); break; - case COMP_CMD_MUTE: + case SOF_CTRL_CMD_MUTE: trace_eq_iir("EFm"); for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) iir_mute_df2t(&cd->iir[i]); break; - case COMP_CMD_UNMUTE: + case SOF_CTRL_CMD_UNMUTE: trace_eq_iir("EFu"); for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) iir_unmute_df2t(&cd->iir[i]); break; + default: + trace_eq_iir_error("ec1"); + ret = -EINVAL; + break; + } + + return ret; +} + +/* used to pass standard and bespoke commands (with data) to component */ +static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) +{ + struct sof_ipc_ctrl_data *cdata = data; + int ret = 0; + + trace_eq_iir("cmd"); + + switch (cmd) { + case COMP_CMD_SET_DATA: + ret = iir_cmd(dev, cdata); + break; case COMP_CMD_START: trace_eq_iir("EFs"); dev->state = COMP_STATE_RUNNING; @@ -398,6 +410,7 @@ static int eq_iir_cmd(struct comp_dev *dev, int cmd, void *data) break; default: trace_eq_iir("EDf"); + ret = -EINVAL; break; } diff --git a/src/audio/src.c b/src/audio/src.c index 0279841..5dd8345 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -376,29 +376,42 @@ static int src_params(struct comp_dev *dev) return 0; } -/* used to pass standard and bespoke commands (with data) to component */ -static int src_cmd(struct comp_dev *dev, int cmd, void *data) +static int src_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { - trace_src("SCm"); struct comp_data *cd = comp_get_drvdata(dev); int i; - switch (cmd) { - case COMP_CMD_SRC: - trace_src("SMa"); - break; - case COMP_CMD_MUTE: + switch (cdata->cmd) { + case SOF_CTRL_CMD_MUTE: trace_src("SMu"); for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) src_polyphase_mute(&cd->src[i]); break; - case COMP_CMD_UNMUTE: + case SOF_CTRL_CMD_UNMUTE: trace_src("SUm"); for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) src_polyphase_unmute(&cd->src[i]); break; + default: + trace_src_error("ec1"); + return -EINVAL; + } + + return 0; +} + +/* used to pass standard and bespoke commands (with data) to component */ +static int src_cmd(struct comp_dev *dev, int cmd, void *data) +{ + struct sof_ipc_ctrl_data *cdata = data; + + trace_src("SCm"); + + switch (cmd) { + case COMP_CMD_SET_VALUE: + return src_ctrl_cmd(dev, cdata); case COMP_CMD_START: trace_src("SSt"); dev->state = COMP_STATE_RUNNING; diff --git a/src/audio/tone.c b/src/audio/tone.c index cbc50ac..448c472 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -229,6 +229,7 @@ static inline void tonegen_set_f(struct tone_state *sg, int32_t f) sg->f = f; } +#if 0 /* Tone sweep parameters description: * fc - Multiplication factor for frequency as Q2.30 for logarithmic change * ac - Multiplication factor for amplitude as Q2.30 for logarithmic change @@ -250,6 +251,7 @@ static void tonegen_set_sweep(struct tone_state *sg, int32_t fc, int32_t ac, sg->tone_length = (l > 0) ? l : INT32_MAXVALUE; /* Count rate 125 us */ sg->tone_period = (p > 0) ? p : INT32_MAXVALUE; /* Count rate 125 us */ } +#endif /* Tone ramp parameters: * step - Value that is added or subtracted to amplitude. A zero or negative @@ -428,16 +430,22 @@ static int tone_params(struct comp_dev *dev) return 0; } -/* used to pass standard and bespoke commands (with data) to component */ -static int tone_cmd(struct comp_dev *dev, int cmd, void *data) +static int tone_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - struct sof_ipc_comp_tone *ct; - - trace_tone("tri"); - switch (cmd) { - case COMP_CMD_TONE: + switch (cdata->cmd) { + case SOF_CTRL_CMD_MUTE: + trace_tone("TMu"); + tonegen_mute(&cd->sg); + break; + case SOF_CTRL_CMD_UNMUTE: + trace_tone("TUm"); + tonegen_unmute(&cd->sg); + break; +/* TODO: use comp value list array to set this */ +#if 0 + case SOF_CTRL_TYPE_VALUE_COMP_SET: trace_tone("Tto"); ct = (struct sof_ipc_comp_tone *) data; /* Ignore channels while tone implementation is mono */ @@ -447,14 +455,25 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data) ct->length, ct->period, ct->repeats); tonegen_set_linramp(&cd->sg, ct->ramp_step); break; - case COMP_CMD_MUTE: - trace_tone("TMu"); - tonegen_mute(&cd->sg); - break; - case COMP_CMD_UNMUTE: - trace_tone("TUm"); - tonegen_unmute(&cd->sg); - break; +#endif + default: + trace_tone_error("ec1"); + return -EINVAL; + } + + return 0; +} + +/* used to pass standard and bespoke commands (with data) to component */ +static int tone_cmd(struct comp_dev *dev, int cmd, void *data) +{ + struct sof_ipc_ctrl_data *cdata = data; + + trace_tone("tri"); + + switch (cmd) { + case COMP_CMD_SET_VALUE: + return tone_ctrl_cmd(dev, cdata); case COMP_CMD_START: trace_tone("TSt"); dev->state = COMP_STATE_RUNNING; diff --git a/src/audio/volume.c b/src/audio/volume.c index 93a3839..6cbd6ff 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -69,16 +69,16 @@ struct comp_data { uint32_t sink_period_bytes; enum sof_ipc_frame source_format; enum sof_ipc_frame sink_format; - uint32_t chan[PLATFORM_MAX_CHANNELS]; - uint32_t volume[PLATFORM_MAX_CHANNELS]; /* current volume */ - uint32_t tvolume[PLATFORM_MAX_CHANNELS]; /* target volume */ - uint32_t mvolume[PLATFORM_MAX_CHANNELS]; /* mute volume */ + uint32_t chan[SOF_IPC_MAX_CHANNELS]; + uint32_t volume[SOF_IPC_MAX_CHANNELS]; /* current volume */ + uint32_t tvolume[SOF_IPC_MAX_CHANNELS]; /* target volume */ + uint32_t mvolume[SOF_IPC_MAX_CHANNELS]; /* mute volume */ void (*scale_vol)(struct comp_dev *dev, struct comp_buffer *sink, struct comp_buffer *source, uint32_t frames); struct work volwork; /* host volume readback */ - struct sof_ipc_ctrl_values *hvol; + struct sof_ipc_ctrl_value_chan *hvol; }; struct comp_func_map { @@ -234,9 +234,9 @@ static void vol_sync_host(struct comp_data *cd, uint32_t chan) if (cd->hvol == NULL) return; - for (i = 0; i < cd->hvol->num_values; i++) { - if (cd->hvol->values[i].channel == cd->chan[chan]) - cd->hvol->values[i].value = cd->volume[chan]; + for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++) { + if (cd->hvol[i].channel == cd->chan[chan]) + cd->hvol[i].value = cd->volume[chan]; } } @@ -380,50 +380,61 @@ static inline void volume_set_chan_unmute(struct comp_dev *dev, int chan) cd->tvolume[chan] = cd->mvolume[chan]; } -/* used to pass standard and bespoke commands (with data) to component */ -static int volume_cmd(struct comp_dev *dev, int cmd, void *data) +static int volume_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - struct sof_ipc_ctrl_values *cv; int i, j; - trace_volume("cmd"); - - switch (cmd) { - case COMP_CMD_VOLUME: - cv = (struct sof_ipc_ctrl_values*)data; + switch (cdata->cmd) { + case SOF_CTRL_CMD_VOLUME: - for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) { - for (j = 0; j < cv->num_values; j++) { - if (cv->values[j].channel == cd->chan[i]) - volume_set_chan(dev, i, cv->values[j].value); + for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++) { + for (j = 0; j < cdata->num_elems; j++) { + if (cdata->chanv[j].value == cd->chan[i]) + volume_set_chan(dev, i, cdata->chanv[j].value); } } work_schedule_default(&cd->volwork, VOL_RAMP_US); break; - case COMP_CMD_MUTE: - cv = (struct sof_ipc_ctrl_values*)data; + case SOF_CTRL_CMD_MUTE: - for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) { - for (j = 0; j < cv->num_values; j++) { - if (cv->values[j].channel == cd->chan[i]) + for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++) { + for (j = 0; j < cdata->num_elems; j++) { + if (cdata->chanv[j].value == cd->chan[i]) volume_set_chan_mute(dev, i); } } work_schedule_default(&cd->volwork, VOL_RAMP_US); break; - case COMP_CMD_UNMUTE: - cv = (struct sof_ipc_ctrl_values*)data; + case SOF_CTRL_CMD_UNMUTE: - for (i = 0; i < PLATFORM_MAX_CHANNELS; i++) { - for (j = 0; j < cv->num_values; j++) { - if (cv->values[j].channel == cd->chan[i]) + for (i = 0; i < SOF_IPC_MAX_CHANNELS; i++) { + for (j = 0; j < cdata->num_elems; j++) { + if (cdata->chanv[j].value == cd->chan[i]) volume_set_chan_unmute(dev, i); } } work_schedule_default(&cd->volwork, VOL_RAMP_US); break; + default: + trace_volume_error("ec1"); + return -EINVAL; + } + + return 0; +} + +/* used to pass standard and bespoke commands (with data) to component */ +static int volume_cmd(struct comp_dev *dev, int cmd, void *data) +{ + struct sof_ipc_ctrl_data *cdata = data; + + trace_volume("cmd"); + + switch (cmd) { + case COMP_CMD_SET_VALUE: + return volume_ctrl_cmd(dev, cdata); case COMP_CMD_START: dev->state = COMP_STATE_RUNNING; break; diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index e73a22a..35c80de 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -59,7 +59,9 @@ #define COMP_STATE_PAUSED 5 /* component paused */ #define COMP_STATE_RUNNING 6 /* component active */ -/* standard component commands */ +/* + * standard component stream commands + */ #define COMP_CMD_STOP 0 /* stop component stream */ #define COMP_CMD_START 1 /* start component stream */ @@ -69,18 +71,15 @@ #define COMP_CMD_SUSPEND 5 /* suspend component */ #define COMP_CMD_RESUME 6 /* resume component */ -#define COMP_CMD_VOLUME 100 -#define COMP_CMD_MUTE 101 -#define COMP_CMD_UNMUTE 102 -#define COMP_CMD_ROUTE 103 -#define COMP_CMD_SRC 104 -#define COMP_CMD_LOOPBACK 105 - -#define COMP_CMD_TONE 106 /* Tone generator amplitude and frequency */ -#define COMP_CMD_EQ_FIR_CONFIG 107 /* Configuration data for FIR EQ */ -#define COMP_CMD_EQ_FIR_SWITCH 108 /* Update request for FIR EQ */ -#define COMP_CMD_EQ_IIR_CONFIG 109 /* Configuration data for IIR EQ */ -#define COMP_CMD_EQ_IIR_SWITCH 110 /* Response update request for IIR EQ */ +/* + * standard component control commands + */ + +#define COMP_CMD_SET_VALUE 100 +#define COMP_CMD_GET_VALUE 101 +#define COMP_CMD_SET_DATA 102 +#define COMP_CMD_GET_DATA 103 + /* MMAP IPC status */ #define COMP_CMD_IPC_MMAP_RPOS 200 /* host read position */ diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index 053390c..c8cdedb 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -88,15 +88,12 @@ #define SOF_IPC_PM_CLK_GET SOF_CMD_TYPE(0x005) #define SOF_IPC_PM_CLK_REQ SOF_CMD_TYPE(0x006) -/* component - multiple different types */ -#define SOF_IPC_COMP_SET_VOLUME SOF_CMD_TYPE(0x001) -#define SOF_IPC_COMP_GET_VOLUME SOF_CMD_TYPE(0x002) -#define SOF_IPC_COMP_SET_MIXER SOF_CMD_TYPE(0x003) -#define SOF_IPC_COMP_GET_MIXER SOF_CMD_TYPE(0x004) -#define SOF_IPC_COMP_SET_MUX SOF_CMD_TYPE(0x005) -#define SOF_IPC_COMP_GET_MUX SOF_CMD_TYPE(0x006) -#define SOF_IPC_COMP_SET_SRC SOF_CMD_TYPE(0x007) -#define SOF_IPC_COMP_GET_SRC SOF_CMD_TYPE(0x008) +/* component runtime config - multiple different types */ +#define SOF_IPC_COMP_SET_VALUE SOF_CMD_TYPE(0x001) +#define SOF_IPC_COMP_GET_VALUE SOF_CMD_TYPE(0x002) +#define SOF_IPC_COMP_SET_DATA SOF_CMD_TYPE(0x003) +#define SOF_IPC_COMP_GET_DATA SOF_CMD_TYPE(0x004) + /* DAI messages */ #define SOF_IPC_DAI_CONFIG SOF_CMD_TYPE(0x001) @@ -433,24 +430,69 @@ struct sof_ipc_stream_posn { * Component Mixers and Controls */ -struct sof_ipc_ctrl_chan { +/* control data type and direction */ +enum sof_ipc_ctrl_type { + SOF_CTRL_TYPE_VALUE_CHAN_GET = 0, + SOF_CTRL_TYPE_VALUE_CHAN_SET, + SOF_CTRL_TYPE_VALUE_COMP_GET, + SOF_CTRL_TYPE_VALUE_COMP_SET, + SOF_CTRL_TYPE_DATA_GET, + SOF_CTRL_TYPE_DATA_SET, +}; + +/* control command type */ +enum sof_ipc_ctrl_cmd { + SOF_CTRL_CMD_VOLUME = 0, + SOF_CTRL_CMD_ROUTE, + SOF_CTRL_CMD_SRC, + SOF_CTRL_CMD_LOOPBACK, + SOF_CTRL_CMD_EQ_SWITCH, + SOF_CTRL_CMD_EQ_CONFIG, + /* Mute is similar to volume, but maps better onto ALSA switch controls */ + SOF_CTRL_CMD_MUTE, + SOF_CTRL_CMD_UNMUTE, +}; + +/* generic channel mapped value data */ +struct sof_ipc_ctrl_value_chan { enum sof_ipc_chmap channel; uint32_t value; } __attribute__((packed)); -struct sof_ipc_ctrl_values { - struct sof_ipc_hdr hdr; - uint32_t comp_id; - uint32_t num_values; - struct sof_ipc_ctrl_chan values[SOF_IPC_MAX_CHANNELS]; +/* generic component mapped value data */ +struct sof_ipc_ctrl_value_comp { + uint32_t index; /* component source/sink/control index in control */ + union { + uint32_t uvalue; + int32_t svalue; + }; } __attribute__((packed)); -struct sof_ipc_ctrl_get_values { +/* generic control data */ +struct sof_ipc_ctrl_data { struct sof_ipc_hdr hdr; uint32_t comp_id; - uint32_t num_values; + + /* control access and data type */ + enum sof_ipc_ctrl_type type; + enum sof_ipc_ctrl_cmd cmd; + + /* control data - can either be appended or DMAed from host */ + struct sof_ipc_host_buffer buffer; + uint32_t num_elems; /* in array elems or bytes */ + + /* control data - add new types if needed */ + union { + /* channel values can be used by volume type controls */ + struct sof_ipc_ctrl_value_chan chanv[0]; + /* component values used by routing controls like mux, mixer */ + struct sof_ipc_ctrl_value_comp compv[0]; + /* data can be used by binary controls */ + char data[0]; + }; } __attribute__((packed)); + /* * Component */ @@ -599,28 +641,6 @@ struct sof_ipc_comp_eq_iir { struct sof_ipc_comp_config config; } __attribute__((packed)); -/* IPC to pass configuration blobs to equalizers and re-assign responses */ -struct sof_ipc_eq_fir_blob { - struct sof_ipc_comp comp; - struct sof_ipc_host_buffer buffer; - int32_t data[]; -} __attribute__((packed)); - -struct sof_ipc_eq_iir_blob { - struct sof_ipc_comp comp; - struct sof_ipc_host_buffer buffer; - int32_t data[]; -} __attribute__((packed)); - -struct sof_ipc_eq_fir_switch { - struct sof_ipc_comp comp; - int32_t data[]; -} __attribute__((packed)); - -struct sof_ipc_eq_iir_switch { - struct sof_ipc_comp comp; - int32_t data[]; -} __attribute__((packed)); /* frees components, buffers and pipelines * SOF_IPC_TPLG_COMP_FREE, SOF_IPC_TPLG_PIPE_FREE, SOF_IPC_TPLG_BUFFER_FREE diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 60001c3..4f397c1 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -559,48 +559,31 @@ static int ipc_glb_pm_message(uint32_t header) * Topology IPC Operations. */ -static int ipc_comp_set_value(uint32_t header, uint32_t cmd) +/* get/set component values or runtime data */ +static int ipc_comp_value(uint32_t header, uint32_t cmd) { struct ipc_comp_dev *stream_dev; - struct sof_ipc_ctrl_values *values = _ipc->comp_data; - - trace_ipc("VoS"); - - /* get the component */ - stream_dev = ipc_get_comp(_ipc, values->comp_id); - if (stream_dev == NULL) { - trace_ipc_error("eVs"); - return -ENODEV; - } - - /* set component values */ - return comp_cmd(stream_dev->cd, cmd, values); -} - -static int ipc_comp_get_value(uint32_t header, uint32_t cmd) -{ - struct ipc_comp_dev *stream_dev; - struct sof_ipc_ctrl_values *values = _ipc->comp_data; + struct sof_ipc_ctrl_data *data = _ipc->comp_data; int ret; trace_ipc("VoG"); /* get the component */ - stream_dev = ipc_get_comp(_ipc, values->comp_id); + stream_dev = ipc_get_comp(_ipc, data->comp_id); if (stream_dev == NULL){ trace_ipc_error("eVg"); return -ENODEV; } /* get component values */ - ret = comp_cmd(stream_dev->cd, COMP_CMD_VOLUME, values); + ret = comp_cmd(stream_dev->cd, cmd, data); if (ret < 0) { trace_ipc_error("eVG"); return ret; } /* write component values to the outbox */ - mailbox_outbox_write(values, 0, sizeof(*values)); + mailbox_outbox_write(0, data, data->hdr.size); return 0; } @@ -610,22 +593,14 @@ static int ipc_glb_comp_message(uint32_t header) uint32_t cmd = (header & SOF_CMD_TYPE_MASK) >> SOF_CMD_TYPE_SHIFT; switch (cmd) { - case iCS(SOF_IPC_COMP_SET_VOLUME): - return ipc_comp_set_value(header, COMP_CMD_VOLUME); - case iCS(SOF_IPC_COMP_GET_VOLUME): - return ipc_comp_get_value(header, COMP_CMD_VOLUME); - case iCS(SOF_IPC_COMP_SET_MIXER): - return ipc_comp_set_value(header, COMP_CMD_ROUTE); - case iCS(SOF_IPC_COMP_GET_MIXER): - return ipc_comp_get_value(header, COMP_CMD_ROUTE); - case iCS(SOF_IPC_COMP_SET_MUX): - return ipc_comp_set_value(header, COMP_CMD_ROUTE); - case iCS(SOF_IPC_COMP_GET_MUX): - return ipc_comp_get_value(header, COMP_CMD_ROUTE); - case iCS(SOF_IPC_COMP_SET_SRC): - return ipc_comp_set_value(header, COMP_CMD_SRC); - case iCS(SOF_IPC_COMP_GET_SRC): - return ipc_comp_get_value(header, COMP_CMD_SRC); + case iCS(SOF_IPC_COMP_SET_VALUE): + return ipc_comp_value(header, COMP_CMD_SET_VALUE); + case iCS(SOF_IPC_COMP_GET_VALUE): + return ipc_comp_value(header, COMP_CMD_GET_VALUE); + case iCS(SOF_IPC_COMP_SET_DATA): + return ipc_comp_value(header, COMP_CMD_SET_DATA); + case iCS(SOF_IPC_COMP_GET_DATA): + return ipc_comp_value(header, COMP_CMD_GET_DATA); default: trace_ipc_error("eCc"); trace_value(header); -- 2.11.0
2 1
0 0
[Sound-open-firmware] [PATCH v2 2/2] Passthrough component added
by Ranjani Sridharan 05 Sep '17

05 Sep '17
This patch adds a passthrough component that copies the input stream from the source buffer to the sink buffer. It is meant to serve as a template for creating new components. Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> --- src/audio/Makefile.am | 3 +- src/audio/passthrough.c | 238 +++++++++++++++++++++++++++++++++++++++++++++++ src/include/reef/trace.h | 1 + src/include/uapi/ipc.h | 7 ++ 4 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 src/audio/passthrough.c diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am index 285422e..c71430c 100644 --- a/src/audio/Makefile.am +++ b/src/audio/Makefile.am @@ -17,7 +17,8 @@ libaudio_a_SOURCES = \ pipeline.c \ pipeline_static.c \ component.c \ - buffer.c + buffer.c \ + passthrough.c libaudio_a_CFLAGS = \ $(ARCH_CFLAGS) \ diff --git a/src/audio/passthrough.c b/src/audio/passthrough.c new file mode 100644 index 0000000..4163db9 --- /dev/null +++ b/src/audio/passthrough.c @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2016, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> + */ + +#include <stdio.h> +#include <stdint.h> +#include <stddef.h> +#include <reef/lock.h> +#include <reef/alloc.h> +#include <reef/list.h> +#include <reef/stream.h> +#include <reef/trace.h> +#include <reef/audio/component.h> +#include <reef/audio/pipeline.h> +#include <uapi/ipc.h> + +/* tracing */ +#define trace_pass(__e) trace_event(TRACE_CLASS_PASS, __e) +#define trace_pass_error(__e) trace_error(TRACE_CLASS_PASS, __e) +#define tracev_pass(__e) tracev_event(TRACE_CLASS_PASS, __e) + +/* The passthrough component, as the name inplies, allows the source buffer + * to pass through the component, without any processing, to the sink buffer. + * It supports 16-bits and 32-bits data formats. + * This code is intended to be used as a template for creating new components. + */ + +/* + * passthrough_comp_data structure: This is private data that cannot be touched + * outside the component. It contains: + * passthrough_func - function that performs the buffer copy + */ +struct passthrough_comp_data { + int (*passthrough_func)(struct comp_dev *dev, struct comp_buffer *sink, + struct comp_buffer *source, uint32_t frames); + +}; + +/* This function performs memcpy of the stream data from the source buffer to + * the sink buffer. It returns the number of frames that were copied. + */ +static int passthrough_function(struct comp_dev *dev, + struct comp_buffer *sink_buffer, + struct comp_buffer *source_buffer, uint32_t frames) +{ + struct sof_ipc_comp_config *config = COMP_GET_CONFIG(dev); + int32_t *src = (int32_t *) source_buffer->r_ptr; + int32_t *dest = (int32_t *) sink_buffer->w_ptr; + int nch = dev->params.channels; + + /* copy frames from source to destination */ + switch (config->frame_fmt) { + case SOF_IPC_FRAME_S16_LE: + memcpy(dest, src, frames * nch * sizeof(int16_t)); + break; + case SOF_IPC_FRAME_S32_LE: + case SOF_IPC_FRAME_S24_4LE: + case SOF_IPC_FRAME_FLOAT: + memcpy(dest, src, frames * nch * sizeof(int32_t)); + break; + default: + trace_pass_error("PTp"); + return -EINVAL; + } + + return frames; +} + +/* passthrough_new create the new passthrough component and allocates + * memory for the component and its private data. + * It returns a pointer to struct comp_dev that was created. + */ +static struct comp_dev *passthrough_new(struct sof_ipc_comp *comp) +{ + struct comp_dev *dev; + struct passthrough_comp_data *cd; + + trace_pass("PTn"); + dev = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, + COMP_SIZE(struct sof_ipc_comp_passthrough)); + if (dev == NULL) + return NULL; + + memcpy(&dev->comp, comp, sizeof(struct sof_ipc_comp_passthrough)); + + cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd)); + if (cd == NULL) { + rfree(dev); + return NULL; + } + + comp_set_drvdata(dev, cd); + cd->passthrough_func = passthrough_function; + + return dev; +} + +/* passthrough_free performs the clean-up */ +static void passthrough_free(struct comp_dev *dev) +{ + struct passthrough_comp_data *cd = comp_get_drvdata(dev); + + rfree(cd); + rfree(dev); +} + +/* passthrough_params sets the component audio stream parameters */ +static int passthrough_params(struct comp_dev *dev) +{ + return 0; +} + +/* passthrough_cmd is used to pass standard and bespoke commands (with data) + * to the component + */ +static int passthrough_cmd(struct comp_dev *dev, int cmd, void *data) +{ + int ret = 0; + + switch (cmd) { + case COMP_CMD_START: + case COMP_CMD_STOP: + case COMP_CMD_PAUSE: + case COMP_CMD_RELEASE: + default: + ret = comp_set_state(dev, cmd); + break; + } + + return ret; +} + +/* passthrough_copy is called when stream data flows through the pipeline + * It calls passthrough_function to copy the source buffer to the sink buffer. + * It returns the number of frames that were copied. + */ +static int passthrough_copy(struct comp_dev *dev) +{ + struct passthrough_comp_data *cd = comp_get_drvdata(dev); + struct comp_buffer *source_buffer = NULL, *sink_buffer = NULL; + uint32_t copy_bytes; + + /* get source and sink buffers */ + source_buffer = list_first_item(&dev->bsource_list, struct comp_buffer, + sink_list); + sink_buffer = list_first_item(&dev->bsink_list, struct comp_buffer, + source_list); + + /* check that source has enough frames available and sink enough + * frames free + */ + copy_bytes = comp_buffer_get_copy_bytes(dev, source_buffer, + sink_buffer); + + if (copy_bytes < dev->frames * dev->frame_bytes) { + trace_pass_error("PTc"); + return -EINVAL; + } + + /* Run passthrough if buffers have enough room */ + cd->passthrough_func(dev, sink_buffer, source_buffer, dev->frames); + + comp_update_buffer_consume(source_buffer, + dev->params.host_period_bytes); + comp_update_buffer_produce(sink_buffer, dev->params.host_period_bytes); + + return dev->frames; +} + +/* passthrough_preload is used for preloading the component buffers before + * pipeline start + */ +static int passthrough_preload(struct comp_dev *dev) +{ + return passthrough_copy(dev); +} + +/* passthrough_reset rests the component state */ +static int passthrough_reset(struct comp_dev *dev) +{ + trace_pass("PTe"); + dev->state = COMP_STATE_INIT; + return 0; +} + +/* passthrough_prepare prepares the component for receiving stream data */ +static int passthrough_prepare(struct comp_dev *dev) +{ + trace_pass("PTl"); + dev->state = COMP_STATE_PREPARE; + return 0; +} + +/* passthrough component driver ops */ +struct comp_driver comp_passthrough = { + .type = SOF_COMP_PASSTHROUGH, + .ops = { + .new = passthrough_new, + .free = passthrough_free, + .params = passthrough_params, + .cmd = passthrough_cmd, + .copy = passthrough_copy, + .prepare = passthrough_prepare, + .reset = passthrough_reset, + .preload = passthrough_preload, + }, +}; + +void sys_comp_passthrough_init(void) +{ + comp_register(&comp_passthrough); +} diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 300e8d8..b7ec31a 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -87,6 +87,7 @@ #define TRACE_CLASS_TONE (18 << 24) #define TRACE_CLASS_EQ_FIR (19 << 24) #define TRACE_CLASS_EQ_IIR (20 << 24) +#define TRACE_CLASS_PASS (21 << 24) /* move to config.h */ #define TRACE 1 diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index be4c9f2..127ecf1 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -516,6 +516,7 @@ enum sof_comp_type { SOF_COMP_EQ_FIR, SOF_COMP_FILEREAD, /* host test based file IO */ SOF_COMP_FILEWRITE, /* host test based file IO */ + SOF_COMP_PASSTHROUGH, }; /* XRUN action for component */ @@ -615,6 +616,12 @@ struct sof_ipc_comp_mux { struct sof_ipc_comp_config config; } __attribute__((packed)); +/* generic passthrough component */ +struct sof_ipc_comp_passthrough { + struct sof_ipc_comp comp; + struct sof_ipc_comp_config config; +} __attribute__((packed)); + /* generic tone generator component */ struct sof_ipc_comp_tone { struct sof_ipc_comp comp; -- 2.9.3
1 0
0 0
[Sound-open-firmware] [PATCH] topology: byt-rt5640: Fix stream name for BE DAI link
by Liam Girdwood 04 Sep '17

04 Sep '17
Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- topology/reef-byt-rt5640.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/topology/reef-byt-rt5640.m4 b/topology/reef-byt-rt5640.m4 index 0629d43..9855f1a 100644 --- a/topology/reef-byt-rt5640.m4 +++ b/topology/reef-byt-rt5640.m4 @@ -66,11 +66,11 @@ SectionGraph."pipe-byt-rt5640" { # playback DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 -DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, I2S, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0) +DAI_ADD(sof/pipe-dai-playback.m4, SSP, 2, Audio, PIPELINE_SOURCE_1, 2, s24le, 48, 1000, 0, 0) # capture DAI is SSP2 using I2S DAPM stream and 2 periods # Buffers use s24le format, with 48 frame per 1000us on core 0 with priorty 0 -DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, I2S, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) +DAI_ADD(sof/pipe-dai-capture.m4, SSP, 2, Audio, PIPELINE_SINK_2, 2, s24le, 48, 1000, 0, 0) # # BE configurations - overrides config in ACPI if present -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH v2 1/3] comp: default function to set comp state
by Ranjani Sridharan 04 Sep '17

04 Sep '17
This patch adds a the comp_set_state() used for the mandatory pipeline commands, START, STOP, PAUSE and RELEASE. It also updates the cmd method in existing components to use comp_set_state(). Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> --- src/audio/component.c | 38 ++++++++++++++++++++++++++++++++++++++ src/audio/eq_fir.c | 23 +---------------------- src/audio/host.c | 16 ++++------------ src/audio/src.c | 26 +++----------------------- src/audio/tone.c | 29 ++++++----------------------- src/audio/volume.c | 21 ++++----------------- src/include/reef/audio/component.h | 3 +++ 7 files changed, 59 insertions(+), 97 deletions(-) diff --git a/src/audio/component.c b/src/audio/component.c index 6369e2e..232ef02 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -117,6 +117,44 @@ void comp_unregister(struct comp_driver *drv) spin_unlock(&cd->lock); } +int comp_set_state(struct comp_dev *dev, int cmd) +{ + int ret = 0; + + switch (cmd) { + case COMP_CMD_START: + case COMP_CMD_RELEASE: + dev->state = COMP_STATE_RUNNING; + break; + case COMP_CMD_STOP: + if (dev->state == COMP_STATE_RUNNING || + dev->state == COMP_STATE_DRAINING || + dev->state == COMP_STATE_PAUSED) { + comp_buffer_reset(dev); + dev->state = COMP_STATE_SETUP; + } else { + trace_comp_error("CEs"); + ret = -EINVAL; + } + break; + case COMP_CMD_PAUSE: + /* only support pausing for running */ + if (dev->state == COMP_STATE_RUNNING) + dev->state = COMP_STATE_PAUSED; + else { + trace_comp_error("CEp"); + ret = -EINVAL; + } + break; + default: + trace_comp_error("CEd"); + ret = -EINVAL; + break; + } + + return ret; +} + void sys_comp_init(void) { cd = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*cd)); diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index 540c68f..98cd43e 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -382,32 +382,11 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) ret = fir_cmd(dev, cdata); break; case COMP_CMD_START: - trace_src("EFs"); - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - trace_src("ESp"); - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - trace_src("EPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - - break; case COMP_CMD_RELEASE: - trace_src("ERl"); - dev->state = COMP_STATE_RUNNING; - break; default: - trace_src("EDf"); - ret = -EINVAL; + ret = comp_set_state(dev, cmd); break; } diff --git a/src/audio/host.c b/src/audio/host.c index e71e95f..f81fd66 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -553,28 +553,20 @@ static int host_cmd(struct comp_dev *dev, int cmd, void *data) // TODO: align cmd macros. switch (cmd) { - case COMP_CMD_PAUSE: - /* only support pausing for running, channel is paused by DAI */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - break; case COMP_CMD_STOP: if (dev->state == COMP_STATE_RUNNING || dev->state == COMP_STATE_DRAINING || dev->state == COMP_STATE_PAUSED) ret = host_stop(dev); break; - case COMP_CMD_RELEASE: - /* channel is released by DAI */ - dev->state = COMP_STATE_RUNNING; - break; - case COMP_CMD_START: - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_SUSPEND: case COMP_CMD_RESUME: break; + case COMP_CMD_START: + case COMP_CMD_PAUSE: + case COMP_CMD_RELEASE: default: + ret = comp_set_state(dev, cmd); break; } diff --git a/src/audio/src.c b/src/audio/src.c index c11ef3f..056822f 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -404,7 +404,7 @@ static int src_params(struct comp_dev *dev) static int src_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - int i; + int i, ret = 0; switch (cdata->cmd) { case SOF_CTRL_CMD_MUTE: @@ -438,35 +438,15 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) case COMP_CMD_SET_VALUE: return src_ctrl_cmd(dev, cdata); case COMP_CMD_START: - trace_src("SSt"); - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - trace_src("SSp"); - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - trace_src("SPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - - break; case COMP_CMD_RELEASE: - trace_src("SRl"); - dev->state = COMP_STATE_RUNNING; - break; default: - trace_src("SDf"); + ret = comp_set_state(dev, cmd); break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/audio/tone.c b/src/audio/tone.c index 448c472..5d844b2 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -433,6 +433,10 @@ static int tone_params(struct comp_dev *dev) static int tone_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); + struct sof_ipc_comp_tone *ct; + int ret = 0; + + trace_tone("tri"); switch (cdata->cmd) { case SOF_CTRL_CMD_MUTE: @@ -475,36 +479,15 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data) case COMP_CMD_SET_VALUE: return tone_ctrl_cmd(dev, cdata); case COMP_CMD_START: - trace_tone("TSt"); - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - trace_tone("TSp"); - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - trace_tone("TPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - - break; case COMP_CMD_RELEASE: - trace_tone("TRl"); - dev->state = COMP_STATE_RUNNING; - break; default: - trace_tone("TDf"); - + ret = comp_set_state(dev, cmd); break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/audio/volume.c b/src/audio/volume.c index 6cbd6ff..cde117c 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -383,7 +383,8 @@ static inline void volume_set_chan_unmute(struct comp_dev *dev, int chan) static int volume_ctrl_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *cdata) { struct comp_data *cd = comp_get_drvdata(dev); - int i, j; + struct sof_ipc_ctrl_values *cv; + int i, j, ret = 0; switch (cdata->cmd) { case SOF_CTRL_CMD_VOLUME: @@ -436,29 +437,15 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data) case COMP_CMD_SET_VALUE: return volume_ctrl_cmd(dev, cdata); case COMP_CMD_START: - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - break; case COMP_CMD_RELEASE: - dev->state = COMP_STATE_RUNNING; - break; default: + ret = comp_set_state(dev, cmd); break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index 35c80de..e20ffed 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -214,6 +214,9 @@ static inline void comp_free(struct comp_dev *dev) dev->drv->ops.free(dev); } +/* component state set */ +int comp_set_state(struct comp_dev *dev, int cmd); + /* component parameter init - mandatory */ static inline int comp_params(struct comp_dev *dev) { -- 2.9.3
1 0
0 0
[Sound-open-firmware] [PATCH] pipeline: fixed return value from preload_downstream
by Ranjani Sridharan 04 Sep '17

04 Sep '17
This patch fixes the return value from the preload_downstream() call in pipeline_params() Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> --- src/audio/pipeline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 4327254..49a0c51 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -505,7 +505,7 @@ static int preload_downstream(struct comp_dev *start, struct comp_dev *current) int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) { struct op_data op_data; - int ret, count, i; + int ret, i; trace_pipe("pre"); @@ -527,10 +527,10 @@ int pipeline_prepare(struct pipeline *p, struct comp_dev *dev) * trigger start */ for (i = 0; i < MAX_PRELOAD_SIZE; i++) { - count = preload_downstream(dev, dev); + ret = preload_downstream(dev, dev); /* complete ? */ - if (count <= 0) + if (ret <= 0) goto out; } -- 2.9.3
2 1
0 0
[Sound-open-firmware] [PATCH] rmbox: check for non printable chars in trace.
by Liam Girdwood 04 Sep '17

04 Sep '17
Non printable means trace is a value. Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- rmbox/rmbox.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rmbox/rmbox.c b/rmbox/rmbox.c index 1f81e06..3ef6fb4 100644 --- a/rmbox/rmbox.c +++ b/rmbox/rmbox.c @@ -19,6 +19,7 @@ #include <stdint.h> #include <errno.h> #include <string.h> +#include <ctype.h> // TODO: include all this stuff @@ -135,6 +136,12 @@ static void show_trace(uint32_t val, uint32_t addr, uint32_t *timestamp, float c return; } + /* check for printable values - otherwise it's a value */ + if (!isprint((char)(val >> 16)) || !isprint((char)(val >> 8)) || !isprint((char)val)) { + printf("value 0x%8.8x\n", (uint32_t)val); + return; + } + class = val & 0xff000000; if (class == TRACE_CLASS_IRQ) trace = "irq"; -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH v1 1/3] comp: default function to set comp state
by Ranjani Sridharan 04 Sep '17

04 Sep '17
This patch adds a the comp_set_state() used for the mandatory pipeline commands, START, STOP, PAUSE and RELEASE. It also updates the cmd method in existing components to use comp_set_state(). Signed-off-by: Ranjani Sridharan <ranjani.sridharan(a)linux.intel.com> --- src/audio/component.c | 36 ++++++++++++++++++++++++++++++++++++ src/audio/eq_fir.c | 23 ++--------------------- src/audio/host.c | 16 ++++------------ src/audio/src.c | 26 +++----------------------- src/audio/tone.c | 26 +++----------------------- src/audio/volume.c | 20 +++----------------- src/include/reef/audio/component.h | 3 +++ 7 files changed, 54 insertions(+), 96 deletions(-) diff --git a/src/audio/component.c b/src/audio/component.c index 6369e2e..6f2e0c3 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -117,6 +117,42 @@ void comp_unregister(struct comp_driver *drv) spin_unlock(&cd->lock); } +int comp_set_state(struct comp_dev *dev, int cmd) +{ + int ret = 0; + + switch (cmd) { + case COMP_CMD_START: + case COMP_CMD_RELEASE: + dev->state = COMP_STATE_RUNNING; + break; + case COMP_CMD_STOP: + if (dev->state == COMP_STATE_RUNNING || + dev->state == COMP_STATE_DRAINING || + dev->state == COMP_STATE_PAUSED) { + comp_buffer_reset(dev); + dev->state = COMP_STATE_SETUP; + } else { + trace_comp_error("CEs"); + ret = -EINVAL; + } + break; + case COMP_CMD_PAUSE: + /* only support pausing for running */ + if (dev->state == COMP_STATE_RUNNING) + dev->state = COMP_STATE_PAUSED; + else { + trace_comp_error("CEp"); + ret = -EINVAL; + } + break; + default: + break; + } + + return ret; +} + void sys_comp_init(void) { cd = rzalloc(RZONE_SYS, RFLAGS_NONE, sizeof(*cd)); diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index 534a4a1..6380340 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -364,31 +364,12 @@ static int eq_fir_cmd(struct comp_dev *dev, int cmd, void *data) break; case COMP_CMD_START: - trace_src("EFs"); - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - trace_src("ESp"); - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - trace_src("EPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - - break; case COMP_CMD_RELEASE: - trace_src("ERl"); - dev->state = COMP_STATE_RUNNING; - break; default: - trace_src("EDf"); + ret = comp_set_state(dev, cmd); + break; } return ret; diff --git a/src/audio/host.c b/src/audio/host.c index e71e95f..f81fd66 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -553,28 +553,20 @@ static int host_cmd(struct comp_dev *dev, int cmd, void *data) // TODO: align cmd macros. switch (cmd) { - case COMP_CMD_PAUSE: - /* only support pausing for running, channel is paused by DAI */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - break; case COMP_CMD_STOP: if (dev->state == COMP_STATE_RUNNING || dev->state == COMP_STATE_DRAINING || dev->state == COMP_STATE_PAUSED) ret = host_stop(dev); break; - case COMP_CMD_RELEASE: - /* channel is released by DAI */ - dev->state = COMP_STATE_RUNNING; - break; - case COMP_CMD_START: - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_SUSPEND: case COMP_CMD_RESUME: break; + case COMP_CMD_START: + case COMP_CMD_PAUSE: + case COMP_CMD_RELEASE: default: + ret = comp_set_state(dev, cmd); break; } diff --git a/src/audio/src.c b/src/audio/src.c index 0279841..0ecb48c 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -381,7 +381,7 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) { trace_src("SCm"); struct comp_data *cd = comp_get_drvdata(dev); - int i; + int i, ret = 0; switch (cmd) { case COMP_CMD_SRC: @@ -400,35 +400,15 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) break; case COMP_CMD_START: - trace_src("SSt"); - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - trace_src("SSp"); - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - trace_src("SPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - - break; case COMP_CMD_RELEASE: - trace_src("SRl"); - dev->state = COMP_STATE_RUNNING; - break; default: - trace_src("SDf"); + ret = comp_set_state(dev, cmd); break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/audio/tone.c b/src/audio/tone.c index cbc50ac..305563e 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -433,6 +433,7 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data) { struct comp_data *cd = comp_get_drvdata(dev); struct sof_ipc_comp_tone *ct; + int ret = 0; trace_tone("tri"); @@ -456,36 +457,15 @@ static int tone_cmd(struct comp_dev *dev, int cmd, void *data) tonegen_unmute(&cd->sg); break; case COMP_CMD_START: - trace_tone("TSt"); - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - trace_tone("TSp"); - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - trace_tone("TPe"); - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - - break; case COMP_CMD_RELEASE: - trace_tone("TRl"); - dev->state = COMP_STATE_RUNNING; - break; default: - trace_tone("TDf"); - + ret = comp_set_state(dev, cmd); break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/audio/volume.c b/src/audio/volume.c index 93a3839..2e097d5 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -385,7 +385,7 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data) { struct comp_data *cd = comp_get_drvdata(dev); struct sof_ipc_ctrl_values *cv; - int i, j; + int i, j, ret = 0; trace_volume("cmd"); @@ -425,29 +425,15 @@ static int volume_cmd(struct comp_dev *dev, int cmd, void *data) work_schedule_default(&cd->volwork, VOL_RAMP_US); break; case COMP_CMD_START: - dev->state = COMP_STATE_RUNNING; - break; case COMP_CMD_STOP: - if (dev->state == COMP_STATE_RUNNING || - dev->state == COMP_STATE_DRAINING || - dev->state == COMP_STATE_PAUSED) { - comp_buffer_reset(dev); - dev->state = COMP_STATE_SETUP; - } - break; case COMP_CMD_PAUSE: - /* only support pausing for running */ - if (dev->state == COMP_STATE_RUNNING) - dev->state = COMP_STATE_PAUSED; - break; case COMP_CMD_RELEASE: - dev->state = COMP_STATE_RUNNING; - break; default: + ret = comp_set_state(dev, cmd); break; } - return 0; + return ret; } /* copy and process stream data from source to sink buffers */ diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h index e73a22a..cbd2356 100644 --- a/src/include/reef/audio/component.h +++ b/src/include/reef/audio/component.h @@ -215,6 +215,9 @@ static inline void comp_free(struct comp_dev *dev) dev->drv->ops.free(dev); } +/* component state set */ +int comp_set_state(struct comp_dev *dev, int cmd); + /* component parameter init - mandatory */ static inline int comp_params(struct comp_dev *dev) { -- 2.9.3
2 5
0 0
[Sound-open-firmware] [PATCH] alloc: Add support for allocating different types of memory from the heap
by Keyon Jie 04 Sep '17

04 Sep '17
To add support for different types of heap memory, here it will: 1. add handle for RFLAGS_DMA which will allocate DMA buffer blocks if exist; 2. refine free_block, which will free blocks of runtime heap, general buffer heap, or dma buffer heap. Signed-off-by: Keyon Jie <yang.jie(a)linux.intel.com> Tested-by: Zhang Keqiao <keqiao.zhang(a)intel.com> --- src/lib/alloc.c | 82 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/src/lib/alloc.c b/src/lib/alloc.c index 86c2bc7..e28817b 100644 --- a/src/lib/alloc.c +++ b/src/lib/alloc.c @@ -334,20 +334,38 @@ found: /* free block(s) */ static void free_block(struct mm_heap *heap, void *ptr) { - struct block_map *map; + struct mm_heap * mm_heap; + struct block_map * block_map; struct block_hdr *hdr; - int i, block; + int i, block, array_size; /* sanity check */ if (ptr == NULL) return; + /* find mm_heap that ptr belongs to */ + if ((uint32_t)ptr >= memmap.runtime.heap && + (uint32_t)ptr < memmap.runtime.heap + memmap.runtime.size) { + mm_heap = &memmap.runtime; + array_size = ARRAY_SIZE(rt_heap_map); + } else if ((uint32_t)ptr >= memmap.buffer.heap && + (uint32_t)ptr < memmap.buffer.heap + memmap.buffer.size) { + mm_heap = &memmap.buffer; + array_size = ARRAY_SIZE(buf_heap_map); +#if (HEAP_DMA_BUFFER_SIZE > 0) + } else if ((uint32_t)ptr >= memmap.dma.heap && + (uint32_t)ptr < memmap.dma.heap + memmap.dma.size) { + mm_heap = &memmap.dma; + array_size = ARRAY_SIZE(dma_buf_heap_map); +#endif + } else + return; + /* find block that ptr belongs to */ - for (i = 0; i < ARRAY_SIZE(rt_heap_map) - 1; i ++) { + for (i = 0; i < array_size - 1; i ++) { /* is ptr in this block */ - if ((uint32_t)ptr >= rt_heap_map[i].base && - (uint32_t)ptr < rt_heap_map[i + 1].base) + if ((uint32_t)ptr < mm_heap->map[i + 1].base) goto found; } @@ -356,27 +374,29 @@ static void free_block(struct mm_heap *heap, void *ptr) return; found: + /* the block i is it */ + block_map = &mm_heap->map[i]; + /* calculate block header */ - map = &rt_heap_map[i]; - block = ((uint32_t)ptr - map->base) / map->block_size; - hdr = &map->block[block]; + block = ((uint32_t)ptr - block_map->base) / block_map->block_size; + hdr = &block_map->block[block]; /* free block header and continious blocks */ for (i = block; i < block + hdr->size; i++) { - hdr = &map->block[i]; + hdr = &block_map->block[i]; hdr->size = 0; hdr->flags = 0; - map->free_count++; - heap->info.used -= map->block_size; - heap->info.free += map->block_size; + block_map->free_count++; + heap->info.used -= block_map->block_size; + heap->info.free += block_map->block_size; } /* set first free */ - if (block < map->first_free) - map->first_free = block; + if (block < block_map->first_free) + block_map->first_free = block; #if DEBUG_BLOCK_FREE - alloc_memset_region(ptr, map->block_size * (i - 1), DEBUG_BLOCK_FREE_VALUE); + alloc_memset_region(ptr, block_map->block_size * (i - 1), DEBUG_BLOCK_FREE_VALUE); #endif } @@ -443,47 +463,57 @@ void *rzalloc(int zone, int bflags, size_t bytes) /* allocates continuous buffer on 1k boundary */ void *rballoc(int zone, int bflags, size_t bytes) { + struct block_map * block_map = buf_heap_map; + struct mm_heap * mm_heap = &memmap.buffer; + int i, array_size = ARRAY_SIZE(buf_heap_map); uint32_t flags; void *ptr = NULL; - int i; +#if (HEAP_DMA_BUFFER_SIZE > 0) + if (bflags & RFLAGS_DMA) { + mm_heap = &memmap.dma; + block_map = dma_buf_heap_map; + array_size = ARRAY_SIZE(dma_buf_heap_map); + } +#endif spin_lock_irq(&memmap.lock, flags); /* will request fit in single block */ - for (i = 0; i < ARRAY_SIZE(buf_heap_map); i++) { + for (i = 0; i < array_size; i++) { + trace_value(block_map[i].block_size); /* is block big enough */ - if (buf_heap_map[i].block_size < bytes) + if (block_map[i].block_size < bytes) continue; /* does block have free space */ - if (buf_heap_map[i].free_count == 0) + if (block_map[i].free_count == 0) continue; /* allocate block */ - ptr = alloc_block(&memmap.buffer, i, bflags); + ptr = alloc_block(mm_heap, i, bflags); goto out; } /* request spans > 1 block */ /* only 1 choice for block size */ - if (ARRAY_SIZE(buf_heap_map) == 1) { - ptr = alloc_cont_blocks(&memmap.buffer, 0, bflags, bytes); + if (array_size == 1) { + ptr = alloc_cont_blocks(mm_heap, 0, bflags, bytes); goto out; } else { /* find best block size for request */ - for (i = 0; i < ARRAY_SIZE(buf_heap_map); i++) { + for (i = 0; i < array_size; i++) { /* allocate is block size smaller than request */ - if (buf_heap_map[i].block_size < bytes) - alloc_cont_blocks(&memmap.buffer, i, bflags, + if (block_map[i].block_size < bytes) + alloc_cont_blocks(mm_heap, i, bflags, bytes); } } - ptr = alloc_cont_blocks(&memmap.buffer, ARRAY_SIZE(buf_heap_map) - 1, + ptr = alloc_cont_blocks(mm_heap, array_size - 1, bflags, bytes); out: -- 2.11.0
2 1
0 0
[Sound-open-firmware] [PATCH] sof: abi: Add component ABI header for host configuration
by Liam Girdwood 04 Sep '17

04 Sep '17
Add an ABI header to be pre-pended to all binary blobs or bespoke component data structures that will be passed from host to DSP component or vice versa (i.e via binary kcontrols). Signed-off-by: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> --- src/include/uapi/Makefile.am | 3 ++- src/include/uapi/abi.h | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/include/uapi/abi.h diff --git a/src/include/uapi/Makefile.am b/src/include/uapi/Makefile.am index b49560c..c4c2fe6 100644 --- a/src/include/uapi/Makefile.am +++ b/src/include/uapi/Makefile.am @@ -1,2 +1,3 @@ include_HEADERS = \ - ipc.h + ipc.h \ + abi.h diff --git a/src/include/uapi/abi.h b/src/include/uapi/abi.h new file mode 100644 index 0000000..66ec16a --- /dev/null +++ b/src/include/uapi/abi.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Liam Girdwood <liam.r.girdwood(a)linux.intel.com> + */ + +#ifndef __INCLUDE_UAPI_ABI_H__ +#define __INCLUDE_UAPI_ABI_H__ + +#define SOF_ABI_VERSION 1 + +/* + * Header for all non IPC ABI data. Identifies data type, size and ABI. + * Used by any bespoke component data structures or binary blobs. + */ + +struct sof_abi_hdr { + char magic[4]; /* 'S', 'O', 'F', '\0' */ + uint32_t type; /* component specific type */ + uint32_t size; /* size in bytes of data excluding this struct */ + uint32_t abi; /* SOF ABI version */ + uint32_t comp_abi; /* component specific ABI version */ +} __attribute__((packed)); + +#endif + -- 2.11.0
1 0
0 0
[Sound-open-firmware] [PATCH 1/4] SRC: Bug fixes, add support for int16 coefficients, comments cleanup
by Seppo Ingalsuo 04 Sep '17

04 Sep '17
This patch fixes bugs in sink and source buffers handling and adds support for short coefficient type to save RAM in platforms with less space such as BYT. The patch introduces also a RAM saving minimum conversions set between 16, 44.1, and 48 kHz. A new possible rate 18.9 kHz was added to supported rates indication bits. SRC filters quality is also adjusted for lower default performance. The higher performance will need >16bit coefficients usage. The larger conversion set and 32 bit filter coefficients can be easily restored with the SRC tools in rimage. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo(a)linux.intel.com> --- src/audio/src.c | 62 +- src/audio/src_core.c | 67 +- src/audio/src_core.h | 11 + .../coefficients/src/src_int16_1_3_4375_5000.h | 251 +++++ .../coefficients/src/src_int16_20_21_4020_5000.h | 1066 ++++++++++++++++++++ .../coefficients/src/src_int16_21_20_4020_5000.h | 1056 +++++++++++++++++++ .../coefficients/src/src_int16_3_1_4375_5000.h | 252 +++++ .../coefficients/src/src_int16_7_8_4375_5000.h | 657 ++++++++++++ .../coefficients/src/src_int16_8_7_4375_5000.h | 662 ++++++++++++ .../reef/audio/coefficients/src/src_int16_define.h | 11 + .../reef/audio/coefficients/src/src_int16_table.h | 32 + 11 files changed, 4076 insertions(+), 51 deletions(-) create mode 100644 src/include/reef/audio/coefficients/src/src_int16_1_3_4375_5000.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_20_21_4020_5000.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_21_20_4020_5000.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_3_1_4375_5000.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_7_8_4375_5000.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_8_7_4375_5000.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_define.h create mode 100644 src/include/reef/audio/coefficients/src/src_int16_table.h diff --git a/src/audio/src.c b/src/audio/src.c index 074c041..0279841 100644 --- a/src/audio/src.c +++ b/src/audio/src.c @@ -60,7 +60,6 @@ struct comp_data { int scratch_length; uint32_t sink_rate; uint32_t source_rate; - //int32_t z[STAGE_BUF_SIZE]; void (*src_func)(struct comp_dev *dev, struct comp_buffer *source, struct comp_buffer *sink, @@ -117,8 +116,6 @@ static void fallback_s32(struct comp_dev *dev, { struct comp_data *cd = comp_get_drvdata(dev); - //int32_t *src = (int32_t*) source->r_ptr; - //int32_t *dest = (int32_t*) sink->w_ptr; int nch = dev->params.channels; int blk_in = cd->src[0].blk_in; int blk_out = cd->src[0].blk_out; @@ -253,7 +250,7 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp) { struct comp_dev *dev; struct sof_ipc_comp_src *src; - struct sof_ipc_comp_src *ipc_src = (struct sof_ipc_comp_src *)comp; + struct sof_ipc_comp_src *ipc_src = (struct sof_ipc_comp_src *) comp; struct comp_data *cd; int i; @@ -264,7 +261,7 @@ static struct comp_dev *src_new(struct sof_ipc_comp *comp) if (dev == NULL) return NULL; - src = (struct sof_ipc_comp_src *)&dev->comp; + src = (struct sof_ipc_comp_src *) &dev->comp; memcpy(src, ipc_src, sizeof(struct sof_ipc_comp_src)); cd = rzalloc(RZONE_RUNTIME, RFLAGS_NONE, sizeof(*cd)); @@ -312,7 +309,7 @@ static int src_params(struct comp_dev *dev) trace_src("par"); - /* EQ supports only S32_LE PCM format */ + /* SRC supports only S32_LE PCM format */ if (config->frame_fmt != SOF_IPC_FRAME_S32_LE) return -EINVAL; @@ -372,14 +369,9 @@ static int src_params(struct comp_dev *dev) break; } - /* Check that src blk_in and blk_out are less than params.period_frames. - * Return an error if the period is too short. - */ - if (src_polyphase_get_blk_in(&cd->src[0]) > dev->frames) - return -EINVAL; - - if (src_polyphase_get_blk_out(&cd->src[0]) > dev->frames) - return -EINVAL; + /* Need to compute this */ + dev->frame_bytes = + dev->params.sample_container_bytes * dev->params.channels; return 0; } @@ -389,15 +381,11 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) { trace_src("SCm"); struct comp_data *cd = comp_get_drvdata(dev); -// struct sof_ipc_comp_src *cv; int i; switch (cmd) { case COMP_CMD_SRC: trace_src("SMa"); -// cv = (struct sof_ipc_comp_src *) data; -// cv->in_mask = src_input_rates(); -// cv->out_mask = src_output_rates(); break; case COMP_CMD_MUTE: trace_src("SMu"); @@ -447,11 +435,8 @@ static int src_cmd(struct comp_dev *dev, int cmd, void *data) static int src_copy(struct comp_dev *dev) { struct comp_data *cd = comp_get_drvdata(dev); - struct comp_buffer *source; - struct comp_buffer *sink; - uint32_t frames_source; - uint32_t frames_sink; - int need_source, need_sink, min_frames; + struct comp_buffer *source, *sink; + int need_source, need_sink, blk_in, blk_out, frames_source, frames_sink; trace_comp("SRC"); @@ -464,36 +449,23 @@ static int src_copy(struct comp_dev *dev) /* Check that source has enough frames available and sink enough * frames free. */ - frames_source = dev->frames; - frames_sink = dev->frames; - - min_frames = src_polyphase_get_blk_in(&cd->src[0]); - if (frames_source > min_frames) - need_source = frames_source * dev->frame_bytes; - else { - frames_source = min_frames; - need_source = min_frames * dev->frame_bytes; - } - - min_frames = src_polyphase_get_blk_out(&cd->src[0]); - if (frames_sink > min_frames) - need_sink = frames_sink * dev->frame_bytes; - else { - frames_sink = min_frames; - need_sink = min_frames * dev->frame_bytes; - } + blk_in = src_polyphase_get_blk_in(&cd->src[0]); + blk_out = src_polyphase_get_blk_out(&cd->src[0]); + frames_source = dev->frames * blk_in / blk_out; + frames_sink = frames_source * blk_out / blk_in; + need_source = frames_source * dev->frame_bytes; + need_sink = frames_sink * dev->frame_bytes; /* Run as many times as buffers allow */ while ((source->avail >= need_source) && (sink->free >= need_sink)) { /* Run src */ cd->src_func(dev, source, sink, frames_source, frames_sink); + /* calc new free and available */ + comp_update_buffer_consume(source, 0); + comp_update_buffer_produce(sink, 0); } - /* calc new free and available - offset calc by conversion func */ - comp_update_buffer_consume(source, 0); - comp_update_buffer_produce(sink, 0); - return 0; } diff --git a/src/audio/src_core.c b/src/audio/src_core.c index 7deae14..55f7062 100644 --- a/src/audio/src_core.c +++ b/src/audio/src_core.c @@ -45,14 +45,17 @@ #include "src_core.h" /* Include conversion tables */ +#if SRC_SHORT == 1 +#include <reef/audio/coefficients/src/src_int16_table.h> +#else #include <reef/audio/coefficients/src/src_int24_table.h> +#endif -#if 1 /* TODO: These should be defined somewhere else. */ -#define SOF_RATES_LENGTH 15 -int sof_rates[SOF_RATES_LENGTH] = {7350, 8000, 11025, 12000, 16000, 22050, - 24000, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000}; -#endif +#define SOF_RATES_LENGTH 16 +int sof_rates[SOF_RATES_LENGTH] = {7350, 8000, 11025, 12000, 16000, 18900, + 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000, 176400, + 192000}; /* Calculates the needed FIR delay line length */ int src_fir_delay_length(struct src_stage *s) @@ -293,6 +296,23 @@ int src_polyphase_init(struct polyphase_src *src, int fs1, int fs2, return n_stages; } +#if SRC_SHORT == 1 + +/* Calculate a FIR filter part that does not need circular modification */ +static inline void fir_part(int64_t *y, int ntaps, const int16_t c[], int *ic, + int32_t d[], int *id) +{ + int64_t p; + int n; + + /* Data is Q1.31, coef is Q1.15, product is Q2.46 */ + for (n = 0; n < ntaps; n++) { + p = (int64_t) c[(*ic)++] * d[(*id)--]; + *y += p; + } +} +#else + /* Calculate a FIR filter part that does not need circular modification */ static inline void fir_part(int64_t *y, int ntaps, const int32_t c[], int *ic, int32_t d[], int *id) @@ -307,6 +327,40 @@ static inline void fir_part(int64_t *y, int ntaps, const int32_t c[], int *ic, *y += p; } } +#endif + +#if SRC_SHORT == 1 + +static inline int32_t fir_filter( + struct src_state *fir, const int16_t coefs[], + int *coefi, int filter_length, int shift) +{ + int64_t y = 0; + int n1; + int n2; + + n1 = fir->fir_ri + 1; + if (n1 > filter_length) { + /* No need to un-wrap fir read index, make sure fir_fi + * is ge 0 after FIR computation. + */ + fir_part(&y, filter_length, coefs, coefi, fir->fir_delay, + &fir->fir_ri); + } else { + n2 = filter_length - n1; + /* Part 1, loop n1 times, fir_ri becomes -1 */ + fir_part(&y, n1, coefs, coefi, fir->fir_delay, &fir->fir_ri); + + /* Part 2, unwrap fir_ri, continue rest of filter */ + fir->fir_ri = fir->fir_delay_size - 1; + fir_part(&y, n2, coefs, coefi, fir->fir_delay, &fir->fir_ri); + } + /* Q2.46 -> Q2.31, saturate to Q1.31 */ + y = y >> (15 + shift); + + return (int32_t) sat_int32(y); +} +#else static inline int32_t fir_filter( struct src_state *fir, const int32_t coefs[], @@ -335,8 +389,9 @@ static inline int32_t fir_filter( /* Q9.47 -> Q9.24, saturate to Q8.24 */ y = y >> (23 + shift); - return (int32_t)sat_int32(y); + return (int32_t) sat_int32(y); } +#endif void src_polyphase_stage_cir(struct src_stage_prm *s) { diff --git a/src/audio/src_core.h b/src/audio/src_core.h index 0444215..dae5e53 100644 --- a/src/audio/src_core.h +++ b/src/audio/src_core.h @@ -32,10 +32,17 @@ #ifndef SRC_CORE_H #define SRC_CORE_H +/* TODO: This should be made per platform configurable */ +#define SRC_SHORT 1 + #define MAX(a, b) (((a) > (b)) ? (a) : (b)) /* Include SRC min/max constants etc. */ +#if SRC_SHORT == 1 +#include <reef/audio/coefficients/src/src_int16_define.h> +#else #include <reef/audio/coefficients/src/src_int24_define.h> +#endif struct src_alloc { int fir_s1; @@ -57,7 +64,11 @@ struct src_stage { const int blk_out; const int halfband; const int shift; +#if SRC_SHORT == 1 + const int16_t *coefs; +#else const int32_t *coefs; +#endif }; struct src_state { diff --git a/src/include/reef/audio/coefficients/src/src_int16_1_3_4375_5000.h b/src/include/reef/audio/coefficients/src/src_int16_1_3_4375_5000.h new file mode 100644 index 0000000..34e177c --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_1_3_4375_5000.h @@ -0,0 +1,251 @@ +const int16_t src_int16_1_3_4375_5000_fir[245] = { + 0, + 0, + -1, + 0, + 1, + 1, + 1, + -1, + -2, + -1, + 1, + 3, + 2, + 0, + -4, + -4, + 0, + 4, + 6, + 2, + -5, + -8, + -4, + 5, + 11, + 7, + -4, + -13, + -12, + 1, + 16, + 17, + 2, + -17, + -23, + -8, + 17, + 30, + 16, + -15, + -37, + -26, + 10, + 42, + 39, + -2, + -46, + -52, + -10, + 47, + 67, + 26, + -44, + -82, + -47, + 36, + 95, + 72, + -21, + -104, + -100, + -1, + 109, + 129, + 31, + -106, + -159, + -69, + 94, + 187, + 115, + -71, + -210, + -167, + 35, + 225, + 225, + 16, + -228, + -284, + -82, + 216, + 342, + 163, + -184, + -395, + -259, + 130, + 437, + 368, + -49, + -463, + -489, + -62, + 467, + 616, + 208, + -439, + -748, + -393, + 372, + 880, + 624, + -252, + -1007, + -914, + 60, + 1125, + 1285, + 240, + -1228, + -1791, + -720, + 1313, + 2565, + 1582, + -1377, + -4078, + -3627, + 1416, + 9650, + 17303, + 20414, + 17303, + 9650, + 1416, + -3627, + -4078, + -1377, + 1582, + 2565, + 1313, + -720, + -1791, + -1228, + 240, + 1285, + 1125, + 60, + -914, + -1007, + -252, + 624, + 880, + 372, + -393, + -748, + -439, + 208, + 616, + 467, + -62, + -489, + -463, + -49, + 368, + 437, + 130, + -259, + -395, + -184, + 163, + 342, + 216, + -82, + -284, + -228, + 16, + 225, + 225, + 35, + -167, + -210, + -71, + 115, + 187, + 94, + -69, + -159, + -106, + 31, + 129, + 109, + -1, + -100, + -104, + -21, + 72, + 95, + 36, + -47, + -82, + -44, + 26, + 67, + 47, + -10, + -52, + -46, + -2, + 39, + 42, + 10, + -26, + -37, + -15, + 16, + 30, + 17, + -8, + -23, + -17, + 2, + 17, + 16, + 1, + -12, + -13, + -4, + 7, + 11, + 5, + -4, + -8, + -5, + 2, + 6, + 4, + 0, + -4, + -4, + 0, + 2, + 3, + 1, + -1, + -2, + -1, + 1, + 1, + 1, + 0, + -1, + 0, + 0 + +}; +struct src_stage src_int16_1_3_4375_5000 = { + 1, 0, 1, 245, 245, 3, 1, 0, 1, + src_int16_1_3_4375_5000_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_int16_20_21_4020_5000.h b/src/include/reef/audio/coefficients/src/src_int16_20_21_4020_5000.h new file mode 100644 index 0000000..51aade7 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_20_21_4020_5000.h @@ -0,0 +1,1066 @@ +const int16_t src_int16_20_21_4020_5000_fir[1060] = { + 1, + -2, + 2, + 1, + -8, + 19, + -34, + 46, + -47, + 28, + 20, + -96, + 188, + -274, + 316, + -277, + 125, + 150, + -525, + 939, + -1288, + 1439, + -1233, + 472, + 1182, + -4843, + 21640, + 18847, + -5651, + 2095, + -277, + -717, + 1157, + -1205, + 997, + -663, + 311, + -18, + -175, + 261, + -260, + 203, + -125, + 51, + 3, + -31, + 38, + -32, + 21, + -10, + 3, + 0, + -1, + 1, + -2, + 2, + 0, + -6, + 18, + -34, + 49, + -54, + 40, + 3, + -78, + 175, + -273, + 336, + -323, + 197, + 61, + -439, + 882, + -1296, + 1547, + -1470, + 856, + 658, + -4253, + 22894, + 17336, + -5873, + 2472, + -629, + -447, + 989, + -1132, + 999, + -713, + 382, + -88, + -120, + 228, + -247, + 205, + -135, + 64, + -9, + -23, + 34, + -31, + 21, + -11, + 4, + 0, + -1, + 1, + -2, + 3, + -2, + -4, + 16, + -33, + 51, + -61, + 52, + -14, + -58, + 159, + -268, + 351, + -364, + 266, + -30, + -343, + 808, + -1280, + 1629, + -1687, + 1237, + 97, + -3539, + 24033, + 15769, + -5978, + 2790, + -960, + -177, + 807, + -1040, + 983, + -749, + 444, + -155, + -64, + 191, + -229, + 203, + -143, + 76, + -21, + -14, + 29, + -29, + 21, + -12, + 5, + -1, + -1, + 1, + -3, + 4, + -3, + -2, + 14, + -32, + 52, + -66, + 63, + -32, + -37, + 139, + -257, + 359, + -400, + 333, + -123, + -238, + 718, + -1241, + 1683, + -1879, + 1608, + -491, + -2701, + 25047, + 14163, + -5972, + 3046, + -1263, + 89, + 616, + -932, + 950, + -771, + 497, + -217, + -9, + 151, + -208, + 198, + -148, + 86, + -32, + -5, + 23, + -26, + 20, + -12, + 5, + -1, + 0, + 1, + -3, + 4, + -4, + 0, + 11, + -29, + 52, + -70, + 74, + -49, + -14, + 115, + -241, + 361, + -428, + 394, + -215, + -127, + 613, + -1178, + 1708, + -2042, + 1962, + -1097, + -1745, + 25925, + 12534, + -5861, + 3238, + -1534, + 347, + 417, + -810, + 900, + -778, + 540, + -274, + 46, + 109, + -183, + 189, + -151, + 95, + -41, + 3, + 18, + -23, + 19, + -12, + 6, + -2, + 0, + 1, + -3, + 5, + -6, + 2, + 8, + -27, + 51, + -74, + 83, + -66, + 10, + 90, + -221, + 356, + -450, + 450, + -306, + -11, + 494, + -1092, + 1703, + -2173, + 2293, + -1713, + -675, + 26656, + 10897, + -5655, + 3365, + -1770, + 591, + 216, + -676, + 836, + -771, + 573, + -326, + 98, + 67, + -156, + 177, + -150, + 101, + -50, + 11, + 12, + -20, + 18, + -12, + 6, + -2, + 0, + 1, + -3, + 5, + -7, + 4, + 5, + -23, + 49, + -76, + 92, + -82, + 33, + 62, + -196, + 344, + -464, + 498, + -393, + 108, + 364, + -984, + 1666, + -2267, + 2593, + -2327, + 502, + 27233, + 9269, + -5360, + 3428, + -1968, + 819, + 16, + -532, + 757, + -751, + 594, + -370, + 148, + 24, + -127, + 162, + -147, + 106, + -58, + 19, + 6, + -16, + 17, + -12, + 6, + -2, + 0, + 1, + -3, + 6, + -8, + 6, + 2, + -20, + 46, + -76, + 98, + -97, + 57, + 32, + -167, + 326, + -469, + 539, + -475, + 228, + 224, + -856, + 1597, + -2323, + 2856, + -2928, + 1779, + 27649, + 7665, + -4988, + 3428, + -2124, + 1027, + -180, + -383, + 667, + -718, + 604, + -406, + 194, + -18, + -96, + 145, + -142, + 108, + -64, + 26, + 0, + -13, + 15, + -12, + 7, + -3, + 1, + 1, + -3, + 6, + -9, + 9, + -2, + -15, + 42, + -75, + 104, + -111, + 81, + 0, + -134, + 302, + -466, + 570, + -550, + 345, + 76, + -709, + 1498, + -2337, + 3076, + -3506, + 3145, + 27901, + 6101, + -4547, + 3367, + -2238, + 1211, + -368, + -230, + 567, + -672, + 604, + -435, + 235, + -59, + -64, + 125, + -134, + 109, + -70, + 32, + -5, + -9, + 13, + -11, + 7, + -3, + 1, + 1, + -3, + 6, + -10, + 11, + -5, + -10, + 38, + -73, + 107, + -123, + 104, + -32, + -98, + 271, + -455, + 592, + -616, + 459, + -76, + -546, + 1368, + -2309, + 3248, + -4050, + 4589, + 27985, + 4589, + -4050, + 3248, + -2309, + 1368, + -546, + -76, + 459, + -616, + 592, + -455, + 271, + -98, + -32, + 104, + -123, + 107, + -73, + 38, + -10, + -5, + 11, + -10, + 6, + -3, + 1, + 1, + -3, + 7, + -11, + 13, + -9, + -5, + 32, + -70, + 109, + -134, + 125, + -64, + -59, + 235, + -435, + 604, + -672, + 567, + -230, + -368, + 1211, + -2238, + 3367, + -4547, + 6101, + 27901, + 3145, + -3506, + 3076, + -2337, + 1498, + -709, + 76, + 345, + -550, + 570, + -466, + 302, + -134, + 0, + 81, + -111, + 104, + -75, + 42, + -15, + -2, + 9, + -9, + 6, + -3, + 1, + 1, + -3, + 7, + -12, + 15, + -13, + 0, + 26, + -64, + 108, + -142, + 145, + -96, + -18, + 194, + -406, + 604, + -718, + 667, + -383, + -180, + 1027, + -2124, + 3428, + -4988, + 7665, + 27649, + 1779, + -2928, + 2856, + -2323, + 1597, + -856, + 224, + 228, + -475, + 539, + -469, + 326, + -167, + 32, + 57, + -97, + 98, + -76, + 46, + -20, + 2, + 6, + -8, + 6, + -3, + 1, + 0, + -2, + 6, + -12, + 17, + -16, + 6, + 19, + -58, + 106, + -147, + 162, + -127, + 24, + 148, + -370, + 594, + -751, + 757, + -532, + 16, + 819, + -1968, + 3428, + -5360, + 9269, + 27233, + 502, + -2327, + 2593, + -2267, + 1666, + -984, + 364, + 108, + -393, + 498, + -464, + 344, + -196, + 62, + 33, + -82, + 92, + -76, + 49, + -23, + 5, + 4, + -7, + 5, + -3, + 1, + 0, + -2, + 6, + -12, + 18, + -20, + 12, + 11, + -50, + 101, + -150, + 177, + -156, + 67, + 98, + -326, + 573, + -771, + 836, + -676, + 216, + 591, + -1770, + 3365, + -5655, + 10897, + 26656, + -675, + -1713, + 2293, + -2173, + 1703, + -1092, + 494, + -11, + -306, + 450, + -450, + 356, + -221, + 90, + 10, + -66, + 83, + -74, + 51, + -27, + 8, + 2, + -6, + 5, + -3, + 1, + 0, + -2, + 6, + -12, + 19, + -23, + 18, + 3, + -41, + 95, + -151, + 189, + -183, + 109, + 46, + -274, + 540, + -778, + 900, + -810, + 417, + 347, + -1534, + 3238, + -5861, + 12534, + 25925, + -1745, + -1097, + 1962, + -2042, + 1708, + -1178, + 613, + -127, + -215, + 394, + -428, + 361, + -241, + 115, + -14, + -49, + 74, + -70, + 52, + -29, + 11, + 0, + -4, + 4, + -3, + 1, + 0, + -1, + 5, + -12, + 20, + -26, + 23, + -5, + -32, + 86, + -148, + 198, + -208, + 151, + -9, + -217, + 497, + -771, + 950, + -932, + 616, + 89, + -1263, + 3046, + -5972, + 14163, + 25047, + -2701, + -491, + 1608, + -1879, + 1683, + -1241, + 718, + -238, + -123, + 333, + -400, + 359, + -257, + 139, + -37, + -32, + 63, + -66, + 52, + -32, + 14, + -2, + -3, + 4, + -3, + 1, + -1, + -1, + 5, + -12, + 21, + -29, + 29, + -14, + -21, + 76, + -143, + 203, + -229, + 191, + -64, + -155, + 444, + -749, + 983, + -1040, + 807, + -177, + -960, + 2790, + -5978, + 15769, + 24033, + -3539, + 97, + 1237, + -1687, + 1629, + -1280, + 808, + -343, + -30, + 266, + -364, + 351, + -268, + 159, + -58, + -14, + 52, + -61, + 51, + -33, + 16, + -4, + -2, + 3, + -2, + 1, + -1, + 0, + 4, + -11, + 21, + -31, + 34, + -23, + -9, + 64, + -135, + 205, + -247, + 228, + -120, + -88, + 382, + -713, + 999, + -1132, + 989, + -447, + -629, + 2472, + -5873, + 17336, + 22894, + -4253, + 658, + 856, + -1470, + 1547, + -1296, + 882, + -439, + 61, + 197, + -323, + 336, + -273, + 175, + -78, + 3, + 40, + -54, + 49, + -34, + 18, + -6, + 0, + 2, + -2, + 1, + -1, + 0, + 3, + -10, + 21, + -32, + 38, + -31, + 3, + 51, + -125, + 203, + -260, + 261, + -175, + -18, + 311, + -663, + 997, + -1205, + 1157, + -717, + -277, + 2095, + -5651, + 18847, + 21640, + -4843, + 1182, + 472, + -1233, + 1439, + -1288, + 939, + -525, + 150, + 125, + -277, + 316, + -274, + 188, + -96, + 20, + 28, + -47, + 46, + -34, + 19, + -8, + 1, + 2, + -2, + 1, + -1, + 1, + 2, + -9, + 20, + -33, + 43, + -39, + 15, + 36, + -111, + 198, + -269, + 291, + -228, + 53, + 233, + -600, + 977, + -1257, + 1308, + -980, + 93, + 1663, + -5309, + 20286, + 20286, + -5309, + 1663, + 93, + -980, + 1308, + -1257, + 977, + -600, + 233, + 53, + -228, + 291, + -269, + 198, + -111, + 36, + 15, + -39, + 43, + -33, + 20, + -9, + 2, + 1, + -1, + 0 + +}; +struct src_stage src_int16_20_21_4020_5000 = { + 1, 1, 20, 53, 1060, 21, 20, 0, 0, + src_int16_20_21_4020_5000_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_int16_21_20_4020_5000.h b/src/include/reef/audio/coefficients/src/src_int16_21_20_4020_5000.h new file mode 100644 index 0000000..678ed4f --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_21_20_4020_5000.h @@ -0,0 +1,1056 @@ +const int16_t src_int16_21_20_4020_5000_fir[1050] = { + 1, + -3, + 5, + -9, + 11, + -9, + 0, + 19, + -51, + 96, + -151, + 208, + -253, + 270, + -235, + 130, + 64, + -357, + 750, + -1232, + 1783, + -2376, + 2996, + -3680, + 4818, + 29296, + 1867, + -2442, + 2405, + -2140, + 1762, + -1339, + 921, + -547, + 243, + -19, + -124, + 196, + -213, + 193, + -153, + 107, + -65, + 32, + -10, + -2, + 6, + -6, + 5, + -2, + 1, + -3, + 6, + -9, + 13, + -13, + 6, + 11, + -42, + 87, + -146, + 210, + -267, + 300, + -287, + 204, + -31, + -248, + 640, + -1142, + 1744, + -2434, + 3227, + -4251, + 6405, + 29032, + 527, + -1798, + 2058, + -1969, + 1705, + -1355, + 980, + -626, + 324, + -91, + -66, + 155, + -188, + 181, + -150, + 109, + -70, + 38, + -15, + 2, + 4, + -5, + 4, + -2, + 1, + -3, + 6, + -10, + 14, + -16, + 12, + 3, + -32, + 77, + -138, + 208, + -277, + 326, + -335, + 276, + -128, + -132, + 516, + -1030, + 1672, + -2450, + 3408, + -4773, + 8048, + 28594, + -709, + -1152, + 1686, + -1768, + 1619, + -1346, + 1020, + -691, + 397, + -160, + -9, + 113, + -160, + 166, + -144, + 110, + -73, + 42, + -19, + 5, + 2, + -4, + 3, + -2, + 1, + -3, + 6, + -11, + 16, + -20, + 17, + -5, + -21, + 65, + -127, + 202, + -281, + 347, + -377, + 345, + -224, + -11, + 380, + -895, + 1568, + -2421, + 3532, + -5235, + 9732, + 27989, + -1832, + -515, + 1297, + -1541, + 1506, + -1314, + 1041, + -743, + 462, + -225, + 47, + 69, + -130, + 148, + -136, + 108, + -76, + 46, + -23, + 8, + 0, + -3, + 3, + -2, + 1, + -3, + 6, + -11, + 18, + -23, + 23, + -14, + -9, + 51, + -113, + 193, + -281, + 362, + -414, + 409, + -318, + 113, + 233, + -742, + 1433, + -2346, + 3596, + -5626, + 11441, + 27221, + -2836, + 102, + 898, + -1292, + 1369, + -1259, + 1043, + -780, + 517, + -284, + 102, + 25, + -98, + 128, + -125, + 105, + -76, + 49, + -26, + 11, + -2, + -2, + 2, + -2, + 1, + -2, + 6, + -12, + 19, + -26, + 28, + -23, + 3, + 36, + -97, + 179, + -275, + 370, + -443, + 467, + -409, + 237, + 80, + -571, + 1268, + -2227, + 3596, + -5935, + 13160, + 26300, + -3715, + 690, + 495, + -1027, + 1211, + -1183, + 1026, + -802, + 561, + -337, + 153, + -18, + -66, + 106, + -113, + 99, + -76, + 51, + -29, + 13, + -4, + 0, + 2, + -1, + 0, + -2, + 6, + -12, + 20, + -28, + 34, + -31, + 15, + 20, + -79, + 162, + -264, + 372, + -466, + 517, + -494, + 360, + -79, + -385, + 1075, + -2063, + 3531, + -6153, + 14870, + 25235, + -4465, + 1240, + 97, + -751, + 1035, + -1087, + 991, + -810, + 595, + -383, + 200, + -60, + -32, + 83, + -99, + 93, + -74, + 51, + -31, + 16, + -6, + 1, + 1, + -1, + 0, + -2, + 5, + -12, + 20, + -30, + 38, + -39, + 28, + 3, + -59, + 142, + -248, + 367, + -480, + 559, + -572, + 479, + -240, + -189, + 858, + -1856, + 3397, + -6268, + 16557, + 24038, + -5085, + 1745, + -290, + -469, + 845, + -974, + 939, + -803, + 617, + -421, + 243, + -100, + 0, + 59, + -84, + 84, + -71, + 51, + -32, + 17, + -7, + 2, + 0, + -1, + 0, + -2, + 5, + -11, + 20, + -32, + 42, + -47, + 40, + -14, + -37, + 118, + -227, + 355, + -486, + 592, + -641, + 592, + -400, + 16, + 619, + -1609, + 3196, + -6275, + 18202, + 22722, + -5573, + 2198, + -660, + -186, + 644, + -846, + 872, + -782, + 628, + -450, + 280, + -138, + 32, + 34, + -67, + 75, + -66, + 50, + -33, + 19, + -9, + 3, + 0, + 0, + 0, + -1, + 4, + -11, + 20, + -33, + 46, + -54, + 52, + -32, + -14, + 92, + -201, + 337, + -483, + 615, + -700, + 696, + -556, + 226, + 363, + -1324, + 2927, + -6165, + 19788, + 21300, + -5932, + 2594, + -1006, + 93, + 437, + -706, + 790, + -747, + 627, + -471, + 312, + -172, + 63, + 10, + -50, + 64, + -61, + 48, + -33, + 20, + -10, + 4, + -1, + 0, + 0, + -1, + 4, + -10, + 20, + -33, + 48, + -61, + 64, + -50, + 10, + 63, + -172, + 312, + -471, + 627, + -747, + 790, + -706, + 437, + 93, + -1006, + 2594, + -5932, + 21300, + 19788, + -6165, + 2927, + -1324, + 363, + 226, + -556, + 696, + -700, + 615, + -483, + 337, + -201, + 92, + -14, + -32, + 52, + -54, + 46, + -33, + 20, + -11, + 4, + -1, + 0, + 0, + 0, + 3, + -9, + 19, + -33, + 50, + -66, + 75, + -67, + 34, + 32, + -138, + 280, + -450, + 628, + -782, + 872, + -846, + 644, + -186, + -660, + 2198, + -5573, + 22722, + 18202, + -6275, + 3196, + -1609, + 619, + 16, + -400, + 592, + -641, + 592, + -486, + 355, + -227, + 118, + -37, + -14, + 40, + -47, + 42, + -32, + 20, + -11, + 5, + -2, + 0, + -1, + 0, + 2, + -7, + 17, + -32, + 51, + -71, + 84, + -84, + 59, + 0, + -100, + 243, + -421, + 617, + -803, + 939, + -974, + 845, + -469, + -290, + 1745, + -5085, + 24038, + 16557, + -6268, + 3397, + -1856, + 858, + -189, + -240, + 479, + -572, + 559, + -480, + 367, + -248, + 142, + -59, + 3, + 28, + -39, + 38, + -30, + 20, + -12, + 5, + -2, + 0, + -1, + 1, + 1, + -6, + 16, + -31, + 51, + -74, + 93, + -99, + 83, + -32, + -60, + 200, + -383, + 595, + -810, + 991, + -1087, + 1035, + -751, + 97, + 1240, + -4465, + 25235, + 14870, + -6153, + 3531, + -2063, + 1075, + -385, + -79, + 360, + -494, + 517, + -466, + 372, + -264, + 162, + -79, + 20, + 15, + -31, + 34, + -28, + 20, + -12, + 6, + -2, + 0, + -1, + 2, + 0, + -4, + 13, + -29, + 51, + -76, + 99, + -113, + 106, + -66, + -18, + 153, + -337, + 561, + -802, + 1026, + -1183, + 1211, + -1027, + 495, + 690, + -3715, + 26300, + 13160, + -5935, + 3596, + -2227, + 1268, + -571, + 80, + 237, + -409, + 467, + -443, + 370, + -275, + 179, + -97, + 36, + 3, + -23, + 28, + -26, + 19, + -12, + 6, + -2, + 1, + -2, + 2, + -2, + -2, + 11, + -26, + 49, + -76, + 105, + -125, + 128, + -98, + 25, + 102, + -284, + 517, + -780, + 1043, + -1259, + 1369, + -1292, + 898, + 102, + -2836, + 27221, + 11441, + -5626, + 3596, + -2346, + 1433, + -742, + 233, + 113, + -318, + 409, + -414, + 362, + -281, + 193, + -113, + 51, + -9, + -14, + 23, + -23, + 18, + -11, + 6, + -3, + 1, + -2, + 3, + -3, + 0, + 8, + -23, + 46, + -76, + 108, + -136, + 148, + -130, + 69, + 47, + -225, + 462, + -743, + 1041, + -1314, + 1506, + -1541, + 1297, + -515, + -1832, + 27989, + 9732, + -5235, + 3532, + -2421, + 1568, + -895, + 380, + -11, + -224, + 345, + -377, + 347, + -281, + 202, + -127, + 65, + -21, + -5, + 17, + -20, + 16, + -11, + 6, + -3, + 1, + -2, + 3, + -4, + 2, + 5, + -19, + 42, + -73, + 110, + -144, + 166, + -160, + 113, + -9, + -160, + 397, + -691, + 1020, + -1346, + 1619, + -1768, + 1686, + -1152, + -709, + 28594, + 8048, + -4773, + 3408, + -2450, + 1672, + -1030, + 516, + -132, + -128, + 276, + -335, + 326, + -277, + 208, + -138, + 77, + -32, + 3, + 12, + -16, + 14, + -10, + 6, + -3, + 1, + -2, + 4, + -5, + 4, + 2, + -15, + 38, + -70, + 109, + -150, + 181, + -188, + 155, + -66, + -91, + 324, + -626, + 980, + -1355, + 1705, + -1969, + 2058, + -1798, + 527, + 29032, + 6405, + -4251, + 3227, + -2434, + 1744, + -1142, + 640, + -248, + -31, + 204, + -287, + 300, + -267, + 210, + -146, + 87, + -42, + 11, + 6, + -13, + 13, + -9, + 6, + -3, + 1, + -2, + 5, + -6, + 6, + -2, + -10, + 32, + -65, + 107, + -153, + 193, + -213, + 196, + -124, + -19, + 243, + -547, + 921, + -1339, + 1762, + -2140, + 2405, + -2442, + 1867, + 29296, + 4818, + -3680, + 2996, + -2376, + 1783, + -1232, + 750, + -357, + 64, + 130, + -235, + 270, + -253, + 208, + -151, + 96, + -51, + 19, + 0, + -9, + 11, + -9, + 5, + -3, + 1, + -3, + 5, + -8, + 8, + -5, + -5, + 26, + -58, + 102, + -153, + 202, + -235, + 235, + -181, + 55, + 156, + -457, + 844, + -1298, + 1788, + -2277, + 2720, + -3073, + 3302, + 29385, + 3302, + -3073, + 2720, + -2277, + 1788, + -1298, + 844, + -457, + 156, + 55, + -181, + 235, + -235, + 202, + -153, + 102, + -58, + 26, + -5, + -5, + 8, + -8, + 5, + -3, + 0 + +}; +struct src_stage src_int16_21_20_4020_5000 = { + 19, 20, 21, 50, 1050, 20, 21, 0, 0, + src_int16_21_20_4020_5000_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_int16_3_1_4375_5000.h b/src/include/reef/audio/coefficients/src/src_int16_3_1_4375_5000.h new file mode 100644 index 0000000..a8d5813 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_3_1_4375_5000.h @@ -0,0 +1,252 @@ +const int16_t src_int16_3_1_4375_5000_fir[246] = { + 0, + -1, + 2, + -3, + 4, + -7, + 9, + -11, + 13, + -15, + 14, + -12, + 7, + 2, + -15, + 33, + -55, + 82, + -112, + 143, + -175, + 204, + -226, + 239, + -237, + 218, + -176, + 108, + -11, + -118, + 281, + -478, + 711, + -979, + 1286, + -1636, + 2044, + -2544, + 3231, + -4424, + 8001, + 29412, + -2495, + 372, + 409, + -786, + 974, + -1051, + 1053, + -1004, + 919, + -810, + 688, + -560, + 434, + -316, + 209, + -117, + 41, + 18, + -61, + 90, + -106, + 111, + -107, + 98, + -85, + 70, + -55, + 41, + -28, + 18, + -10, + 4, + 0, + -2, + 3, + -3, + 3, + -2, + 2, + -1, + 0, + 0, + 0, + -1, + 2, + -4, + 7, + -11, + 16, + -22, + 29, + -35, + 41, + -44, + 45, + -40, + 30, + -13, + -12, + 46, + -89, + 140, + -198, + 260, + -323, + 384, + -436, + 473, + -489, + 477, + -428, + 333, + -183, + -36, + 339, + -755, + 1332, + -2180, + 3582, + -6592, + 20737, + 20737, + -6592, + 3582, + -2180, + 1332, + -755, + 339, + -36, + -183, + 333, + -428, + 477, + -489, + 473, + -436, + 384, + -323, + 260, + -198, + 140, + -89, + 46, + -12, + -13, + 30, + -40, + 45, + -44, + 41, + -35, + 29, + -22, + 16, + -11, + 7, + -4, + 2, + -1, + 0, + 0, + 0, + -1, + 2, + -2, + 3, + -3, + 3, + -2, + 0, + 4, + -10, + 18, + -28, + 41, + -55, + 70, + -85, + 98, + -107, + 111, + -106, + 90, + -61, + 18, + 41, + -117, + 209, + -316, + 434, + -560, + 688, + -810, + 919, + -1004, + 1053, + -1051, + 974, + -786, + 409, + 372, + -2495, + 29412, + 8001, + -4424, + 3231, + -2544, + 2044, + -1636, + 1286, + -979, + 711, + -478, + 281, + -118, + -11, + 108, + -176, + 218, + -237, + 239, + -226, + 204, + -175, + 143, + -112, + 82, + -55, + 33, + -15, + 2, + 7, + -12, + 14, + -15, + 13, + -11, + 9, + -7, + 4, + -3, + 2, + -1, + 0 + +}; +struct src_stage src_int16_3_1_4375_5000 = { + 0, 1, 3, 82, 246, 1, 3, 0, 0, + src_int16_3_1_4375_5000_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_int16_7_8_4375_5000.h b/src/include/reef/audio/coefficients/src/src_int16_7_8_4375_5000.h new file mode 100644 index 0000000..4b0eb73 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_7_8_4375_5000.h @@ -0,0 +1,657 @@ +const int16_t src_int16_7_8_4375_5000_fir[651] = { + 0, + 0, + 0, + -2, + 4, + -5, + 4, + 0, + -7, + 14, + -19, + 16, + -5, + -14, + 36, + -50, + 49, + -25, + -17, + 68, + -108, + 117, + -81, + 0, + 106, + -200, + 242, + -199, + 66, + 130, + -329, + 452, + -431, + 235, + 106, + -502, + 816, + -902, + 656, + -61, + -786, + 1673, + -2295, + 2280, + -1124, + -2459, + 23097, + 16168, + -5503, + 1769, + 321, + -1397, + 1681, + -1391, + 780, + -103, + -434, + 711, + -708, + 489, + -168, + -135, + 332, + -384, + 307, + -151, + -18, + 144, + -198, + 178, + -108, + 20, + 52, + -91, + 91, + -63, + 23, + 13, + -35, + 39, + -30, + 15, + 0, + -10, + 13, + -11, + 6, + -1, + -2, + 3, + -2, + 1, + 0, + -1, + 1, + 0, + -1, + 3, + -5, + 6, + -3, + -3, + 12, + -19, + 22, + -15, + -2, + 26, + -48, + 59, + -48, + 13, + 41, + -96, + 130, + -121, + 61, + 43, + -160, + 247, + -260, + 174, + 4, + -229, + 425, + -508, + 414, + -132, + -282, + 706, + -980, + 952, + -531, + -271, + 1315, + -2341, + 2983, + -2730, + 328, + 25336, + 12012, + -5744, + 2742, + -665, + -691, + 1357, + -1419, + 1047, + -464, + -112, + 517, + -672, + 587, + -340, + 42, + 205, + -337, + 336, + -231, + 78, + 66, + -157, + 179, + -141, + 67, + 9, + -64, + 85, + -74, + 43, + -8, + -20, + 33, + -32, + 21, + -7, + -4, + 10, + -11, + 8, + -3, + 0, + 2, + -2, + 1, + -1, + -1, + 1, + -1, + 0, + 3, + -6, + 7, + -6, + 1, + 8, + -18, + 25, + -24, + 11, + 12, + -40, + 62, + -65, + 42, + 7, + -70, + 125, + -147, + 116, + -28, + -97, + 219, + -288, + 263, + -128, + -95, + 341, + -520, + 544, + -361, + -15, + 496, + -929, + 1132, + -951, + 308, + 756, + -2069, + 3342, + -4177, + 3814, + 26503, + 7795, + -5248, + 3273, + -1492, + 59, + 876, + -1263, + 1168, + -751, + 212, + 263, + -550, + 605, + -462, + 208, + 56, + -247, + 320, + -279, + 160, + -18, + -98, + 157, + -154, + 104, + -34, + -30, + 67, + -74, + 56, + -26, + -4, + 24, + -30, + 25, + -14, + 2, + 6, + -9, + 8, + -5, + 1, + 1, + -2, + 1, + -1, + -1, + 1, + -2, + 1, + 1, + -5, + 8, + -9, + 6, + 2, + -14, + 25, + -30, + 24, + -4, + -26, + 56, + -74, + 67, + -30, + -34, + 104, + -154, + 157, + -98, + -18, + 160, + -279, + 320, + -247, + 56, + 208, + -462, + 605, + -550, + 263, + 212, + -751, + 1168, + -1263, + 876, + 59, + -1492, + 3273, + -5248, + 7795, + 26503, + 3814, + -4177, + 3342, + -2069, + 756, + 308, + -951, + 1132, + -929, + 496, + -15, + -361, + 544, + -520, + 341, + -95, + -128, + 263, + -288, + 219, + -97, + -28, + 116, + -147, + 125, + -70, + 7, + 42, + -65, + 62, + -40, + 12, + 11, + -24, + 25, + -18, + 8, + 1, + -6, + 7, + -6, + 3, + 0, + -1, + 1, + -1, + -1, + 1, + -2, + 2, + 0, + -3, + 8, + -11, + 10, + -4, + -7, + 21, + -32, + 33, + -20, + -8, + 43, + -74, + 85, + -64, + 9, + 67, + -141, + 179, + -157, + 66, + 78, + -231, + 336, + -337, + 205, + 42, + -340, + 587, + -672, + 517, + -112, + -464, + 1047, + -1419, + 1357, + -691, + -665, + 2742, + -5744, + 12012, + 25336, + 328, + -2730, + 2983, + -2341, + 1315, + -271, + -531, + 952, + -980, + 706, + -282, + -132, + 414, + -508, + 425, + -229, + 4, + 174, + -260, + 247, + -160, + 43, + 61, + -121, + 130, + -96, + 41, + 13, + -48, + 59, + -48, + 26, + -2, + -15, + 22, + -19, + 12, + -3, + -3, + 6, + -5, + 3, + -1, + 0, + 1, + -1, + 0, + 1, + -2, + 3, + -2, + -1, + 6, + -11, + 13, + -10, + 0, + 15, + -30, + 39, + -35, + 13, + 23, + -63, + 91, + -91, + 52, + 20, + -108, + 178, + -198, + 144, + -18, + -151, + 307, + -384, + 332, + -135, + -168, + 489, + -708, + 711, + -434, + -103, + 780, + -1391, + 1681, + -1397, + 321, + 1769, + -5503, + 16168, + 23097, + -2459, + -1124, + 2280, + -2295, + 1673, + -786, + -61, + 656, + -902, + 816, + -502, + 106, + 235, + -431, + 452, + -329, + 130, + 66, + -199, + 242, + -200, + 106, + 0, + -81, + 117, + -108, + 68, + -17, + -25, + 49, + -50, + 36, + -14, + -5, + 16, + -19, + 14, + -7, + 0, + 4, + -5, + 4, + -2, + 0, + 0, + 0, + 0, + 1, + -2, + 4, + -3, + 1, + 4, + -10, + 15, + -15, + 9, + 6, + -24, + 40, + -45, + 32, + -1, + -44, + 86, + -106, + 90, + -31, + -59, + 153, + -213, + 206, + -114, + -48, + 236, + -382, + 418, + -300, + 32, + 322, + -650, + 816, + -710, + 288, + 395, + -1173, + 1796, + -1960, + 1348, + 436, + -4418, + 19959, + 19959, + -4418, + 436, + 1348, + -1960, + 1796, + -1173, + 395, + 288, + -710, + 816, + -650, + 322, + 32, + -300, + 418, + -382, + 236, + -48, + -114, + 206, + -213, + 153, + -59, + -31, + 90, + -106, + 86, + -44, + -1, + 32, + -45, + 40, + -24, + 6, + 9, + -15, + 15, + -10, + 4, + 1, + -3, + 4, + -2, + 1, + 0, + 0 + +}; +struct src_stage src_int16_7_8_4375_5000 = { + 1, 1, 7, 93, 651, 8, 7, 0, 0, + src_int16_7_8_4375_5000_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_int16_8_7_4375_5000.h b/src/include/reef/audio/coefficients/src/src_int16_8_7_4375_5000.h new file mode 100644 index 0000000..1ad7797 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_8_7_4375_5000.h @@ -0,0 +1,662 @@ +const int16_t src_int16_8_7_4375_5000_fir[656] = { + 0, + 0, + 1, + -2, + 4, + -7, + 10, + -13, + 17, + -21, + 23, + -23, + 21, + -14, + 3, + 14, + -37, + 65, + -99, + 136, + -174, + 211, + -242, + 263, + -269, + 256, + -219, + 152, + -53, + -81, + 251, + -458, + 702, + -979, + 1290, + -1635, + 2021, + -2471, + 3050, + -3986, + 6580, + 29785, + -1328, + -372, + 958, + -1207, + 1295, + -1286, + 1212, + -1095, + 951, + -792, + 628, + -469, + 322, + -190, + 79, + 10, + -77, + 123, + -150, + 161, + -159, + 146, + -128, + 105, + -82, + 60, + -40, + 23, + -10, + 1, + 5, + -9, + 10, + -9, + 8, + -6, + 5, + -3, + 2, + -1, + 0, + 0, + 0, + -1, + 3, + -5, + 9, + -13, + 18, + -23, + 28, + -32, + 34, + -33, + 27, + -15, + -3, + 29, + -62, + 102, + -147, + 195, + -243, + 287, + -322, + 342, + -341, + 314, + -253, + 155, + -14, + -175, + 414, + -709, + 1065, + -1493, + 2018, + -2695, + 3672, + -5455, + 11305, + 27819, + -4054, + 1304, + -212, + -361, + 684, + -859, + 934, + -938, + 889, + -804, + 696, + -574, + 449, + -327, + 215, + -117, + 36, + 28, + -74, + 104, + -119, + 123, + -117, + 105, + -89, + 71, + -53, + 37, + -23, + 12, + -4, + -1, + 4, + -6, + 6, + -5, + 4, + -3, + 2, + -1, + -1, + 1, + -1, + 0, + 1, + -3, + 6, + -11, + 16, + -23, + 30, + -38, + 44, + -48, + 49, + -44, + 33, + -13, + -15, + 52, + -99, + 153, + -212, + 274, + -333, + 385, + -422, + 438, + -426, + 378, + -287, + 143, + 60, + -332, + 686, + -1143, + 1741, + -2566, + 3846, + -6377, + 16134, + 24716, + -5794, + 2637, + -1264, + 480, + 17, + -342, + 547, + -665, + 715, + -712, + 670, + -600, + 513, + -417, + 319, + -225, + 140, + -68, + 9, + 35, + -66, + 84, + -92, + 91, + -83, + 72, + -59, + 46, + -33, + 22, + -13, + 6, + -1, + -2, + 3, + -3, + 3, + -2, + 2, + -1, + -1, + 1, + -2, + 2, + -1, + 0, + 3, + -7, + 12, + -19, + 28, + -38, + 48, + -57, + 64, + -68, + 65, + -55, + 36, + -6, + -35, + 88, + -151, + 223, + -300, + 377, + -449, + 509, + -548, + 559, + -531, + 454, + -316, + 106, + 197, + -619, + 1209, + -2077, + 3504, + -6542, + 20718, + 20718, + -6542, + 3504, + -2077, + 1209, + -619, + 197, + 106, + -316, + 454, + -531, + 559, + -548, + 509, + -449, + 377, + -300, + 223, + -151, + 88, + -35, + -6, + 36, + -55, + 65, + -68, + 64, + -57, + 48, + -38, + 28, + -19, + 12, + -7, + 3, + 0, + -1, + 2, + -2, + 1, + -1, + -1, + 2, + -2, + 3, + -3, + 3, + -2, + -1, + 6, + -13, + 22, + -33, + 46, + -59, + 72, + -83, + 91, + -92, + 84, + -66, + 35, + 9, + -68, + 140, + -225, + 319, + -417, + 513, + -600, + 670, + -712, + 715, + -665, + 547, + -342, + 17, + 480, + -1264, + 2637, + -5794, + 24716, + 16134, + -6377, + 3846, + -2566, + 1741, + -1143, + 686, + -332, + 60, + 143, + -287, + 378, + -426, + 438, + -422, + 385, + -333, + 274, + -212, + 153, + -99, + 52, + -15, + -13, + 33, + -44, + 49, + -48, + 44, + -38, + 30, + -23, + 16, + -11, + 6, + -3, + 1, + 0, + -1, + 1, + -1, + -1, + 2, + -3, + 4, + -5, + 6, + -6, + 4, + -1, + -4, + 12, + -23, + 37, + -53, + 71, + -89, + 105, + -117, + 123, + -119, + 104, + -74, + 28, + 36, + -117, + 215, + -327, + 449, + -574, + 696, + -804, + 889, + -938, + 934, + -859, + 684, + -361, + -212, + 1304, + -4054, + 27819, + 11305, + -5455, + 3672, + -2695, + 2018, + -1493, + 1065, + -709, + 414, + -175, + -14, + 155, + -253, + 314, + -341, + 342, + -322, + 287, + -243, + 195, + -147, + 102, + -62, + 29, + -3, + -15, + 27, + -33, + 34, + -32, + 28, + -23, + 18, + -13, + 9, + -5, + 3, + -1, + 0, + 0, + 0, + -1, + 2, + -3, + 5, + -6, + 8, + -9, + 10, + -9, + 5, + 1, + -10, + 23, + -40, + 60, + -82, + 105, + -128, + 146, + -159, + 161, + -150, + 123, + -77, + 10, + 79, + -190, + 322, + -469, + 628, + -792, + 951, + -1095, + 1212, + -1286, + 1295, + -1207, + 958, + -372, + -1328, + 29785, + 6580, + -3986, + 3050, + -2471, + 2021, + -1635, + 1290, + -979, + 702, + -458, + 251, + -81, + -53, + 152, + -219, + 256, + -269, + 263, + -242, + 211, + -174, + 136, + -99, + 65, + -37, + 14, + 3, + -14, + 21, + -23, + 23, + -21, + 17, + -13, + 10, + -7, + 4, + -2, + 1, + 0, + 0, + -1, + 2, + -3, + 5, + -7, + 10, + -12, + 14, + -16, + 15, + -12, + 5, + 5, + -20, + 40, + -64, + 92, + -122, + 151, + -178, + 199, + -209, + 205, + -184, + 140, + -72, + -24, + 147, + -298, + 474, + -673, + 887, + -1112, + 1339, + -1559, + 1765, + -1947, + 2097, + -2210, + 2280, + 30458, + 2280, + -2210, + 2097, + -1947, + 1765, + -1559, + 1339, + -1112, + 887, + -673, + 474, + -298, + 147, + -24, + -72, + 140, + -184, + 205, + -209, + 199, + -178, + 151, + -122, + 92, + -64, + 40, + -20, + 5, + 5, + -12, + 15, + -16, + 14, + -12, + 10, + -7, + 5, + -3, + 2, + -1, + 0 + +}; +struct src_stage src_int16_8_7_4375_5000 = { + 6, 7, 8, 82, 656, 7, 8, 0, 0, + src_int16_8_7_4375_5000_fir}; diff --git a/src/include/reef/audio/coefficients/src/src_int16_define.h b/src/include/reef/audio/coefficients/src/src_int16_define.h new file mode 100644 index 0000000..65954b0 --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_define.h @@ -0,0 +1,11 @@ +/* SRC constants */ +#define MAX_FIR_DELAY_SIZE 450 +#define MAX_OUT_DELAY_SIZE 401 +#define MAX_BLK_IN 21 +#define MAX_BLK_OUT 21 +#define NUM_IN_FS 3 +#define NUM_OUT_FS 3 +#define STAGE1_TIMES_MAX 21 +#define STAGE2_TIMES_MAX 21 +#define STAGE_BUF_SIZE 168 +#define NUM_ALL_COEFFICIENTS 3908 diff --git a/src/include/reef/audio/coefficients/src/src_int16_table.h b/src/include/reef/audio/coefficients/src/src_int16_table.h new file mode 100644 index 0000000..e37dfae --- /dev/null +++ b/src/include/reef/audio/coefficients/src/src_int16_table.h @@ -0,0 +1,32 @@ +/* SRC conversions */ +#include <reef/audio/coefficients/src/src_int16_1_3_4375_5000.h> +#include <reef/audio/coefficients/src/src_int16_3_1_4375_5000.h> +#include <reef/audio/coefficients/src/src_int16_7_8_4375_5000.h> +#include <reef/audio/coefficients/src/src_int16_8_7_4375_5000.h> +#include <reef/audio/coefficients/src/src_int16_20_21_4020_5000.h> +#include <reef/audio/coefficients/src/src_int16_21_20_4020_5000.h> + +/* SRC table */ +int16_t fir_one = 16384; +struct src_stage src_int16_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one }; +struct src_stage src_int16_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one }; +int src_in_fs[3] = { 16000, 44100, 48000}; +int src_out_fs[3] = { 16000, 44100, 48000}; +struct src_stage *src_table1[3][3] = { + { &src_int16_1_1_0_0, &src_int16_0_0_0_0, + &src_int16_1_3_4375_5000}, + { &src_int16_0_0_0_0, + &src_int16_1_1_0_0, &src_int16_21_20_4020_5000 + }, + { &src_int16_3_1_4375_5000, &src_int16_8_7_4375_5000, + &src_int16_1_1_0_0} +}; +struct src_stage *src_table2[3][3] = { + { &src_int16_1_1_0_0, &src_int16_0_0_0_0, + &src_int16_1_1_0_0}, + { &src_int16_0_0_0_0, + &src_int16_1_1_0_0, &src_int16_7_8_4375_5000 + }, + { &src_int16_1_1_0_0, &src_int16_20_21_4020_5000, + &src_int16_1_1_0_0} +}; -- 2.11.0
2 4
0 0
  • ← Newer
  • 1
  • ...
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • ...
  • 158
  • Older →

HyperKitty Powered by HyperKitty version 1.3.8.