History

aacdec: template mid/side stereo application separately

Lynne committed 2 years ago

Commit 9f3fa771 parent a6295582 files · +36 −35Browse files

Unified · Split

2 files
  1. libavcodec/aac/aacdec_dsp_template.c +35 −0
  2. libavcodec/aacdec_template.c +1 −35
libavcodec/aac/aacdec_dsp_template.c+35−0
@@ -88,6 +88,41 @@ static void AAC_RENAME(dequant_scalefactors)(SingleChannelElement *sce) · 87 unmodified lines
88 }88 }
89}89}
90 90
91/**
92 * Mid/Side stereo decoding; reference: 4.6.8.1.3.
93 */
94static void AAC_RENAME(apply_mid_side_stereo)(AACDecContext *ac, ChannelElement *cpe)
95{
96 const IndividualChannelStream *ics = &cpe->ch[0].ics;
97 INTFLOAT *ch0 = cpe->ch[0].AAC_RENAME(coeffs);
98 INTFLOAT *ch1 = cpe->ch[1].AAC_RENAME(coeffs);
99 int g, i, group, idx = 0;
100 const uint16_t *offsets = ics->swb_offset;
101 for (g = 0; g < ics->num_window_groups; g++) {
102 for (i = 0; i < ics->max_sfb; i++, idx++) {
103 if (cpe->ms_mask[idx] &&
104 cpe->ch[0].band_type[idx] < NOISE_BT &&
105 cpe->ch[1].band_type[idx] < NOISE_BT) {
106#if USE_FIXED
107 for (group = 0; group < ics->group_len[g]; group++) {
108 ac->fdsp->butterflies_fixed(ch0 + group * 128 + offsets[i],
109 ch1 + group * 128 + offsets[i],
110 offsets[i+1] - offsets[i]);
111#else
112 for (group = 0; group < ics->group_len[g]; group++) {
113 ac->fdsp->butterflies_float(ch0 + group * 128 + offsets[i],
114 ch1 + group * 128 + offsets[i],
115 offsets[i+1] - offsets[i]);
116#endif /* USE_FIXED */
117 }
118 }
119 }
120 ch0 += ics->group_len[g] * 128;
121 ch1 += ics->group_len[g] * 128;
122 }
123}
124
91const AACDecDSP AAC_RENAME(aac_dsp) = {125const AACDecDSP AAC_RENAME(aac_dsp) = {
92 .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),126 .dequant_scalefactors = &AAC_RENAME(dequant_scalefactors),
127 .apply_mid_side_stereo = &AAC_RENAME(apply_mid_side_stereo),
93};128};
libavcodec/aacdec_template.c+1−35
@@ -2062,40 +2062,6 @@ fail: · 2061 unmodified lines
2062 return ret;2062 return ret;
2063}2063}
2064 2064
2065/**
2066 * Mid/Side stereo decoding; reference: 4.6.8.1.3.
2067 */
2068static void apply_mid_side_stereo(AACDecContext *ac, ChannelElement *cpe)
2069{
2070 const IndividualChannelStream *ics = &cpe->ch[0].ics;
2071 INTFLOAT *ch0 = cpe->ch[0].AAC_RENAME(coeffs);
2072 INTFLOAT *ch1 = cpe->ch[1].AAC_RENAME(coeffs);
2073 int g, i, group, idx = 0;
2074 const uint16_t *offsets = ics->swb_offset;
2075 for (g = 0; g < ics->num_window_groups; g++) {
2076 for (i = 0; i < ics->max_sfb; i++, idx++) {
2077 if (cpe->ms_mask[idx] &&
2078 cpe->ch[0].band_type[idx] < NOISE_BT &&
2079 cpe->ch[1].band_type[idx] < NOISE_BT) {
2080#if USE_FIXED
2081 for (group = 0; group < ics->group_len[g]; group++) {
2082 ac->fdsp->butterflies_fixed(ch0 + group * 128 + offsets[i],
2083 ch1 + group * 128 + offsets[i],
2084 offsets[i+1] - offsets[i]);
2085#else
2086 for (group = 0; group < ics->group_len[g]; group++) {
2087 ac->fdsp->butterflies_float(ch0 + group * 128 + offsets[i],
2088 ch1 + group * 128 + offsets[i],
2089 offsets[i+1] - offsets[i]);
2090#endif /* USE_FIXED */
2091 }
2092 }
2093 }
2094 ch0 += ics->group_len[g] * 128;
2095 ch1 += ics->group_len[g] * 128;
2096 }
2097}
2098
2099/**2065/**
2100 * intensity stereo decoding; reference: 4.6.8.2.32066 * intensity stereo decoding; reference: 4.6.8.2.3
2101 *2067 *
@@ -2183,7 +2149,7 @@ static int decode_cpe(AACDecContext *ac, GetBitContext *gb, ChannelElement *cpe) · 81 unmodified lines
2183 2149
2184 if (common_window) {2150 if (common_window) {
2185 if (ms_present)2151 if (ms_present)
2186 apply_mid_side_stereo(ac, cpe);2152 ac->dsp.apply_mid_side_stereo(ac, cpe);
2187 if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {2153 if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) {
2188 apply_prediction(ac, &cpe->ch[0]);2154 apply_prediction(ac, &cpe->ch[0]);
2189 apply_prediction(ac, &cpe->ch[1]);2155 apply_prediction(ac, &cpe->ch[1]);

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