ref: b66080a8794f7e49d519a8e3e063ae5c645f465e
parent: b1034eb1f06250f6524e14b9c9e1f388a45eb158
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Mon Jun 20 08:11:05 EDT 2016
Fixes minor code quality issues in CELT Reported by Durandal.
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -414,7 +414,7 @@
/* Compensating for the mid normalization */
xp = MULT16_32_Q15(mid, xp);
/* mid and side are in Q15, not Q14 like X and Y */
- mid2 = SHR32(mid, 1);
+ mid2 = SHR16(mid, 1);
El = MULT16_16(mid2, mid2) + side - 2*xp;
Er = MULT16_16(mid2, mid2) + side + 2*xp;
if (Er < QCONST32(6e-4f, 28) || El < QCONST32(6e-4f, 28))
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1175,10 +1175,10 @@
if (N>COMBFILTER_MAXPERIOD)
{
- OPUS_MOVE(prefilter_mem+c*COMBFILTER_MAXPERIOD, pre[c]+N, COMBFILTER_MAXPERIOD);
+ OPUS_COPY(prefilter_mem+c*COMBFILTER_MAXPERIOD, pre[c]+N, COMBFILTER_MAXPERIOD);
} else {
OPUS_MOVE(prefilter_mem+c*COMBFILTER_MAXPERIOD, prefilter_mem+c*COMBFILTER_MAXPERIOD+N, COMBFILTER_MAXPERIOD-N);
- OPUS_MOVE(prefilter_mem+c*COMBFILTER_MAXPERIOD+COMBFILTER_MAXPERIOD-N, pre[c]+COMBFILTER_MAXPERIOD, N);
+ OPUS_COPY(prefilter_mem+c*COMBFILTER_MAXPERIOD+COMBFILTER_MAXPERIOD-N, pre[c]+COMBFILTER_MAXPERIOD, N);
}
} while (++c<CC);
--- a/celt/celt_lpc.c
+++ b/celt/celt_lpc.c
@@ -49,8 +49,7 @@
float *lpc = _lpc;
#endif
- for (i = 0; i < p; i++)
- lpc[i] = 0;
+ OPUS_CLEAR(lpc, p);
if (ac[0] != 0)
{
for (i = 0; i < p; i++) {
--- a/celt/kiss_fft.c
+++ b/celt/kiss_fft.c
@@ -191,7 +191,7 @@
kiss_fft_cpx * Fout_beg = Fout;
#ifdef FIXED_POINT
- epi3.r = -16384;
+ /*epi3.r = -16384;*/ /* Unused */
epi3.i = -28378;
#else
epi3 = st->twiddles[fstride*m];
--- a/celt/mathops.c
+++ b/celt/mathops.c
@@ -164,7 +164,7 @@
{
return _celt_cos_pi_2(EXTRACT16(x));
} else {
- return NEG32(_celt_cos_pi_2(EXTRACT16(65536-x)));
+ return NEG16(_celt_cos_pi_2(EXTRACT16(65536-x)));
}
} else {
if (x&0x0000ffff)
--- a/celt/pitch.c
+++ b/celt/pitch.c
@@ -514,7 +514,7 @@
if (abs(T1-prev_period)<=1)
cont = prev_gain;
else if (abs(T1-prev_period)<=2 && 5*k*k < T0)
- cont = HALF32(prev_gain);
+ cont = HALF16(prev_gain);
else
cont = 0;
thresh = MAX16(QCONST16(.3f,15), MULT16_16_Q15(QCONST16(.7f,15),g0)-cont);
--- a/celt/vq.c
+++ b/celt/vq.c
@@ -271,7 +271,7 @@
best_id = 0;
/* The squared magnitude term gets added anyway, so we might as well
add it outside the loop */
- yy = ADD32(yy, 1);
+ yy = ADD16(yy, 1);
j=0;
do {
opus_val16 Rxy, Ryy;