*/
static void calc_transform_coeffs_cpl(AC3DecodeContext *s)
{
- int i, j, ch, bnd;
-
- i = s->start_freq[CPL_CH];
- for(bnd=0; bnd<s->num_cpl_bands; bnd++) {
- for (j = 0; j < s->cpl_band_sizes[bnd]; j++,i++) {
- for(ch=1; ch<=s->fbw_channels; ch++) {
- if(s->channel_in_cpl[ch]) {
- s->fixed_coeffs[ch][i] = ((int64_t)s->fixed_coeffs[CPL_CH][i] *
- (int64_t)s->cpl_coords[ch][bnd]) >> 23;
- if (ch == 2 && s->phase_flags[bnd])
- s->fixed_coeffs[ch][i] = -s->fixed_coeffs[ch][i];
+ int bin, band, ch;
+
+ bin = s->start_freq[CPL_CH];
+ for (band = 0; band < s->num_cpl_bands; band++) {
+ int band_start = bin;
+ int band_end = bin + s->cpl_band_sizes[band];
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (s->channel_in_cpl[ch]) {
+ int64_t cpl_coord = s->cpl_coords[ch][band];
+ for (bin = band_start; bin < band_end; bin++) {
+ s->fixed_coeffs[ch][bin] = ((int64_t)s->fixed_coeffs[CPL_CH][bin] *
+ cpl_coord) >> 23;
+ }
+ if (ch == 2 && s->phase_flags[band]) {
+ for (bin = band_start; bin < band_end; bin++)
+ s->fixed_coeffs[2][bin] = -s->fixed_coeffs[2][bin];
}
}
}
+ bin = band_end;
}
}
switch(bap){
case 0:
if (dither)
- mantissa = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
+ mantissa = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
else
mantissa = 0;
break;
{
int bnd, i;
int end, bndend;
- int tmp0, tmp1;
end = FFMIN(s->end_freq[1], s->end_freq[2]);
if(s->rematrixing_flags[bnd]) {
bndend = FFMIN(end, ff_ac3_rematrix_band_tab[bnd+1]);
for(i=ff_ac3_rematrix_band_tab[bnd]; i<bndend; i++) {
- tmp0 = s->fixed_coeffs[1][i];
- tmp1 = s->fixed_coeffs[2][i];
- s->fixed_coeffs[1][i] = tmp0 + tmp1;
- s->fixed_coeffs[2][i] = tmp0 - tmp1;
+ int tmp0 = s->fixed_coeffs[1][i];
+ s->fixed_coeffs[1][i] += s->fixed_coeffs[2][i];
+ s->fixed_coeffs[2][i] = tmp0 - s->fixed_coeffs[2][i];
}
}
}
for(bnd=0; bnd<s->num_rematrixing_bands; bnd++)
s->rematrixing_flags[bnd] = get_bits1(gbc);
} else if (!blk) {
- av_log(s->avctx, AV_LOG_ERROR, "new rematrixing strategy must be present in block 0\n");
- return -1;
+ av_log(s->avctx, AV_LOG_WARNING, "Warning: new rematrixing strategy not present in block 0\n");
+ s->num_rematrixing_bands = 0;
}
}
for(ch=1; ch<=s->channels; ch++) {
float gain = s->mul_bias / 4194304.0f;
if(s->channel_mode == AC3_CHMODE_DUALMONO) {
- gain *= s->dynamic_range[ch-1];
+ gain *= s->dynamic_range[2-ch];
} else {
gain *= s->dynamic_range[0];
}