Created
June 22, 2020 01:06
-
-
Save MoSal/4e3308951291315a9576609cec9769a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From ffd3f71103302082e6bb2460f9a0ababc0311629 Mon Sep 17 00:00:00 2001 | |
From: Mohammad AlSaleh <[email protected]> | |
Date: Mon, 22 Jun 2020 04:00:44 +0300 | |
Subject: [PATCH] Explicitly use `signed char` instead of `char` where needed | |
Should fix ARM builds. | |
Signed-off-by: Mohammad AlSaleh <[email protected]> | |
--- | |
src/lib/exhaleEnc.h | 2 +- | |
src/lib/linearPrediction.cpp | 8 ++++---- | |
2 files changed, 5 insertions(+), 5 deletions(-) | |
diff --git a/src/lib/exhaleEnc.h b/src/lib/exhaleEnc.h | |
index a82b87f..da7fc1a 100644 | |
--- a/src/lib/exhaleEnc.h | |
+++ b/src/lib/exhaleEnc.h | |
@@ -28,7 +28,7 @@ | |
#define WIN_SCALE double (1 << 23) | |
// channelConfigurationIndex setup | |
-typedef enum USAC_CCI : char | |
+typedef enum USAC_CCI : signed char | |
{ | |
CCI_UNDEF = -1, | |
CCI_CONF = 0, // channel-to-speaker mapping defined in UsacChannelConfig() (not to be used here!) | |
diff --git a/src/lib/linearPrediction.cpp b/src/lib/linearPrediction.cpp | |
index b715691..ecc9cde 100644 | |
--- a/src/lib/linearPrediction.cpp | |
+++ b/src/lib/linearPrediction.cpp | |
@@ -24,7 +24,7 @@ static const short tnsQuantCoeff4[17/*2^4+1*/] = { // = round (2^11 * sin (x * p | |
static const short* tnsQuantCoeff[2/*coefRes*/] = {tnsQuantCoeff3, tnsQuantCoeff4}; | |
// ISO/IEC 14496-3, Sec. 4.6.9.3, 3-bit | |
-static const char tnsQuantIndex3[SCHAR_MAX + 1] = { // = round (asin (x / 64) * (x < 0 ? 9 : 7) / pi) | |
+static const signed char tnsQuantIndex3[SCHAR_MAX + 1] = { // = round (asin (x / 64) * (x < 0 ? 9 : 7) / pi) | |
-4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, | |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
@@ -32,14 +32,14 @@ static const char tnsQuantIndex3[SCHAR_MAX + 1] = { // = round (asin (x / 64) * | |
}; | |
// ISO/IEC 14496-3, Sec. 4.6.9.3, 4-bit | |
-static const char tnsQuantIndex4[SCHAR_MAX + 1] = { // = round (asin (x / 64) * (x < 0 ? 17 : 15) / pi) | |
+static const signed char tnsQuantIndex4[SCHAR_MAX + 1] = { // = round (asin (x / 64) * (x < 0 ? 17 : 15) / pi) | |
-8, -7, -7, -7, -6, -6, -6, -6, -6, -5, -5, -5, -5, -5, -5, -5, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, | |
-3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, | |
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7 | |
}; | |
-static const char* tnsQuantIndex[2/*coefRes*/] = {tnsQuantIndex3, tnsQuantIndex4}; | |
+static const signed char* tnsQuantIndex[2/*coefRes*/] = {tnsQuantIndex3, tnsQuantIndex4}; | |
// static helper functions | |
static int quantizeParCorCoeffs (const short* const parCorCoeffs, const uint16_t nCoeffs, const short bitDepth, int8_t* const quantCoeffs, | |
@@ -49,7 +49,7 @@ static int quantizeParCorCoeffs (const short* const parCorCoeffs, const uint16_t | |
const unsigned tabIdx = (lowRes ? 0 : 1); | |
const char tabOffset = 4 << tabIdx; | |
const short* coeffTab = tnsQuantCoeff[tabIdx]; | |
- const char* indexTab = tnsQuantIndex[tabIdx]; | |
+ const signed char* indexTab = tnsQuantIndex[tabIdx]; | |
int dist0, dist1, distTotal = 0; | |
for (uint16_t s = 0; s < nCoeffs; s++) | |
-- | |
2.27.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment