FreeCalypso > hg > gsm-codec-lib
view libgsmhr1/tw_gsmhr.h @ 510:5bf71b091323
libgsmhr1: add direct conversion from RTP input to decoder params
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Aug 2024 02:19:37 +0000 |
parents | af70bf42eb1b |
children | 4f0ab833bec0 |
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 and decoder engines */ struct gsmhr_encoder_state; /* opaque to external users */ struct gsmhr_decoder_state; /* ditto */ struct gsmhr_encoder_state *gsmhr_encoder_create(int dtx); struct gsmhr_decoder_state *gsmhr_decoder_create(void); /* use standard free() call to free both 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); /* 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); /* 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); /* perfect SID detection and regeneration */ int gsmhr_ts101318_is_perfect_sid(const uint8_t *payload); void gsmhr_ts101318_set_sid_codeword(uint8_t *payload); /* 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 */