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
345 float cost_stay_here, cost_get_here;345 float cost_stay_here, cost_get_here;
346 float rd = 0.0f;346 float rd = 0.0f;
347 for (w = 0; w < group_len; w++) {347 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];
349 rd += quantize_band_cost(s, sce->coeffs + start + w*128,349 rd += quantize_band_cost(s, sce->coeffs + start + w*128,
350 s->scoefs + start + w*128, size,350 s->scoefs + start + w*128, size,
351 sce->sf_idx[(win+w)*16+swb], cb,351 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
625 qmin = INT_MAX;625 qmin = INT_MAX;
626 qmax = 0.0f;626 qmax = 0.0f;
627 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {627 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];
629 if (band->energy <= band->threshold || band->threshold == 0.0f) {629 if (band->energy <= band->threshold || band->threshold == 0.0f) {
630 sce->zeroes[(w+w2)*16+g] = 1;630 sce->zeroes[(w+w2)*16+g] = 1;
631 continue;631 continue;
@@ -654,7 +654,7 @@ static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, · 22 unmodified lines
654 float dist = 0;654 float dist = 0;
655 int cb = find_min_book(maxval, sce->sf_idx[w*16+g]);655 int cb = find_min_book(maxval, sce->sf_idx[w*16+g]);
656 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {656 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];
658 dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g],658 dist += quantize_band_cost(s, coefs + w2*128, s->scoefs + start + w2*128, sce->ics.swb_sizes[g],
659 q + q0, cb, lambda / band->threshold, INFINITY, NULL);659 q + q0, cb, lambda / band->threshold, INFINITY, NULL);
660 }660 }
@@ -727,7 +727,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 66 unmodified lines
727 int nz = 0;727 int nz = 0;
728 float uplim = 0.0f;728 float uplim = 0.0f;
729 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {729 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];
731 uplim += band->threshold;731 uplim += band->threshold;
732 if (band->energy <= band->threshold || band->threshold == 0.0f) {732 if (band->energy <= band->threshold || band->threshold == 0.0f) {
733 sce->zeroes[(w+w2)*16+g] = 1;733 sce->zeroes[(w+w2)*16+g] = 1;
@@ -1027,7 +1027,7 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, · 293 unmodified lines
1027 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {1027 for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
1028 for (g = 0; g < sce->ics.num_swb; g++) {1028 for (g = 0; g < sce->ics.num_swb; g++) {
1029 for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {1029 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];
1031 if (band->energy <= band->threshold) {1031 if (band->energy <= band->threshold) {
1032 sce->sf_idx[(w+w2)*16+g] = 218;1032 sce->sf_idx[(w+w2)*16+g] = 218;
1033 sce->zeroes[(w+w2)*16+g] = 1;1033 sce->zeroes[(w+w2)*16+g] = 1;
@@ -1065,8 +1065,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, · 31 unmodified lines
1065 if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {1065 if (!cpe->ch[0].zeroes[w*16+g] && !cpe->ch[1].zeroes[w*16+g]) {
1066 float dist1 = 0.0f, dist2 = 0.0f;1066 float dist1 = 0.0f, dist2 = 0.0f;
1067 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {1067 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];1068 FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
1069 FFPsyBand *band1 = &s->psy.psy_bands[(s->cur_channel+1)*PSY_MAX_BANDS+(w+w2)*16+g];1069 FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
1070 float minthr = FFMIN(band0->threshold, band1->threshold);1070 float minthr = FFMIN(band0->threshold, band1->threshold);
1071 float maxthr = FFMAX(band0->threshold, band1->threshold);1071 float maxthr = FFMAX(band0->threshold, band1->threshold);
1072 for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {1072 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