mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Abramo Bagnara <abramo@alsa-project.org>
Thu, 09 Dec 1999 09:56:47 +0100 Rate plugin is now ready for optimizations (I've verified reading asm generated that loop unrolling is not fully satisfactory, I'll try another solution later today).
This commit is contained in:
parent
4ec59e7283
commit
15c2b15ba1
1 changed files with 27 additions and 23 deletions
|
|
@ -56,38 +56,42 @@ static void mix(struct rate_private_data *data, int voices,
|
|||
{
|
||||
unsigned int pos;
|
||||
signed int val;
|
||||
signed short *S1, *S2;
|
||||
signed short S1, S2;
|
||||
int voice;
|
||||
signed short *src, *dst;
|
||||
int size;
|
||||
|
||||
pos = data->pos;
|
||||
S1 = data->last_S1;
|
||||
S2 = data->last_S2;
|
||||
if (pos >> SHIFT) {
|
||||
src_ptr += ((pos >> SHIFT) - 1) * voices; pos &= MASK;
|
||||
for (voice = 0; voice < voices; ++voice) {
|
||||
S1[voice] = S2[voice];
|
||||
S2[voice] = src_ptr[voice];
|
||||
}
|
||||
}
|
||||
while (dst_size-- > 0) {
|
||||
for (voice = 0; voice < voices; ++voice) {
|
||||
pos = data->pos;
|
||||
S1 = data->last_S1[voice];
|
||||
S2 = data->last_S2[voice];
|
||||
src = src_ptr + voice;
|
||||
dst = dst_ptr + voice;
|
||||
size = dst_size;
|
||||
if (pos >> SHIFT) {
|
||||
src_ptr += (pos >> SHIFT) * voices; pos &= MASK;
|
||||
for (voice = 0; voice < voices; ++voice) {
|
||||
S1[voice] = S2[voice];
|
||||
S2[voice] = src_ptr[voice];
|
||||
}
|
||||
src += ((pos >> SHIFT) - 1) * voices;
|
||||
pos &= MASK;
|
||||
S1 = S2;
|
||||
S2 = *src;
|
||||
}
|
||||
|
||||
for (voice = 0; voice < voices; ++voice) {
|
||||
val = S1[voice] + ((S2[voice] - S1[voice]) * (signed int)pos) / BITS;
|
||||
while (size-- > 0) {
|
||||
if (pos >> SHIFT) {
|
||||
src += (pos >> SHIFT) * voices;
|
||||
pos &= MASK;
|
||||
S1 = S2;
|
||||
S2 = *src;
|
||||
}
|
||||
val = S1 + ((S2 - S1) * (signed int)pos) / BITS;
|
||||
if (val < -32768)
|
||||
val = -32768;
|
||||
else if (val > 32767)
|
||||
val = 32767;
|
||||
*dst_ptr++ = val;
|
||||
*dst = val;
|
||||
dst += voices;
|
||||
pos += data->pitch;
|
||||
}
|
||||
|
||||
pos += data->pitch;
|
||||
data->last_S1[voice] = S1;
|
||||
data->last_S2[voice] = S2;
|
||||
}
|
||||
data->pos = pos;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue