Commit ea134a09 authored by jbr's avatar jbr

Cosmetics: Rename some variables


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20044 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent e9addb3a
...@@ -127,74 +127,71 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, ...@@ -127,74 +127,71 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
int16_t *mask) int16_t *mask)
{ {
int16_t excite[50]; /* excitation */ int16_t excite[50]; /* excitation */
int bin, k; int band;
int bndstrt, bndend, begin, end1, tmp; int band_start, band_end, begin, end1;
int lowcomp, fastleak, slowleak; int lowcomp, fastleak, slowleak;
/* excitation function */ /* excitation function */
bndstrt = bin_to_band_tab[start]; band_start = bin_to_band_tab[start];
bndend = bin_to_band_tab[end-1] + 1; band_end = bin_to_band_tab[end-1] + 1;
if (bndstrt == 0) { if (band_start == 0) {
lowcomp = 0; lowcomp = 0;
lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384);
excite[0] = band_psd[0] - fast_gain - lowcomp; excite[0] = band_psd[0] - fast_gain - lowcomp;
lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384); lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384);
excite[1] = band_psd[1] - fast_gain - lowcomp; excite[1] = band_psd[1] - fast_gain - lowcomp;
begin = 7; begin = 7;
for (bin = 2; bin < 7; bin++) { for (band = 2; band < 7; band++) {
if (!(is_lfe && bin == 6)) if (!(is_lfe && band == 6))
lowcomp = calc_lowcomp1(lowcomp, band_psd[bin], band_psd[bin+1], 384); lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384);
fastleak = band_psd[bin] - fast_gain; fastleak = band_psd[band] - fast_gain;
slowleak = band_psd[bin] - s->slow_gain; slowleak = band_psd[band] - s->slow_gain;
excite[bin] = fastleak - lowcomp; excite[band] = fastleak - lowcomp;
if (!(is_lfe && bin == 6)) { if (!(is_lfe && band == 6)) {
if (band_psd[bin] <= band_psd[bin+1]) { if (band_psd[band] <= band_psd[band+1]) {
begin = bin + 1; begin = band + 1;
break; break;
} }
} }
} }
end1 = FFMIN(bndend, 22); end1 = FFMIN(band_end, 22);
for (band = begin; band < end1; band++) {
for (bin = begin; bin < end1; bin++) { if (!(is_lfe && band == 6))
if (!(is_lfe && bin == 6)) lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band);
lowcomp = calc_lowcomp(lowcomp, band_psd[bin], band_psd[bin+1], bin); fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[bin] - fast_gain); excite[band] = FFMAX(fastleak - lowcomp, slowleak);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[bin] - s->slow_gain);
excite[bin] = FFMAX(fastleak - lowcomp, slowleak);
} }
begin = 22; begin = 22;
} else { } else {
/* coupling channel */ /* coupling channel */
begin = bndstrt; begin = band_start;
fastleak = (s->cpl_fast_leak << 8) + 768; fastleak = (s->cpl_fast_leak << 8) + 768;
slowleak = (s->cpl_slow_leak << 8) + 768; slowleak = (s->cpl_slow_leak << 8) + 768;
} }
for (bin = begin; bin < bndend; bin++) { for (band = begin; band < band_end; band++) {
fastleak = FFMAX(fastleak - s->fast_decay, band_psd[bin] - fast_gain); fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain);
slowleak = FFMAX(slowleak - s->slow_decay, band_psd[bin] - s->slow_gain); slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain);
excite[bin] = FFMAX(fastleak, slowleak); excite[band] = FFMAX(fastleak, slowleak);
} }
/* compute masking curve */ /* compute masking curve */
for (bin = bndstrt; bin < bndend; bin++) { for (band = band_start; band < band_end; band++) {
tmp = s->db_per_bit - band_psd[bin]; int tmp = s->db_per_bit - band_psd[band];
if (tmp > 0) { if (tmp > 0) {
excite[bin] += tmp >> 2; excite[band] += tmp >> 2;
} }
mask[bin] = FFMAX(ff_ac3_hearing_threshold_tab[bin >> s->sr_shift][s->sr_code], excite[bin]); mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]);
} }
/* delta bit allocation */ /* delta bit allocation */
if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) {
int band, seg, delta; int i, seg, delta;
if (dba_nsegs >= 8) if (dba_nsegs >= 8)
return -1; return -1;
band = 0; band = 0;
...@@ -207,9 +204,8 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, ...@@ -207,9 +204,8 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd,
} else { } else {
delta = (dba_values[seg] - 4) << 7; delta = (dba_values[seg] - 4) << 7;
} }
for (k = 0; k < dba_lengths[seg]; k++) { for (i = 0; i < dba_lengths[seg]; i++) {
mask[band] += delta; mask[band++] += delta;
band++;
} }
} }
} }
......
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