mirror of https://gerrit.osmocom.org/gapk
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.
This commit is contained in:
parent
bd42eba35d
commit
526fc6e5e9
|
@ -26,6 +26,8 @@
|
||||||
#define HR_CANON_LEN 14
|
#define HR_CANON_LEN 14
|
||||||
#define EFR_CANON_LEN 31
|
#define EFR_CANON_LEN 31
|
||||||
#define PCM_CANON_LEN (160*sizeof(uint16_t))
|
#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 {
|
enum codec_type {
|
||||||
CODEC_INVALID = 0,
|
CODEC_INVALID = 0,
|
||||||
|
|
|
@ -53,7 +53,7 @@ codec_hr_encode(void *_state, uint8_t *cod, const uint8_t *pcm, unsigned int pcm
|
||||||
BENCHMARK_STOP(CODEC_HR, 1);
|
BENCHMARK_STOP(CODEC_HR, 1);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
return HR_CANON_LEN;
|
return HR_REF_ENC_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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;
|
struct gsmhr *state = _state;
|
||||||
int rc;
|
int rc;
|
||||||
assert(cod_len == HR_CANON_LEN);
|
assert(cod_len == HR_REF_DEC_LEN);
|
||||||
BENCHMARK_START;
|
BENCHMARK_START;
|
||||||
rc = gsmhr_decode(state, (int16_t *)pcm, (const int16_t *)cod);
|
rc = gsmhr_decode(state, (int16_t *)pcm, (const int16_t *)cod);
|
||||||
BENCHMARK_STOP(CODEC_HR, 0);
|
BENCHMARK_STOP(CODEC_HR, 0);
|
||||||
|
|
|
@ -26,9 +26,6 @@
|
||||||
#include <gapk/formats.h>
|
#include <gapk/formats.h>
|
||||||
#include <gapk/utils.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[] = {
|
static const int params_unvoiced[] = {
|
||||||
5, /* R0 */
|
5, /* R0 */
|
||||||
11, /* k1Tok3 */
|
11, /* k1Tok3 */
|
||||||
|
|
Loading…
Reference in New Issue