Commit 262d8702 authored by Justin Ruggles's avatar Justin Ruggles

AC-3 decoder, soc revision 53, Aug 17 08:53:44 2006 UTC by cloud9

Converted the window from double to float.
Now sound produced is as good as sound produced by liba52.

Originally committed as revision 9661 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 67414da7
...@@ -224,10 +224,10 @@ static inline int16_t dither_int16(dither_state *state) ...@@ -224,10 +224,10 @@ static inline int16_t dither_int16(dither_state *state)
* Generate a Kaiser Window. * Generate a Kaiser Window.
*/ */
static void static void
k_window_init(int alpha, double *window, int n, int iter) k_window_init(int alpha, float *window, int n, int iter)
{ {
int j, k; int j, k;
double a, x; float a, x;
a = alpha * M_PI / n; a = alpha * M_PI / n;
a = a*a; a = a*a;
for(k=0; k<n; k++) { for(k=0; k<n; k++) {
...@@ -247,10 +247,10 @@ k_window_init(int alpha, double *window, int n, int iter) ...@@ -247,10 +247,10 @@ k_window_init(int alpha, double *window, int n, int iter)
* @param iter number of iterations to use in BesselI0 * @param iter number of iterations to use in BesselI0
*/ */
static void static void
kbd_window_init(int alpha, double *window, int n, int iter) kbd_window_init(int alpha, float *window, int n, int iter)
{ {
int k, n2; int k, n2;
double *kwindow; float *kwindow;
n2 = n >> 1; n2 = n >> 1;
kwindow = &window[n2]; kwindow = &window[n2];
...@@ -319,7 +319,6 @@ static void generate_quantizers_table_3(int16_t quantizers[], int level, int len ...@@ -319,7 +319,6 @@ static void generate_quantizers_table_3(int16_t quantizers[], int level, int len
static void ac3_tables_init(void) static void ac3_tables_init(void)
{ {
int i, j, k, l, v; int i, j, k, l, v;
float alpha;
/* compute bndtab and masktab from bandsz */ /* compute bndtab and masktab from bandsz */
k = 0; k = 0;
l = 0; l = 0;
...@@ -376,19 +375,6 @@ static void ac3_tables_init(void) ...@@ -376,19 +375,6 @@ static void ac3_tables_init(void)
//for level-15 quantizers //for level-15 quantizers
generate_quantizers_table(l15_quantizers, 15, 15); generate_quantizers_table(l15_quantizers, 15, 15);
/* Twiddle Factors for IMDCT. */
for(i = 0; i < N / 4; i++) {
alpha = 2 * M_PI * (8 * i + 1) / (8 * N);
x_cos1[i] = -cos(alpha);
x_sin1[i] = -sin(alpha);
}
for (i = 0; i < N / 8; i++) {
alpha = 2 * M_PI * (8 * i + 1) / (4 * N);
x_cos2[i] = -cos(alpha);
x_sin2[i] = -sin(alpha);
}
/* Kaiser-Bessel derived window. */ /* Kaiser-Bessel derived window. */
kbd_window_init(5, window, 256, 100); kbd_window_init(5, window, 256, 100);
} }
...@@ -1917,8 +1903,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -1917,8 +1903,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
AC3DecodeContext *ctx = (AC3DecodeContext *)avctx->priv_data; AC3DecodeContext *ctx = (AC3DecodeContext *)avctx->priv_data;
int frame_start; int frame_start;
int16_t *out_samples = (int16_t *)data; int16_t *out_samples = (int16_t *)data;
int i, j, k, value, fs_58; int i, j, k, value;
uint16_t crc1;
av_log(NULL, AV_LOG_INFO, "decoding frame %d buf_size = %d\n", frame_count++, buf_size); av_log(NULL, AV_LOG_INFO, "decoding frame %d buf_size = %d\n", frame_count++, buf_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