summaryrefslogtreecommitdiff
path: root/apps/codecs/libfaad/ps_dec.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libfaad/ps_dec.c')
-rw-r--r--apps/codecs/libfaad/ps_dec.c43
1 files changed, 7 insertions, 36 deletions
diff --git a/apps/codecs/libfaad/ps_dec.c b/apps/codecs/libfaad/ps_dec.c
index 2c7e5fdf47..3fed4e6a0a 100644
--- a/apps/codecs/libfaad/ps_dec.c
+++ b/apps/codecs/libfaad/ps_dec.c
@@ -145,26 +145,10 @@ static const uint16_t map_group2bk34[32+18] =
145 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 145 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33
146}; 146};
147 147
148/* type definitions */
149typedef struct
150{
151 uint8_t frame_len;
152 uint8_t resolution20[3];
153 uint8_t resolution34[5];
154
155 qmf_t work[32+12];
156 qmf_t buffer[5][32];
157 qmf_t temp[32][12];
158} hyb_info;
159
160
161/* static variables */
162static hyb_info s_hyb_info;
163static ps_info s_ps_info;
164 148
165/* static function declarations */ 149/* static function declarations */
166static void ps_data_decode(ps_info *ps); 150static void ps_data_decode(ps_info *ps);
167static hyb_info *hybrid_init(void); 151static void hybrid_init(hyb_info *hyb);
168static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, 152static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
169 qmf_t *buffer, qmf_t X_hybrid[32][12]); 153 qmf_t *buffer, qmf_t X_hybrid[32][12]);
170static INLINE void DCT3_4_unscaled(real_t *y, real_t *x); 154static INLINE void DCT3_4_unscaled(real_t *y, real_t *x);
@@ -200,10 +184,8 @@ static void ps_mix_phase(ps_info *ps,
200/* */ 184/* */
201 185
202 186
203static hyb_info *hybrid_init() 187static void hybrid_init(hyb_info *hyb)
204{ 188{
205 hyb_info *hyb = &s_hyb_info;
206
207 hyb->resolution34[0] = 12; 189 hyb->resolution34[0] = 12;
208 hyb->resolution34[1] = 8; 190 hyb->resolution34[1] = 8;
209 hyb->resolution34[2] = 4; 191 hyb->resolution34[2] = 4;
@@ -219,8 +201,6 @@ static hyb_info *hybrid_init()
219 memset(hyb->work , 0, sizeof(hyb->work)); 201 memset(hyb->work , 0, sizeof(hyb->work));
220 memset(hyb->buffer, 0, sizeof(hyb->buffer)); 202 memset(hyb->buffer, 0, sizeof(hyb->buffer));
221 memset(hyb->temp , 0, sizeof(hyb->temp)); 203 memset(hyb->temp , 0, sizeof(hyb->temp));
222
223 return hyb;
224} 204}
225 205
226/* real filter, size 2 */ 206/* real filter, size 2 */
@@ -1815,16 +1795,12 @@ static void ps_mix_phase(ps_info *ps,
1815 } 1795 }
1816} 1796}
1817 1797
1818ps_info *ps_init(uint8_t sr_index) 1798void ps_init(ps_info *ps)
1819{ 1799{
1820 uint8_t i; 1800 uint8_t i;
1821 uint8_t short_delay_band; 1801 uint8_t short_delay_band;
1822 1802
1823 ps_info *ps = &s_ps_info; 1803 hybrid_init(&ps->hyb);
1824 memset(ps, 0, sizeof(ps_info));
1825
1826 (void)sr_index;
1827 ps->hyb = hybrid_init();
1828 1804
1829 ps->ps_data_available = 0; 1805 ps->ps_data_available = 0;
1830 1806
@@ -1905,8 +1881,6 @@ ps_info *ps_init(uint8_t sr_index)
1905 RE(ps->opd_prev[i][1]) = 0; 1881 RE(ps->opd_prev[i][1]) = 0;
1906 IM(ps->opd_prev[i][1]) = 0; 1882 IM(ps->opd_prev[i][1]) = 0;
1907 } 1883 }
1908
1909 return ps;
1910} 1884}
1911 1885
1912/* main Parametric Stereo decoding function */ 1886/* main Parametric Stereo decoding function */
@@ -1944,8 +1918,7 @@ uint8_t ps_decode(ps_info *ps,
1944 /* Perform further analysis on the lowest subbands to get a higher 1918 /* Perform further analysis on the lowest subbands to get a higher
1945 * frequency resolution 1919 * frequency resolution
1946 */ 1920 */
1947 hybrid_analysis((hyb_info*)ps->hyb, X_left, X_hybrid_left, 1921 hybrid_analysis(&ps->hyb, X_left, X_hybrid_left, ps->use34hybrid_bands);
1948 ps->use34hybrid_bands);
1949 1922
1950 /* decorrelate mono signal */ 1923 /* decorrelate mono signal */
1951 ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); 1924 ps_decorrelate(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
@@ -1954,11 +1927,9 @@ uint8_t ps_decode(ps_info *ps,
1954 ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right); 1927 ps_mix_phase(ps, X_left, X_right, X_hybrid_left, X_hybrid_right);
1955 1928
1956 /* hybrid synthesis, to rebuild the SBR QMF matrices */ 1929 /* hybrid synthesis, to rebuild the SBR QMF matrices */
1957 hybrid_synthesis((hyb_info*)ps->hyb, X_left, X_hybrid_left, 1930 hybrid_synthesis(&ps->hyb, X_left, X_hybrid_left, ps->use34hybrid_bands);
1958 ps->use34hybrid_bands);
1959 1931
1960 hybrid_synthesis((hyb_info*)ps->hyb, X_right, X_hybrid_right, 1932 hybrid_synthesis(&ps->hyb, X_right, X_hybrid_right, ps->use34hybrid_bands);
1961 ps->use34hybrid_bands);
1962 1933
1963 return 0; 1934 return 0;
1964} 1935}