diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2010-07-31 01:32:19 +0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2010-07-31 01:32:19 +0400 |
commit | 520effb9b58098383fd287e8b727a47b0fe3f3dd (patch) | |
tree | ae1c1e0552237169b3f820b2897870cd88f5e313 /libavcodec/flacenc.c | |
parent | fb443a6f3b3397422172df4775535673524a43da (diff) |
Combine output_subframe() and output_subframes().
Originally committed as revision 24611 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r-- | libavcodec/flacenc.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 1d640f9287..9d710c1c20 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1101,13 +1101,23 @@ static void output_frame_header(FlacEncodeContext *s) } -static void output_subframe(FlacEncodeContext *s, FlacSubframe *sub) +static void output_subframes(FlacEncodeContext *s) { + int ch; + + for (ch = 0; ch < s->channels; ch++) { + FlacSubframe *sub = &s->frame.subframes[ch]; int i, p, porder, psize; int32_t *part_end; int32_t *res = sub->residual; int32_t *frame_end = &sub->residual[s->frame.blocksize]; + /* subframe header */ + put_bits(&s->pb, 1, 0); + put_bits(&s->pb, 6, sub->type_code); + put_bits(&s->pb, 1, 0); /* no wasted bits */ + + /* subframe */ if (sub->type == FLAC_SUBFRAME_CONSTANT) { put_sbits(&s->pb, sub->obits, res[0]); } else if (sub->type == FLAC_SUBFRAME_VERBATIM) { @@ -1145,24 +1155,6 @@ static void output_subframe(FlacEncodeContext *s, FlacSubframe *sub) part_end = FFMIN(frame_end, part_end + psize); } } -} - - -static void output_subframes(FlacEncodeContext *s) -{ - FlacSubframe *sub; - int ch; - - for (ch = 0; ch < s->channels; ch++) { - sub = &s->frame.subframes[ch]; - - /* subframe header */ - put_bits(&s->pb, 1, 0); - put_bits(&s->pb, 6, sub->type_code); - put_bits(&s->pb, 1, 0); /* no wasted bits */ - - /* subframe */ - output_subframe(s, sub); } } |