summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-11-06 14:00:03 -0500
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-11-06 14:00:03 -0500
commit73af4a06e03cd6928d7382eb6c3553b741e08e46 (patch)
tree2cec742ac16fdf6df60d7f7f1f5f733ac41de779
parent8dae2b9196ae47051f9ea3c68ad0d21fd080e264 (diff)
downloadopus-73af4a06e03cd6928d7382eb6c3553b741e08e46.tar.gz
first hack seems to be working
-rw-r--r--src/analysis.c4
-rw-r--r--src/opus_encoder.c20
2 files changed, 14 insertions, 10 deletions
diff --git a/src/analysis.c b/src/analysis.c
index 50e2ddfd..9faffb52 100644
--- a/src/analysis.c
+++ b/src/analysis.c
@@ -378,7 +378,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
frame_stationarity += stationarity;
/*band_tonality[b] = tE/(1e-15+E)*/;
band_tonality[b] = MAX16(tE/(1e-15f+E), stationarity*tonal->prev_band_tonality[b]);
- //printf("%f ", band_tonality[b]);
+ printf("%f ", band_tonality[b]);
#if 0
if (b>=NB_TONAL_SKIP_BANDS)
{
@@ -395,7 +395,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
/*printf("%f %f ", band_tonality[b], stationarity);*/
tonal->prev_band_tonality[b] = band_tonality[b];
}
- //printf("\n");
+ printf("\n");
bandwidth_mask = 0;
bandwidth = 0;
maxE = 0;
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 58a6e295..a3bb1add 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -586,7 +586,7 @@ void silk_resampler_down2_float(
int inLen /* I Number of input samples */
)
{
- int k, len2 = silk_RSHIFT32( inLen, 1 );
+ int k, len2 = inLen/2;
opus_val32 in32, out32, Y, X;
/* Internal variables and state are in Q10 format */
@@ -654,24 +654,29 @@ void downmix_float(const void *_x, opus_val32 *sub, int subframe, int offset, in
float S[2];
void downmix_int(const void *_x, opus_val32 *sub, int subframe, int offset, int c1, int c2, int C)
{
- float out[1000];
+ VARDECL(opus_val16, tmp);
const opus_int16 *x;
opus_val32 scale;
int j;
+ ALLOC_STACK;
+
+ subframe *= 2;
+ ALLOC(tmp, subframe, opus_val16);
+
x = (const opus_int16 *)_x;
for (j=0;j<subframe;j++)
- sub[j] = x[(j+offset)*C+c1];
+ tmp[j] = x[(j+offset)*C+c1];
if (c2>-1)
{
for (j=0;j<subframe;j++)
- sub[j] += x[(j+offset)*C+c2];
+ tmp[j] += x[(j+offset)*C+c2];
} else if (c2==-2)
{
int c;
for (c=1;c<C;c++)
{
for (j=0;j<subframe;j++)
- sub[j] += x[(j+offset)*C+c];
+ tmp[j] += x[(j+offset)*C+c];
}
}
#ifdef FIXED_POINT
@@ -684,9 +689,8 @@ void downmix_int(const void *_x, opus_val32 *sub, int subframe, int offset, int
else if (c2>-1)
scale /= 2;
for (j=0;j<subframe;j++)
- sub[j] *= scale;
- silk_resampler_down2_float(S, out, sub, subframe);
- for (j=0;j<subframe/2;j++) printf("%f\n", out[j]);
+ tmp[j] *= scale;
+ silk_resampler_down2_float(S, sub, tmp, subframe);
}
opus_int32 frame_size_select(opus_int32 frame_size, int variable_duration, opus_int32 Fs)