| @@ -1349,8 +1349,8 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr, · 1348 unmodified lines |
| 1349 | 1349 | |
| 1350 | 1350 | /// Generate the subband filtered lowband |
| 1351 | 1351 | 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) |
| 1354 | 1354 | { |
| 1355 | 1355 | int k, i; |
| 1356 | 1356 | const int i_f = 32; |
| @@ -1364,8 +1364,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], · 7 unmodified lines |
| 1364 | 1364 | } |
| 1365 | 1365 | for (; k < sbr->kx[0] + sbr->m[0]; k++) { |
| 1366 | 1366 | 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]; |
| 1369 | 1369 | } |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| @@ -1377,8 +1377,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], · 5 unmodified lines |
| 1377 | 1377 | } |
| 1378 | 1378 | for (; k < sbr->kx[1] + sbr->m[1]; k++) { |
| 1379 | 1379 | 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]; |
| 1382 | 1382 | } |
| 1383 | 1383 | } |
| 1384 | 1384 | return 0; |
| @@ -1537,7 +1537,8 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr, · 152 unmodified lines |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | /// 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], |
| 1541 | 1542 | SpectralBandReplication *sbr, SBRData *ch_data, |
| 1542 | 1543 | const int e_a[2]) |
| 1543 | 1544 | { |
| @@ -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 |
| 1559 | 1560 | float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp; |
| 1560 | 1561 | int indexnoise = ch_data->f_indexnoise; |
| 1561 | 1562 | int indexsine = ch_data->f_indexsine; |
| 1562 | | − memcpy(Y[0], Y[1], sizeof(Y[0])); |
| 1563 | 1563 | |
| 1564 | 1564 | if (sbr->reset) { |
| 1565 | 1565 | 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 |
| 1602 | 1602 | q_filt = q_temp[i]; |
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 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, |
| 1606 | 1606 | i + ENVELOPE_ADJUSTMENT_OFFSET); |
| 1607 | 1607 | |
| 1608 | 1608 | 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], |
| 1610 | 1610 | q_filt, indexnoise, |
| 1611 | 1611 | kx, m_max); |
| 1612 | 1612 | } else { |
| 1613 | 1613 | for (m = 0; m < m_max; m++) { |
| 1614 | | − Y[1][i][m + kx][0] += |
| 1614 | + Y1[i][m + kx][0] += |
| 1615 | 1615 | sbr->s_m[e][m] * phi[0][indexsine]; |
| 1616 | | − Y[1][i][m + kx][1] += |
| 1616 | + Y1[i][m + kx][1] += |
| 1617 | 1617 | sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign); |
| 1618 | 1618 | phi_sign = -phi_sign; |
| 1619 | 1619 | } |
| @@ -1653,12 +1653,17 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, · 33 unmodified lines |
| 1653 | 1653 | sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a); |
| 1654 | 1654 | sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]); |
| 1655 | 1655 | 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], |
| 1657 | 1659 | sbr->data[ch].e_a); |
| 1658 | 1660 | } |
| 1659 | 1661 | |
| 1660 | 1662 | /* 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); |
| 1662 | 1667 | } |
| 1663 | 1668 | |
| 1664 | 1669 | if (ac->m4ac.ps == 1) { |