FreeCalypso > hg > gsm-codec-lib
view libgsmhr1/tw_gsmhr.h @ 585:3c6bf0d26ee7 default tip
TW-TS-005 reader: fix maximum line length bug
TW-TS-005 section 4.1 states:
The maximum allowed length of each line is 80 characters, not
including the OS-specific newline encoding.
The implementation of this line length limit in the TW-TS-005 hex file
reader function in the present suite was wrong, such that lines of
the full maximum length could not be read. Fix it.
Note that this bug affects comment lines too, not just actual RTP
payloads. Neither Annex A nor Annex B features an RTP payload format
that goes to the maximum of 40 bytes, but if a comment line goes to
the maximum allowed length of 80 characters not including the
terminating newline, the bug will be triggered, necessitating
the present fix.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 25 Feb 2025 07:49:28 +0000 |
parents | 993cb9273f89 |
children |
line wrap: on
line source
/* * This header file is the external public interface to libgsmhr1: * Themyscira Wireless implementation of GSM HRv1 speech codec * based on the original ETSI code of GSM 06.06. * * This header file should be installed in some system include directory * such that it can be included by C sources as <tw_gsmhr.h>. */ #ifndef __THEMWI_GSMHR_H #define __THEMWI_GSMHR_H #include <stdint.h> #define GSMHR_NUM_PARAMS 18 /* actual codec parameters */ #define GSMHR_NUM_PARAMS_ENC 20 /* output from the encoder */ #define GSMHR_NUM_PARAMS_DEC 22 /* input to the decoder */ #define GSMHR_FRAME_LEN_RPF 14 /* raw packed format */ #define GSMHR_FRAME_LEN_5993 15 /* RFC 5993 and TW-TS-002 */ /* stateful encoder, decoder and TFO engines */ struct gsmhr_encoder_state; /* opaque to external users */ struct gsmhr_decoder_state; /* ditto */ struct gsmhr_rxfe_state; struct gsmhr_encoder_state *gsmhr_encoder_create(int dtx); struct gsmhr_decoder_state *gsmhr_decoder_create(void); struct gsmhr_rxfe_state *gsmhr_rxfe_create(void); /* use standard free() call to free these instances afterward */ /* reset state to initial */ void gsmhr_encoder_reset(struct gsmhr_encoder_state *st, int dtx); void gsmhr_decoder_reset(struct gsmhr_decoder_state *st); void gsmhr_rxfe_reset(struct gsmhr_rxfe_state *st); /* encoder and decoder main functions */ void gsmhr_encode_frame(struct gsmhr_encoder_state *st, const int16_t *pcm, int16_t *param); void gsmhr_decode_frame(struct gsmhr_decoder_state *st, const int16_t *param, int16_t *pcm); /* TFO transform */ void gsmhr_tfo_xfrm(struct gsmhr_rxfe_state *st, int dtxd, const int16_t *ul, int16_t *dl); /* stateless format conversion functions */ void gsmhr_pack_ts101318(const int16_t *param, uint8_t *payload); void gsmhr_unpack_ts101318(const uint8_t *payload, int16_t *param); void gsmhr_encoder_twts002_out(const int16_t *param, uint8_t *payload); int gsmhr_decoder_twts002_in(const uint8_t *payload, int16_t *param); int gsmhr_rtp_in_preen(const uint8_t *rtp_in, unsigned rtp_in_len, uint8_t *canon_pl); int gsmhr_rtp_in_direct(const uint8_t *rtp_in, unsigned rtp_in_len, int16_t *param); /* reading parameter arrays from files: validation functions */ int gsmhr_check_common_params(const int16_t *params); int gsmhr_check_encoder_params(const int16_t *params); int gsmhr_check_decoder_params(const int16_t *params); /* perfect SID detection and regeneration */ int gsmhr_ts101318_is_perfect_sid(const uint8_t *payload); void gsmhr_ts101318_set_sid_codeword(uint8_t *payload); void gsmhr_set_sid_cw_params(int16_t *params); /* public const data items */ extern const int16_t gsmhr_dhf_params[GSMHR_NUM_PARAMS]; extern const uint8_t gsmhr_dhf_ts101318[GSMHR_FRAME_LEN_RPF]; #endif /* include guard */