52 lines
2.0 KiB
Diff
52 lines
2.0 KiB
Diff
Since there are reports of crashes in libfaad2 when called from
|
|
firefox and icecat in the function ps_decode(), this is a try
|
|
to reduce the stack footprint of faad2 decoding by making the
|
|
main arrays X_left[][] and X_right[][] use static __thread storage.
|
|
|
|
--- a/libfaad/sbr_dec.c
|
|
+++ b/libfaad/sbr_dec.c
|
|
@@ -610,8 +610,12 @@ uint8_t sbrDecodeSingleFramePS(sbr_info
|
|
uint8_t l, k;
|
|
uint8_t dont_process = 0;
|
|
uint8_t ret = 0;
|
|
- ALIGN qmf_t X_left[MAX_NTSRHFG][64] = {{{0}}};
|
|
- ALIGN qmf_t X_right[MAX_NTSRHFG][64] = {{{0}}}; /* must set this to 0 */
|
|
+ /* 2015-09-11 jbu: make static to reduce stack footprint */
|
|
+ static __thread ALIGN qmf_t X_left[MAX_NTSRHFG][64];
|
|
+ static __thread ALIGN qmf_t X_right[MAX_NTSRHFG][64];
|
|
+ /* must set this to 0 */
|
|
+ memset(X_left, 0, sizeof(X_left));
|
|
+ memset(X_right, 0, sizeof(X_right));
|
|
|
|
if (sbr == NULL)
|
|
return 20;
|
|
--- a/libfaad/ps_dec.c
|
|
+++ b/libfaad/ps_dec.c
|
|
@@ -1045,10 +1045,10 @@ static void ps_decorrelate(ps_info *ps,
|
|
const complex_t *Phi_Fract_SubQmf;
|
|
uint8_t temp_delay_ser[NO_ALLPASS_LINKS];
|
|
real_t P_SmoothPeakDecayDiffNrg, nrg;
|
|
- real_t P[32][34];
|
|
- real_t G_TransientRatio[32][34] = {{0}};
|
|
+ static __thread real_t P[32][34];
|
|
+ static __thread real_t G_TransientRatio[32][34];
|
|
complex_t inputLeft;
|
|
-
|
|
+ memset(G_TransientRatio, 0, sizeof(G_TransientRatio));
|
|
|
|
/* chose hybrid filterbank: 20 or 34 band case */
|
|
if (ps->use34hybrid_bands)
|
|
@@ -1991,8 +1991,10 @@ ps_info *ps_init(uint8_t sr_index, uint8
|
|
/* main Parametric Stereo decoding function */
|
|
uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
|
|
{
|
|
- qmf_t X_hybrid_left[32][32] = {{{0}}};
|
|
- qmf_t X_hybrid_right[32][32] = {{{0}}};
|
|
+ static __thread qmf_t X_hybrid_left[32][32];
|
|
+ static __thread qmf_t X_hybrid_right[32][32];
|
|
+ memset(X_hybrid_left, 0, sizeof(X_hybrid_left));
|
|
+ memset(X_hybrid_right, 0, sizeof(X_hybrid_right));
|
|
|
|
/* delta decoding of the bitstream data */
|
|
ps_data_decode(ps);
|