diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2010-10-19 12:03:22 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2010-10-19 12:03:22 +0800 |
commit | 5e718520be87fa220e67802d39d807457c50bbd8 (patch) | |
tree | 575d89914b22c315ac86101680a800a16150f7ce /src | |
parent | cf131cc0e2e92cf711431798cdef39c719937cab (diff) |
optimize the dumb_resample further
Diffstat (limited to 'src')
-rw-r--r-- | src/dumb_resample.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/dumb_resample.cpp b/src/dumb_resample.cpp index 2e1dc34..8e16bbb 100644 --- a/src/dumb_resample.cpp +++ b/src/dumb_resample.cpp @@ -230,7 +230,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa xbuf[1] = resampler->x[2]; while (todo && x < &xbuf[2]) { HEAVYASSERT(pos >= resampler->start); - *dst++ += MULSC(x[0], vol); + *dst++ += x[0]; subpos += dt; pos += subpos >> 16; x -= subpos >> 16; @@ -239,7 +239,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa } x = xstart = &src[pos]; LOOP4(todo, - *dst++ += MULSC(x[2], vol); + *dst++ += x[2]; subpos += dt; x += subpos >> 16; subpos &= 65535; @@ -254,7 +254,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa xbuf[2] = src[pos]; while (todo && x < &xbuf[3]) { HEAVYASSERT(pos >= resampler->start); - *dst++ += MULSC(x[0] + MULSC(x[-1] - x[0], subpos), vol); + *dst++ += x[0] + MULSC(x[-1] - x[0], subpos); subpos += dt; pos += subpos >> 16; x -= subpos >> 16; @@ -264,7 +264,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa x = &src[pos]; LOOP4(todo, HEAVYASSERT(pos >= resampler->start); - *dst++ += MULSC(x[1] + MULSC(x[2] - x[1], subpos), vol); + *dst++ += x[1] + MULSC(x[2] - x[1], subpos); subpos += dt; pos += subpos >> 16; x += subpos >> 16; @@ -290,7 +290,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa b = (x[-2] << 1) + x[0] - ((5 * x[-1] + x[-3]) >> 1); c = (x[-2] - x[0]) >> 1; } - *dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-1], vol); + *dst++ += MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-1]; subpos += dt; pos += subpos >> 16; x -= subpos >> 16; @@ -307,7 +307,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa b = (x[2] << 1) + x[0] - ((5 * x[1] + x[3]) >> 1); c = (x[2] - x[0]) >> 1; } - *dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[1], vol); + *dst++ += MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[1]; subpos += dt; pos += subpos >> 16; x += subpos >> 16; @@ -344,7 +344,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa xbuf[1] = resampler->x[2]; while (todo && x < &xbuf[2]) { HEAVYASSERT(pos < resampler->end); - *dst++ += MULSC(x[0], vol); + *dst++ += x[0]; subpos += dt; pos += subpos >> 16; x += subpos >> 16; @@ -353,7 +353,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa } x = xstart = &src[pos]; LOOP4(todo, - *dst++ += MULSC(x[-2], vol); + *dst++ += x[-2]; subpos += dt; x += subpos >> 16; subpos &= 65535; @@ -368,7 +368,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa xbuf[2] = src[pos]; while (todo && x < &xbuf[3]) { HEAVYASSERT(pos < resampler->end); - *dst++ += MULSC(x[-1] + MULSC(x[0] - x[-1], subpos), vol); + *dst++ += x[-1] + MULSC(x[0] - x[-1], subpos); subpos += dt; pos += subpos >> 16; x += subpos >> 16; @@ -378,7 +378,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa x = &src[pos]; LOOP4(todo, HEAVYASSERT(pos < resampler->end); - *dst++ += MULSC(x[-2] + MULSC(x[-1] - x[-2], subpos), vol); + *dst++ += x[-2] + MULSC(x[-1] - x[-2], subpos); subpos += dt; pos += subpos >> 16; x += subpos >> 16; @@ -404,7 +404,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa b = (x[-1] << 1) + x[-3] - ((5 * x[-2] + x[0]) >> 1); c = (x[-1] - x[-3]) >> 1; } - *dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-2], vol); + *dst++ += MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-2]; subpos += dt; pos += subpos >> 16; x += subpos >> 16; @@ -421,7 +421,7 @@ long dumb_resample(DUMB_RESAMPLER *resampler, sample_t *dst, long dst_size, floa b = (x[-1] << 1) + x[-3] - ((5 * x[-2] + x[0]) >> 1); c = (x[-1] - x[-3]) >> 1; } - *dst++ += MULSC(MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-2], vol); + *dst++ += MULSC(MULSC(MULSC(a, subpos) + b, subpos) + c, subpos) + x[-2]; subpos += dt; pos += subpos >> 16; x += subpos >> 16; |