fixed-point: converted denormalise_bands()

This commit is contained in:
Jean-Marc Valin 2008-03-04 17:31:18 +11:00
parent a31899f0e2
commit 7e94cc4d95
2 changed files with 6 additions and 3 deletions

View file

@ -143,17 +143,20 @@ void renormalise_bands(const CELTMode *m, celt_norm_t *X)
void denormalise_bands(const CELTMode *m, const celt_norm_t *X, celt_sig_t *freq, const celt_ener_t *bank)
{
int i, c, B, C;
const celt_word16_t sqrtC_1[2] = {QCONST16(1.f, 14), QCONST16(1.414214f, 14)};
const int *eBands = m->eBands;
B = m->nbMdctBlocks;
C = m->nbChannels;
if (C>2)
celt_fatal("denormalise_bands() not implemented for >2 channels");
for (c=0;c<C;c++)
{
for (i=0;i<m->nbEBands;i++)
{
int j;
float g = ENER_SCALING_1*sqrt(C)*bank[i*C+c];
celt_word32_t g = MULT16_32_Q14(sqrtC_1[C-1],bank[i*C+c]);
for (j=B*eBands[i];j<B*eBands[i+1];j++)
freq[j*C+c] = NORM_SCALING_1*SIG_SCALING*X[j*C+c] * g;
freq[j*C+c] = MULT16_32_Q14(X[j*C+c], g);
}
}
for (i=B*C*eBands[m->nbEBands];i<B*C*eBands[m->nbEBands+1];i++)

View file

@ -219,7 +219,7 @@ int main(int argc, char *argv[])
sizeof(remoteAddr));
if(rc<0) {
printf("cannot send audio data\n");
perror("cannot send to socket");
close(sd);
exit(1);
}