Commit 7e67a8cb authored by jm's avatar jm
Browse files

Minor cleanup patch by Alfred E. Heggestad


git-svn-id: http://svn.xiph.org/trunk/speex@9365 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 11a7c0ae
......@@ -45,14 +45,14 @@
void speex_bits_init(SpeexBits *bits)
{
bits->chars = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
if (!bits->chars)
return;
bits->buf_size = MAX_BYTES_PER_FRAME;
bits->chars[0]=0;
bits->nbBits=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->owner=1;
bits->overflow=0;
speex_bits_reset(bits);
}
void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
......@@ -60,12 +60,9 @@ void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
bits->chars = (char*)buff;
bits->buf_size = buf_size;
bits->chars[0]=0;
bits->nbBits=0;
bits->charPtr=0;
bits->bitPtr=0;
bits->owner=0;
bits->overflow=0;
speex_bits_reset(bits);
}
void speex_bits_destroy(SpeexBits *bits)
......@@ -96,7 +93,7 @@ void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
int i;
if (len > bits->buf_size)
{
speex_warning_int("Packet if larger than allocated buffer: ", len);
speex_warning_int("Packet is larger than allocated buffer: ", len);
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->chars, len);
......
......@@ -47,6 +47,7 @@
#define M_PI 3.14159265358979323846
#endif
#undef BETA
#define BETA .65
#define min(a,b) ((a)<(b) ? (a) : (b))
......
......@@ -1267,6 +1267,9 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
speex_encoder_ctl(state, SPEEX_SET_QUALITY, &q);
break;
}
case SPEEX_GET_VBR_QUALITY:
(*(float*)ptr) = st->vbr_quality;
break;
case SPEEX_SET_ABR:
st->abr_enabled = (*(int*)ptr);
st->vbr_enabled = 1;
......@@ -1437,6 +1440,9 @@ int sb_decoder_ctl(void *state, int request, void *ptr)
speex_decoder_ctl(st->st_low, request, ptr);
st->lpc_enh_enabled = *((int*)ptr);
break;
case SPEEX_GET_ENH:
*((int*)ptr) = st->lpc_enh_enabled;
break;
case SPEEX_SET_MODE:
case SPEEX_SET_QUALITY:
{
......
......@@ -19,7 +19,6 @@ int main(int argc, char **argv)
FILE *fin, *fout, *fbits=NULL;
short in_short[FRAME_SIZE];
short out_short[FRAME_SIZE];
float in_float[FRAME_SIZE];
float sigpow,errpow,snr, seg_snr=0;
int snr_frames = 0;
char cbits[200];
......@@ -82,8 +81,6 @@ int main(int argc, char **argv)
fread(in_short, sizeof(short), FRAME_SIZE, fin);
if (feof(fin))
break;
for (i=0;i<FRAME_SIZE;i++)
in_float[i]=in_short[i];
speex_bits_reset(&bits);
speex_encode_int(st, in_short, &bits);
......
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