Commit 86bb320f authored by jm's avatar jm

Changed part of the API to use spx_int32_t instead of int (works better on

16-bit architectures)


git-svn-id: http://svn.xiph.org/trunk/speex@11803 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 56b90803
For 1.1.13:
Input buffer in new enhancer
(remove the if's in loops in interp_pitch())
Fix --force-nb
Fix wideband PLC
change filter structure in vorbis-psy (use the numerator=LPC version)
Fix overflow in mdf
Later:
use 16-bit version of the filters in ltp.c
Better saturation handling in mdf?
get rid of crap that shouldn't be exposed in speex.h
Would be nice:
......
......@@ -91,7 +91,7 @@ typedef struct SpeexJitter {
int valid_bits; /**< True if Speex bits are valid */
JitterBuffer *packets;
void *dec; /**< Pointer to Speex decoder */
int frame_size; /**< Frame size of Speex decoder */
spx_int32_t frame_size; /**< Frame size of Speex decoder */
} SpeexJitter;
/** Initialise jitter buffer */
......
......@@ -490,7 +490,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
/* delta_qual*=.1*(3+st->vbr_quality);*/
if (st->vbr_enabled)
{
int mode;
spx_int32_t mode;
int choice=0;
float min_diff=100;
mode = 8;
......@@ -540,7 +540,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
if (st->abr_enabled)
{
int bitrate;
spx_int32_t bitrate;
speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate);
st->abr_drift+=(bitrate-st->abr_enabled);
st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled);
......@@ -1759,40 +1759,40 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
switch(request)
{
case SPEEX_GET_FRAME_SIZE:
(*(int*)ptr) = st->frameSize;
(*(spx_int32_t*)ptr) = st->frameSize;
break;
case SPEEX_SET_LOW_MODE:
case SPEEX_SET_MODE:
st->submodeSelect = st->submodeID = (*(int*)ptr);
st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_LOW_MODE:
case SPEEX_GET_MODE:
(*(int*)ptr) = st->submodeID;
(*(spx_int32_t*)ptr) = st->submodeID;
break;
case SPEEX_SET_VBR:
st->vbr_enabled = (*(int*)ptr);
st->vbr_enabled = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_VBR:
(*(int*)ptr) = st->vbr_enabled;
(*(spx_int32_t*)ptr) = st->vbr_enabled;
break;
case SPEEX_SET_VAD:
st->vad_enabled = (*(int*)ptr);
st->vad_enabled = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_VAD:
(*(int*)ptr) = st->vad_enabled;
(*(spx_int32_t*)ptr) = st->vad_enabled;
break;
case SPEEX_SET_DTX:
st->dtx_enabled = (*(int*)ptr);
st->dtx_enabled = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_DTX:
(*(int*)ptr) = st->dtx_enabled;
(*(spx_int32_t*)ptr) = st->dtx_enabled;
break;
case SPEEX_SET_ABR:
st->abr_enabled = (*(spx_int32_t*)ptr);
st->vbr_enabled = st->abr_enabled!=0;
if (st->vbr_enabled)
{
int i=10;
spx_int32_t i=10;
spx_int32_t rate, target;
float vbr_qual;
target = (*(spx_int32_t*)ptr);
......@@ -1834,7 +1834,7 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
}
break;
case SPEEX_SET_COMPLEXITY:
st->complexity = (*(int*)ptr);
st->complexity = (*(spx_int32_t*)ptr);
if (st->complexity<0)
st->complexity=0;
break;
......@@ -1843,7 +1843,7 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
break;
case SPEEX_SET_BITRATE:
{
int i=10;
spx_int32_t i=10;
spx_int32_t rate, target;
target = (*(spx_int32_t*)ptr);
while (i>=0)
......@@ -1884,21 +1884,21 @@ int nb_encoder_ctl(void *state, int request, void *ptr)
}
break;
case SPEEX_SET_SUBMODE_ENCODING:
st->encode_submode = (*(int*)ptr);
st->encode_submode = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_SUBMODE_ENCODING:
(*(int*)ptr) = st->encode_submode;
(*(spx_int32_t*)ptr) = st->encode_submode;
break;
case SPEEX_GET_LOOKAHEAD:
(*(int*)ptr)=(st->windowSize-st->frameSize);
(*(spx_int32_t*)ptr)=(st->windowSize-st->frameSize);
break;
case SPEEX_SET_PLC_TUNING:
st->plc_tuning = (*(int*)ptr);
st->plc_tuning = (*(spx_int32_t*)ptr);
if (st->plc_tuning>100)
st->plc_tuning=100;
break;
case SPEEX_GET_PLC_TUNING:
(*(int*)ptr)=(st->plc_tuning);
(*(spx_int32_t*)ptr)=(st->plc_tuning);
break;
case SPEEX_SET_VBR_MAX_BITRATE:
st->vbr_max = (*(spx_int32_t*)ptr);
......@@ -1954,20 +1954,20 @@ int nb_decoder_ctl(void *state, int request, void *ptr)
{
case SPEEX_SET_LOW_MODE:
case SPEEX_SET_MODE:
st->submodeID = (*(int*)ptr);
st->submodeID = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_LOW_MODE:
case SPEEX_GET_MODE:
(*(int*)ptr) = st->submodeID;
(*(spx_int32_t*)ptr) = st->submodeID;
break;
case SPEEX_SET_ENH:
st->lpc_enh_enabled = *((int*)ptr);
st->lpc_enh_enabled = *((spx_int32_t*)ptr);
break;
case SPEEX_GET_ENH:
*((int*)ptr) = st->lpc_enh_enabled;
*((spx_int32_t*)ptr) = st->lpc_enh_enabled;
break;
case SPEEX_GET_FRAME_SIZE:
(*(int*)ptr) = st->frameSize;
(*(spx_int32_t*)ptr) = st->frameSize;
break;
case SPEEX_GET_BITRATE:
if (st->submodes[st->submodeID])
......@@ -2007,13 +2007,13 @@ int nb_decoder_ctl(void *state, int request, void *ptr)
}
break;
case SPEEX_SET_SUBMODE_ENCODING:
st->encode_submode = (*(int*)ptr);
st->encode_submode = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_SUBMODE_ENCODING:
(*(int*)ptr) = st->encode_submode;
(*(spx_int32_t*)ptr) = st->encode_submode;
break;
case SPEEX_GET_LOOKAHEAD:
(*(int*)ptr)=st->subframeSize;
(*(spx_int32_t*)ptr)=st->subframeSize;
break;
case SPEEX_SET_HIGHPASS:
st->highpass_enabled = (*(spx_int32_t*)ptr);
......@@ -2039,7 +2039,7 @@ int nb_decoder_ctl(void *state, int request, void *ptr)
}
break;
case SPEEX_GET_DTX_STATUS:
*((int*)ptr) = st->dtx_enabled;
*((spx_int32_t*)ptr) = st->dtx_enabled;
break;
case SPEEX_SET_INNOVATION_SAVE:
st->innov_save = (spx_sig_t*)ptr;
......
......@@ -101,7 +101,7 @@ typedef struct EncState {
VBRState *vbr; /**< State of the VBR data */
float vbr_quality; /**< Quality setting for VBR encoding */
float relative_quality; /**< Relative quality that will be needed by VBR */
int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
spx_int32_t vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode */
int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */
int dtx_enabled; /**< 1 for enabling DTX, 0 otherwise */
......
......@@ -226,6 +226,7 @@ static void mix_and_saturate(spx_word32_t *x0, spx_word32_t *x1, spx_word16_t *o
void *sb_encoder_init(const SpeexMode *m)
{
int i;
spx_int32_t tmp;
SBEncState *st;
const SpeexSBMode *mode;
......@@ -254,10 +255,10 @@ void *sb_encoder_init(const SpeexMode *m)
st->submodes=mode->submodes;
st->submodeSelect = st->submodeID=mode->defaultSubmode;
i=9;
speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &i);
i=1;
speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &i);
tmp=9;
speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &tmp);
tmp=1;
speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
st->lag_factor = mode->lag_factor;
st->lpc_floor = mode->lpc_floor;
......@@ -386,7 +387,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
VARDECL(spx_word32_t *low_pi_gain);
VARDECL(spx_word16_t *low_exc);
const SpeexSBMode *mode;
int dtx;
spx_int32_t dtx;
spx_word16_t *in = (spx_word16_t*)vin;
st = (SBEncState*)state;
......@@ -501,7 +502,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
/*if (ratio>-2)*/
if (st->vbr_enabled)
{
int modeid;
spx_int32_t modeid;
modeid = mode->nb_modes-1;
st->relative_quality+=1.0*(ratio+2);
if (st->relative_quality<-1)
......@@ -523,7 +524,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
speex_encoder_ctl(state, SPEEX_SET_HIGH_MODE, &modeid);
if (st->abr_enabled)
{
int bitrate;
spx_int32_t bitrate;
speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate);
st->abr_drift+=(bitrate-st->abr_enabled);
st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled);
......@@ -836,7 +837,7 @@ int sb_encode(void *state, void *vin, SpeexBits *bits)
void *sb_decoder_init(const SpeexMode *m)
{
int tmp;
spx_int32_t tmp;
SBDecState *st;
const SpeexSBMode *mode;
st = (SBDecState*)speex_alloc(sizeof(SBDecState));
......@@ -991,7 +992,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout)
VARDECL(spx_word32_t *low_pi_gain);
VARDECL(spx_word16_t *low_exc);
VARDECL(spx_coef_t *ak);
int dtx;
spx_int32_t dtx;
const SpeexSBMode *mode;
spx_word16_t *out = (spx_word16_t*)vout;
......@@ -1256,10 +1257,10 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
switch(request)
{
case SPEEX_GET_FRAME_SIZE:
(*(int*)ptr) = st->full_frame_size;
(*(spx_int32_t*)ptr) = st->full_frame_size;
break;
case SPEEX_SET_HIGH_MODE:
st->submodeSelect = st->submodeID = (*(int*)ptr);
st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr);
break;
case SPEEX_SET_LOW_MODE:
speex_encoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
......@@ -1277,22 +1278,22 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
speex_encoder_ctl(st, SPEEX_SET_QUALITY, ptr);
break;
case SPEEX_SET_VBR:
st->vbr_enabled = (*(int*)ptr);
st->vbr_enabled = (*(spx_int32_t*)ptr);
speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr);
break;
case SPEEX_GET_VBR:
(*(int*)ptr) = st->vbr_enabled;
(*(spx_int32_t*)ptr) = st->vbr_enabled;
break;
case SPEEX_SET_VAD:
st->vad_enabled = (*(int*)ptr);
st->vad_enabled = (*(spx_int32_t*)ptr);
speex_encoder_ctl(st->st_low, SPEEX_SET_VAD, ptr);
break;
case SPEEX_GET_VAD:
(*(int*)ptr) = st->vad_enabled;
(*(spx_int32_t*)ptr) = st->vad_enabled;
break;
case SPEEX_SET_VBR_QUALITY:
{
int q;
spx_int32_t q;
float qual = (*(float*)ptr)+.6;
st->vbr_quality = (*(float*)ptr);
if (qual>10)
......@@ -1313,7 +1314,7 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled);
if (st->vbr_enabled)
{
int i=10, rate, target;
spx_int32_t i=10, rate, target;
float vbr_qual;
target = (*(spx_int32_t*)ptr);
while (i>=0)
......@@ -1339,8 +1340,8 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
break;
case SPEEX_SET_QUALITY:
{
int nb_qual;
int quality = (*(int*)ptr);
spx_int32_t nb_qual;
int quality = (*(spx_int32_t*)ptr);
if (quality < 0)
quality = 0;
if (quality > 10)
......@@ -1352,16 +1353,16 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
break;
case SPEEX_SET_COMPLEXITY:
speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr);
st->complexity = (*(int*)ptr);
st->complexity = (*(spx_int32_t*)ptr);
if (st->complexity<1)
st->complexity=1;
break;
case SPEEX_GET_COMPLEXITY:
(*(int*)ptr) = st->complexity;
(*(spx_int32_t*)ptr) = st->complexity;
break;
case SPEEX_SET_BITRATE:
{
int i=10;
spx_int32_t i=10;
spx_int32_t rate, target;
target = (*(spx_int32_t*)ptr);
while (i>=0)
......@@ -1409,15 +1410,15 @@ int sb_encoder_ctl(void *state, int request, void *ptr)
}
break;
case SPEEX_SET_SUBMODE_ENCODING:
st->encode_submode = (*(int*)ptr);
st->encode_submode = (*(spx_int32_t*)ptr);
speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr);
break;
case SPEEX_GET_SUBMODE_ENCODING:
(*(int*)ptr) = st->encode_submode;
(*(spx_int32_t*)ptr) = st->encode_submode;
break;
case SPEEX_GET_LOOKAHEAD:
speex_encoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
(*(int*)ptr) = 2*(*(int*)ptr) + QMF_ORDER - 1;
(*(spx_int32_t*)ptr) = 2*(*(int*)ptr) + QMF_ORDER - 1;
break;
case SPEEX_SET_PLC_TUNING:
speex_encoder_ctl(st->st_low, SPEEX_SET_PLC_TUNING, ptr);
......@@ -1517,7 +1518,7 @@ int sb_decoder_ctl(void *state, int request, void *ptr)
switch(request)
{
case SPEEX_SET_HIGH_MODE:
st->submodeID = (*(int*)ptr);
st->submodeID = (*(spx_int32_t*)ptr);
break;
case SPEEX_SET_LOW_MODE:
speex_decoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
......@@ -1526,20 +1527,20 @@ int sb_decoder_ctl(void *state, int request, void *ptr)
speex_decoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);
break;
case SPEEX_GET_FRAME_SIZE:
(*(int*)ptr) = st->full_frame_size;
(*(spx_int32_t*)ptr) = st->full_frame_size;
break;
case SPEEX_SET_ENH:
speex_decoder_ctl(st->st_low, request, ptr);
st->lpc_enh_enabled = *((int*)ptr);
st->lpc_enh_enabled = *((spx_int32_t*)ptr);
break;
case SPEEX_GET_ENH:
*((int*)ptr) = st->lpc_enh_enabled;
*((spx_int32_t*)ptr) = st->lpc_enh_enabled;
break;
case SPEEX_SET_MODE:
case SPEEX_SET_QUALITY:
{
int nb_qual;
int quality = (*(int*)ptr);
spx_int32_t nb_qual;
int quality = (*(spx_int32_t*)ptr);
if (quality < 0)
quality = 0;
if (quality > 10)
......@@ -1583,15 +1584,15 @@ int sb_decoder_ctl(void *state, int request, void *ptr)
}
break;
case SPEEX_SET_SUBMODE_ENCODING:
st->encode_submode = (*(int*)ptr);
st->encode_submode = (*(spx_int32_t*)ptr);
speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, &ptr);
break;
case SPEEX_GET_SUBMODE_ENCODING:
(*(int*)ptr) = st->encode_submode;
(*(spx_int32_t*)ptr) = st->encode_submode;
break;
case SPEEX_GET_LOOKAHEAD:
speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
(*(int*)ptr) = 2*(*(int*)ptr);
(*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr);
break;
case SPEEX_SET_HIGHPASS:
speex_decoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr);
......
......@@ -86,7 +86,7 @@ int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out)
int speex_encode(void *state, float *in, SpeexBits *bits)
{
int i;
int N;
spx_int32_t N;
spx_int16_t short_in[MAX_IN_SAMPLES];
speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
for (i=0;i<N;i++)
......@@ -111,7 +111,7 @@ int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
int speex_decode(void *state, SpeexBits *bits, float *out)
{
int i, ret;
int N;
spx_int32_t N;
spx_int16_t short_out[MAX_IN_SAMPLES];
speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
ret = (*((SpeexMode**)state))->dec(state, bits, short_out);
......@@ -136,7 +136,7 @@ int speex_encode(void *state, float *in, SpeexBits *bits)
int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits)
{
int i;
int N;
spx_int32_t N;
float float_in[MAX_IN_SAMPLES];
speex_encoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
for (i=0;i<N;i++)
......@@ -152,7 +152,7 @@ int speex_decode(void *state, SpeexBits *bits, float *out)
int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out)
{
int i;
int N;
spx_int32_t N;
float float_out[MAX_IN_SAMPLES];
int ret;
speex_decoder_ctl(state, SPEEX_GET_FRAME_SIZE, &N);
......
......@@ -73,7 +73,7 @@ int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *st
int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
{
int m;
spx_int32_t m;
m = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_MODE, &m);
return 0;
......@@ -81,7 +81,7 @@ int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
{
int m;
spx_int32_t m;
m = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_LOW_MODE, &m);
return 0;
......@@ -89,7 +89,7 @@ int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
{
int m;
spx_int32_t m;
m = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_HIGH_MODE, &m);
return 0;
......@@ -97,7 +97,7 @@ int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data
int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
{
int vbr;
spx_int32_t vbr;
vbr = speex_bits_unpack_unsigned(bits, 1);
speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr);
return 0;
......@@ -105,7 +105,7 @@ int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
{
int enh;
spx_int32_t enh;
enh = speex_bits_unpack_unsigned(bits, 1);
speex_decoder_ctl(data, SPEEX_SET_ENH, &enh);
return 0;
......@@ -113,7 +113,7 @@ int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
{
int qual;
float qual;
qual = speex_bits_unpack_unsigned(bits, 4);
speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual);
return 0;
......
......@@ -27,7 +27,7 @@ int main(int argc, char **argv)
void *st;
void *dec;
SpeexBits bits;
int tmp;
spx_int32_t tmp;
int bitCount=0;
int skip_group_delay;
SpeexCallback callback;
......
......@@ -28,7 +28,7 @@ int main(int argc, char **argv)
void *st;
void *dec;
SpeexBits bits;
int tmp;
spx_int32_t tmp;
int bitCount=0;
int skip_group_delay;
SpeexCallback callback;
......
......@@ -28,7 +28,7 @@ int main(int argc, char **argv)
void *st;
void *dec;
SpeexBits bits;
int tmp;
spx_int32_t tmp;
int bitCount=0;
int skip_group_delay;
SpeexCallback callback;
......
......@@ -299,7 +299,7 @@ void version_short()
printf ("Copyright (C) 2002-2006 Jean-Marc Valin\n");
}
static void *process_header(ogg_packet *op, int enh_enabled, int *frame_size, int *granule_frame_size, int *rate, int *nframes, int forceMode, int *channels, SpeexStereoState *stereo, int *extra_headers, int quiet)
static void *process_header(ogg_packet *op, spx_int32_t enh_enabled, spx_int32_t *frame_size, int *granule_frame_size, spx_int32_t *rate, int *nframes, int forceMode, int *channels, SpeexStereoState *stereo, int *extra_headers, int quiet)
{
void *st;
const SpeexMode *mode;
......@@ -459,7 +459,7 @@ int main(int argc, char **argv)
SpeexStereoState stereo = SPEEX_STEREO_STATE_INIT;
int channels=-1;
int rate=0;
int extra_headers;
int extra_headers=0;
int wav_format=0;
int lookahead;
int speex_serialno = -1;
......@@ -693,7 +693,7 @@ int main(int argc, char **argv)
speex_decode_stereo_int(output, frame_size, &stereo);
if (print_bitrate) {
int tmp;
spx_int32_t tmp;
char ch=13;
speex_decoder_ctl(st, SPEEX_GET_BITRATE, &tmp);
fputc (ch, stderr);
......
......@@ -80,7 +80,7 @@ int oe_write_page(ogg_page *page, FILE *fp)
#define MAX_FRAME_BYTES 2000
/* Convert input audio bits, endians and channels */
static int read_samples(FILE *fin,int frame_size, int bits, int channels, int lsb, short * input, char *buff, int *size)
static int read_samples(FILE *fin,int frame_size, int bits, int channels, int lsb, short * input, char *buff, spx_int32_t *size)
{
unsigned char in[MAX_FRAME_BYTES*2];
int i;
......@@ -253,13 +253,13 @@ int main(int argc, char **argv)
char *inFile, *outFile;
FILE *fin, *fout;
short input[MAX_FRAME_SIZE];
int frame_size;
spx_int32_t frame_size;
int quiet=0;
int vbr_enabled=0;
spx_int32_t vbr_enabled=0;
spx_int32_t vbr_max=0;
int abr_enabled=0;
int vad_enabled=0;
int dtx_enabled=0;
spx_int32_t vad_enabled=0;
spx_int32_t dtx_enabled=0;
int nbBytes;
const SpeexMode *mode=NULL;
int modeID = -1;
......@@ -300,10 +300,11 @@ int main(int argc, char **argv)
{0, 0, 0, 0}
};
int print_bitrate=0;
int rate=0, size;
spx_int32_t rate=0;
spx_int32_t size;
int chan=1;
int fmt=16;
int quality=-1;
spx_int32_t quality=-1;
float vbr_quality=-1;
int lsb=1;
ogg_stream_state os;
......@@ -314,20 +315,20 @@ int main(int argc, char **argv)
int id=-1;
SpeexHeader header;
int nframes=1;
int complexity=3;
spx_int32_t complexity=3;
char *vendor_string = "Encoded with Speex " SPEEX_VERSION;
char *comments;
int comments_length;
int close_in=0, close_out=0;
int eos=0;
int bitrate=0;
spx_int32_t bitrate=0;
double cumul_bits=0, enc_frames=0;
char first_bytes[12];
int wave_input=0;
int tmp;
spx_int32_t tmp;
SpeexPreprocessState *preprocess = NULL;
int denoise_enabled=0, agc_enabled=0;
int lookahead = 0;
spx_int32_t lookahead = 0;
comment_init(&comments, &comments_length, vendor_string);
......
......@@ -71,13 +71,13 @@ unsigned short le_short(unsigned short s)
}
int read_wav_header(FILE *file, int *rate, int *channels, int *format, int *size)
int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32_t *size)
{
char ch[5];
int itmp;
short stmp;
int bpersec;
short balign;
spx_int32_t itmp;
spx_int16_t stmp;
spx_int32_t bpersec;
spx_int16_t balign;
int skip_bytes;
int i;
......@@ -221,8 +221,8 @@ int read_wav_header(FILE *file, int *rate, int *channels, int *format, int *size
void write_wav_header(FILE *file, int rate, int channels, int format, int size)
{
char ch[5];
int itmp;
short stmp;
spx_int32_t itmp;
spx_int16_t stmp;
ch[4]=0;
......
......@@ -39,7 +39,7 @@ unsigned short be_short(unsigned short s);
unsigned short le_short(unsigned short s);
spx_uint32_t le_int(spx_uint32_t i);
int read_wav_header(FILE *file, int *rate, int *channels, int *format, int *size);
int read_wav_header(FILE *file, int *rate, int *channels, int *format, spx_int32_t *size);
void write_wav_header(FILE *file, int rate, int channels, int format, int size);
......
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