History

psymodel: Add channels and channel groups to the psymodel.

Nathan Caldwell committed 15 years ago

Commit 0bc01cc1 parent a3e1f805 files · +91 −25Browse files

Showing the changes to libavcodec/aaccoder.c (1 of 5 files). Show all

Unified · Split

libavcodec/aaccoder.c+7−7
@@ -345,7 +345,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce · 344 unmodified lines
345345 float cost_stay_here, cost_get_here;
346346 float rd = 0.0f;
347347 for (w = 0; w < group_len; w++) {
348− FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(win+w)*16+swb];
348+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(win+w)*16+swb];
349349 rd += quantize_band_cost(s, sce->coeffs + start + w*128,
350350 s->scoefs + start + w*128, size,
351351 sce->sf_idx[(win+w)*16+swb], cb,
@@ -625,7 +625,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 273 unmodified lines
625625 qmin = INT_MAX;
626626 qmax = 0.0f;
627627 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
628− FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
628+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
629629 if (band->energy <= band->threshold || band->threshold == 0.0f) {
630630 sce->zeroes[(w+w2)*16+g] = 1;
631631 continue;
@@ -654,7 +654,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 22 unmodified lines
654654 float dist = 0;
655655 int cb = find_min_book(maxval, sce->sf_idx[w*16+g]);
656656 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
657− FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
657+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
658658 dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g],
659659 q + q0, cb, lambda / band->threshold, INFINITY, NULL);
660660 }
@@ -727,7 +727,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 66 unmodified lines
727727 int nz = 0;
728728 float uplim = 0.0f;
729729 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
730− FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
730+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
731731 uplim += band->threshold;
732732 if (band->energy <= band->threshold || band->threshold == 0.0f) {
733733 sce->zeroes[(w+w2)*16+g] = 1;
@@ -1027,7 +1027,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, · 293 unmodified lines
10271027 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
10281028 for (g = 0; g < sce->ics.num_swb; g++) {
10291029 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
1030− FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
1030+ FFPsyBand *band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
10311031 if (band->energy <= band->threshold) {
10321032 sce->sf_idx[(w+w2)*16+g] = 218;
10331033 sce->zeroes[(w+w2)*16+g] = 1;
@@ -1065,8 +1065,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, · 31 unmodified lines
10651065 if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {
10661066 float dist1 = 0.0f, dist2 = 0.0f;
10671067 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
1068− FFPsyBand *band0 = &s->psy.psy_bands[(s->cur_channel+0)*PSY_MAX_BANDS+(w+w2)*16+g];
1069− FFPsyBand *band1 = &s->psy.psy_bands[(s->cur_channel+1)*PSY_MAX_BANDS+(w+w2)*16+g];
1068+ FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
1069+ FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
10701070 float minthr = FFMIN(band0->threshold, band1->threshold);
10711071 float maxthr = FFMAX(band0->threshold, band1->threshold);
10721072 for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t