summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-02-16 12:01:35 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-02-16 12:01:35 +0000
commit09186e31ae4409f50c1437911a413c36b381f3a4 (patch)
treecec1d61ef397682a6dadf9ff6aaca29ccea4aae0 /apps/dsp.c
parent6ffd8043cbdbf6c092ac7eb689863a02dc9840ff (diff)
downloadrockbox-09186e31ae4409f50c1437911a413c36b381f3a4.tar.gz
rockbox-09186e31ae4409f50c1437911a413c36b381f3a4.zip
SWCODEC: Remove the last quirks when upsampling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12336 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index e0fb4475da..02e231d800 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -253,9 +253,15 @@ static int downsample(int32_t **dst, int32_t **src, int count,
253 if (pos < count) 253 if (pos < count)
254 *d[j]++ = last_sample + FRACMUL((phase & 0xffff) << 15, 254 *d[j]++ = last_sample + FRACMUL((phase & 0xffff) << 15,
255 src[j][pos] - last_sample); 255 src[j][pos] - last_sample);
256 else /* This is kinda nasty but works somewhat well for now */ 256 else
257 *d[j]++ = src[j][count - 1]; 257 {
258 /* No samples can be output here since were already passed the
259 end. Keep phase, save the last sample and return nothing. */
260 i = 0;
261 goto done;
262 }
258 } 263 }
264
259 phase += delta; 265 phase += delta;
260 266
261 while ((pos = phase >> 16) < count) 267 while ((pos = phase >> 16) < count)
@@ -268,6 +274,7 @@ static int downsample(int32_t **dst, int32_t **src, int count,
268 } 274 }
269 275
270 /* Wrap phase accumulator back to start of next frame. */ 276 /* Wrap phase accumulator back to start of next frame. */
277done:
271 r->phase = phase - (count << 16); 278 r->phase = phase - (count << 16);
272 r->last_sample[0] = src[0][count - 1]; 279 r->last_sample[0] = src[0][count - 1];
273 r->last_sample[1] = src[1][count - 1]; 280 r->last_sample[1] = src[1][count - 1];
@@ -768,6 +775,8 @@ int dsp_process(char *dst, const char *src[], int count)
768 count -= samples; 775 count -= samples;
769 apply_gain(tmp, samples); 776 apply_gain(tmp, samples);
770 samples = resample(tmp, samples); 777 samples = resample(tmp, samples);
778 if (samples <= 0)
779 break; /* I'm pretty sure we're downsampling here */
771 if (dsp->crossfeed_enabled && dsp->stereo_mode != STEREO_MONO) 780 if (dsp->crossfeed_enabled && dsp->stereo_mode != STEREO_MONO)
772 apply_crossfeed(tmp, samples); 781 apply_crossfeed(tmp, samples);
773 if (dsp->eq_enabled) 782 if (dsp->eq_enabled)