diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2010-07-30 20:09:14 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2010-07-30 20:09:14 +0000 |
commit | 1f1c05b09f7321a8cb065e7d38230dadfa61ef9f (patch) | |
tree | e78f59a126cdac3471148c27e9245acf635c6a21 | |
parent | 15f537ed53fe3fa6b59809a1fcb2919fa821cb17 (diff) | |
download | ffmpeg-1f1c05b09f7321a8cb065e7d38230dadfa61ef9f.tar.gz |
Pass FlacSubframe to output_subframe_* instead of channel number.
Originally committed as revision 24603 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/flacenc.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index e5f23b4cd3..773c3448f4 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1101,26 +1101,22 @@ static void output_frame_header(FlacEncodeContext *s) } -static void output_subframe_constant(FlacEncodeContext *s, int ch) +static void output_subframe_constant(FlacEncodeContext *s, FlacSubframe *sub) { - FlacSubframe *sub; int32_t res; - sub = &s->frame.subframes[ch]; res = sub->residual[0]; put_sbits(&s->pb, sub->obits, res); } -static void output_subframe_verbatim(FlacEncodeContext *s, int ch) +static void output_subframe_verbatim(FlacEncodeContext *s, FlacSubframe *sub) { int i; FlacFrame *frame; - FlacSubframe *sub; int32_t res; frame = &s->frame; - sub = &frame->subframes[ch]; for (i = 0; i < frame->blocksize; i++) { res = sub->residual[i]; @@ -1129,16 +1125,14 @@ static void output_subframe_verbatim(FlacEncodeContext *s, int ch) } -static void output_residual(FlacEncodeContext *s, int ch) +static void output_residual(FlacEncodeContext *s, FlacSubframe *sub) { int i, j, p, n, parts; int k, porder, psize, res_cnt; FlacFrame *frame; - FlacSubframe *sub; int32_t *res; frame = &s->frame; - sub = &frame->subframes[ch]; res = sub->residual; n = frame->blocksize; @@ -1165,32 +1159,25 @@ static void output_residual(FlacEncodeContext *s, int ch) } -static void output_subframe_fixed(FlacEncodeContext *s, int ch) +static void output_subframe_fixed(FlacEncodeContext *s, FlacSubframe *sub) { int i; - FlacFrame *frame; - FlacSubframe *sub; - - frame = &s->frame; - sub = &frame->subframes[ch]; /* warm-up samples */ for (i = 0; i < sub->order; i++) put_sbits(&s->pb, sub->obits, sub->residual[i]); /* residual */ - output_residual(s, ch); + output_residual(s, sub); } -static void output_subframe_lpc(FlacEncodeContext *s, int ch) +static void output_subframe_lpc(FlacEncodeContext *s, FlacSubframe *sub) { int i, cbits; FlacFrame *frame; - FlacSubframe *sub; frame = &s->frame; - sub = &frame->subframes[ch]; /* warm-up samples */ for (i = 0; i < sub->order; i++) @@ -1204,7 +1191,7 @@ static void output_subframe_lpc(FlacEncodeContext *s, int ch) put_sbits(&s->pb, cbits, sub->coefs[i]); /* residual */ - output_residual(s, ch); + output_residual(s, sub); } @@ -1226,13 +1213,13 @@ static void output_subframes(FlacEncodeContext *s) /* subframe */ if(sub->type == FLAC_SUBFRAME_CONSTANT) - output_subframe_constant(s, ch); + output_subframe_constant(s, sub); else if(sub->type == FLAC_SUBFRAME_VERBATIM) - output_subframe_verbatim(s, ch); + output_subframe_verbatim(s, sub); else if(sub->type == FLAC_SUBFRAME_FIXED) - output_subframe_fixed(s, ch); + output_subframe_fixed(s, sub); else if(sub->type == FLAC_SUBFRAME_LPC) - output_subframe_lpc(s, ch); + output_subframe_lpc(s, sub); } } |