History

aacsbr: use a swap index for the Y matrix rather than copy buffers.

Christophe Gisquet committed 14 years ago

Commit cc412b71 parent 63c9de62 files · +20 −14Browse files

Unified · Split

2 files
  1. libavcodec/aacsbr.c +19 −14
  2. libavcodec/sbr.h +1 −0
libavcodec/aacsbr.c+19−14
@@ -1349,8 +1349,8 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr, · 1348 unmodified lines
13491349
13501350 /// Generate the subband filtered lowband
13511351 static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
1352− const float X_low[32][40][2], const float Y[2][38][64][2],
1353− int ch)
1352+ const float Y0[38][64][2], const float Y1[38][64][2],
1353+ const float X_low[32][40][2], int ch)
13541354 {
13551355 int k, i;
13561356 const int i_f = 32;
@@ -1364,8 +1364,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], · 7 unmodified lines
13641364 }
13651365 for (; k < sbr->kx[0] + sbr->m[0]; k++) {
13661366 for (i = 0; i < i_Temp; i++) {
1367− X[0][i][k] = Y[0][i + i_f][k][0];
1368− X[1][i][k] = Y[0][i + i_f][k][1];
1367+ X[0][i][k] = Y0[i + i_f][k][0];
1368+ X[1][i][k] = Y0[i + i_f][k][1];
13691369 }
13701370 }
13711371
@@ -1377,8 +1377,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], · 5 unmodified lines
13771377 }
13781378 for (; k < sbr->kx[1] + sbr->m[1]; k++) {
13791379 for (i = i_Temp; i < i_f; i++) {
1380− X[0][i][k] = Y[1][i][k][0];
1381− X[1][i][k] = Y[1][i][k][1];
1380+ X[0][i][k] = Y1[i][k][0];
1381+ X[1][i][k] = Y1[i][k][1];
13821382 }
13831383 }
13841384 return 0;
@@ -1537,7 +1537,8 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr, · 152 unmodified lines
15371537 }
15381538
15391539 /// Assembling HF Signals (14496-3 sp04 p220)
1540−static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2],
1540+static void sbr_hf_assemble(float Y1[38][64][2],
1541+ const float X_high[64][40][2],
15411542 SpectralBandReplication *sbr, SBRData *ch_data,
15421543 const int e_a[2])
15431544 {
@@ -1559,7 +1560,6 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2] · 15 unmodified lines
15591560 float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp;
15601561 int indexnoise = ch_data->f_indexnoise;
15611562 int indexsine = ch_data->f_indexsine;
1562− memcpy(Y[0], Y[1], sizeof(Y[0]));
15631563
15641564 if (sbr->reset) {
15651565 for (i = 0; i < h_SL; i++) {
@@ -1602,18 +1602,18 @@ static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2] · 36 unmodified lines
16021602 q_filt = q_temp[i];
16031603 }
16041604
1605− sbr->dsp.hf_g_filt(Y[1][i] + kx, X_high + kx, g_filt, m_max,
1605+ sbr->dsp.hf_g_filt(Y1[i] + kx, X_high + kx, g_filt, m_max,
16061606 i + ENVELOPE_ADJUSTMENT_OFFSET);
16071607
16081608 if (e != e_a[0] && e != e_a[1]) {
1609− sbr->dsp.hf_apply_noise[indexsine](Y[1][i] + kx, sbr->s_m[e],
1609+ sbr->dsp.hf_apply_noise[indexsine](Y1[i] + kx, sbr->s_m[e],
16101610 q_filt, indexnoise,
16111611 kx, m_max);
16121612 } else {
16131613 for (m = 0; m < m_max; m++) {
1614− Y[1][i][m + kx][0] +=
1614+ Y1[i][m + kx][0] +=
16151615 sbr->s_m[e][m] * phi[0][indexsine];
1616− Y[1][i][m + kx][1] +=
1616+ Y1[i][m + kx][1] +=
16171617 sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
16181618 phi_sign = -phi_sign;
16191619 }
@@ -1653,12 +1653,17 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, · 33 unmodified lines
16531653 sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
16541654 sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
16551655 sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
1656− sbr_hf_assemble(sbr->data[ch].Y, sbr->X_high, sbr, &sbr->data[ch],
1656+ sbr->data[ch].Ypos ^= 1;
1657+ sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos],
1658+ sbr->X_high, sbr, &sbr->data[ch],
16571659 sbr->data[ch].e_a);
16581660 }
16591661
16601662 /* synthesis */
1661− sbr_x_gen(sbr, sbr->X[ch], sbr->X_low, sbr->data[ch].Y, ch);
1663+ sbr_x_gen(sbr, sbr->X[ch],
1664+ sbr->data[ch].Y[1-sbr->data[ch].Ypos],
1665+ sbr->data[ch].Y[ sbr->data[ch].Ypos],
1666+ sbr->X_low, ch);
16621667 }
16631668
16641669 if (ac->m4ac.ps == 1) {
libavcodec/sbr.h+1−0
@@ -88,6 +88,7 @@ typedef struct { · 87 unmodified lines
8888 ///QMF values of the original signal
8989 float W[2][32][32][2];
9090 ///QMF output of the HF adjustor
91+ int Ypos;
9192 DECLARE_ALIGNED(16, float, Y)[2][38][64][2];
9293 DECLARE_ALIGNED(16, float, g_temp)[42][48];
9394 float q_temp[42][48];

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