annotate libfaad2/sbr_huff.c @ 27518:e54c9b7eb0d8

Revert bad changes to SSA/ASS subtitle packet format The following commits are reverted partially or completely: "a valid ASS line contains 9 ',' before actual text" "demux_mkv: output correctly formated ASS packets" "libass: add a new ass_process_data() to process demuxed subtitle packets" These commits converted the internal representation of SSA/ASS subtitle packets from the format used by Matroska to a custom format where each packet has contents exactly matching one line in complete SSA script files. AFAIK no files natively use such a format for muxed subtitles. The stated reason for this change was to use a format that could in principle be muxed into a maximal number of containers. SSA subtitles do not have an implicit duration so both start time and duration or end time need to be specified explicitly; the new format moved timing information inside the codec packet data so it could be muxed without modification into containers that can represent only start time at the container level. However such a change is wrong from the viewpoint of program architecture. Timing information belongs to the demuxer level, but these commits moved not only the duration but also the authoritative value of the start time to inside the codec data. Additionally the new format lost the value of the Matroska ReadOrder field which is used by MPlayer. This commit changes the internal packet format back to that used by Matroska and makes the internal Matroska demuxer output that format again. Libavformat still outputs the "new" format; it could be converted back to the Matroska format in demux_lavf.c, but I'm not adding that code at least yet. The current lavf code has similar problems as the reverted code in MPlayer, and it also currently fails to provide any way to access the value of the ReadOrder field. I hope that the lavf side will be improved; if it isn't conversion can be added later. For now I'll make MPlayer default to the internal Matroska demuxer instead of the lavf one in a separate commit.
author uau
date Mon, 08 Sep 2008 21:26:22 +0000
parents 59b6fa5b4201
children e83eef58b30a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
1 /*
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
3 ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
4 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
5 ** This program is free software; you can redistribute it and/or modify
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
6 ** it under the terms of the GNU General Public License as published by
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
7 ** the Free Software Foundation; either version 2 of the License, or
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
8 ** (at your option) any later version.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
9 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
10 ** This program is distributed in the hope that it will be useful,
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
13 ** GNU General Public License for more details.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
14 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
15 ** You should have received a copy of the GNU General Public License
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
16 ** along with this program; if not, write to the Free Software
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
18 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
19 ** Any non-GPL usage of this software or parts of this software is strictly
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
20 ** forbidden.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
21 **
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
22 ** Commercial non-GPL licensing of this software is possible.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
24 **
18141
59b6fa5b4201 Update to faad2 cvs 20040915+MPlayer fixes
rtognimp
parents: 14727
diff changeset
25 ** $Id: sbr_huff.c,v 1.17 2004/09/04 14:56:28 menno Exp $
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
26 **/
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
27
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
28 #include "common.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
29 #include "structs.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
30
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
31 #ifdef SBR_DEC
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
32
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
33 #include "sbr_syntax.h"
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
34 #include "bits.h"
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
35 #include "sbr_huff.h"
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
36 #include "sbr_e_nf.h"
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
37
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
38
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
39 typedef const int8_t (*sbr_huff_tab)[2];
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
40
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
41 static const int8_t t_huffman_env_1_5dB[120][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
42 { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
43 { 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
44 { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
45 { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
46 { 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
47 { -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
48 { -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
49 { -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
50 { -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
51 { 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
52 { 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
53 { -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
54 {-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
55 {-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
56 {-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
57 { 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
58 { 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
59 { 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
60 { -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
61 { 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
62 { -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
63 { -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
64 { -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
65 { 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
66 { -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
67 { -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
68 { -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
69 { -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
70 { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
71 { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
72 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
73
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
74 static const int8_t f_huffman_env_1_5dB[120][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
75 { 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
76 { 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
77 { 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
78 { -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
79 { 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
80 { 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
81 { 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
82 { 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
83 { 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
84 { 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
85 { -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
86 { 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
87 { 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
88 { -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
89 { 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
90 { 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
91 {-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
92 { 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
93 { 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
94 { 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
95 {-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
96 {-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
97 {-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
98 { 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
99 { -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
100 { -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
101 { -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
102 { -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
103 { -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
104 { -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
105 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
106
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
107 static const int8_t t_huffman_env_bal_1_5dB[48][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
108 { -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
109 { -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
110 { -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
111 { -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
112 { -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
113 { -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
114 { -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
115 { 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
116 { -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
117 { 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
118 { -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
119 { -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
120 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
121
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
122 static const int8_t f_huffman_env_bal_1_5dB[48][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
123 { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
124 { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
125 { -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
126 { -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
127 { -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
128 { -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
129 { -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
130 { -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
131 { 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
132 { -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
133 { 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
134 { 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
135 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
136
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
137 static const int8_t t_huffman_env_3_0dB[62][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
138 { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
139 { -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
140 { -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
141 { -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
142 { -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
143 { -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
144 { -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
145 { -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
146 { 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
147 { -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
148 { 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
149 { 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
150 { 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
151 { 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
152 { 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
153 { -36, -35 }, { -34, -33 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
154 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
155
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
156 static const int8_t f_huffman_env_3_0dB[62][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
157 { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
158 { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
159 { 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
160 { 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
161 { 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
162 { 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
163 { 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
164 { -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
165 { 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
166 { -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
167 { 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
168 { 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
169 { 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
170 { 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
171 { 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
172 { -36, -35 }, { -34, -33 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
173 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
174
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
175 static const int8_t t_huffman_env_bal_3_0dB[24][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
176 { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
177 { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
178 { -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
179 { -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
180 { 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
181 { 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
182 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
183
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
184 static const int8_t f_huffman_env_bal_3_0dB[24][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
185 { -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
186 { -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
187 { -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
188 { -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
189 { -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
190 { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
191 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
192
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
193 static const int8_t t_huffman_noise_3_0dB[62][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
194 { -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
195 { -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
196 { 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
197 { 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
198 { 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
199 { 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
200 { 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
201 { -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
202 { 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
203 { 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
204 { 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
205 { -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
206 { 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
207 { -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
208 { -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
209 { -35, 61 }, { -34, -33 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
210 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
211
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
212 static const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
10725
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
213 { -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
214 { -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
215 { -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
216 { -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
217 { -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 },
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
218 { -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
219 };
e989150f8216 libfaad2 v2.0rc1 imported
arpi
parents:
diff changeset
220
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
221
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
222 static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
223 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
224 uint8_t bit;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
225 int16_t index = 0;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
226
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
227 while (index >= 0)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
228 {
13453
6d50ef45a058 Update FAAD to a 2.1 beta CVS snapshot from 2004.07.12.
diego
parents: 12625
diff changeset
229 bit = (uint8_t)faad_get1bit(ld);
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
230 index = t_huff[index][bit];
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
231 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
232
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
233 return index + 64;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
234 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
235
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
236 /* table 10 */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
237 void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
238 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
239 uint8_t env, band;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
240 int8_t delta = 0;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
241 sbr_huff_tab t_huff, f_huff;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
242
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
243 if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
244 sbr->amp_res[ch] = 0;
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
245 else
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
246 sbr->amp_res[ch] = sbr->bs_amp_res;
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
247
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
248 if ((sbr->bs_coupling) && (ch == 1))
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
249 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
250 delta = 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
251 if (sbr->amp_res[ch])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
252 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
253 t_huff = t_huffman_env_bal_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
254 f_huff = f_huffman_env_bal_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
255 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
256 t_huff = t_huffman_env_bal_1_5dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
257 f_huff = f_huffman_env_bal_1_5dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
258 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
259 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
260 delta = 0;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
261 if (sbr->amp_res[ch])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
262 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
263 t_huff = t_huffman_env_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
264 f_huff = f_huffman_env_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
265 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
266 t_huff = t_huffman_env_1_5dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
267 f_huff = f_huffman_env_1_5dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
268 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
269 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
270
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
271 for (env = 0; env < sbr->L_E[ch]; env++)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
272 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
273 if (sbr->bs_df_env[ch][env] == 0)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
274 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
275 if ((sbr->bs_coupling == 1) && (ch == 1))
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
276 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
277 if (sbr->amp_res[ch])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
278 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
279 sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
280 DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
281 } else {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
282 sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
283 DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
284 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
285 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
286 if (sbr->amp_res[ch])
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
287 {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
288 sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
289 DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
290 } else {
12527
4a370c80fe5c update to the 2.0 release of faad, patch by adland
diego
parents: 10989
diff changeset
291 sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7
10989
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
292 DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
293 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
294 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
295
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
296 for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
297 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
298 sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
299 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
300
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
301 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
302 for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
303 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
304 sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
305 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
306 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
307 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
308
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
309 extract_envelope_data(sbr, ch);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
310 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
311
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
312 /* table 11 */
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
313 void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
314 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
315 uint8_t noise, band;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
316 int8_t delta = 0;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
317 sbr_huff_tab t_huff, f_huff;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
318
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
319 if ((sbr->bs_coupling == 1) && (ch == 1))
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
320 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
321 delta = 1;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
322 t_huff = t_huffman_noise_bal_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
323 f_huff = f_huffman_env_bal_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
324 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
325 delta = 0;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
326 t_huff = t_huffman_noise_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
327 f_huff = f_huffman_env_3_0dB;
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
328 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
329
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
330 for (noise = 0; noise < sbr->L_Q[ch]; noise++)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
331 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
332 if(sbr->bs_df_noise[ch][noise] == 0)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
333 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
334 if ((sbr->bs_coupling == 1) && (ch == 1))
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
335 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
336 sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
337 DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
338 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
339 sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
340 DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
341 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
342 for (band = 1; band < sbr->N_Q; band++)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
343 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
344 sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
345 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
346 } else {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
347 for (band = 0; band < sbr->N_Q; band++)
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
348 {
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
349 sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
350 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
351 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
352 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
353
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
354 extract_noise_floor_data(sbr, ch);
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
355 }
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
356
3185f64f6350 synced with current cvs
alex
parents: 10725
diff changeset
357 #endif