Displaying 6 results from an estimated 6 matches for "spx_state_".
2010 Apr 13
1
Another newbie question on encoding
...xCodecMode
{
SC_NARROWBAND, // 8 kHz
SC_WIDEBAND, // 16 kHz
SC_ULTRAWIDEBAND // 32 kHz
};
CSpeexCodec();
~CSpeexCodec();
BOOL Init();
UINT Encode( sample_type *inBuff, char **outBuff, UINT BufferFrames );
private:
SpeexBits spx_bits_;
void* spx_state_;
UINT spx_quality_;
UINT frameSize_;
char* outBuffer_;
};
BOOL CSpeexCodec::Init()
{
spx_state_ = speex_encoder_init(&speex_nb_mode);
speex_encoder_ctl(spx_state_, SPEEX_GET_FRAME_SIZE, &frameSize_);
// Create the output buffer
outBuffer_ = ne...
2010 Apr 14
3
Decoded output buffer size
...udio buffer (8000 kHz, MONO, float) of 640 PCM
frames.
In output I have 4 speex frame of 20 byte each that I put in a RPT
payload of 80 bytes:
UINT CSpeexCodec::Encode( float *inBuff,
const char**outBuff,
UINT BufferFrames )
{
speex_encoder_ctl(spx_state_,
SPEEX_GET_FRAME_SIZE,
&spx_frame_size_);
while (BufferFrames>0)
{
speex_bits_reset(&spx_bits_);
speex_encode(spx_state_, inBuff, &spx_bits_);
nbBytes += speex_bits_write(&spx_bits_,
spx_enc_...
2010 Apr 15
2
Decoded output buffer size
..., but after some cycles it returns
always 4.
UINT DecodePayload( char* payload, UINT payload_len )
{
speex_bits_reset(&spx_bits_);
speex_bits_read_from(&spx_bits_, payload, payload_len);
UINT nbBytes = speex_bits_remaining(&spx_bits_);
while (nbBytes>0)
{
speex_decode(spx_state_, &spx_bits_, spx_dec_frame_);
nbBytes = speex_bits_remaining(&spx_bits_);
// Save the speex frame into the buffer
DecOutBuffer_.Write(spx_dec_frame_, spx_frame_size_);
}
}
Any suggestion?
Thanks,
Daniele.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
iEYEA...
2010 Apr 14
2
Decoded output buffer size
Hi,
in a VoIP application, the endpoint A send speex payload to B.
B doesn't know how A acquire audio, it only know that the channel is
narrowband so, how can B know the size of the output buffer to pass to
the speex_decode()?
Thanks,
Daniele.
2010 Apr 14
0
Decoded output buffer size
...0 PCM
> frames.
> In output I have 4 speex frame of 20 byte each that I put in a RPT
> payload of 80 bytes:
>
> UINT CSpeexCodec::Encode( float *inBuff,
> ? ? ? ? ? ? ? ? ? ? ? ? ?const char**outBuff,
> ? ? ? ? ? ? ? ? ? ? ? ? ?UINT BufferFrames )
> {
> ?speex_encoder_ctl(spx_state_,
> ? ? ? ? ? ? ? ? ? ?SPEEX_GET_FRAME_SIZE,
> ? ? ? ? ? ? ? ? ? ?&spx_frame_size_);
>
> ?while (BufferFrames>0)
> ?{
> ? ?speex_bits_reset(&spx_bits_);
> ? ?speex_encode(spx_state_, inBuff, &spx_bits_);
> ? ?nbBytes += speex_bits_write(&spx_bits_,
> ? ?...
2010 Apr 15
0
Decoded output buffer size
...4.
>
> UINT DecodePayload( char* payload, UINT payload_len )
> {
> ?speex_bits_reset(&spx_bits_);
> ?speex_bits_read_from(&spx_bits_, payload, payload_len);
> ?UINT nbBytes = speex_bits_remaining(&spx_bits_);
>
> ?while (nbBytes>0)
> ?{
> ? ?speex_decode(spx_state_, &spx_bits_, spx_dec_frame_);
> ? ?nbBytes = speex_bits_remaining(&spx_bits_);
>
> ? ?// Save the speex frame into the buffer
> ? ?DecOutBuffer_.Write(spx_dec_frame_, spx_frame_size_);
> ?}
> }
>
> Any suggestion?
I think speex_decode() updates the number of bits re...