For high bitrates where SNR offset is often at max (1023), the bit allocation 
search can essentially be eliminated by starting the search at 1023. Speeds up 
encoding for high bitrates by about 7% overall.
---
 libavcodec/ac3enc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git libavcodec/ac3enc.c libavcodec/ac3enc.c
index e98e3de..26058cf 100644
--- libavcodec/ac3enc.c
+++ libavcodec/ac3enc.c
@@ -701,6 +701,9 @@ static int compute_bit_allocation(AC3EncodeContext *s,
        offset until we can pack everything in the requested frame size */
 
     snr_offset = s->coarse_snr_offset << 4;
+    if ((snr_offset | s->fine_snr_offset[0]) == 1023)
+        snr_offset = 1023;
+
     while (snr_offset >= 0 &&
            bit_alloc(s, mask, psd, bap, frame_bits, snr_offset) < 0)
         snr_offset -= 64;
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to