int startrate;
int stoprate;
enum Mode mode;
-
} AMR_bitrates;
/* Match desired bitrate with closest one*/
{7950,9999,MR795},//9
{10000,11999,MR102},//10
{12000,64000,MR122},//12
-
};
int i;
+
for(i=0;i<8;i++)
{
if(rates[i].startrate<=bitrate && rates[i].stoprate>=bitrate)
Speech_Encode_FrameState *enstate;
sid_syncState *sidstate;
enum TXFrameType tx_frametype;
-
-
} AMRContext;
static int amr_nb_decode_init(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
s->frameCount=0;
s->speech_decoder_state=NULL;
s->rx_type = (enum RXFrameType)0;
static int amr_nb_encode_init(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
s->frameCount=0;
s->speech_decoder_state=NULL;
s->rx_type = (enum RXFrameType)0;
static int amr_nb_encode_close(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
Speech_Encode_Frame_exit(&s->enstate);
sid_sync_exit (&s->sidstate);
av_freep(&avctx->coded_frame);
static int amr_nb_decode_close(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
Speech_Decode_Frame_exit(&s->speech_decoder_state);
return 0;
}
uint8_t * buf, int buf_size)
{
AMRContext *s = avctx->priv_data;
-
uint8_t*amrData=buf;
int offset=0;
-
UWord8 toc, q, ft;
-
Word16 serial[SERIAL_FRAMESIZE]; /* coded bits */
Word16 *synth;
UWord8 *packed_bits;
-
static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
int i;
unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
{
short serial_data[250] = {0};
-
AMRContext *s = avctx->priv_data;
int written;
static int amr_nb_decode_init(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
s->frameCount=0;
s->decState=Decoder_Interface_init();
if(!s->decState)
static int amr_nb_encode_init(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
s->frameCount=0;
if(avctx->sample_rate!=8000)
static int amr_nb_decode_close(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
Decoder_Interface_exit(s->decState);
return 0;
}
static int amr_nb_encode_close(AVCodecContext * avctx)
{
AMRContext *s = avctx->priv_data;
+
Encoder_Interface_exit(s->enstate);
av_freep(&avctx->coded_frame);
return 0;
uint8_t * buf, int buf_size)
{
AMRContext *s = (AMRContext*)avctx->priv_data;
-
uint8_t*amrData=buf;
static short block_size[16]={ 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
enum Mode dec_mode;
int startrate;
int stoprate;
int mode;
-
} AMRWB_bitrates;
static int getWBBitrateMode(int bitrate)
{18001,22000,6},//19.85
{22001,23000,7},//23.05
{23001,24000,8},//23.85
-
};
int i;
static int amr_wb_encode_init(AVCodecContext * avctx)
{
AMRWBContext *s = (AMRWBContext*)avctx->priv_data;
+
s->frameCount=0;
if(avctx->sample_rate!=16000)
static int amr_wb_encode_close(AVCodecContext * avctx)
{
AMRWBContext *s = (AMRWBContext*) avctx->priv_data;
+
E_IF_exit(s->state);
av_freep(&avctx->coded_frame);
s->frameCount++;
static int amr_wb_decode_init(AVCodecContext * avctx)
{
AMRWBContext *s = (AMRWBContext *)avctx->priv_data;
+
s->frameCount=0;
s->state = D_IF_init();
uint8_t * buf, int buf_size)
{
AMRWBContext *s = (AMRWBContext*)avctx->priv_data;
-
uint8_t*amrData=buf;
int mode;
int packet_size;
static int amr_wb_decode_close(AVCodecContext * avctx)
{
AMRWBContext *s = (AMRWBContext *)avctx->priv_data;
+
D_IF_exit(s->state);
return 0;
}