summaryrefslogtreecommitdiff
path: root/lib/rbcodec/dsp/dsp_proc_entry.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-12-19 17:34:57 -0500
committerMichael Sevakis <jethead71@rockbox.org>2013-05-04 13:43:33 -0400
commit78a45b47dede5ddf35dfc53e965b486a79177b18 (patch)
treeedb3ad7c101e600a7cc3be4b40380430cbeb3e55 /lib/rbcodec/dsp/dsp_proc_entry.h
parentcdb71c707bb434f44368b72f2db3becc37b7a46c (diff)
downloadrockbox-78a45b47dede5ddf35dfc53e965b486a79177b18.tar.gz
rockbox-78a45b47dede5ddf35dfc53e965b486a79177b18.zip
Cleanup and simplify latest DSP code incarnation.
Some things can just be a bit simpler in handling the list of stages and some things, especially format change handling, can be simplified for each stage implementation. Format changes are sent through the configure() callback. Hide some internal details and variables from processing stages and let the core deal with it. Do some miscellaneous cleanup and keep things a bit better factored. Change-Id: I19dd8ce1d0b792ba914d426013088a49a52ecb7e
Diffstat (limited to 'lib/rbcodec/dsp/dsp_proc_entry.h')
-rw-r--r--lib/rbcodec/dsp/dsp_proc_entry.h43
1 files changed, 31 insertions, 12 deletions
diff --git a/lib/rbcodec/dsp/dsp_proc_entry.h b/lib/rbcodec/dsp/dsp_proc_entry.h
index c53443713b..902385f08d 100644
--- a/lib/rbcodec/dsp/dsp_proc_entry.h
+++ b/lib/rbcodec/dsp/dsp_proc_entry.h
@@ -79,7 +79,7 @@ struct dsp_proc_db_entry;
79#define DSP_PROC_DB_START \ 79#define DSP_PROC_DB_START \
80 enum dsp_proc_ids \ 80 enum dsp_proc_ids \
81 { \ 81 { \
82 ___DSP_PROC_ID_FIRST = -1, 82 ___DSP_PROC_ID_RESERVED = 0,
83 83
84#define DSP_PROC_DB_ITEM(name) \ 84#define DSP_PROC_DB_ITEM(name) \
85 DSP_PROC_##name, 85 DSP_PROC_##name,
@@ -102,19 +102,24 @@ typedef void (*dsp_proc_fn_type)(struct dsp_proc_entry *this,
102 * The structure allocated to every stage when enabled. 102 * The structure allocated to every stage when enabled.
103 * 103 *
104 * default settings: 104 * default settings:
105 * .data = 0 105 * .data = 0
106 * .ip_mask = BIT_N(dsp_proc_db_entry.id) 106 * .process = NULL
107 * .process[0] = dsp_process_null
108 * .process[1] = dsp_format_change_process
109 * 107 *
110 * DSP_PROC_INIT handler just has to change what it needs to change. It may 108 * DSP_PROC_INIT handler just has to change what it needs to change. It may
111 * also be modified at any time to implement the stage's demands. 109 * also be modified at any time to implement the stage's demands.
112 */ 110 */
113struct dsp_proc_entry 111struct dsp_proc_entry
114{ 112{
115 intptr_t data; /* 00h: any value, at beginning for easy asm use */ 113 intptr_t data; /* 00h: any value, used by asm */
116 uint32_t ip_mask; /* In-place id bit (0 or id bit flag if in-place) */ 114 dsp_proc_fn_type process; /* Processing vector */
117 dsp_proc_fn_type process[2]; /* Processing normal/format changes */ 115};
116
117/* Return values for DSP_PROC_NEW_FORMAT setting */
118enum
119{
120 PROC_NEW_FORMAT_OK = 0, /* Acks, calls process() (default) */
121 PROC_NEW_FORMAT_DEACTIVATED, /* Acks, does not call process() */
122 PROC_NEW_FORMAT_TRANSITION /* Does not ack, calls process() */
118}; 123};
119 124
120/* DSP transform configure function prototype */ 125/* DSP transform configure function prototype */
@@ -137,10 +142,24 @@ void dsp_proc_activate(struct dsp_config *dsp, enum dsp_proc_ids id,
137/* Is the specified stage active on the DSP? */ 142/* Is the specified stage active on the DSP? */
138bool dsp_proc_active(struct dsp_config *dsp, enum dsp_proc_ids id); 143bool dsp_proc_active(struct dsp_config *dsp, enum dsp_proc_ids id);
139 144
140/* Call this->process[fmt] according to the rules 145/* Force the specified stage to receive a format update before the next
141 * pass (unsigned)-1 to call function 0 with no restriction */ 146 * buffer is sent to process() */
142bool dsp_proc_call(struct dsp_proc_entry *this, struct dsp_buffer **buf_p, 147void dsp_proc_want_format_update(struct dsp_config *dsp,
143 unsigned int fmt); 148 enum dsp_proc_ids id);
149
150/* Set or unset in-place operation */
151void dsp_proc_set_in_place(struct dsp_config *dsp, enum dsp_proc_ids id,
152 bool in_place);
153
154#define DSP_PRINT_FORMAT(id, format) \
155 DEBUGF("DSP format- " #id "\n" \
156 " ver:%u ch:%u fb:%u os:%u hz:%u chz:%u\n", \
157 (unsigned int)(format).version \
158 (unsigned int)(format).num_channels, \
159 (unsigned int)(format).frac_bits, \
160 (unsigned int)(format).output_scale, \
161 (unsigned int)(format).frequency, \
162 (unsigned int)(format).codec_frequency);
144 163
145struct dsp_proc_db_entry 164struct dsp_proc_db_entry
146{ 165{