diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2010-07-31 00:28:46 +0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2010-07-31 00:28:46 +0400 |
commit | 175a57113f932dc6ebf13385970d46d22cc8236e (patch) | |
tree | 37c456c11235ab7d61278e9db19d9c0587af7fb7 /libavcodec/flacenc.c | |
parent | 89912b5ff13778527c814b8bcc8a9459d1e8d557 (diff) |
Combine and simplify output_subframe_fixed() and output_subframe_lpc().
Originally committed as revision 24605 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r-- | libavcodec/flacenc.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index ef29548c3f..e7d1921fed 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1147,36 +1147,22 @@ static void output_residual(FlacEncodeContext *s, FlacSubframe *sub) } -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(FlacEncodeContext *s) 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; } } |