[FFmpeg-cvslog] r24605 - trunk/libavcodec/flacenc.c

jbr subversion
Fri Jul 30 22:28:46 CEST 2010


Author: jbr
Date: Fri Jul 30 22:28:46 2010
New Revision: 24605

Log:
Combine and simplify output_subframe_fixed() and output_subframe_lpc().

Modified:
   trunk/libavcodec/flacenc.c

Modified: trunk/libavcodec/flacenc.c
==============================================================================
--- trunk/libavcodec/flacenc.c	Fri Jul 30 22:24:15 2010	(r24604)
+++ trunk/libavcodec/flacenc.c	Fri Jul 30 22:28:46 2010	(r24605)
@@ -1147,36 +1147,22 @@ static void output_residual(FlacEncodeCo
 }
 
 
-static void output_subframe_fixed(FlacEncodeContext *s, FlacSubframe *sub)
-{
-    int i;
-
-    /* warm-up samples */
-    for (i = 0; i < sub->order; i++)
-        put_sbits(&s->pb, sub->obits, sub->residual[i]);
-
-    /* residual */
-    output_residual(s, sub);
-}
-
-
 static void output_subframe_lpc(FlacEncodeContext *s, FlacSubframe *sub)
 {
-    int i, cbits;
-    FlacFrame *frame;
-
-    frame = &s->frame;
+    int i;
 
     /* warm-up samples */
     for (i = 0; i < sub->order; i++)
         put_sbits(&s->pb, sub->obits, sub->residual[i]);
 
     /* LPC coefficients */
-    cbits = s->options.lpc_coeff_precision;
+    if (sub->type == FLAC_SUBFRAME_LPC) {
+    int cbits = s->options.lpc_coeff_precision;
     put_bits( &s->pb, 4, cbits-1);
     put_sbits(&s->pb, 5, sub->shift);
     for (i = 0; i < sub->order; i++)
         put_sbits(&s->pb, cbits, sub->coefs[i]);
+    }
 
     /* residual */
     output_residual(s, sub);
@@ -1203,7 +1189,7 @@ static void output_subframes(FlacEncodeC
         switch (sub->type) {
         case FLAC_SUBFRAME_CONSTANT:
         case FLAC_SUBFRAME_VERBATIM: output_subframe_verbatim(s, sub); break;
-        case FLAC_SUBFRAME_FIXED:    output_subframe_fixed(   s, sub); break;
+        case FLAC_SUBFRAME_FIXED:
         case FLAC_SUBFRAME_LPC:      output_subframe_lpc(     s, sub); break;
         }
     }



More information about the ffmpeg-cvslog mailing list