diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-02-07 00:51:50 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-02-07 00:51:50 +0000 |
commit | aba6ca0881d1481b4047b2d7834d70ca2eb5c64b (patch) | |
tree | 6635b98840dcf4936b3c1ca641c00c32ea1b3e7f /apps/codecs/mpa.c | |
parent | dd50c863e60488662dee8f28f7292389ade42bac (diff) | |
download | rockbox-aba6ca0881d1481b4047b2d7834d70ca2eb5c64b.tar.gz rockbox-aba6ca0881d1481b4047b2d7834d70ca2eb5c64b.zip |
Fix resampling clicking as much as possible at the moment. 1) Upsampling clicked because of size inaccuracies returned by DSP. Fix by simplifying audio system to use per-channel sample count from codec to pcm buffer. 2) Downsampling affected by 1) and was often starting passed the end of the data when not enough was available to generate an output sample. Fix by clamping input range to last sample in buffer and using the last sample value in the buffer. A perfect fix will require a double buffering scheme on the resampler to sufficient data during small data transients on both ends at all times of the down ratio on input and the up ratio on output.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12218 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mpa.c')
-rw-r--r-- | apps/codecs/mpa.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index 6e474c1abb..4c99778071 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c | |||
@@ -199,9 +199,9 @@ next_track: | |||
199 | loop we will need to process the final frame that was decoded. */ | 199 | loop we will need to process the final frame that was decoded. */ |
200 | if (framelength > 0) { | 200 | if (framelength > 0) { |
201 | /* In case of a mono file, the second array will be ignored. */ | 201 | /* In case of a mono file, the second array will be ignored. */ |
202 | ci->pcmbuf_insert_split(&synth.pcm.samples[0][samples_to_skip], | 202 | ci->pcmbuf_insert(&synth.pcm.samples[0][samples_to_skip], |
203 | &synth.pcm.samples[1][samples_to_skip], | 203 | &synth.pcm.samples[1][samples_to_skip], |
204 | framelength * 4); | 204 | framelength); |
205 | 205 | ||
206 | /* Only skip samples for the first frame added. */ | 206 | /* Only skip samples for the first frame added. */ |
207 | samples_to_skip = 0; | 207 | samples_to_skip = 0; |
@@ -244,8 +244,8 @@ next_track: | |||
244 | /* Finish the remaining decoded frame. | 244 | /* Finish the remaining decoded frame. |
245 | Cut the required samples from the end. */ | 245 | Cut the required samples from the end. */ |
246 | if (framelength > stop_skip) | 246 | if (framelength > stop_skip) |
247 | ci->pcmbuf_insert_split(synth.pcm.samples[0], synth.pcm.samples[1], | 247 | ci->pcmbuf_insert(synth.pcm.samples[0], synth.pcm.samples[1], |
248 | (framelength - stop_skip) * 4); | 248 | framelength - stop_skip); |
249 | 249 | ||
250 | stream.error = 0; | 250 | stream.error = 0; |
251 | 251 | ||