[Speex-dev] version 1.0.1 X 1.1.4

Flavio P. Duarte flaviop72 at bol.com.br
Mon Nov 15 09:06:21 PST 2004


Hi,
    I am writing a program that should be able to compile using speex 
version 1.0.1 and speex version 1.1.4, but a I am getting some trouble 
to encode with one version e decode using the other. The program is 
taking care of the change in both speex_encode and speex_decode. The 
sample being coded or decoded has changed from float to short. To test 
it, I have modified the sampleenc.c that came with the documentation. I 
simply removed the for statement that did the conversion from short to 
float. The file encoded with version 1.0.1 differs from the file encoded 
using version 1.1.4. I can encode and decode using the same version, but 
I can not exchange versions. Can someone show me what I am doing wrong ?

encoder 1.0.1:
while( 1 )
{
    /* Read a 16 bits/sample audio frame */
    fread( in, sizeof( short ), FRAME_SIZE, fin );
    if( feof( in ) )
        break;

    /* Copy the 16 bits values to float so Speex can work on them */
    for( i = 0; i < FRAME_SIZE; i++ )
        input[ i ] = in[ i ];

    /* Flush al the bits in the struct so we can encode a new frame */
    speex_bits_reset( &bits );

    /* Encode the frame */
    speex_encode( state, input, &bits );
...


encoder 1.1.4:while( 1 )
{
    /* Read a 16 bits/sample audio frame */
    fread( in, sizeof( short ), FRAME_SIZE, fin );
    if( feof( in ) )
        break;

    /* Flush al the bits in the struct so we can encode a new frame */
    speex_bits_reset( &bits );

    /* Encode the frame */
    speex_encode( state, in, &bits );
...


Flávio


More information about the Speex-dev mailing list