Commit be6753c0 authored by Benoit Fouet's avatar Benoit Fouet Committed by Panagiotis Issaris

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.

Originally committed as revision 8291 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent e7a5854d
...@@ -90,7 +90,6 @@ typedef struct AMR_bitrates ...@@ -90,7 +90,6 @@ typedef struct AMR_bitrates
int startrate; int startrate;
int stoprate; int stoprate;
enum Mode mode; enum Mode mode;
} AMR_bitrates; } AMR_bitrates;
/* Match desired bitrate with closest one*/ /* Match desired bitrate with closest one*/
...@@ -106,9 +105,9 @@ static enum Mode getBitrateMode(int bitrate) ...@@ -106,9 +105,9 @@ static enum Mode getBitrateMode(int bitrate)
{7950,9999,MR795},//9 {7950,9999,MR795},//9
{10000,11999,MR102},//10 {10000,11999,MR102},//10
{12000,64000,MR122},//12 {12000,64000,MR122},//12
}; };
int i; int i;
for(i=0;i<8;i++) for(i=0;i<8;i++)
{ {
if(rates[i].startrate<=bitrate && rates[i].stoprate>=bitrate) if(rates[i].startrate<=bitrate && rates[i].stoprate>=bitrate)
...@@ -154,13 +153,12 @@ typedef struct AMRContext { ...@@ -154,13 +153,12 @@ typedef struct AMRContext {
Speech_Encode_FrameState *enstate; Speech_Encode_FrameState *enstate;
sid_syncState *sidstate; sid_syncState *sidstate;
enum TXFrameType tx_frametype; enum TXFrameType tx_frametype;
} AMRContext; } AMRContext;
static int amr_nb_decode_init(AVCodecContext * avctx) static int amr_nb_decode_init(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
s->frameCount=0; s->frameCount=0;
s->speech_decoder_state=NULL; s->speech_decoder_state=NULL;
s->rx_type = (enum RXFrameType)0; s->rx_type = (enum RXFrameType)0;
...@@ -188,6 +186,7 @@ static int amr_nb_decode_init(AVCodecContext * avctx) ...@@ -188,6 +186,7 @@ static int amr_nb_decode_init(AVCodecContext * avctx)
static int amr_nb_encode_init(AVCodecContext * avctx) static int amr_nb_encode_init(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
s->frameCount=0; s->frameCount=0;
s->speech_decoder_state=NULL; s->speech_decoder_state=NULL;
s->rx_type = (enum RXFrameType)0; s->rx_type = (enum RXFrameType)0;
...@@ -224,6 +223,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) ...@@ -224,6 +223,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx)
static int amr_nb_encode_close(AVCodecContext * avctx) static int amr_nb_encode_close(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
Speech_Encode_Frame_exit(&s->enstate); Speech_Encode_Frame_exit(&s->enstate);
sid_sync_exit (&s->sidstate); sid_sync_exit (&s->sidstate);
av_freep(&avctx->coded_frame); av_freep(&avctx->coded_frame);
...@@ -233,6 +233,7 @@ static int amr_nb_encode_close(AVCodecContext * avctx) ...@@ -233,6 +233,7 @@ static int amr_nb_encode_close(AVCodecContext * avctx)
static int amr_nb_decode_close(AVCodecContext * avctx) static int amr_nb_decode_close(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
Speech_Decode_Frame_exit(&s->speech_decoder_state); Speech_Decode_Frame_exit(&s->speech_decoder_state);
return 0; return 0;
} }
...@@ -242,16 +243,12 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, ...@@ -242,16 +243,12 @@ static int amr_nb_decode_frame(AVCodecContext * avctx,
uint8_t * buf, int buf_size) uint8_t * buf, int buf_size)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
uint8_t*amrData=buf; uint8_t*amrData=buf;
int offset=0; int offset=0;
UWord8 toc, q, ft; UWord8 toc, q, ft;
Word16 serial[SERIAL_FRAMESIZE]; /* coded bits */ Word16 serial[SERIAL_FRAMESIZE]; /* coded bits */
Word16 *synth; Word16 *synth;
UWord8 *packed_bits; UWord8 *packed_bits;
static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0}; static Word16 packed_size[16] = {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
int i; int i;
...@@ -334,7 +331,6 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, ...@@ -334,7 +331,6 @@ static int amr_nb_encode_frame(AVCodecContext *avctx,
unsigned char *frame/*out*/, int buf_size, void *data/*in*/) unsigned char *frame/*out*/, int buf_size, void *data/*in*/)
{ {
short serial_data[250] = {0}; short serial_data[250] = {0};
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
int written; int written;
...@@ -368,6 +364,7 @@ typedef struct AMRContext { ...@@ -368,6 +364,7 @@ typedef struct AMRContext {
static int amr_nb_decode_init(AVCodecContext * avctx) static int amr_nb_decode_init(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
s->frameCount=0; s->frameCount=0;
s->decState=Decoder_Interface_init(); s->decState=Decoder_Interface_init();
if(!s->decState) if(!s->decState)
...@@ -390,6 +387,7 @@ static int amr_nb_decode_init(AVCodecContext * avctx) ...@@ -390,6 +387,7 @@ static int amr_nb_decode_init(AVCodecContext * avctx)
static int amr_nb_encode_init(AVCodecContext * avctx) static int amr_nb_encode_init(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
s->frameCount=0; s->frameCount=0;
if(avctx->sample_rate!=8000) if(avctx->sample_rate!=8000)
...@@ -422,6 +420,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx) ...@@ -422,6 +420,7 @@ static int amr_nb_encode_init(AVCodecContext * avctx)
static int amr_nb_decode_close(AVCodecContext * avctx) static int amr_nb_decode_close(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
Decoder_Interface_exit(s->decState); Decoder_Interface_exit(s->decState);
return 0; return 0;
} }
...@@ -429,6 +428,7 @@ static int amr_nb_decode_close(AVCodecContext * avctx) ...@@ -429,6 +428,7 @@ static int amr_nb_decode_close(AVCodecContext * avctx)
static int amr_nb_encode_close(AVCodecContext * avctx) static int amr_nb_encode_close(AVCodecContext * avctx)
{ {
AMRContext *s = avctx->priv_data; AMRContext *s = avctx->priv_data;
Encoder_Interface_exit(s->enstate); Encoder_Interface_exit(s->enstate);
av_freep(&avctx->coded_frame); av_freep(&avctx->coded_frame);
return 0; return 0;
...@@ -439,7 +439,6 @@ static int amr_nb_decode_frame(AVCodecContext * avctx, ...@@ -439,7 +439,6 @@ static int amr_nb_decode_frame(AVCodecContext * avctx,
uint8_t * buf, int buf_size) uint8_t * buf, int buf_size)
{ {
AMRContext *s = (AMRContext*)avctx->priv_data; AMRContext *s = (AMRContext*)avctx->priv_data;
uint8_t*amrData=buf; 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 }; 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; enum Mode dec_mode;
...@@ -529,7 +528,6 @@ typedef struct AMRWB_bitrates ...@@ -529,7 +528,6 @@ typedef struct AMRWB_bitrates
int startrate; int startrate;
int stoprate; int stoprate;
int mode; int mode;
} AMRWB_bitrates; } AMRWB_bitrates;
static int getWBBitrateMode(int bitrate) static int getWBBitrateMode(int bitrate)
...@@ -545,7 +543,6 @@ static int getWBBitrateMode(int bitrate) ...@@ -545,7 +543,6 @@ static int getWBBitrateMode(int bitrate)
{18001,22000,6},//19.85 {18001,22000,6},//19.85
{22001,23000,7},//23.05 {22001,23000,7},//23.05
{23001,24000,8},//23.85 {23001,24000,8},//23.85
}; };
int i; int i;
...@@ -571,6 +568,7 @@ typedef struct AMRWBContext { ...@@ -571,6 +568,7 @@ typedef struct AMRWBContext {
static int amr_wb_encode_init(AVCodecContext * avctx) static int amr_wb_encode_init(AVCodecContext * avctx)
{ {
AMRWBContext *s = (AMRWBContext*)avctx->priv_data; AMRWBContext *s = (AMRWBContext*)avctx->priv_data;
s->frameCount=0; s->frameCount=0;
if(avctx->sample_rate!=16000) if(avctx->sample_rate!=16000)
...@@ -598,6 +596,7 @@ static int amr_wb_encode_init(AVCodecContext * avctx) ...@@ -598,6 +596,7 @@ static int amr_wb_encode_init(AVCodecContext * avctx)
static int amr_wb_encode_close(AVCodecContext * avctx) static int amr_wb_encode_close(AVCodecContext * avctx)
{ {
AMRWBContext *s = (AMRWBContext*) avctx->priv_data; AMRWBContext *s = (AMRWBContext*) avctx->priv_data;
E_IF_exit(s->state); E_IF_exit(s->state);
av_freep(&avctx->coded_frame); av_freep(&avctx->coded_frame);
s->frameCount++; s->frameCount++;
...@@ -618,6 +617,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx, ...@@ -618,6 +617,7 @@ static int amr_wb_encode_frame(AVCodecContext *avctx,
static int amr_wb_decode_init(AVCodecContext * avctx) static int amr_wb_decode_init(AVCodecContext * avctx)
{ {
AMRWBContext *s = (AMRWBContext *)avctx->priv_data; AMRWBContext *s = (AMRWBContext *)avctx->priv_data;
s->frameCount=0; s->frameCount=0;
s->state = D_IF_init(); s->state = D_IF_init();
...@@ -639,7 +639,6 @@ static int amr_wb_decode_frame(AVCodecContext * avctx, ...@@ -639,7 +639,6 @@ static int amr_wb_decode_frame(AVCodecContext * avctx,
uint8_t * buf, int buf_size) uint8_t * buf, int buf_size)
{ {
AMRWBContext *s = (AMRWBContext*)avctx->priv_data; AMRWBContext *s = (AMRWBContext*)avctx->priv_data;
uint8_t*amrData=buf; uint8_t*amrData=buf;
int mode; int mode;
int packet_size; int packet_size;
...@@ -666,6 +665,7 @@ static int amr_wb_decode_frame(AVCodecContext * avctx, ...@@ -666,6 +665,7 @@ static int amr_wb_decode_frame(AVCodecContext * avctx,
static int amr_wb_decode_close(AVCodecContext * avctx) static int amr_wb_decode_close(AVCodecContext * avctx)
{ {
AMRWBContext *s = (AMRWBContext *)avctx->priv_data; AMRWBContext *s = (AMRWBContext *)avctx->priv_data;
D_IF_exit(s->state); D_IF_exit(s->state);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment