aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-05-28 16:16:21 +0200
committerHarald Welte <laforge@gnumonks.org>2017-05-28 16:18:09 +0200
commit526fc6e5e906937c3227b88c238d2a6d7e520434 (patch)
tree39b28bf096b8460de25b6126087e35b4d1a25758
parentbd42eba35dca8ae23013ad0825d007a0a5f69091 (diff)
Fix HR codec block sizes
The ETSI reference codec actually uses an array of 20/22 16bit values rather than a "canonical" format. The conversion is what fmt_hr_ref.c is doing. However, codec_hr.c must then subsequently not check for the canonical input/output sizes, but those specific to it.
-rw-r--r--include/gapk/codecs.h2
-rw-r--r--src/codec_hr.c4
-rw-r--r--src/fmt_hr_ref.c3
3 files changed, 4 insertions, 5 deletions
diff --git a/include/gapk/codecs.h b/include/gapk/codecs.h
index f62cb25..aa1c829 100644
--- a/include/gapk/codecs.h
+++ b/include/gapk/codecs.h
@@ -26,6 +26,8 @@
#define HR_CANON_LEN 14
#define EFR_CANON_LEN 31
#define PCM_CANON_LEN (160*sizeof(uint16_t))
+#define HR_REF_ENC_LEN (20 * sizeof(uint16_t))
+#define HR_REF_DEC_LEN (22 * sizeof(uint16_t))
enum codec_type {
CODEC_INVALID = 0,
diff --git a/src/codec_hr.c b/src/codec_hr.c
index 0b16985..b3247e0 100644
--- a/src/codec_hr.c
+++ b/src/codec_hr.c
@@ -53,7 +53,7 @@ codec_hr_encode(void *_state, uint8_t *cod, const uint8_t *pcm, unsigned int pcm
BENCHMARK_STOP(CODEC_HR, 1);
if (rc < 0)
return rc;
- return HR_CANON_LEN;
+ return HR_REF_ENC_LEN;
}
static int
@@ -61,7 +61,7 @@ codec_hr_decode(void *_state, uint8_t *pcm, const uint8_t *cod, unsigned int cod
{
struct gsmhr *state = _state;
int rc;
- assert(cod_len == HR_CANON_LEN);
+ assert(cod_len == HR_REF_DEC_LEN);
BENCHMARK_START;
rc = gsmhr_decode(state, (int16_t *)pcm, (const int16_t *)cod);
BENCHMARK_STOP(CODEC_HR, 0);
diff --git a/src/fmt_hr_ref.c b/src/fmt_hr_ref.c
index 32e8d48..d64918b 100644
--- a/src/fmt_hr_ref.c
+++ b/src/fmt_hr_ref.c
@@ -26,9 +26,6 @@
#include <gapk/formats.h>
#include <gapk/utils.h>
-#define HR_REF_DEC_LEN (22 * sizeof(uint16_t))
-#define HR_REF_ENC_LEN (20 * sizeof(uint16_t))
-
static const int params_unvoiced[] = {
5, /* R0 */
11, /* k1Tok3 */