comparison libtwamr/tw_amr.h @ 307:6b33f3ba4289

libtwamr: go for single-chunk-state approach
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 16 Apr 2024 17:18:04 +0000
parents 57b4053559ff
children e4ce7972737f
comparison
equal deleted inserted replaced
306:047c198408c8 307:6b33f3ba4289
1 /* 1 /*
2 * This header file is the external public interface to libtwamr; 2 * This header file is the external public interface to libtwamr;
3 * it should be installed in the same system include directory 3 * it should be installed in the same system include directory
4 * as <gsm.h> and <gsm_efr.h> for more classic GSM codecs. 4 * as <tw_gsmfr.h> and <gsm_efr.h> for more classic GSM codecs.
5 */ 5 */
6 6
7 #ifndef __THEMWI_AMR_H 7 #ifndef __THEMWI_AMR_H
8 #define __THEMWI_AMR_H 8 #define __THEMWI_AMR_H
9 9
60 struct amr_decoder_state; /* ditto */ 60 struct amr_decoder_state; /* ditto */
61 61
62 struct amr_encoder_state *amr_encoder_create(int dtx); 62 struct amr_encoder_state *amr_encoder_create(int dtx);
63 struct amr_decoder_state *amr_decoder_create(void); 63 struct amr_decoder_state *amr_decoder_create(void);
64 64
65 /* special freeing functions to deal with extra internal structs */
66 void amr_encoder_free(struct amr_encoder_state *st);
67 void amr_decoder_free(struct amr_decoder_state *st);
68
69 /* reset state to initial */ 65 /* reset state to initial */
70 void amr_encoder_reset(struct amr_encoder_state *st); 66 void amr_encoder_reset(struct amr_encoder_state *st, int dtx);
71 void amr_decoder_reset(struct amr_decoder_state *st); 67 void amr_decoder_reset(struct amr_decoder_state *st);
72 68
73 /* interface structure for passing frames of codec parameters */ 69 /* interface structure for passing frames of codec parameters */
74 70
75 struct amr_param_frame { 71 struct amr_param_frame {
78 int16_t param[AMR_MAX_PRM]; 74 int16_t param[AMR_MAX_PRM];
79 }; 75 };
80 76
81 /* encoder and decoder main functions */ 77 /* encoder and decoder main functions */
82 78
83 void amr_encode_frame(struct amr_encoder_state *st, const int16_t *pcm, 79 void amr_encode_frame(struct amr_encoder_state *st, enum Mode mode,
84 struct amr_param_frame *frame); 80 const int16_t *pcm, struct amr_param_frame *frame);
85 81
86 void amr_decode_frame(struct amr_decoder_state *st, 82 void amr_decode_frame(struct amr_decoder_state *st,
87 const struct amr_param_frame *frame, int16_t *pcm); 83 const struct amr_param_frame *frame, int16_t *pcm);
88 84
89 /* stateless utility functions: format conversions */ 85 /* stateless utility functions: format conversions */