[FFmpeg-cvslog] r26181 - trunk/libavcodec/ac3enc.c

jbr subversion
Sat Jan 1 00:22:08 CET 2011


Author: jbr
Date: Sat Jan  1 00:22:08 2011
New Revision: 26181

Log:
Skip the bit allocation search if previous and current SNR offsets are the
maximum value of 1023.
This speeds up overall encoding depending on the content and bitrate.
The most improvement is with high bitrates and/or low complexity content.

Modified:
   trunk/libavcodec/ac3enc.c

Modified: trunk/libavcodec/ac3enc.c
==============================================================================
--- trunk/libavcodec/ac3enc.c	Fri Dec 31 23:59:19 2010	(r26180)
+++ trunk/libavcodec/ac3enc.c	Sat Jan  1 00:22:08 2011	(r26181)
@@ -1116,6 +1116,13 @@ static int cbr_bit_allocation(AC3EncodeC
 
     snr_offset = s->coarse_snr_offset << 4;
 
+    /* if previous frame SNR offset was 1023, check if current frame can also
+       use SNR offset of 1023. if so, skip the search. */
+    if ((snr_offset | s->fine_snr_offset[0]) == 1023) {
+        if (bit_alloc(s, 1023) <= bits_left)
+            return 0;
+    }
+
     while (snr_offset >= 0 &&
            bit_alloc(s, snr_offset) > bits_left) {
         snr_offset -= 64;



More information about the ffmpeg-cvslog mailing list