diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-09-13 21:23:32 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-09-13 21:23:32 +0000 |
commit | f24e130017b1bac8b99134f597cfa5549273a0e9 (patch) | |
tree | 8e0236d4142ab75585550906c15360316524a8b2 | |
parent | ddb936a0c5a2a795703d2e4831c0d30124dcef3e (diff) | |
download | rockbox-f24e130017b1bac8b99134f597cfa5549273a0e9.tar.gz rockbox-f24e130017b1bac8b99134f597cfa5549273a0e9.zip |
Further libfaad cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28070 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/libfaad/sbr_hfadj.c | 69 | ||||
-rw-r--r-- | apps/codecs/libfaad/sbr_hfgen.c | 4 |
2 files changed, 15 insertions, 58 deletions
diff --git a/apps/codecs/libfaad/sbr_hfadj.c b/apps/codecs/libfaad/sbr_hfadj.c index 29e12cd6c8..ab712dcd45 100644 --- a/apps/codecs/libfaad/sbr_hfadj.c +++ b/apps/codecs/libfaad/sbr_hfadj.c | |||
@@ -37,6 +37,11 @@ | |||
37 | 37 | ||
38 | #include "sbr_noise.h" | 38 | #include "sbr_noise.h" |
39 | 39 | ||
40 | #ifdef FIXED_POINT | ||
41 | #define REAL_SCALE(A) ((A)<<REAL_BITS) | ||
42 | #else | ||
43 | #define REAL_SCALE(A) (A) | ||
44 | #endif | ||
40 | 45 | ||
41 | /* static function declarations */ | 46 | /* static function declarations */ |
42 | static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, | 47 | static void estimate_current_envelope(sbr_info *sbr, sbr_hfadj_info *adj, |
@@ -1555,8 +1560,6 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, | |||
1555 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) | 1560 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) |
1556 | + MUL_F(Q_filt, RE(V[fIndexNoise])); | 1561 | + MUL_F(Q_filt, RE(V[fIndexNoise])); |
1557 | #else | 1562 | #else |
1558 | //QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) | ||
1559 | // + MUL_F(Q_filt, RE(V[fIndexNoise])); | ||
1560 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) | 1563 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) |
1561 | + MUL_F(Q_filt, RE(V[fIndexNoise])); | 1564 | + MUL_F(Q_filt, RE(V[fIndexNoise])); |
1562 | #endif | 1565 | #endif |
@@ -1567,8 +1570,6 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, | |||
1567 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) | 1570 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = G_filt * QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) |
1568 | + MUL_F(Q_filt, IM(V[fIndexNoise])); | 1571 | + MUL_F(Q_filt, IM(V[fIndexNoise])); |
1569 | #else | 1572 | #else |
1570 | //QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_Q2(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) | ||
1571 | // + MUL_F(Q_filt, IM(V[fIndexNoise])); | ||
1572 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) | 1573 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) = MUL_R(G_filt, QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx])) |
1573 | + MUL_F(Q_filt, IM(V[fIndexNoise])); | 1574 | + MUL_F(Q_filt, IM(V[fIndexNoise])); |
1574 | #endif | 1575 | #endif |
@@ -1577,87 +1578,44 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, | |||
1577 | { | 1578 | { |
1578 | int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1); | 1579 | int8_t rev = (((m + sbr->kx) & 1) ? -1 : 1); |
1579 | QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine]; | 1580 | QMF_RE(psi) = adj->S_M_boost[l][m] * phi_re[fIndexSine]; |
1580 | #ifdef FIXED_POINT | 1581 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += REAL_SCALE(QMF_RE(psi)); |
1581 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_RE(psi) << REAL_BITS); | ||
1582 | #else | ||
1583 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_RE(psi); | ||
1584 | #endif | ||
1585 | 1582 | ||
1586 | #ifndef SBR_LOW_POWER | 1583 | #ifndef SBR_LOW_POWER |
1587 | QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine]; | 1584 | QMF_IM(psi) = rev * adj->S_M_boost[l][m] * phi_im[fIndexSine]; |
1588 | #ifdef FIXED_POINT | 1585 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += REAL_SCALE(QMF_IM(psi)); |
1589 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += (QMF_IM(psi) << REAL_BITS); | ||
1590 | #else | ||
1591 | QMF_IM(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) += QMF_IM(psi); | ||
1592 | #endif | ||
1593 | #else | 1586 | #else |
1594 | 1587 | ||
1595 | i_min1 = (fIndexSine - 1) & 3; | 1588 | i_min1 = (fIndexSine - 1) & 3; |
1596 | i_plus1 = (fIndexSine + 1) & 3; | 1589 | i_plus1 = (fIndexSine + 1) & 3; |
1597 | 1590 | ||
1598 | #ifndef FIXED_POINT | ||
1599 | if ((m == 0) && (phi_re[i_plus1] != 0)) | ||
1600 | { | ||
1601 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += | ||
1602 | (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][0], FRAC_CONST(0.00815))); | ||
1603 | if (sbr->M != 0) | ||
1604 | { | ||
1605 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= | ||
1606 | (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][1], FRAC_CONST(0.00815))); | ||
1607 | } | ||
1608 | } | ||
1609 | if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) | ||
1610 | { | ||
1611 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= | ||
1612 | (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); | ||
1613 | } | ||
1614 | if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) | ||
1615 | { | ||
1616 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= | ||
1617 | (rev*phi_re[i_plus1] * MUL_F(adj->S_M_boost[l][m + 1], FRAC_CONST(0.00815))); | ||
1618 | } | ||
1619 | if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) | ||
1620 | { | ||
1621 | if (m > 0) | ||
1622 | { | ||
1623 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx]) -= | ||
1624 | (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m - 1], FRAC_CONST(0.00815))); | ||
1625 | } | ||
1626 | if (m + sbr->kx < 64) | ||
1627 | { | ||
1628 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += | ||
1629 | (rev*phi_re[i_min1] * MUL_F(adj->S_M_boost[l][m], FRAC_CONST(0.00815))); | ||
1630 | } | ||
1631 | } | ||
1632 | #else | ||
1633 | real_t tmp1 = 0; | 1591 | real_t tmp1 = 0; |
1634 | real_t tmp2 = 0; | 1592 | real_t tmp2 = 0; |
1635 | real_t tmp3 = 0; | 1593 | real_t tmp3 = 0; |
1636 | if ((m == 0) && (phi_re[i_plus1] != 0)) | 1594 | if ((m == 0) && (phi_re[i_plus1] != 0)) |
1637 | { | 1595 | { |
1638 | tmp1 += (phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][0]<<REAL_BITS), FRAC_CONST(0.00815))); | 1596 | tmp1 += (phi_re[i_plus1] * MUL_F(REAL_SCALE(adj->S_M_boost[l][0]), FRAC_CONST(0.00815))); |
1639 | if (sbr->M != 0) | 1597 | if (sbr->M != 0) |
1640 | { | 1598 | { |
1641 | tmp2 -= (phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][1]<<REAL_BITS), FRAC_CONST(0.00815))); | 1599 | tmp2 -= (phi_re[i_plus1] * MUL_F(REAL_SCALE(adj->S_M_boost[l][1]), FRAC_CONST(0.00815))); |
1642 | } | 1600 | } |
1643 | } | 1601 | } |
1644 | if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) | 1602 | if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) |
1645 | { | 1603 | { |
1646 | tmp2 -= (phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815))); | 1604 | tmp2 -= (phi_re[i_min1] * MUL_F(REAL_SCALE(adj->S_M_boost[l][m - 1]), FRAC_CONST(0.00815))); |
1647 | } | 1605 | } |
1648 | if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) | 1606 | if ((m > 0) && (m < sbr->M - 1) && (sinusoids < 16) && (phi_re[i_plus1] != 0)) |
1649 | { | 1607 | { |
1650 | tmp2 -= (phi_re[i_plus1] * MUL_F((adj->S_M_boost[l][m + 1]<<REAL_BITS), FRAC_CONST(0.00815))); | 1608 | tmp2 -= (phi_re[i_plus1] * MUL_F(REAL_SCALE(adj->S_M_boost[l][m + 1]), FRAC_CONST(0.00815))); |
1651 | } | 1609 | } |
1652 | if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) | 1610 | if ((m == sbr->M - 1) && (sinusoids < 16) && (phi_re[i_min1] != 0)) |
1653 | { | 1611 | { |
1654 | if (m > 0) | 1612 | if (m > 0) |
1655 | { | 1613 | { |
1656 | tmp2 -= (phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m - 1]<<REAL_BITS), FRAC_CONST(0.00815))); | 1614 | tmp2 -= (phi_re[i_min1] * MUL_F(REAL_SCALE(adj->S_M_boost[l][m - 1]), FRAC_CONST(0.00815))); |
1657 | } | 1615 | } |
1658 | if (m + sbr->kx < 64) | 1616 | if (m + sbr->kx < 64) |
1659 | { | 1617 | { |
1660 | tmp3 += (phi_re[i_min1] * MUL_F((adj->S_M_boost[l][m]<<REAL_BITS), FRAC_CONST(0.00815))); | 1618 | tmp3 += (phi_re[i_min1] * MUL_F(REAL_SCALE(adj->S_M_boost[l][m]), FRAC_CONST(0.00815))); |
1661 | } | 1619 | } |
1662 | } | 1620 | } |
1663 | 1621 | ||
@@ -1670,7 +1628,6 @@ static void hf_assembly(sbr_info *sbr, sbr_hfadj_info *adj, | |||
1670 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += tmp1; | 1628 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx - 1]) += tmp1; |
1671 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx ]) += tmp2; | 1629 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx ]) += tmp2; |
1672 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += tmp3; | 1630 | QMF_RE(Xsbr[i + sbr->tHFAdj][m+sbr->kx + 1]) += tmp3; |
1673 | #endif | ||
1674 | 1631 | ||
1675 | if (adj->S_M_boost[l][m] != 0) | 1632 | if (adj->S_M_boost[l][m] != 0) |
1676 | sinusoids++; | 1633 | sinusoids++; |
diff --git a/apps/codecs/libfaad/sbr_hfgen.c b/apps/codecs/libfaad/sbr_hfgen.c index 81b8f6d4c1..08d3af0253 100644 --- a/apps/codecs/libfaad/sbr_hfgen.c +++ b/apps/codecs/libfaad/sbr_hfgen.c | |||
@@ -503,11 +503,11 @@ static void calc_aliasing_degree(sbr_info *sbr, real_t *rxx, real_t *deg) | |||
503 | 503 | ||
504 | for (k = 2; k < sbr->k0; k++) | 504 | for (k = 2; k < sbr->k0; k++) |
505 | { | 505 | { |
506 | deg[k] = 0.0; | 506 | deg[k] = COEF_CONST(0.0); |
507 | 507 | ||
508 | if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0))) | 508 | if ((k % 2 == 0) && (rxx[k] < COEF_CONST(0.0))) |
509 | { | 509 | { |
510 | if (rxx[k-1] < 0.0) | 510 | if (rxx[k-1] < COEF_CONST(0.0)) |
511 | { | 511 | { |
512 | deg[k] = COEF_CONST(1.0); | 512 | deg[k] = COEF_CONST(1.0); |
513 | 513 | ||