diff ac3enc.c @ 4645:056127e5df89 libavcodec

remove redundancy in AC-3 parser by using common tables from ac3tab.h
author jbr
date Sun, 11 Mar 2007 02:13:05 +0000
parents 1e175640dad3
children 3a891d2379ce
line wrap: on
line diff
--- a/ac3enc.c	Sat Mar 10 09:20:07 2007 +0000
+++ b/ac3enc.c	Sun Mar 11 02:13:05 2007 +0000
@@ -611,6 +611,8 @@
 
     avctx->frame_size = AC3_FRAME_SIZE;
 
+    ac3_common_init();
+
     /* number of channels */
     if (channels < 1 || channels > 6)
         return -1;
@@ -644,7 +646,7 @@
         return -1;
     s->bit_rate = bitrate;
     s->frmsizecod = i << 1;
-    s->frame_size_min = (bitrate * 1000 * AC3_FRAME_SIZE) / (freq * 16);
+    s->frame_size_min = ff_ac3_frame_sizes[s->frmsizecod][s->fscod];
     s->bits_written = 0;
     s->samples_written = 0;
     s->frame_size = s->frame_size_min;
@@ -663,8 +665,6 @@
     /* initial snr offset */
     s->csnroffst = 40;
 
-    ac3_common_init();
-
     /* mdct init */
     fft_init(MDCT_NBITS - 2);
     for(i=0;i<N/4;i++) {