Since bit allocation params do not change, set them once at init. Left in 
commented-out line in compute_bit_allocation() for when parameters will be 
modified per-frame.
---
 libavcodec/ac3enc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git libavcodec/ac3enc.c libavcodec/ac3enc.c
index 8346f92..46be2c7 100644
--- libavcodec/ac3enc.c
+++ libavcodec/ac3enc.c
@@ -732,7 +732,9 @@ static int compute_bit_allocation(AC3EncodeContext *s,
     int16_t psd[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][AC3_MAX_COEFS];
     int16_t mask[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][50];
 
-    set_bit_alloc_params(s);
+    /* For now bit alloc params do not change and they have already been set at
+       init. When this changes, uncomment the line below. */
+    //set_bit_alloc_params(s);
 
     frame_bits = count_frame_bits(s, exp_strategy, frame_bits);
 
@@ -869,6 +871,9 @@ static av_cold int AC3_encode_init(AVCodecContext *avctx)
     for (ch = 0; ch < s->channels; ch++)
         s->fast_gain_code[ch] = 4;
 
+    /* for now bit alloc params do not change so set them here to avoid unnecessary calls */
+    set_bit_alloc_params(s);
+
     mdct_init();
 
     for (j = 0; j < 256; j++) {
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to