summaryrefslogtreecommitdiff
path: root/celt
diff options
context:
space:
mode:
authorMark Harris <mark.hsj@gmail.com>2017-02-20 19:51:40 -0800
committerMark Harris <mark.hsj@gmail.com>2017-02-26 19:10:45 -0800
commitd6d70371e85ec83307f6df0e067d353daa8e6f33 (patch)
tree9e118ef0267e2e0734cc9db4c5bbd6016aa0e089 /celt
parent8056706f48880bbf0bb7ee842f1067b85f613353 (diff)
downloadopus-d6d70371e85ec83307f6df0e067d353daa8e6f33.tar.gz
Fix compiler warnings
- celt/modes.c:430:14: warning: cast from 'const unsigned char *' to 'opus_int16 *' increases required alignment from 1 to 2 [-Wcast-align] - 'C[0][1]' may be used uninitialized [-Wmaybe-uninitialized] - Unused variable/parameter - Value stored is never read - MSVC warnings about "possible loss of data" due to type conversions - MSVC warning C4146: unary minus operator applied to unsigned type - silk/NLSF_del_dec_quant.c:137:20: warning: array subscript is above array bounds [-Warray-bounds] (gcc -O3 false positive) - src/mlp_train.h:39:20: warning: function declaration isn't a prototype [-Wstrict-prototypes] - Remove SMALL_FOOTPRINT code from SSE 4.1 FIR implementation, matching the C implementation. The clang -Wcast-align warnings with SSE intrinsics are a known clang issue: https://llvm.org/bugs/show_bug.cgi?id=20670
Diffstat (limited to 'celt')
-rw-r--r--celt/celt_encoder.c2
-rw-r--r--celt/fixed_debug.h6
-rw-r--r--celt/fixed_generic.h6
-rw-r--r--celt/modes.c2
-rw-r--r--celt/vq.c2
-rw-r--r--celt/x86/celt_lpc_sse.c12
-rw-r--r--celt/x86/vq_sse2.c1
7 files changed, 11 insertions, 20 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c
index 77de1b6e..afee5aac 100644
--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1997,7 +1997,7 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm,
if (st->silk_info.offset > 100) target -= 18 << BITRES >> (3-LM);
/* Boosting bitrate on transients and vowels with significant temporal
spikes. */
- target += MULT16_16_Q14(tf_estimate-QCONST16(.25f,14), (50<<BITRES));
+ target += (opus_int32)MULT16_16_Q14(tf_estimate-QCONST16(.25f,14), (50<<BITRES));
/* If we have a strong transient, let's make sure it has enough bits to code
the first two bands, so that it can use folding rather than noise. */
if (tf_estimate > QCONST16(.7f,14))
diff --git a/celt/fixed_debug.h b/celt/fixed_debug.h
index 348d3ed7..f4352952 100644
--- a/celt/fixed_debug.h
+++ b/celt/fixed_debug.h
@@ -61,9 +61,11 @@ extern opus_int64 celt_mips;
/** Add two 32-bit values, ignore any overflows */
#define ADD32_ovflw(a,b) (celt_mips+=2,(opus_val32)((opus_uint32)(a)+(opus_uint32)(b)))
-/** Subtract two 32-bit values, ignore any overflows */
+/** Subtract two 32-bit values, ignore any overflows */
#define SUB32_ovflw(a,b) (celt_mips+=2,(opus_val32)((opus_uint32)(a)-(opus_uint32)(b)))
-#define NEG32_ovflw(a) (celt_mips+=2,(opus_val32)(-(opus_uint32)(a)))
+/* Avoid MSVC warning C4146: unary minus operator applied to unsigned type */
+/** Negate 32-bit value, ignore any overflows */
+#define NEG32_ovflw(a) (celt_mips+=2,(opus_val32)(0-(opus_uint32)(a)))
static OPUS_INLINE short NEG16(int x)
{
diff --git a/celt/fixed_generic.h b/celt/fixed_generic.h
index 3561b93c..5f4abda7 100644
--- a/celt/fixed_generic.h
+++ b/celt/fixed_generic.h
@@ -122,9 +122,11 @@
/** Add two 32-bit values, ignore any overflows */
#define ADD32_ovflw(a,b) ((opus_val32)((opus_uint32)(a)+(opus_uint32)(b)))
-/** Subtract two 32-bit values, ignore any overflows */
+/** Subtract two 32-bit values, ignore any overflows */
#define SUB32_ovflw(a,b) ((opus_val32)((opus_uint32)(a)-(opus_uint32)(b)))
-#define NEG32_ovflw(a) ((opus_val32)(-(opus_uint32)(a)))
+/* Avoid MSVC warning C4146: unary minus operator applied to unsigned type */
+/** Negate 32-bit value, ignore any overflows */
+#define NEG32_ovflw(a) ((opus_val32)(0-(opus_uint32)(a)))
/** 16x16 multiplication where the result fits in 16 bits */
#define MULT16_16_16(a,b) ((((opus_val16)(a))*((opus_val16)(b))))
diff --git a/celt/modes.c b/celt/modes.c
index 911686e9..390c5e8a 100644
--- a/celt/modes.c
+++ b/celt/modes.c
@@ -427,7 +427,7 @@ void opus_custom_mode_destroy(CELTMode *mode)
}
#endif /* CUSTOM_MODES_ONLY */
opus_free((opus_int16*)mode->eBands);
- opus_free((opus_int16*)mode->allocVectors);
+ opus_free((unsigned char*)mode->allocVectors);
opus_free((opus_val16*)mode->window);
opus_free((opus_int16*)mode->logN);
diff --git a/celt/vq.c b/celt/vq.c
index 1fac70e2..9462e7fa 100644
--- a/celt/vq.c
+++ b/celt/vq.c
@@ -214,7 +214,7 @@ opus_val16 op_pvq_search_c(celt_norm *X, int *iy, int K, int N, int arch)
rcp = EXTRACT16(MULT16_32_Q16(K, celt_rcp(sum)));
#else
/* Using K+e with e < 1 guarantees we cannot get more than K pulses. */
- rcp = EXTRACT16(MULT16_32_Q16(K+0.8, celt_rcp(sum)));
+ rcp = EXTRACT16(MULT16_32_Q16(K+0.8f, celt_rcp(sum)));
#endif
j=0; do {
#ifdef FIXED_POINT
diff --git a/celt/x86/celt_lpc_sse.c b/celt/x86/celt_lpc_sse.c
index 12a9b0e5..54785688 100644
--- a/celt/x86/celt_lpc_sse.c
+++ b/celt/x86/celt_lpc_sse.c
@@ -57,17 +57,6 @@ void celt_fir_sse4_1(const opus_val16 *x,
ALLOC(rnum, ord, opus_val16);
for(i=0;i<ord;i++)
rnum[i] = num[ord-i-1];
-#ifdef SMALL_FOOTPRINT
- for (i=0;i<N;i++)
- {
- opus_val32 sum = SHL32(EXTEND32(x[i]), SIG_SHIFT);
- for (j=0;j<ord;j++)
- {
- sum = MAC16_16(sum,rnum[j],x[i+j-ord]);
- }
- y[i] = SATURATE16(PSHR32(sum, SIG_SHIFT));
- }
-#else
noA = EXTEND32(1) << SIG_SHIFT >> 1;
vecNoA = _mm_set_epi32(noA, noA, noA, noA);
@@ -94,7 +83,6 @@ void celt_fir_sse4_1(const opus_val16 *x,
y[i] = SATURATE16(ADD32(EXTEND32(x[i]), PSHR32(sum, SIG_SHIFT)));
}
-#endif
RESTORE_STACK;
}
diff --git a/celt/x86/vq_sse2.c b/celt/x86/vq_sse2.c
index c82d7e24..6a317703 100644
--- a/celt/x86/vq_sse2.c
+++ b/celt/x86/vq_sse2.c
@@ -155,7 +155,6 @@ opus_val16 op_pvq_search_sse2(celt_norm *_X, int *iy, int K, int N, int arch)
__m128 max, max2;
__m128i count;
__m128i pos;
- best_id = 0;
/* The squared magnitude term gets added anyway, so we might as well
add it outside the loop */
yy = ADD16(yy, 1);