[Ffmpeg-devel] AAC decoder
Mike Melanson
mike
Tue Mar 21 22:02:44 CET 2006
Mike Melanson wrote:
> One question: Is it really necessary to include tables for sine and
> KBD values? I know the sine table can easily be generated at runtime.
> The same probably applies for the KBD values.
I decided to put my code where my mouth is. What follows is a program
to generate the sine tables, and also validates them against the tables
in your aac.h file. This will eliminate the hard-coding of
sine_long_1024[] and sine_short_128[]. I will see if I can figure out an
algorithm for the KBD stuff as well.
--
-Mike Melanson
#include <stdio.h>
#include <math.h>
#include "aac.h"
int main(int argc, char *argv[])
{
int i;
float sine_long[1024];
float sine_short[128];
for (i = 0; i < 1024; i++) {
sine_long[i] = sin((i * 2 + 1) * M_PI / 4096);
if (sine_long[i] - sine_long_1024[i] > 0.0000001)
printf ("%d: calculated = %f, original = %f\n", i,
sine_long[i], sine_long_1024[i]);
}
for (i = 0; i < 128; i++) {
sine_short[i] = sin((i * 2 + 1) * M_PI / 512);
if (sine_short[i] - sine_short_128[i] > 0.0000001)
printf ("%d: calculated = %f, original = %f\n", i,
sine_short[i], sine_short_128[i]);
}
return 0;
}
More information about the ffmpeg-devel
mailing list