Convert floating-point MDCT coefficients to 24-bit fixed-point all at once
[ffmpeg.git] / libavcodec / ac3enc_float.c
index 82d806bc06f313f096d9ef498e2f10ddd1c920d4..f3246362e796c835ff09aa520a7814fe26d9a702 100644 (file)
@@ -102,6 +102,17 @@ static int normalize_samples(AC3EncodeContext *s)
 }
 
 
+/**
+ * Scale MDCT coefficients from float to 24-bit fixed-point.
+ */
+static void scale_coefficients(AC3EncodeContext *s)
+{
+    int i;
+    for (i = 0; i < AC3_MAX_COEFS * AC3_MAX_BLOCKS * s->channels; i++)
+        s->fixed_coef_buffer[i] = SCALE_FLOAT(s->mdct_coef_buffer[i], 24);
+}
+
+
 AVCodec ac3_encoder = {
     "ac3",
     AVMEDIA_TYPE_AUDIO,