Mercurial > audlegacy-plugins
annotate src/aac/libfaad2/sbr_dec.c @ 3161:6dd886b5c72b
revive stdio plugin for now. gio cannot write id3 tags.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 13 Jul 2009 23:53:41 +0900 |
parents | 201bc2617f0d |
children |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
3 ** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 ** This program is free software; you can redistribute it and/or modify |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 ** it under the terms of the GNU General Public License as published by |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 ** the Free Software Foundation; either version 2 of the License, or |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 ** (at your option) any later version. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 ** This program is distributed in the hope that it will be useful, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 ** GNU General Public License for more details. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 ** You should have received a copy of the GNU General Public License |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
16 ** along with this program; if not, write to the Free Software |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 ** |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 ** Any non-GPL usage of this software or parts of this software is strictly |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 ** forbidden. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 ** |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
22 ** The "appropriate copyright message" mentioned in section 2c of the GPLv2 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
23 ** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com" |
681 | 24 ** |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
25 ** Commercial non-GPL licensing of this software is possible. |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
26 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com. |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
27 ** |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
28 ** $Id: sbr_dec.c,v 1.44 2009/01/26 22:32:31 menno Exp $ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 **/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 #include "common.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 #include "structs.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 #ifdef SBR_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 #include "syntax.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 #include "bits.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 #include "sbr_syntax.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 #include "sbr_qmf.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 #include "sbr_hfgen.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 #include "sbr_hfadj.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 /* static function declarations */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 static void sbr_save_matrix(sbr_info *sbr, uint8_t ch); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
51 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
52 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
53 sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 uint32_t sample_rate, uint8_t downSampledSBR |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
55 #ifdef DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
56 , uint8_t IsDRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
57 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 ) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
59 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
60 sbr_info *sbr = faad_malloc(sizeof(sbr_info)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
61 memset(sbr, 0, sizeof(sbr_info)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
62 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
63 /* save id of the parent element */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
64 sbr->id_aac = id_aac; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
65 sbr->sample_rate = sample_rate; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
66 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
67 sbr->bs_freq_scale = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
68 sbr->bs_alter_scale = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
69 sbr->bs_noise_bands = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
70 sbr->bs_limiter_bands = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 sbr->bs_limiter_gains = 2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
72 sbr->bs_interpol_freq = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
73 sbr->bs_smoothing_mode = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
74 sbr->bs_start_freq = 5; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
75 sbr->bs_amp_res = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
76 sbr->bs_samplerate_mode = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
77 sbr->prevEnvIsShort[0] = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
78 sbr->prevEnvIsShort[1] = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
79 sbr->header_count = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
80 sbr->Reset = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
81 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
82 #ifdef DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
83 sbr->Is_DRM_SBR = IsDRM; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
84 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
85 sbr->tHFGen = T_HFGEN; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
86 sbr->tHFAdj = T_HFADJ; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
87 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
88 sbr->bsco = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
89 sbr->bsco_prev = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
90 sbr->M_prev = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
91 sbr->frame_len = framelength; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
92 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
93 /* force sbr reset */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
94 sbr->bs_start_freq_prev = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
95 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
96 if (framelength == 960) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
97 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
98 sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS_960; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
99 sbr->numTimeSlots = NO_TIME_SLOTS_960; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
100 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
101 sbr->numTimeSlotsRate = RATE * NO_TIME_SLOTS; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
102 sbr->numTimeSlots = NO_TIME_SLOTS; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
103 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
104 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
105 sbr->GQ_ringbuf_index[0] = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
106 sbr->GQ_ringbuf_index[1] = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
107 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
108 if (id_aac == ID_CPE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
109 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
110 /* stereo */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
111 uint8_t j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
112 sbr->qmfa[0] = qmfa_init(32); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
113 sbr->qmfa[1] = qmfa_init(32); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
114 sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
115 sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
116 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
117 for (j = 0; j < 5; j++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
118 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
119 sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
120 sbr->G_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
121 sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
122 sbr->Q_temp_prev[1][j] = faad_malloc(64*sizeof(real_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
123 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
124 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
125 memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
128 /* mono */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
129 uint8_t j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
130 sbr->qmfa[0] = qmfa_init(32); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
131 sbr->qmfs[0] = qmfs_init((downSampledSBR)?32:64); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
132 sbr->qmfs[1] = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
133 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
134 for (j = 0; j < 5; j++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
135 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
136 sbr->G_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
137 sbr->Q_temp_prev[0][j] = faad_malloc(64*sizeof(real_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
138 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
139 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
140 memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
141 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
142 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
143 return sbr; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
144 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
145 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
146 void sbrDecodeEnd(sbr_info *sbr) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
147 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
148 uint8_t j; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
149 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
150 if (sbr) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
151 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
152 qmfa_end(sbr->qmfa[0]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 qmfs_end(sbr->qmfs[0]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 if (sbr->qmfs[1] != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 qmfa_end(sbr->qmfa[1]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
157 qmfs_end(sbr->qmfs[1]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 for (j = 0; j < 5; j++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 if (sbr->G_temp_prev[0][j]) faad_free(sbr->G_temp_prev[0][j]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
163 if (sbr->Q_temp_prev[0][j]) faad_free(sbr->Q_temp_prev[0][j]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 if (sbr->G_temp_prev[1][j]) faad_free(sbr->G_temp_prev[1][j]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 if (sbr->Q_temp_prev[1][j]) faad_free(sbr->Q_temp_prev[1][j]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
166 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
167 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 #ifdef PS_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 if (sbr->ps != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 ps_free(sbr->ps); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
171 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 #ifdef DRM_PS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 if (sbr->drm_ps != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 drm_ps_free(sbr->drm_ps); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
178 faad_free(sbr); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
179 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
180 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
181 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
182 void sbrReset(sbr_info *sbr) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
183 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
184 uint8_t j; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
185 if (sbr->qmfa[0] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
186 memset(sbr->qmfa[0]->x, 0, 2 * sbr->qmfa[0]->channels * 10 * sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
187 if (sbr->qmfa[1] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
188 memset(sbr->qmfa[1]->x, 0, 2 * sbr->qmfa[1]->channels * 10 * sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
189 if (sbr->qmfs[0] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
190 memset(sbr->qmfs[0]->v, 0, 2 * sbr->qmfs[0]->channels * 20 * sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
191 if (sbr->qmfs[1] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
192 memset(sbr->qmfs[1]->v, 0, 2 * sbr->qmfs[1]->channels * 20 * sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
193 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
194 for (j = 0; j < 5; j++) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
195 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
196 if (sbr->G_temp_prev[0][j] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
197 memset(sbr->G_temp_prev[0][j], 0, 64*sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
198 if (sbr->G_temp_prev[1][j] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
199 memset(sbr->G_temp_prev[1][j], 0, 64*sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
200 if (sbr->Q_temp_prev[0][j] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
201 memset(sbr->Q_temp_prev[0][j], 0, 64*sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
202 if (sbr->Q_temp_prev[1][j] != NULL) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
203 memset(sbr->Q_temp_prev[1][j], 0, 64*sizeof(real_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
204 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
205 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
206 memset(sbr->Xsbr[0], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
207 memset(sbr->Xsbr[1], 0, (sbr->numTimeSlotsRate+sbr->tHFGen)*64 * sizeof(qmf_t)); |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
208 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
209 sbr->GQ_ringbuf_index[0] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
210 sbr->GQ_ringbuf_index[1] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
211 sbr->header_count = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
212 sbr->Reset = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
213 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
214 sbr->L_E_prev[0] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
215 sbr->L_E_prev[1] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
216 sbr->bs_freq_scale = 2; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
217 sbr->bs_alter_scale = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
218 sbr->bs_noise_bands = 2; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
219 sbr->bs_limiter_bands = 2; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
220 sbr->bs_limiter_gains = 2; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
221 sbr->bs_interpol_freq = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
222 sbr->bs_smoothing_mode = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
223 sbr->bs_start_freq = 5; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
224 sbr->bs_amp_res = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
225 sbr->bs_samplerate_mode = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
226 sbr->prevEnvIsShort[0] = -1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
227 sbr->prevEnvIsShort[1] = -1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
228 sbr->bsco = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
229 sbr->bsco_prev = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
230 sbr->M_prev = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
231 sbr->bs_start_freq_prev = -1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
232 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
233 sbr->f_prev[0] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
234 sbr->f_prev[1] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
235 for (j = 0; j < MAX_M; j++) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
236 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
237 sbr->E_prev[0][j] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
238 sbr->Q_prev[0][j] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
239 sbr->E_prev[1][j] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
240 sbr->Q_prev[1][j] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
241 sbr->bs_add_harmonic_prev[0][j] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
242 sbr->bs_add_harmonic_prev[1][j] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
243 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
244 sbr->bs_add_harmonic_flag_prev[0] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
245 sbr->bs_add_harmonic_flag_prev[1] = 0; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
246 } |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
247 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 uint8_t i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 /* save data for next frame */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 sbr->kx_prev = sbr->kx; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 sbr->M_prev = sbr->M; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 sbr->bsco_prev = sbr->bsco; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 sbr->L_E_prev[ch] = sbr->L_E[ch]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 /* sbr->L_E[ch] can become 0 on files with bit errors */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 if (sbr->L_E[ch] <= 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 return 19; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 sbr->f_prev[ch] = sbr->f[ch][sbr->L_E[ch] - 1]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 for (i = 0; i < MAX_M; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 sbr->E_prev[ch][i] = sbr->E[ch][i][sbr->L_E[ch] - 1]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 sbr->Q_prev[ch][i] = sbr->Q[ch][i][sbr->L_Q[ch] - 1]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 for (i = 0; i < MAX_M; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 sbr->bs_add_harmonic_prev[ch][i] = sbr->bs_add_harmonic[ch][i]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 sbr->bs_add_harmonic_flag_prev[ch] = sbr->bs_add_harmonic_flag[ch]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 if (sbr->l_A[ch] == sbr->L_E[ch]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 sbr->prevEnvIsShort[ch] = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 sbr->prevEnvIsShort[ch] = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 static void sbr_save_matrix(sbr_info *sbr, uint8_t ch) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 uint8_t i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 for (i = 0; i < sbr->tHFGen; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 memmove(sbr->Xsbr[ch][i], sbr->Xsbr[ch][i+sbr->numTimeSlotsRate], 64 * sizeof(qmf_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 for (i = sbr->tHFGen; i < MAX_NTSRHFG; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 memset(sbr->Xsbr[ch][i], 0, 64 * sizeof(qmf_t)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
298 static uint8_t sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
299 uint8_t ch, uint8_t dont_process, |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
300 const uint8_t downSampledSBR) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 int16_t k, l; |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
303 uint8_t ret = 0; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 #ifdef SBR_LOW_POWER |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 ALIGN real_t deg[64]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 #ifdef DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 if (sbr->Is_DRM_SBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 sbr->bsco = max((int32_t)sbr->maxAACLine*32/(int32_t)sbr->frame_len - (int32_t)sbr->kx, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 sbr->bsco = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 #ifdef DRM |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 //#define PRE_QMF_PRINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 #ifdef PRE_QMF_PRINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 for (i = 0; i < 1024; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 printf("%d\n", channel_buf[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 /* subband analysis */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 if (dont_process) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, 32); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 sbr_qmf_analysis_32(sbr, sbr->qmfa[ch], channel_buf, sbr->Xsbr[ch], sbr->tHFGen, sbr->kx); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 if (!dont_process) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 #if 1 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 /* insert high frequencies here */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 /* hf generation using patching */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 hf_generation(sbr, sbr->Xsbr[ch], sbr->Xsbr[ch] |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 #ifdef SBR_LOW_POWER |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 ,deg |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 ,ch); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
351 #if 0 //def SBR_LOW_POWER |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 for (l = sbr->t_E[ch][0]; l < sbr->t_E[ch][sbr->L_E[ch]]; l++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 for (k = 0; k < sbr->kx; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 QMF_RE(sbr->Xsbr[ch][sbr->tHFAdj + l][k]) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 #if 1 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 /* hf adjustment */ |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
363 ret = hf_adjustment(sbr, sbr->Xsbr[ch] |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 #ifdef SBR_LOW_POWER |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 ,deg |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 ,ch); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 #endif |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
369 if (ret > 0) |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
370 { |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
371 dont_process = 1; |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
372 } |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 if ((sbr->just_seeked != 0) || dont_process) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 for (l = 0; l < sbr->numTimeSlotsRate; l++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 for (k = 0; k < 32; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 #ifndef SBR_LOW_POWER |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 for (k = 32; k < 64; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 QMF_RE(X[l][k]) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 #ifndef SBR_LOW_POWER |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 QMF_IM(X[l][k]) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 for (l = 0; l < sbr->numTimeSlotsRate; l++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 uint8_t kx_band, M_band, bsco_band; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 if (l < sbr->t_E[ch][0]) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 kx_band = sbr->kx_prev; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 M_band = sbr->M_prev; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 bsco_band = sbr->bsco_prev; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 kx_band = sbr->kx; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 M_band = sbr->M; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 bsco_band = sbr->bsco; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 #ifndef SBR_LOW_POWER |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 for (k = 0; k < kx_band + bsco_band; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 for (k = kx_band + bsco_band; k < kx_band + M_band; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 QMF_IM(X[l][k]) = QMF_IM(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 QMF_RE(X[l][k]) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 QMF_IM(X[l][k]) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 #else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 for (k = 0; k < kx_band + bsco_band; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 for (k = kx_band + bsco_band; k < min(kx_band + M_band, 63); k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 QMF_RE(X[l][k]) = QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 for (k = max(kx_band + bsco_band, kx_band + M_band); k < 64; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 QMF_RE(X[l][k]) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 QMF_RE(X[l][kx_band - 1 + bsco_band]) += |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 QMF_RE(sbr->Xsbr[ch][l + sbr->tHFAdj][kx_band - 1 + bsco_band]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 } |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
444 |
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
445 return ret; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 const uint8_t just_seeked, const uint8_t downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 uint8_t dont_process = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 uint8_t ret = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 ALIGN qmf_t X[MAX_NTSR][64]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 if (sbr == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 return 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 /* case can occur due to bit errors */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 if (sbr->id_aac != ID_CPE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 return 21; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 if (sbr->ret || (sbr->header_count == 0)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 /* don't process just upsample */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 dont_process = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 /* Re-activate reset for next frame */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 if (sbr->ret && sbr->Reset) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 sbr->bs_start_freq_prev = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 if (just_seeked) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 sbr->just_seeked = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 sbr->just_seeked = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
479 sbr->ret += sbr_process_channel(sbr, left_chan, X, 0, dont_process, downSampledSBR); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 /* subband synthesis */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 if (downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, left_chan); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
488 sbr->ret += sbr_process_channel(sbr, right_chan, X, 1, dont_process, downSampledSBR); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 /* subband synthesis */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 if (downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X, right_chan); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 if (sbr->bs_header_flag) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 sbr->just_seeked = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 if (sbr->header_count != 0 && sbr->ret == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 ret = sbr_save_prev_data(sbr, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 if (ret) return ret; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 ret = sbr_save_prev_data(sbr, 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 if (ret) return ret; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
508 sbr_save_matrix(sbr, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 sbr_save_matrix(sbr, 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 sbr->frame++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
513 //#define POST_QMF_PRINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 #ifdef POST_QMF_PRINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
517 for (i = 0; i < 2048; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
519 printf("%d\n", left_chan[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
520 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
521 for (i = 0; i < 2048; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
522 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
523 printf("%d\n", right_chan[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
524 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
525 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
527 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
528 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
529 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
531 uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 const uint8_t just_seeked, const uint8_t downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
533 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 uint8_t dont_process = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 uint8_t ret = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 ALIGN qmf_t X[MAX_NTSR][64]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 if (sbr == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
539 return 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
540 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 /* case can occur due to bit errors */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 return 21; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 if (sbr->ret || (sbr->header_count == 0)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
547 /* don't process just upsample */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 dont_process = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
549 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
550 /* Re-activate reset for next frame */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
551 if (sbr->ret && sbr->Reset) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 sbr->bs_start_freq_prev = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
553 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 if (just_seeked) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
557 sbr->just_seeked = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
558 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 sbr->just_seeked = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
560 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
561 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
562 sbr->ret += sbr_process_channel(sbr, channel, X, 0, dont_process, downSampledSBR); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
563 /* subband synthesis */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
564 if (downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
565 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X, channel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
567 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
570 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 if (sbr->bs_header_flag) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
572 sbr->just_seeked = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
573 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
574 if (sbr->header_count != 0 && sbr->ret == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 ret = sbr_save_prev_data(sbr, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 if (ret) return ret; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
578 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
580 sbr_save_matrix(sbr, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 sbr->frame++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 //#define POST_QMF_PRINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 #ifdef POST_QMF_PRINT |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 for (i = 0; i < 2048; i++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 printf("%d\n", channel[i]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
596 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 #if (defined(PS_DEC) || defined(DRM_PS)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 const uint8_t just_seeked, const uint8_t downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 uint8_t l, k; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
603 uint8_t dont_process = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
604 uint8_t ret = 0; |
3009
201bc2617f0d
GCC wanted *another* set of braces. Okay.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
605 ALIGN qmf_t X_left[38][64] = {{{0}}}; |
201bc2617f0d
GCC wanted *another* set of braces. Okay.
Tony Vroon <chainsaw@gentoo.org>
parents:
3004
diff
changeset
|
606 ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 if (sbr == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 return 20; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 /* case can occur due to bit errors */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 return 21; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 if (sbr->ret || (sbr->header_count == 0)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
616 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
617 /* don't process just upsample */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 dont_process = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 /* Re-activate reset for next frame */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 if (sbr->ret && sbr->Reset) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 sbr->bs_start_freq_prev = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 if (just_seeked) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 sbr->just_seeked = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 sbr->just_seeked = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 if (sbr->qmfs[1] == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 sbr->qmfs[1] = qmfs_init((downSampledSBR)?32:64); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
637 sbr->ret += sbr_process_channel(sbr, left_channel, X_left, 0, dont_process, downSampledSBR); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 /* copy some extra data for PS */ |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
640 for (l = sbr->numTimeSlotsRate; l < sbr->numTimeSlotsRate + 6; l++) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 for (k = 0; k < 5; k++) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 QMF_RE(X_left[l][k]) = QMF_RE(sbr->Xsbr[0][sbr->tHFAdj+l][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 QMF_IM(X_left[l][k]) = QMF_IM(sbr->Xsbr[0][sbr->tHFAdj+l][k]); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
649 /* perform parametric stereo */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 #ifdef DRM_PS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 if (sbr->Is_DRM_SBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
652 { |
3004
8867d3491f60
Sync with FAAD 2.7; will fix warnings in separate commits.
Tony Vroon <chainsaw@gentoo.org>
parents:
2835
diff
changeset
|
653 drm_ps_decode(sbr->drm_ps, (sbr->ret > 0), X_left, X_right); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
654 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
656 #ifdef PS_DEC |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
657 ps_decode(sbr->ps, X_left, X_right); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
658 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 #ifdef DRM_PS |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
660 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
662 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 /* subband synthesis */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 if (downSampledSBR) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
665 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 sbr_qmf_synthesis_32(sbr, sbr->qmfs[0], X_left, left_channel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 sbr_qmf_synthesis_32(sbr, sbr->qmfs[1], X_right, right_channel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 } else { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
673 if (sbr->bs_header_flag) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 sbr->just_seeked = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
675 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 if (sbr->header_count != 0 && sbr->ret == 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 ret = sbr_save_prev_data(sbr, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 if (ret) return ret; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 sbr_save_matrix(sbr, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
684 sbr->frame++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 #endif |