summaryrefslogtreecommitdiff
path: root/lib/rbcodec/dsp/dsp_cf.S
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2012-05-01 03:58:27 -0400
committerThomas Martitz <kugel@rockbox.org>2012-05-28 11:34:15 +0200
commitafc96087f8a6282cf732d142a4db7a3d604d39d8 (patch)
treeccdf78007bb087ab658edaa951f245ad4141bae2 /lib/rbcodec/dsp/dsp_cf.S
parent08f5224b1bf1293ab1d59fdfbf9045561733c38d (diff)
downloadrockbox-afc96087f8a6282cf732d142a4db7a3d604d39d8.tar.gz
rockbox-afc96087f8a6282cf732d142a4db7a3d604d39d8.zip
New crossfeed algorithm for Rockbox: "Meier" crossfeed
Emulates the basic "Meier" crossfeed (2 capacitors, 3 resistors) as discussed in http://www.meier-audio.homepage.t-online.de/passivefilter.htm This crossfeed blends a bit of low-pass filtered L signal into the R signal (and vice versa) while adding about 300 us delay to the crossfed-signal. A difference with the crossfeed already present in rockbox, is that this algorithm keeps the total spectrum flat (the one currently in rockbox accentuates low-frequency signals, making it sound a bit muffled). This implementation is quite lightweight, just 3 multiplies per left-right pair of samples. Has a default C implementation and optimized assembly versions for ARM and Coldfire. The crossfeed effect is quite subtle and is noticeable mostly one albums that have very strong left-right separation (e.g. one instrument only on the left, another only on the right). In the user interface, the new crossfeed option appears as "Meier" and is not configureable. The existing crossfeed is renamed to "Custom" as it allows itself to be customised. There is no entry for the user manual yet. Change-Id: Iaa100616fe0fcd7e16f08cdb9a7f41501973eee1
Diffstat (limited to 'lib/rbcodec/dsp/dsp_cf.S')
-rw-r--r--lib/rbcodec/dsp/dsp_cf.S47
1 files changed, 46 insertions, 1 deletions
diff --git a/lib/rbcodec/dsp/dsp_cf.S b/lib/rbcodec/dsp/dsp_cf.S
index c710df5177..7d193e0957 100644
--- a/lib/rbcodec/dsp/dsp_cf.S
+++ b/lib/rbcodec/dsp/dsp_cf.S
@@ -8,7 +8,8 @@
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2006 Thom Johansen 10 * Copyright (C) 2006 Thom Johansen
11 * Portions Copyright (C) 2007 Michael Sevakis 11 * Copyright (C) 2007, 2012 Michael Sevakis
12 * Copyright (C) 2010 Bertrik Sikken
12 * 13 *
13 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
@@ -134,6 +135,50 @@ crossfeed_process:
134 .size crossfeed_process,.-crossfeed_process 135 .size crossfeed_process,.-crossfeed_process
135 136
136/**************************************************************************** 137/****************************************************************************
138 * void crossfeed_meier_process(struct dsp_proc_entry *this,
139 * struct dsp_buffer **buf_p)
140 */
141 .section .text
142 .global crossfeed_meier_process
143crossfeed_meier_process:
144 | input: 4(sp) = this, 8(sp) = buf_p
145 movem.l 4(%sp), %a0-%a1 | %a0 = this, %a1 = buf_p
146 lea.l -24(%sp), %sp | save non-volatiles
147 movem.l %d2-%d6/%a2, (%sp) | .
148 move.l (%a0), %a0 | %a0 = &this->data = &crossfeed_state
149 move.l (%a1), %a1 | %a1 = buf = *buf_p
150 movem.l 16(%a0), %d1-%d5 | %d1 = vcl, %d2 = vcr, %d3 = vdiff,
151 | %d4 = coef1, %d5 = coef2
152 movem.l (%a1), %d0/%a1-%a2 | %d0 = count = buf->remcount
153 | %a1 = p32[0], %a2 = p32[1]
154 | Register usage in loop:
155 | %d0 = count, %d1 = vcl, %d2 = vcr, %d3 = vdiff/lout,
156 | %d4 = coef1, %d5 = coef2, %d6 = rout/scratch
157 | %a1 = p32[0], %a2 = p32[1]
15810: | loop
159 mac.l %d5, %d3, %acc0 | %acc0 = common = coef2*vdiff
160 move.l %acc0, %acc1 | copy common
161 mac.l %d4, %d1, (%a1), %d3, %acc0 | %acc0 += coef1*vcl, %d3 = lout
162 msac.l %d4, %d2, (%a2), %d6, %acc1 | %acc1 -= coef1*vcr, %d6 = rout
163 add.l %d1, %d3 | lout += vcl
164 add.l %d2, %d6 | rout += vcr
165 move.l %d3, (%a1)+ | store left channel, pos inc
166 move.l %d6, (%a2)+ | store right channel, pos inc
167 sub.l %d6, %d3 | vdiff = lout - rout
168 movclr.l %acc0, %d6 | %d4 = fetch res1 in s0.31
169 sub.l %d6, %d1 | vcl -= res1
170 movclr.l %acc1, %d6 | %d5 = fetch -res2 in s0.31
171 add.l %d6, %d2 | vcr += -res2
172 subq.l #1, %d0 | count--
173 bgt 10b | loop | more samples?
174 |
175 movem.l %d1-%d3, 16(%a0) | save vcl, vcr, vdiff
176 movem.l (%sp), %d2-%d6/%a2 | restore non-volatiles
177 lea.l 24(%sp), %sp | .
178 rts |
179 .size crossfeed_meier_process, .-crossfeed_meier_process
180
181/****************************************************************************
137 * int lin_resample_resample(struct resample_data *data, 182 * int lin_resample_resample(struct resample_data *data,
138 * struct dsp_buffer *src, 183 * struct dsp_buffer *src,
139 * struct dsp_buffer *dst) 184 * struct dsp_buffer *dst)