# HG changeset patch # User takis # Date 1173348691 0 # Node ID cd67b7ab311cac82e791573c5cce0e757e93e90a # Parent 260b5f667458497610eb458adc7b5b06d76ae78a Cosmetics in amr.c. - remove carriage returns where (i find it) unneeded - don't break lines when defining variables - break line between variable definition and the rest of the code Patch by Ben Fouet, benoit fouet % purplelabs com. diff -r 260b5f667458 -r cd67b7ab311c amr.c --- a/amr.c Thu Mar 08 10:06:59 2007 +0000 +++ b/amr.c Thu Mar 08 10:11:31 2007 +0000 @@ -90,7 +90,6 @@ int startrate; int stoprate; enum Mode mode; - } AMR_bitrates; /* Match desired bitrate with closest one*/ @@ -106,9 +105,9 @@ {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) @@ -154,13 +153,12 @@ 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; @@ -188,6 +186,7 @@ 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; @@ -224,6 +223,7 @@ 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); @@ -233,6 +233,7 @@ static int amr_nb_decode_close(AVCodecContext * avctx) { AMRContext *s = avctx->priv_data; + Speech_Decode_Frame_exit(&s->speech_decoder_state); return 0; } @@ -242,16 +243,12 @@ 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; @@ -334,7 +331,6 @@ unsigned char *frame/*out*/, int buf_size, void *data/*in*/) { short serial_data[250] = {0}; - AMRContext *s = avctx->priv_data; int written; @@ -368,6 +364,7 @@ static int amr_nb_decode_init(AVCodecContext * avctx) { AMRContext *s = avctx->priv_data; + s->frameCount=0; s->decState=Decoder_Interface_init(); if(!s->decState) @@ -390,6 +387,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) { AMRContext *s = avctx->priv_data; + s->frameCount=0; if(avctx->sample_rate!=8000) @@ -422,6 +420,7 @@ static int amr_nb_decode_close(AVCodecContext * avctx) { AMRContext *s = avctx->priv_data; + Decoder_Interface_exit(s->decState); return 0; } @@ -429,6 +428,7 @@ 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; @@ -439,7 +439,6 @@ 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; @@ -529,7 +528,6 @@ int startrate; int stoprate; int mode; - } AMRWB_bitrates; static int getWBBitrateMode(int bitrate) @@ -545,7 +543,6 @@ {18001,22000,6},//19.85 {22001,23000,7},//23.05 {23001,24000,8},//23.85 - }; int i; @@ -571,6 +568,7 @@ static int amr_wb_encode_init(AVCodecContext * avctx) { AMRWBContext *s = (AMRWBContext*)avctx->priv_data; + s->frameCount=0; if(avctx->sample_rate!=16000) @@ -598,6 +596,7 @@ 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++; @@ -618,6 +617,7 @@ static int amr_wb_decode_init(AVCodecContext * avctx) { AMRWBContext *s = (AMRWBContext *)avctx->priv_data; + s->frameCount=0; s->state = D_IF_init(); @@ -639,7 +639,6 @@ uint8_t * buf, int buf_size) { AMRWBContext *s = (AMRWBContext*)avctx->priv_data; - uint8_t*amrData=buf; int mode; int packet_size; @@ -666,6 +665,7 @@ static int amr_wb_decode_close(AVCodecContext * avctx) { AMRWBContext *s = (AMRWBContext *)avctx->priv_data; + D_IF_exit(s->state); return 0; }