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

jbr subversion
Wed Dec 15 18:28:38 CET 2010


Author: jbr
Date: Wed Dec 15 18:28:38 2010
New Revision: 26017

Log:
Split bit allocation search into a separate function.

Modified:
   trunk/libavcodec/ac3enc.c

Modified: trunk/libavcodec/ac3enc.c
==============================================================================
--- trunk/libavcodec/ac3enc.c	Wed Dec 15 18:16:37 2010	(r26016)
+++ trunk/libavcodec/ac3enc.c	Wed Dec 15 18:28:38 2010	(r26017)
@@ -929,26 +929,15 @@ static int bit_alloc(AC3EncodeContext *s
 
 
 /**
- * Perform bit allocation search.
- * Finds the SNR offset value that maximizes quality and fits in the specified
- * frame size.  Output is the SNR offset and a set of bit allocation pointers
- * used to quantize the mantissas.
+ * Constant bitrate bit allocation search.
+ * Find the largest SNR offset that will allow data to fit in the frame.
  */
-static int compute_bit_allocation(AC3EncodeContext *s)
+static int cbr_bit_allocation(AC3EncodeContext *s)
 {
     int ch;
     int bits_left;
     int snr_offset;
 
-    /* count frame bits other than exponents and mantissas */
-    count_frame_bits(s);
-
-    /* calculate psd and masking curve before doing bit allocation */
-    bit_alloc_masking(s);
-
-    /* now the big work begins : do the bit allocation. Modify the snr
-       offset until we can pack everything in the requested frame size */
-
     bits_left = 8 * s->frame_size - (s->frame_bits + s->exponent_bits);
 
     snr_offset = s->coarse_snr_offset << 4;
@@ -991,6 +980,24 @@ static int compute_bit_allocation(AC3Enc
 
 
 /**
+ * Perform bit allocation search.
+ * Finds the SNR offset value that maximizes quality and fits in the specified
+ * frame size.  Output is the SNR offset and a set of bit allocation pointers
+ * used to quantize the mantissas.
+ */
+static int compute_bit_allocation(AC3EncodeContext *s)
+{
+    /* count frame bits other than exponents and mantissas */
+    count_frame_bits(s);
+
+    /* calculate psd and masking curve before doing bit allocation */
+    bit_alloc_masking(s);
+
+    return cbr_bit_allocation(s);
+}
+
+
+/**
  * Symmetric quantization on 'levels' levels.
  */
 static inline int sym_quant(int c, int e, int levels)



More information about the ffmpeg-cvslog mailing list