Mercurial > libavcodec.hg
changeset 12306:94e9dcf99f21 libavcodec
Pass FlacSubframe to output_subframe_* instead of channel number.
author | jbr |
---|---|
date | Fri, 30 Jul 2010 20:09:14 +0000 |
parents | 000218dd70aa |
children | a2de400ccd30 |
files | flacenc.c |
diffstat | 1 files changed, 11 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/flacenc.c Fri Jul 30 19:40:18 2010 +0000 +++ b/flacenc.c Fri Jul 30 20:09:14 2010 +0000 @@ -1101,26 +1101,22 @@ } -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_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_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 @@ put_sbits(&s->pb, cbits, sub->coefs[i]); /* residual */ - output_residual(s, ch); + output_residual(s, sub); } @@ -1226,13 +1213,13 @@ /* 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); } }