Browse code

ac3enc: scale floating-point coupling channel coefficients in scale_coefficients() rather than in apply_channel_coupling()

Justin Ruggles authored on 2011/08/08 06:51:13
Showing 2 changed files
... ...
@@ -104,9 +104,10 @@ static int normalize_samples(AC3EncodeContext *s)
104 104
 static void scale_coefficients(AC3EncodeContext *s)
105 105
 {
106 106
     int chan_size = AC3_MAX_COEFS * s->num_blocks;
107
-    s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + chan_size,
108
-                               s->mdct_coef_buffer  + chan_size,
109
-                               chan_size * s->channels);
107
+    int cpl       = s->cpl_on;
108
+    s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + (chan_size * !cpl),
109
+                               s->mdct_coef_buffer  + (chan_size * !cpl),
110
+                               chan_size * (s->channels + cpl));
110 111
 }
111 112
 
112 113
 
... ...
@@ -168,10 +168,6 @@ static void apply_channel_coupling(AC3EncodeContext *s)
168 168
 
169 169
         /* coefficients must be clipped in order to be encoded */
170 170
         clip_coefficients(&s->dsp, cpl_coef, num_cpl_coefs);
171
-
172
-        /* scale coupling coefficients from float to 24-bit fixed-point */
173
-        s->ac3dsp.float_to_fixed24(&block->fixed_coef[CPL_CH][cpl_start],
174
-                                   cpl_coef, num_cpl_coefs);
175 171
     }
176 172
 
177 173
     /* calculate energy in each band in coupling channel and each fbw channel */