ref: 1ad6f6d557d06289a58abb726f987e5e79688924
parent: e8e5ecb3f896a72cd484d6c41dbee5679ac0f1b9
author: Jean-Marc Valin <[email protected]>
date: Tue Oct 1 15:25:40 EDT 2013
Fixes scaling of downmix_float() for fixed-point. The previous version simply produced zeros for fixed-point.
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -759,6 +759,11 @@
#endif
#ifndef DISABLE_FLOAT_API
+#ifdef FIXED_POINT
+#define PCM2VAL(x) FLOAT2INT16(x)
+#else
+#define PCM2VAL(x) SCALEIN(x)
+#endif
void downmix_float(const void *_x, opus_val32 *sub, int subframe, int offset, int c1, int c2, int C)
{
const float *x;
@@ -766,11 +771,11 @@
int j;
x = (const float *)_x;
for (j=0;j<subframe;j++)
- sub[j] = SCALEIN(x[(j+offset)*C+c1]);
+ sub[j] = PCM2VAL(x[(j+offset)*C+c1]);
if (c2>-1)
{
for (j=0;j<subframe;j++)
- sub[j] += SCALEIN(x[(j+offset)*C+c2]);
+ sub[j] += PCM2VAL(x[(j+offset)*C+c2]);
} else if (c2==-2)
{
int c;
@@ -777,7 +782,7 @@
for (c=1;c<C;c++)
{
for (j=0;j<subframe;j++)
- sub[j] += SCALEIN(x[(j+offset)*C+c]);
+ sub[j] += PCM2VAL(x[(j+offset)*C+c]);
}
}
#ifdef FIXED_POINT