Commit eaf84d97 authored by Justin Ruggles's avatar Justin Ruggles

cosmetics: use braces when it makes the code easier to read.

Originally committed as revision 9893 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent fc59010b
...@@ -572,8 +572,9 @@ static int get_transform_coeffs(AC3DecodeContext * ctx) ...@@ -572,8 +572,9 @@ static int get_transform_coeffs(AC3DecodeContext * ctx)
got_cplchan = 1; got_cplchan = 1;
} }
end = ctx->cplendmant; end = ctx->cplendmant;
} else } else {
end = ctx->endmant[i]; end = ctx->endmant[i];
}
do do
ctx->transform_coeffs[i + 1][end] = 0; ctx->transform_coeffs[i + 1][end] = 0;
while(++end < 256); while(++end < 256);
...@@ -673,13 +674,13 @@ static inline void do_imdct(AC3DecodeContext *ctx) ...@@ -673,13 +674,13 @@ static inline void do_imdct(AC3DecodeContext *ctx)
ctx->window, 256); ctx->window, 256);
} }
for (ch=1; ch<=ctx->nfchans; ch++) { for (ch=1; ch<=ctx->nfchans; ch++) {
if (ctx->blksw[ch-1]) if (ctx->blksw[ch-1]) {
do_imdct_256(ctx, ch); do_imdct_256(ctx, ch);
else } else {
ctx->imdct_512.fft.imdct_calc(&ctx->imdct_512, ctx->tmp_output, ctx->imdct_512.fft.imdct_calc(&ctx->imdct_512, ctx->tmp_output,
ctx->transform_coeffs[ch], ctx->transform_coeffs[ch],
ctx->tmp_imdct); ctx->tmp_imdct);
}
ctx->dsp.vector_fmul_add_add(ctx->output[ch], ctx->tmp_output, ctx->dsp.vector_fmul_add_add(ctx->output[ch], ctx->tmp_output,
ctx->window, ctx->delay[ch], 384, 256, 1); ctx->window, ctx->delay[ch], 384, 256, 1);
ctx->dsp.vector_fmul_reverse(ctx->delay[ch], ctx->tmp_output+256, ctx->dsp.vector_fmul_reverse(ctx->delay[ch], ctx->tmp_output+256,
...@@ -749,11 +750,12 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -749,11 +750,12 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
ctx->ncplbnd = ctx->ncplsubnd = 3 + cplendf - cplbegf; ctx->ncplbnd = ctx->ncplsubnd = 3 + cplendf - cplbegf;
ctx->cplstrtmant = cplbegf * 12 + 37; ctx->cplstrtmant = cplbegf * 12 + 37;
ctx->cplendmant = cplendf * 12 + 73; ctx->cplendmant = cplendf * 12 + 73;
for (i = 0; i < ctx->ncplsubnd - 1; i++) /* coupling band structure */ for (i = 0; i < ctx->ncplsubnd - 1; i++) { /* coupling band structure */
if (get_bits1(gb)) { if (get_bits1(gb)) {
ctx->cplbndstrc[i] = 1; ctx->cplbndstrc[i] = 1;
ctx->ncplbnd--; ctx->ncplbnd--;
} }
}
} else { } else {
for (i = 0; i < nfchans; i++) for (i = 0; i < nfchans; i++)
ctx->chincpl[i] = 0; ctx->chincpl[i] = 0;
...@@ -763,8 +765,8 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -763,8 +765,8 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
if (ctx->cplinu) { if (ctx->cplinu) {
int cplcoe = 0; int cplcoe = 0;
for (i = 0; i < nfchans; i++) for (i = 0; i < nfchans; i++) {
if (ctx->chincpl[i]) if (ctx->chincpl[i]) {
if (get_bits1(gb)) { /* coupling co-ordinates */ if (get_bits1(gb)) { /* coupling co-ordinates */
cplcoe = 1; cplcoe = 1;
mstrcplco = 3 * get_bits(gb, 2); mstrcplco = 3 * get_bits(gb, 2);
...@@ -778,11 +780,15 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -778,11 +780,15 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
ctx->cplco[i][bnd] *= scale_factors[cplcoexp + mstrcplco]; ctx->cplco[i][bnd] *= scale_factors[cplcoexp + mstrcplco];
} }
} }
}
}
if (acmod == AC3_ACMOD_STEREO && ctx->phsflginu && cplcoe) if (acmod == AC3_ACMOD_STEREO && ctx->phsflginu && cplcoe) {
for (bnd = 0; bnd < ctx->ncplbnd; bnd++) for (bnd = 0; bnd < ctx->ncplbnd; bnd++) {
if (get_bits1(gb)) if (get_bits1(gb))
ctx->cplco[1][bnd] = -ctx->cplco[1][bnd]; ctx->cplco[1][bnd] = -ctx->cplco[1][bnd];
}
}
} }
if (acmod == AC3_ACMOD_STEREO) {/* rematrixing */ if (acmod == AC3_ACMOD_STEREO) {/* rematrixing */
...@@ -805,7 +811,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -805,7 +811,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
if (ctx->lfeon) /* lfe exponent strategy */ if (ctx->lfeon) /* lfe exponent strategy */
ctx->lfeexpstr = get_bits1(gb); ctx->lfeexpstr = get_bits1(gb);
for (i = 0; i < nfchans; i++) /* channel bandwidth code */ for (i = 0; i < nfchans; i++) { /* channel bandwidth code */
if (ctx->chexpstr[i] != EXP_REUSE) { if (ctx->chexpstr[i] != EXP_REUSE) {
if (ctx->chincpl[i]) if (ctx->chincpl[i])
ctx->endmant[i] = ctx->cplstrtmant; ctx->endmant[i] = ctx->cplstrtmant;
...@@ -818,6 +824,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -818,6 +824,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
ctx->endmant[i] = chbwcod * 3 + 73; ctx->endmant[i] = chbwcod * 3 + 73;
} }
} }
}
if (ctx->cplexpstr != EXP_REUSE) {/* coupling exponents */ if (ctx->cplexpstr != EXP_REUSE) {/* coupling exponents */
bit_alloc_flags = 64; bit_alloc_flags = 64;
...@@ -826,7 +833,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -826,7 +833,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
decode_exponents(gb, ctx->cplexpstr, ngrps, cplabsexp, ctx->dcplexps + ctx->cplstrtmant); decode_exponents(gb, ctx->cplexpstr, ngrps, cplabsexp, ctx->dcplexps + ctx->cplstrtmant);
} }
for (i = 0; i < nfchans; i++) /* fbw channel exponents */ for (i = 0; i < nfchans; i++) { /* fbw channel exponents */
if (ctx->chexpstr[i] != EXP_REUSE) { if (ctx->chexpstr[i] != EXP_REUSE) {
bit_alloc_flags |= 1 << i; bit_alloc_flags |= 1 << i;
grpsize = 3 << (ctx->chexpstr[i] - 1); grpsize = 3 << (ctx->chexpstr[i] - 1);
...@@ -836,6 +843,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -836,6 +843,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
decode_exponents(gb, ctx->chexpstr[i], ngrps, dexps[0], dexps + 1); decode_exponents(gb, ctx->chexpstr[i], ngrps, dexps[0], dexps + 1);
skip_bits(gb, 2); /* skip gainrng */ skip_bits(gb, 2); /* skip gainrng */
} }
}
if (ctx->lfeexpstr != EXP_REUSE) { /* lfe exponents */ if (ctx->lfeexpstr != EXP_REUSE) { /* lfe exponents */
bit_alloc_flags |= 32; bit_alloc_flags |= 32;
...@@ -895,7 +903,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -895,7 +903,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
} }
} }
if (ctx->cplinu) if (ctx->cplinu) {
if (ctx->cpldeltbae == DBA_NEW) { /*coupling delta offset, len and bit allocation */ if (ctx->cpldeltbae == DBA_NEW) { /*coupling delta offset, len and bit allocation */
ctx->cpldeltnseg = get_bits(gb, 3); ctx->cpldeltnseg = get_bits(gb, 3);
for (seg = 0; seg <= ctx->cpldeltnseg; seg++) { for (seg = 0; seg <= ctx->cpldeltnseg; seg++) {
...@@ -904,8 +912,9 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -904,8 +912,9 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
ctx->cpldeltba[seg] = get_bits(gb, 3); ctx->cpldeltba[seg] = get_bits(gb, 3);
} }
} }
}
for (i = 0; i < nfchans; i++) for (i = 0; i < nfchans; i++) {
if (ctx->deltbae[i] == DBA_NEW) {/*channel delta offset, len and bit allocation */ if (ctx->deltbae[i] == DBA_NEW) {/*channel delta offset, len and bit allocation */
ctx->deltnseg[i] = get_bits(gb, 3); ctx->deltnseg[i] = get_bits(gb, 3);
for (seg = 0; seg <= ctx->deltnseg[i]; seg++) { for (seg = 0; seg <= ctx->deltnseg[i]; seg++) {
...@@ -914,6 +923,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -914,6 +923,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
ctx->deltba[i][seg] = get_bits(gb, 3); ctx->deltba[i][seg] = get_bits(gb, 3);
} }
} }
}
} else if(blk == 0) { } else if(blk == 0) {
if(ctx->cplinu) if(ctx->cplinu)
ctx->cpldeltbae = DBA_NONE; ctx->cpldeltbae = DBA_NONE;
...@@ -923,7 +933,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -923,7 +933,7 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
} }
if (bit_alloc_flags) { if (bit_alloc_flags) {
if (ctx->cplinu && (bit_alloc_flags & 64)) if (ctx->cplinu && (bit_alloc_flags & 64)) {
ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ctx->cplbap, ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ctx->cplbap,
ctx->dcplexps, ctx->cplstrtmant, ctx->dcplexps, ctx->cplstrtmant,
ctx->cplendmant, ctx->cplsnroffst, ctx->cplendmant, ctx->cplsnroffst,
...@@ -931,19 +941,23 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk) ...@@ -931,19 +941,23 @@ static int ac3_parse_audio_block(AC3DecodeContext *ctx, int blk)
ctx->cpldeltbae, ctx->cpldeltnseg, ctx->cpldeltbae, ctx->cpldeltnseg,
ctx->cpldeltoffst, ctx->cpldeltlen, ctx->cpldeltoffst, ctx->cpldeltlen,
ctx->cpldeltba); ctx->cpldeltba);
for (i = 0; i < nfchans; i++) }
if ((bit_alloc_flags >> i) & 1) for (i = 0; i < nfchans; i++) {
if ((bit_alloc_flags >> i) & 1) {
ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ac3_parametric_bit_allocation(&ctx->bit_alloc_params,
ctx->bap[i], ctx->dexps[i], 0, ctx->bap[i], ctx->dexps[i], 0,
ctx->endmant[i], ctx->snroffst[i], ctx->endmant[i], ctx->snroffst[i],
ctx->fgain[i], 0, ctx->deltbae[i], ctx->fgain[i], 0, ctx->deltbae[i],
ctx->deltnseg[i], ctx->deltoffst[i], ctx->deltnseg[i], ctx->deltoffst[i],
ctx->deltlen[i], ctx->deltba[i]); ctx->deltlen[i], ctx->deltba[i]);
if (ctx->lfeon && (bit_alloc_flags & 32)) }
}
if (ctx->lfeon && (bit_alloc_flags & 32)) {
ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ctx->lfebap, ac3_parametric_bit_allocation(&ctx->bit_alloc_params, ctx->lfebap,
ctx->dlfeexps, 0, 7, ctx->lfesnroffst, ctx->dlfeexps, 0, 7, ctx->lfesnroffst,
ctx->lfefgain, 1, ctx->lfefgain, 1,
DBA_NONE, 0, NULL, NULL, NULL); DBA_NONE, 0, NULL, NULL, NULL);
}
} }
if (get_bits1(gb)) { /* unused dummy data */ if (get_bits1(gb)) { /* unused dummy data */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment