summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-12-03 15:24:41 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-12-22 18:00:37 -0500
commit34a092a99729dd4de014aa1f76c48660f28a9c97 (patch)
tree40bd89c62bb6b1b7da10ede5a744b83c9c29bee5
parentb96b7640de381757c5ceac182e01bc84f668e64a (diff)
downloadrockbox-34a092a997.tar.gz
rockbox-34a092a997.zip
rbcodec dsp: Replace enum dsp_ids arguments with unsigned int
Because casting to and from "enum dsp_id" just adds noise, change everything to unsigned int. Change-Id: I52a7ae55f406e673d5b811b29657fcdc4b62ab10
-rw-r--r--apps/plugin.h2
-rw-r--r--lib/rbcodec/dsp/dsp_core.c15
-rw-r--r--lib/rbcodec/dsp/dsp_core.h4
-rw-r--r--lib/rbcodec/dsp/dsp_misc.c4
-rw-r--r--lib/rbcodec/dsp/dsp_sample_input.c5
-rw-r--r--lib/rbcodec/dsp/dsp_sample_io.c2
-rw-r--r--lib/rbcodec/dsp/dsp_sample_io.h2
-rw-r--r--lib/rbcodec/dsp/resample.c7
-rw-r--r--lib/rbcodec/dsp/tdspeed.c5
9 files changed, 19 insertions, 27 deletions
diff --git a/apps/plugin.h b/apps/plugin.h
index 377b18773f..e44511a6f5 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -714,7 +714,7 @@ struct plugin_api {
#endif
intptr_t (*dsp_configure)(struct dsp_config *dsp,
unsigned int setting, intptr_t value);
- struct dsp_config * (*dsp_get_config)(enum dsp_ids id);
+ struct dsp_config * (*dsp_get_config)(unsigned int dsp_id);
void (*dsp_process)(struct dsp_config *dsp, struct dsp_buffer *src,
struct dsp_buffer *dst);
diff --git a/lib/rbcodec/dsp/dsp_core.c b/lib/rbcodec/dsp/dsp_core.c
index 3e72322ea6..14bf228bd6 100644
--- a/lib/rbcodec/dsp/dsp_core.c
+++ b/lib/rbcodec/dsp/dsp_core.c
@@ -483,24 +483,19 @@ intptr_t dsp_configure(struct dsp_config *dsp, unsigned int setting,
return proc_broadcast(dsp, setting, value);
}
-struct dsp_config * dsp_get_config(enum dsp_ids id)
+struct dsp_config *dsp_get_config(unsigned int dsp_id)
{
- if (id >= DSP_COUNT)
+ if (dsp_id >= DSP_COUNT)
return NULL;
- return &dsp_conf[id];
+ return &dsp_conf[dsp_id];
}
/* Return the id given a dsp pointer (or even via something within
the struct itself) */
-enum dsp_ids dsp_get_id(const struct dsp_config *dsp)
+unsigned int dsp_get_id(const struct dsp_config *dsp)
{
- ptrdiff_t id = dsp - dsp_conf;
-
- if (id < 0 || id >= DSP_COUNT)
- return DSP_COUNT; /* obviously invalid */
-
- return (enum dsp_ids)id;
+ return dsp - dsp_conf;
}
/* Do what needs initializing before enable/disable calls can be made.
diff --git a/lib/rbcodec/dsp/dsp_core.h b/lib/rbcodec/dsp/dsp_core.h
index e18d045056..3544084056 100644
--- a/lib/rbcodec/dsp/dsp_core.h
+++ b/lib/rbcodec/dsp/dsp_core.h
@@ -128,10 +128,10 @@ static inline void dsp_advance_buffer32(struct dsp_buffer *buf,
}
/* Get DSP pointer */
-struct dsp_config * dsp_get_config(enum dsp_ids id);
+struct dsp_config *dsp_get_config(unsigned int dsp_id);
/* Get DSP id */
-enum dsp_ids dsp_get_id(const struct dsp_config *dsp);
+unsigned int dsp_get_id(const struct dsp_config *dsp);
/** General DSP processing **/
diff --git a/lib/rbcodec/dsp/dsp_misc.c b/lib/rbcodec/dsp/dsp_misc.c
index 83e577935b..8687abc06a 100644
--- a/lib/rbcodec/dsp/dsp_misc.c
+++ b/lib/rbcodec/dsp/dsp_misc.c
@@ -149,7 +149,7 @@ unsigned int dsp_get_output_frequency(struct dsp_config *dsp)
return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0);
}
-static void misc_dsp_init(struct dsp_config *dsp, enum dsp_ids dsp_id)
+static void misc_dsp_init(struct dsp_config *dsp, unsigned int dsp_id)
{
/* Enable us for the audio DSP at startup */
if (dsp_id == CODEC_IDX_AUDIO)
@@ -168,7 +168,7 @@ static intptr_t misc_handler_configure(struct dsp_proc_entry *this,
switch (setting)
{
case DSP_INIT:
- misc_dsp_init(dsp, (enum dsp_ids)value);
+ misc_dsp_init(dsp, value);
break;
case DSP_PROC_CLOSE:
diff --git a/lib/rbcodec/dsp/dsp_sample_input.c b/lib/rbcodec/dsp/dsp_sample_input.c
index 8068ce5097..06ce11fab7 100644
--- a/lib/rbcodec/dsp/dsp_sample_input.c
+++ b/lib/rbcodec/dsp/dsp_sample_input.c
@@ -242,8 +242,7 @@ void dsp_sample_input_flush(struct sample_io_data *this)
this->sample_buf.remcount = 0;
}
-void dsp_sample_input_init(struct sample_io_data *this,
- enum dsp_ids dsp_id)
+void dsp_sample_input_init(struct sample_io_data *this, unsigned int dsp_id)
{
int32_t *lbuf, *rbuf;
@@ -260,7 +259,7 @@ void dsp_sample_input_init(struct sample_io_data *this,
default:
/* orly */
- DEBUGF("DSP Input- unknown dsp %d\n", (int)dsp_id);
+ DEBUGF("DSP Input- unknown dsp %u\n", dsp_id);
return;
}
diff --git a/lib/rbcodec/dsp/dsp_sample_io.c b/lib/rbcodec/dsp/dsp_sample_io.c
index 637d41a918..af3a424aa0 100644
--- a/lib/rbcodec/dsp/dsp_sample_io.c
+++ b/lib/rbcodec/dsp/dsp_sample_io.c
@@ -46,7 +46,7 @@ bool dsp_sample_io_configure(struct sample_io_data *this,
{
case DSP_INIT:
this->output_sampr = DSP_OUT_DEFAULT_HZ;
- dsp_sample_input_init(this, (enum dsp_ids)value);
+ dsp_sample_input_init(this, value);
dsp_sample_output_init(this);
break;
diff --git a/lib/rbcodec/dsp/dsp_sample_io.h b/lib/rbcodec/dsp/dsp_sample_io.h
index 483f24112c..7e41337a5b 100644
--- a/lib/rbcodec/dsp/dsp_sample_io.h
+++ b/lib/rbcodec/dsp/dsp_sample_io.h
@@ -56,7 +56,7 @@ struct sample_io_data
uint8_t output_version; /* Format version of src buffer at output */
};
-void dsp_sample_input_init(struct sample_io_data *this, enum dsp_ids dsp_id);
+void dsp_sample_input_init(struct sample_io_data *this, unsigned int dsp_id);
void dsp_sample_input_flush(struct sample_io_data *this);
void dsp_sample_input_format_change(struct sample_io_data *this,
struct sample_format *format);
diff --git a/lib/rbcodec/dsp/resample.c b/lib/rbcodec/dsp/resample.c
index a583f60a55..77e1c5e0e5 100644
--- a/lib/rbcodec/dsp/resample.c
+++ b/lib/rbcodec/dsp/resample.c
@@ -262,8 +262,7 @@ static intptr_t resample_new_format(struct dsp_proc_entry *this,
return PROC_NEW_FORMAT_DEACTIVATED;
}
-static void resample_dsp_init(struct dsp_config *dsp,
- enum dsp_ids dsp_id)
+static void resample_dsp_init(struct dsp_config *dsp, unsigned int dsp_id)
{
int32_t *lbuf, *rbuf;
@@ -280,7 +279,7 @@ static void resample_dsp_init(struct dsp_config *dsp,
default:
/* huh? */
- DEBUGF("DSP_PROC_RESAMPLE- unknown DSP %d\n", (int)dsp_id);
+ DEBUGF("DSP_PROC_RESAMPLE- unknown DSP %u\n", dsp_id);
return;
}
@@ -312,7 +311,7 @@ static intptr_t resample_configure(struct dsp_proc_entry *this,
switch (setting)
{
case DSP_INIT:
- resample_dsp_init(dsp, (enum dsp_ids)value);
+ resample_dsp_init(dsp, value);
break;
case DSP_FLUSH:
diff --git a/lib/rbcodec/dsp/tdspeed.c b/lib/rbcodec/dsp/tdspeed.c
index 7a9d818f19..88d057560c 100644
--- a/lib/rbcodec/dsp/tdspeed.c
+++ b/lib/rbcodec/dsp/tdspeed.c
@@ -521,8 +521,7 @@ static intptr_t tdspeed_new_format(struct dsp_proc_entry *this,
(void)this;
}
-static void tdspeed_dsp_init(struct tdspeed_state_s *st,
- enum dsp_ids dsp_id)
+static void tdspeed_dsp_init(struct tdspeed_state_s *st, unsigned int dsp_id)
{
/* everything is at 100% until dsp_set_timestretch is called with
some other value and timestretch is enabled at the time */
@@ -543,7 +542,7 @@ static intptr_t tdspeed_configure(struct dsp_proc_entry *this,
switch (setting)
{
case DSP_INIT:
- tdspeed_dsp_init(st, (enum dsp_ids)value);
+ tdspeed_dsp_init(st, value);
break;
case DSP_FLUSH: