|
|
@ -345,7 +345,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce |
|
|
|
float cost_stay_here, cost_get_here; |
|
|
|
float cost_stay_here, cost_get_here; |
|
|
|
float rd = 0.0f; |
|
|
|
float rd = 0.0f; |
|
|
|
for (w = 0; w < group_len; w++) { |
|
|
|
for (w = 0; w < group_len; w++) { |
|
|
|
FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(win+w)*16+swb]; |
|
|
|
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(win+w)*16+swb]; |
|
|
|
rd += quantize_band_cost(s, sce->coeffs + start + w*128, |
|
|
|
rd += quantize_band_cost(s, sce->coeffs + start + w*128, |
|
|
|
s->scoefs + start + w*128, size, |
|
|
|
s->scoefs + start + w*128, size, |
|
|
|
sce->sf_idx[(win+w)*16+swb], cb, |
|
|
|
sce->sf_idx[(win+w)*16+swb], cb, |
|
|
@ -625,7 +625,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, |
|
|
|
qmin = INT_MAX; |
|
|
|
qmin = INT_MAX; |
|
|
|
qmax = 0.0f; |
|
|
|
qmax = 0.0f; |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g]; |
|
|
|
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g]; |
|
|
|
if (band->energy <= band->threshold || band->threshold == 0.0f) { |
|
|
|
if (band->energy <= band->threshold || band->threshold == 0.0f) { |
|
|
|
sce->zeroes[(w+w2)*16+g] = 1; |
|
|
|
sce->zeroes[(w+w2)*16+g] = 1; |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -654,7 +654,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, |
|
|
|
float dist = 0; |
|
|
|
float dist = 0; |
|
|
|
int cb = find_min_book(maxval, sce->sf_idx[w*16+g]); |
|
|
|
int cb = find_min_book(maxval, sce->sf_idx[w*16+g]); |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g]; |
|
|
|
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g]; |
|
|
|
dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g], |
|
|
|
dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g], |
|
|
|
q + q0, cb, lambda / band->threshold, INFINITY, NULL); |
|
|
|
q + q0, cb, lambda / band->threshold, INFINITY, NULL); |
|
|
|
} |
|
|
|
} |
|
|
@ -727,7 +727,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, |
|
|
|
int nz = 0; |
|
|
|
int nz = 0; |
|
|
|
float uplim = 0.0f; |
|
|
|
float uplim = 0.0f; |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g]; |
|
|
|
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g]; |
|
|
|
uplim += band->threshold; |
|
|
|
uplim += band->threshold; |
|
|
|
if (band->energy <= band->threshold || band->threshold == 0.0f) { |
|
|
|
if (band->energy <= band->threshold || band->threshold == 0.0f) { |
|
|
|
sce->zeroes[(w+w2)*16+g] = 1; |
|
|
|
sce->zeroes[(w+w2)*16+g] = 1; |
|
|
@ -1027,7 +1027,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, |
|
|
|
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { |
|
|
|
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { |
|
|
|
for (g = 0; g < sce->ics.num_swb; g++) { |
|
|
|
for (g = 0; g < sce->ics.num_swb; g++) { |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) { |
|
|
|
FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g]; |
|
|
|
FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g]; |
|
|
|
if (band->energy <= band->threshold) { |
|
|
|
if (band->energy <= band->threshold) { |
|
|
|
sce->sf_idx[(w+w2)*16+g] = 218; |
|
|
|
sce->sf_idx[(w+w2)*16+g] = 218; |
|
|
|
sce->zeroes[(w+w2)*16+g] = 1; |
|
|
|
sce->zeroes[(w+w2)*16+g] = 1; |
|
|
@ -1065,8 +1065,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, |
|
|
|
if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) { |
|
|
|
if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) { |
|
|
|
float dist1 = 0.0f, dist2 = 0.0f; |
|
|
|
float dist1 = 0.0f, dist2 = 0.0f; |
|
|
|
for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { |
|
|
|
for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) { |
|
|
|
FFPsyBand *band0 = &s->psy.psy_bands[(s->cur_channel+0)*PSY_MAX_BANDS+(w+w2)*16+g]; |
|
|
|
FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g]; |
|
|
|
FFPsyBand *band1 = &s->psy.psy_bands[(s->cur_channel+1)*PSY_MAX_BANDS+(w+w2)*16+g]; |
|
|
|
FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g]; |
|
|
|
float minthr = FFMIN(band0->threshold, band1->threshold); |
|
|
|
float minthr = FFMIN(band0->threshold, band1->threshold); |
|
|
|
float maxthr = FFMAX(band0->threshold, band1->threshold); |
|
|
|
float maxthr = FFMAX(band0->threshold, band1->threshold); |
|
|
|
for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { |
|
|
|
for (i = 0; i < sce0->ics.swb_sizes[g]; i++) { |
|
|
|