summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-20 12:11:05 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-06-20 12:11:05 -0400
commitb66080a8794f7e49d519a8e3e063ae5c645f465e (patch)
treee26c3ac1ae12577385ccae82cd567457d73dca04
parentb1034eb1f06250f6524e14b9c9e1f388a45eb158 (diff)
downloadopus-b66080a8794f7e49d519a8e3e063ae5c645f465e.tar.gz
Fixes minor code quality issues in CELT
Reported by Durandal.
-rw-r--r--celt/bands.c2
-rw-r--r--celt/celt_encoder.c4
-rw-r--r--celt/celt_lpc.c3
-rw-r--r--celt/kiss_fft.c2
-rw-r--r--celt/mathops.c2
-rw-r--r--celt/pitch.c2
-rw-r--r--celt/vq.c2
7 files changed, 8 insertions, 9 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 22a0034b..87eaa6c0 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -414,7 +414,7 @@ static void stereo_merge(celt_norm * OPUS_RESTRICT X, celt_norm * OPUS_RESTRICT
/* 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))
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c
index 9221441d..3ee7a4d3 100644
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1175,10 +1175,10 @@ static int run_prefilter(CELTEncoder *st, celt_sig *in, celt_sig *prefilter_mem,
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);
diff --git a/celt/celt_lpc.c b/celt/celt_lpc.c
index f02145af..b410a21c 100644
--- a/celt/celt_lpc.c
+++ b/celt/celt_lpc.c
@@ -49,8 +49,7 @@ int p
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++) {
diff --git a/celt/kiss_fft.c b/celt/kiss_fft.c
index 4ed37d2b..1f8fd053 100644
--- a/celt/kiss_fft.c
+++ b/celt/kiss_fft.c
@@ -191,7 +191,7 @@ static void kf_bfly3(
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];
diff --git a/celt/mathops.c b/celt/mathops.c
index 3f8c5dcc..21a01f52 100644
--- a/celt/mathops.c
+++ b/celt/mathops.c
@@ -164,7 +164,7 @@ opus_val16 celt_cos_norm(opus_val32 x)
{
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)
diff --git a/celt/pitch.c b/celt/pitch.c
index 873a09b8..bf46e7d5 100644
--- a/celt/pitch.c
+++ b/celt/pitch.c
@@ -514,7 +514,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
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);
diff --git a/celt/vq.c b/celt/vq.c
index f3583960..d29f38fd 100644
--- a/celt/vq.c
+++ b/celt/vq.c
@@ -271,7 +271,7 @@ unsigned alg_quant(celt_norm *X, int N, int K, int spread, int B, ec_enc *enc
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;