Minor loop optimization in libfaad's is/ms decoding.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29837 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7d4616ea40
commit
f79769c541
2 changed files with 14 additions and 13 deletions
|
@ -32,7 +32,7 @@
|
||||||
#include "is.h"
|
#include "is.h"
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
static real_t pow05_table[] = {
|
static real_t pow05_table[] ICONST_ATTR = {
|
||||||
COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
|
COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
|
||||||
COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
|
COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
|
||||||
COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
|
COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
|
||||||
|
@ -47,7 +47,7 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
|
||||||
uint16_t frame_len)
|
uint16_t frame_len)
|
||||||
{
|
{
|
||||||
uint8_t g, sfb, b;
|
uint8_t g, sfb, b;
|
||||||
uint16_t i;
|
uint16_t i, k;
|
||||||
#ifndef FIXED_POINT
|
#ifndef FIXED_POINT
|
||||||
real_t scale;
|
real_t scale;
|
||||||
#else
|
#else
|
||||||
|
@ -84,19 +84,21 @@ void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
|
||||||
|
|
||||||
/* Scale from left to right channel,
|
/* Scale from left to right channel,
|
||||||
do not touch left channel */
|
do not touch left channel */
|
||||||
for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
|
k = (group*nshort) + icsr->swb_offset[sfb];
|
||||||
|
for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++, k++)
|
||||||
{
|
{
|
||||||
#ifndef FIXED_POINT
|
#ifndef FIXED_POINT
|
||||||
r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
|
r_spec[k] = MUL_R(l_spec[k], scale);
|
||||||
#else
|
#else
|
||||||
if (exp < 0)
|
if (exp < 0)
|
||||||
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
|
r_spec[k] = l_spec[k] << -exp;
|
||||||
else
|
else
|
||||||
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
|
r_spec[k] = l_spec[k] >> exp;
|
||||||
r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
|
|
||||||
|
r_spec[k] = MUL_C(r_spec[k], pow05_table[frac + 3]);
|
||||||
#endif
|
#endif
|
||||||
if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
|
if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
|
||||||
r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
|
r_spec[k] = -r_spec[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
|
||||||
uint16_t nshort = frame_len/8;
|
uint16_t nshort = frame_len/8;
|
||||||
|
|
||||||
uint16_t i, k;
|
uint16_t i, k;
|
||||||
real_t tmp;
|
|
||||||
|
|
||||||
if (ics->ms_mask_present >= 1)
|
if (ics->ms_mask_present >= 1)
|
||||||
{
|
{
|
||||||
|
@ -58,12 +57,12 @@ void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
|
||||||
if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
|
if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
|
||||||
!is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
|
!is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
|
||||||
{
|
{
|
||||||
for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++)
|
k = (group*nshort) + ics->swb_offset[sfb];
|
||||||
|
for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++, k++)
|
||||||
{
|
{
|
||||||
k = (group*nshort) + i;
|
/* L' = L+R, R' = L-R */
|
||||||
tmp = l_spec[k] - r_spec[k];
|
|
||||||
l_spec[k] = l_spec[k] + r_spec[k];
|
l_spec[k] = l_spec[k] + r_spec[k];
|
||||||
r_spec[k] = tmp;
|
r_spec[k] = l_spec[k] - (r_spec[k]<<1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue