mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-26 23:36:37 -04:00
libfaad: Move PS related variables to sbr_info struct. This allows dynamic allocation including error handling.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29857 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
df7deee00f
commit
0e7c04e57d
5 changed files with 26 additions and 45 deletions
|
|
@ -145,26 +145,10 @@ static const uint16_t map_group2bk34[32+18] =
|
|||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
|
||||
};
|
||||
|
||||
/* type definitions */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t frame_len;
|
||||
uint8_t resolution20[3];
|
||||
uint8_t resolution34[5];
|
||||
|
||||
qmf_t work[32+12];
|
||||
qmf_t buffer[5][32];
|
||||
qmf_t temp[32][12];
|
||||
} hyb_info;
|
||||
|
||||
|
||||
/* static variables */
|
||||
static hyb_info s_hyb_info;
|
||||
static ps_info s_ps_info;
|
||||
|
||||
/* static function declarations */
|
||||
static void ps_data_decode(ps_info *ps);
|
||||
static hyb_info *hybrid_init(void);
|
||||
static void hybrid_init(hyb_info *hyb);
|
||||
static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
|
||||
qmf_t *buffer, qmf_t X_hybrid[32][12]);
|
||||
static INLINE void DCT3_4_unscaled(real_t *y, real_t *x);
|
||||
|
|
@ -200,10 +184,8 @@ static void ps_mix_phase(ps_info *ps,
|
|||
/* */
|
||||
|
||||
|
||||
static hyb_info *hybrid_init()
|
||||
static void hybrid_init(hyb_info *hyb)
|
||||
{
|
||||
hyb_info *hyb = &s_hyb_info;
|
||||
|
||||
hyb->resolution34[0] = 12;
|
||||
hyb->resolution34[1] = 8;
|
||||
hyb->resolution34[2] = 4;
|
||||
|
|
@ -219,8 +201,6 @@ static hyb_info *hybrid_init()
|
|||
memset(hyb->work , 0, sizeof(hyb->work));
|
||||
memset(hyb->buffer, 0, sizeof(hyb->buffer));
|
||||
memset(hyb->temp , 0, sizeof(hyb->temp));
|
||||
|
||||
return hyb;
|
||||
}
|
||||
|
||||
/* real filter, size 2 */
|
||||
|
|
@ -1815,16 +1795,12 @@ static void ps_mix_phase(ps_info *ps,
|
|||
}
|
||||
}
|
||||
|
||||
ps_info *ps_init(uint8_t sr_index)
|
||||
void ps_init(ps_info *ps)
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t short_delay_band;
|
||||
|
||||
ps_info *ps = &s_ps_info;
|
||||
memset(ps, 0, sizeof(ps_info));
|
||||
|
||||
(void)sr_index;
|
||||
ps->hyb = hybrid_init();
|
||||
hybrid_init(&ps->hyb);
|
||||
|
||||
ps->ps_data_available = 0;
|
||||
|
||||
|
|
@ -1905,8 +1881,6 @@ ps_info *ps_init(uint8_t sr_index)
|
|||
RE(ps->opd_prev[i][1]) = 0;
|
||||
IM(ps->opd_prev[i][1]) = 0;
|
||||
}
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
/* main Parametric Stereo decoding function */
|
||||
|
|
@ -1944,8 +1918,7 @@ uint8_t ps_decode(ps_info *ps,
|
|||
/* Perform further analysis on the lowest subbands to get a higher
|
||||
* frequency resolution
|
||||
*/
|
||||
hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left,
|
||||
ps->use34hybrid_bands);
|
||||
hybrid_analysis(&ps->hyb, X_left, X_hybrid_left, ps->use34hybrid_bands);
|
||||
|
||||
/* decorrelate mono signal */
|
||||
ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
|
||||
|
|
@ -1954,11 +1927,9 @@ uint8_t ps_decode(ps_info *ps,
|
|||
ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
|
||||
|
||||
/* hybrid synthesis, to rebuild the SBR QMF matrices */
|
||||
hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left,
|
||||
ps->use34hybrid_bands);
|
||||
hybrid_synthesis(&ps->hyb, X_left, X_hybrid_left, ps->use34hybrid_bands);
|
||||
|
||||
hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right,
|
||||
ps->use34hybrid_bands);
|
||||
hybrid_synthesis(&ps->hyb, X_right, X_hybrid_right, ps->use34hybrid_bands);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue