fft routines are wrongly prototyped:
void fft_long ( lame_internal_flags* gfc, FLOAT x_real [BLKSIZE ], int, sample_t
** );
void fft_short ( lame_internal_flags* gfc, FLOAT x_real [3] [BLKSIZE_s], int, sample_t
** );
void init_fft ( lame_internal_flags* gfc );
Right is:
void fft_long ( lame_internal_flags* gfc, FLOAT x_real [BLKSIZE ], int, sample_t
[] [2] );
void fft_short ( lame_internal_flags* gfc, FLOAT x_real [3] [BLKSIZE_s], int, sample_t
[] [2] );
void init_fft ( lame_internal_flags* gfc );
or
void fft_long ( lame_internal_flags* gfc, FLOAT x_real [BLKSIZE ], int,
sample_t* [2] );
void fft_short ( lame_internal_flags* gfc, FLOAT x_real [3] [BLKSIZE_s], int,
sample_t* [2] );
void init_fft ( lame_internal_flags* gfc );
which are different from the above. If gfc is not modified, also
void fft_long ( const lame_internal_flags* gfc, FLOAT x_real [BLKSIZE ], int,
sample_t ** );
void fft_short ( const lame_internal_flags* gfc, FLOAT x_real [3] [BLKSIZE_s], int,
sample_t ** );
void init_fft ( lame_internal_flags* gfc );
is right and fine. Also a last remark for today:
There still strange tabs within the source code.
______________________________________________________________________________________________
Examples to store 2D in C (comments are in German):
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define TYP char
#define XRES 128
#define YRES 128
/*************** 2D-Array **************/
/* Eine aufgerufene Funktion */
void foo1 ( TYP (*Array) [XRES], size_t len )
{
size_t i;
size_t j;
int k;
clock_t c = clock ();
for ( k = 0; k < 1000; k++ )
for ( i = 0; i < XRES; i++ )
for ( j = 1; j < len-1; j++ )
Array [j] [i] = Array [j-1] [i] + Array [j+1] [i];
c = clock() - c;
printf ("%.3f µs\n", 1.e6/CLOCKS_PER_SEC/XRES/YRES*c);
}
/* Möglichkeiten, so ein Array zu erzeugen und zu zerstören */
void bar1 ( void )
{
TYP A [YRES] [XRES];
TYP (*B) [XRES] = malloc ( YRES*XRES*sizeof(TYP) );
foo1 (A, YRES);
foo1 (B, YRES);
free (B);
}
/*************** Zeiger-Array **************/
/* Eine aufgerufene Funktion */
void foo2 ( TYP** Array, size_t len )
{
size_t i;
size_t j;
int k;
clock_t c = clock ();
for ( k = 0; k < 1000; k++)
for ( i = 0; i < XRES; i++ )
for ( j = 1; j < len-1; j++ )
Array [j] [i] = Array [j-1] [i] + Array [j+1] [i];
c = clock() - c;
printf ("%.3f µs\n", 1.e6/CLOCKS_PER_SEC/XRES/YRES*c);
}
/* Möglichkeiten, so ein Array zu erzeugen und zu zerstören */
void bar2 ( void )
{
size_t i;
size_t j;
TYP tmp [YRES] [XRES];
TYP* p;
TYP* A [YRES];
TYP** B;
TYP* C [YRES];
TYP* D [YRES];
TYP** E;
TYP** F;
TYP** G;
for ( i=0; i<YRES; i++ )
A [i] = tmp [i];
B = A;
p = malloc (YRES*XRES*sizeof(TYP) );
for ( i = 0; i < YRES; i++, p += XRES )
C [i] = p;
for ( i = 0; i < YRES; i++ )
D [i] = malloc ( XRES*sizeof(TYP) );
E = malloc ( YRES*sizeof(TYP*) );
for ( i = 0; i < YRES; i++ )
E [i] = malloc ( XRES*sizeof(TYP) );
F = malloc ( YRES*sizeof(TYP*) );
p = malloc ( YRES*XRES*sizeof(TYP) );
for ( i = 0; i < YRES; i++, p += XRES )
F [i] = p;
j = YRES * sizeof(TYP*) / sizeof(TYP) + 1;
p = malloc ( j*sizeof(TYP) + YRES*XRES*sizeof(TYP) );
G = (TYP**) p;
p += j;
for ( i = 0; i < YRES; i++, p += XRES )
G [i] = p;
foo2 (A, YRES);
foo2 (B, YRES);
foo2 (C, YRES);
foo2 (D, YRES);
foo2 (E, YRES);
foo2 (F, YRES);
foo2 (G, YRES);
free (*C);
for ( i = 0; i < YRES; i++ )
free ( D[i] );
for ( i = 0; i < YRES; i++ )
free ( E[i] );
free (E);
free (*F);
free (F);
free (G);
}
int main (void)
{
bar1 ();
bar2 ();
return 0;
}
/*
* Für Fortgeschrittene:
* - das ganze mit 3 Dimensionen
* - das ganze mit N Dimensionen
* - das ganze mit allen 'const'-Varianten
* - das ganze mit allen 'const'-Varianten mit 3 Dimensionen
* - das ganze mit allen 'const'-Varianten mit N Dimensionen
*/
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )