summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libfaad/sbr_dec.c60
-rw-r--r--src/libfaad/sbr_huff.c673
-rw-r--r--src/libfaad/sbr_qmf.c289
-rw-r--r--src/libfaad/sbr_syntax.c609
4 files changed, 0 insertions, 1631 deletions
diff --git a/src/libfaad/sbr_dec.c b/src/libfaad/sbr_dec.c
deleted file mode 100644
index b4f51b726..000000000
--- a/src/libfaad/sbr_dec.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-** FAAD - Freeware Advanced Audio Decoder
-** Copyright (C) 2002 M. Bakker
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-**
-** $Id: sbr_dec.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $
-**/
-
-/*
- SBR Decoder overview:
-
- To achieve a synchronized output signal, the following steps have to be
- acknowledged in the decoder:
- - The bitstream parser divides the bitstream into two parts; the AAC
- core coder part and the SBR part.
- - The SBR bitstream part is fed to the bitstream de-multiplexer followed
- by de-quantization The raw data is Huffman decoded.
- - The AAC bitstream part is fed to the AAC core decoder, where the
- bitstream data of the current frame is decoded, yielding a time domain
- audio signal block of 1024 samples. The block length could easily be
- adapted to other sizes e.g. 960.
- - The core coder audio block is fed to the analysis QMF bank using a
- delay of 1312 samples.
- - The analysis QMF bank performs the filtering of the delayed core coder
- audio signal. The output from the filtering is stored in the matrix
- Xlow. The output from the analysis QMF bank is delayed tHFGen subband
- samples, before being fed to the synthesis QMF bank. To achieve
- synchronization tHFGen = 32, i.e. the value must equal the number of
- subband samples corresponding to one frame.
- - The HF generator calculates XHigh given the matrix XLow. The process
- is guided by the SBR data contained in the current frame.
- - The envelope adjuster calculates the matrix Y given the matrix XHigh
- and the SBR envelope data, extracted from the SBR bitstream. To
- achieve synchronization, tHFAdj has to be set to tHFAdj = 0, i.e. the
- envelope adjuster operates on data delayed tHFGen subband samples.
- - The synthesis QMF bank operates on the delayed output from the analysis
- QMF bank and the output from the envelope adjuster.
- */
-
-#include "common.h"
-
-#ifdef SBR
-
-#include "sbr_syntax.h"
-#include "sbr_qmf.h"
-
-#endif
diff --git a/src/libfaad/sbr_huff.c b/src/libfaad/sbr_huff.c
deleted file mode 100644
index 62413d708..000000000
--- a/src/libfaad/sbr_huff.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/*
-** FAAD - Freeware Advanced Audio Decoder
-** Copyright (C) 2002 M. Bakker
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-**
-** $Id: sbr_huff.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $
-**/
-
-#include "common.h"
-
-#ifdef SBR
-
-#include "bits.h"
-#include "sbr_huff.h"
-
-
-/* huffman tables all have some offset LAV */
-uint16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab *t_huff)
-{
-}
-
-
-sbr_huff_tab t_huffman_env_1_5dB[] = {
-{ /* */ 0, 60},
-{ /* */ 1, 59},
-{ /* */ 4, 61},
-{ /* */ 5, 58},
-{ /* */ 12, 62},
-{ /* */ 13, 57},
-{ /* */ 28, 63},
-{ /* */ 29, 56},
-{ /* */ 60, 64},
-{ /* */ 61, 55},
-{ /* */ 124, 65},
-{ /* */ 125, 54},
-{ /* */ 252, 66},
-{ /* */ 253, 53},
-{ /* */ 508, 67},
-{ /* */ 509, 52},
-{ /* */ 1020, 51},
-{ /* */ 1021, 68},
-{ /* */ 2044, 50},
-{ /* */ 4090, 69},
-{ /* */ 4091, 49},
-{ /* */ 8184, 70},
-{ /* */ 8185, 48},
-{ /* */ 8186, 47},
-{ /* */ 16374, 71},
-{ /* */ 16375, 46},
-{ /* */ 16376, 72},
-{ /* */ 16377, 45},
-{ /* */ 32756, 44},
-{ /* */ 32757, 73},
-{ /* */ 65516, 41},
-{ /* */ 65517, 42},
-{ /* */ 65518, 43},
-{ /* */ 65519, 74},
-{ /* */ 65520, 36},
-{ /* */ 65521, 40},
-{ /* */ 65522, 76},
-{ /* */ 131046, 34},
-{ /* */ 131047, 39},
-{ /* */ 131048, 75},
-{ /* */ 131049, 37},
-{ /* */ 262100, 35},
-{ /* */ 262101, 38},
-{ /* */ 262102, 0},
-{ /* */ 262103, 1},
-{ /* */ 262104, 2},
-{ /* */ 262105, 3},
-{ /* */ 262106, 4},
-{ /* */ 262107, 5},
-{ /* */ 524216, 6},
-{ /* */ 524217, 7},
-{ /* */ 524218, 8},
-{ /* */ 524219, 9},
-{ /* */ 524220, 10},
-{ /* */ 524221, 11},
-{ /* */ 524222, 12},
-{ /* */ 524223, 13},
-{ /* */ 524224, 14},
-{ /* */ 524225, 15},
-{ /* */ 524226, 16},
-{ /* */ 524227, 17},
-{ /* */ 524228, 18},
-{ /* */ 524229, 19},
-{ /* */ 524230, 20},
-{ /* */ 524231, 21},
-{ /* */ 524232, 22},
-{ /* */ 524233, 23},
-{ /* */ 524234, 24},
-{ /* */ 524235, 25},
-{ /* */ 524236, 26},
-{ /* */ 524237, 27},
-{ /* */ 524238, 28},
-{ /* */ 524239, 29},
-{ /* */ 524240, 30},
-{ /* */ 524241, 31},
-{ /* */ 524242, 32},
-{ /* */ 524243, 33},
-{ /* */ 524244, 77},
-{ /* */ 524245, 78},
-{ /* */ 524246, 79},
-{ /* */ 524247, 80},
-{ /* */ 524248, 81},
-{ /* */ 524249, 82},
-{ /* */ 524250, 83},
-{ /* */ 524251, 84},
-{ /* */ 524252, 85},
-{ /* */ 524253, 86},
-{ /* */ 524254, 87},
-{ /* */ 524255, 88},
-{ /* */ 524256, 89},
-{ /* */ 524257, 90},
-{ /* */ 524258, 91},
-{ /* */ 524259, 92},
-{ /* */ 524260, 93},
-{ /* */ 524261, 94},
-{ /* */ 524262, 95},
-{ /* */ 524263, 96},
-{ /* */ 524264, 97},
-{ /* */ 524265, 98},
-{ /* */ 524266, 99},
-{ /* */ 524267, 100},
-{ /* */ 524268, 101},
-{ /* */ 524269, 102},
-{ /* */ 524270, 103},
-{ /* */ 524271, 104},
-{ /* */ 524272, 105},
-{ /* */ 524273, 106},
-{ /* */ 524274, 107},
-{ /* */ 524275, 108},
-{ /* */ 524276, 109},
-{ /* */ 524277, 110},
-{ /* */ 524278, 111},
-{ /* */ 524279, 112},
-{ /* */ 524280, 113},
-{ /* */ 524281, 114},
-{ /* */ 524282, 115},
-{ /* */ 524283, 116},
-{ /* */ 524284, 117},
-{ /* */ 524285, 118},
-{ /* */ 524286, 119},
-{ /* */ 524287, 120}
-};
-
-sbr_huff_tab f_huffman_env_1_5dB[] = {
-{ /* */ 0, 60},
-{ /* */ 1, 59},
-{ /* */ 4, 61},
-{ /* */ 5, 58},
-{ /* */ 12, 57},
-{ /* */ 13, 62},
-{ /* */ 28, 56},
-{ /* */ 29, 63},
-{ /* */ 60, 55},
-{ /* */ 61, 64},
-{ /* */ 124, 54},
-{ /* */ 250, 65},
-{ /* */ 251, 53},
-{ /* */ 252, 66},
-{ /* */ 506, 52},
-{ /* */ 507, 67},
-{ /* */ 508, 51},
-{ /* */ 1018, 68},
-{ /* */ 1019, 50},
-{ /* */ 2040, 69},
-{ /* */ 2041, 49},
-{ /* */ 2042, 70},
-{ /* */ 2043, 71},
-{ /* */ 4088, 48},
-{ /* */ 4089, 72},
-{ /* */ 4090, 47},
-{ /* */ 4091, 73},
-{ /* */ 8184, 74},
-{ /* */ 8185, 46},
-{ /* */ 8186, 45},
-{ /* */ 8187, 75},
-{ /* */ 16376, 76},
-{ /* */ 16377, 77},
-{ /* */ 16378, 44},
-{ /* */ 32758, 43},
-{ /* */ 32759, 42},
-{ /* */ 65520, 41},
-{ /* */ 65521, 78},
-{ /* */ 65522, 79},
-{ /* */ 65523, 40},
-{ /* */ 65524, 39},
-{ /* */ 131050, 80},
-{ /* */ 131051, 81},
-{ /* */ 131052, 36},
-{ /* */ 131053, 37},
-{ /* */ 131054, 38},
-{ /* */ 131055, 34},
-{ /* */ 262112, 32},
-{ /* */ 262113, 82},
-{ /* */ 262114, 83},
-{ /* */ 262115, 85},
-{ /* */ 262116, 19},
-{ /* */ 262117, 35},
-{ /* */ 262118, 86},
-{ /* */ 262119, 87},
-{ /* */ 262120, 30},
-{ /* */ 262121, 33},
-{ /* */ 262122, 84},
-{ /* */ 262123, 88},
-{ /* */ 262124, 104},
-{ /* */ 524250, 9},
-{ /* */ 524251, 14},
-{ /* */ 524252, 16},
-{ /* */ 524253, 17},
-{ /* */ 524254, 23},
-{ /* */ 524255, 27},
-{ /* */ 524256, 29},
-{ /* */ 524257, 31},
-{ /* */ 524258, 90},
-{ /* */ 524259, 97},
-{ /* */ 524260, 102},
-{ /* */ 524261, 107},
-{ /* */ 524262, 108},
-{ /* */ 524263, 0},
-{ /* */ 524264, 1},
-{ /* */ 1048530, 2},
-{ /* */ 1048531, 3},
-{ /* */ 1048532, 4},
-{ /* */ 1048533, 5},
-{ /* */ 1048534, 6},
-{ /* */ 1048535, 7},
-{ /* */ 1048536, 8},
-{ /* */ 1048537, 10},
-{ /* */ 1048538, 11},
-{ /* */ 1048539, 12},
-{ /* */ 1048540, 13},
-{ /* */ 1048541, 15},
-{ /* */ 1048542, 18},
-{ /* */ 1048543, 20},
-{ /* */ 1048544, 21},
-{ /* */ 1048545, 22},
-{ /* */ 1048546, 24},
-{ /* */ 1048547, 25},
-{ /* */ 1048548, 26},
-{ /* */ 1048549, 28},
-{ /* */ 1048550, 89},
-{ /* */ 1048551, 91},
-{ /* */ 1048552, 92},
-{ /* */ 1048553, 93},
-{ /* */ 1048554, 94},
-{ /* */ 1048555, 95},
-{ /* */ 1048556, 96},
-{ /* */ 1048557, 98},
-{ /* */ 1048558, 99},
-{ /* */ 1048559, 100},
-{ /* */ 1048560, 101},
-{ /* */ 1048561, 103},
-{ /* */ 1048562, 105},
-{ /* */ 1048563, 106},
-{ /* */ 1048564, 109},
-{ /* */ 1048565, 110},
-{ /* */ 1048566, 111},
-{ /* */ 1048567, 112},
-{ /* */ 1048568, 113},
-{ /* */ 1048569, 114},
-{ /* */ 1048570, 115},
-{ /* */ 1048571, 116},
-{ /* */ 1048572, 117},
-{ /* */ 1048573, 118},
-{ /* */ 1048574, 119},
-{ /* */ 1048575, 120}
-};
-
-sbr_huff_tab t_huffman_env_bal_1_5dB[] = {
-{ /* */ 0, 24},
-{ /* */ 2, 25},
-{ /* */ 6, 23},
-{ /* */ 14, 26},
-{ /* */ 30, 22},
-{ /* */ 62, 27},
-{ /* */ 126, 21},
-{ /* */ 254, 28},
-{ /* */ 510, 20},
-{ /* */ 2044, 19},
-{ /* */ 2045, 29},
-{ /* */ 4092, 18},
-{ /* */ 4093, 30},
-{ /* */ 32752, 31},
-{ /* */ 65506, 17},
-{ /* */ 65507, 32},
-{ /* */ 65508, 0},
-{ /* */ 65509, 1},
-{ /* */ 65510, 2},
-{ /* */ 65511, 3},
-{ /* */ 65512, 4},
-{ /* */ 65513, 5},
-{ /* */ 65514, 6},
-{ /* */ 65515, 7},
-{ /* */ 65516, 8},
-{ /* */ 65517, 9},
-{ /* */ 65518, 10},
-{ /* */ 65519, 11},
-{ /* */ 65520, 12},
-{ /* */ 65521, 13},
-{ /* */ 65522, 14},
-{ /* */ 65523, 15},
-{ /* */ 65524, 16},
-{ /* */ 65525, 33},
-{ /* */ 65526, 34},
-{ /* */ 65527, 35},
-{ /* */ 65528, 36},
-{ /* */ 65529, 37},
-{ /* */ 65530, 38},
-{ /* */ 131062, 39},
-{ /* */ 131063, 40},
-{ /* */ 131064, 41},
-{ /* */ 131065, 42},
-{ /* */ 131066, 43},
-{ /* */ 131067, 44},
-{ /* */ 131068, 45},
-{ /* */ 131069, 46},
-{ /* */ 131070, 47},
-{ /* */ 131071, 48}
-};
-
-sbr_huff_tab f_huffman_env_bal_1_5dB[] = {
-{ /* */ 0, 24},
-{ /* */ 2, 23},
-{ /* */ 6, 25},
-{ /* */ 14, 22},
-{ /* */ 30, 26},
-{ /* */ 62, 27},
-{ /* */ 115, 21},
-{ /* */ 243, 20},
-{ /* */ 510, 28},
-{ /* */ 2044, 19},
-{ /* */ 2045, 29},
-{ /* */ 2046, 18},
-{ /* */ 4094, 30},
-{ /* */ 16380, 17},
-{ /* */ 32762, 31},
-{ /* */ 65526, 32},
-{ /* */ 65527, 15},
-{ /* */ 131056, 16},
-{ /* */ 262114, 0},
-{ /* */ 262115, 1},
-{ /* */ 262116, 2},
-{ /* */ 262117, 3},
-{ /* */ 262118, 4},
-{ /* */ 262119, 5},
-{ /* */ 262120, 6},
-{ /* */ 262121, 7},
-{ /* */ 262122, 8},
-{ /* */ 262123, 9},
-{ /* */ 262124, 10},
-{ /* */ 262125, 11},
-{ /* */ 262126, 12},
-{ /* */ 262127, 13},
-{ /* */ 262128, 14},
-{ /* */ 262129, 33},
-{ /* */ 262130, 34},
-{ /* */ 262131, 35},
-{ /* */ 262132, 36},
-{ /* */ 262133, 37},
-{ /* */ 262134, 38},
-{ /* */ 262135, 39},
-{ /* */ 262136, 40},
-{ /* */ 262137, 41},
-{ /* */ 262138, 42},
-{ /* */ 262139, 43},
-{ /* */ 262140, 44},
-{ /* */ 262141, 45},
-{ /* */ 262142, 46},
-{ /* */ 524286, 47},
-{ /* */ 524287, 48}
-};
-
-sbr_huff_tab t_huffman_env_3_0dB[] = {
-{ /* */ 0, 31},
-{ /* */ 2, 30},
-{ /* */ 6, 32},
-{ /* */ 14, 29},
-{ /* */ 30, 33},
-{ /* */ 62, 28},
-{ /* */ 126, 34},
-{ /* */ 254, 27},
-{ /* */ 510, 35},
-{ /* */ 2044, 26},
-{ /* */ 2045, 36},
-{ /* */ 4092, 25},
-{ /* */ 8186, 24},
-{ /* */ 8187, 37},
-{ /* */ 16376, 23},
-{ /* */ 16377, 38},
-{ /* */ 16378, 22},
-{ /* */ 16379, 21},
-{ /* */ 16380, 39},
-{ /* */ 32762, 40},
-{ /* */ 65526, 41},
-{ /* */ 65527, 18},
-{ /* */ 65528, 20},
-{ /* */ 65529, 19},
-{ /* */ 131060, 17},
-{ /* */ 131061, 42},
-{ /* */ 262124, 43},
-{ /* */ 262125, 0},
-{ /* */ 262126, 1},
-{ /* */ 524254, 2},
-{ /* */ 524255, 3},
-{ /* */ 524256, 4},
-{ /* */ 524257, 5},
-{ /* */ 524258, 6},
-{ /* */ 524259, 7},
-{ /* */ 524260, 8},
-{ /* */ 524261, 9},
-{ /* */ 524262, 10},
-{ /* */ 524263, 11},
-{ /* */ 524264, 12},
-{ /* */ 524265, 13},
-{ /* */ 524266, 14},
-{ /* */ 524267, 15},
-{ /* */ 524268, 16},
-{ /* */ 524269, 44},
-{ /* */ 524270, 45},
-{ /* */ 524271, 46},
-{ /* */ 524272, 47},
-{ /* */ 524273, 48},
-{ /* */ 524274, 49},
-{ /* */ 524275, 50},
-{ /* */ 524276, 51},
-{ /* */ 524277, 52},
-{ /* */ 524278, 53},
-{ /* */ 524279, 54},
-{ /* */ 524280, 55},
-{ /* */ 524281, 56},
-{ /* */ 524282, 57},
-{ /* */ 524283, 58},
-{ /* */ 524284, 59},
-{ /* */ 524285, 60},
-{ /* */ 524286, 61},
-{ /* */ 524287, 62}
-};
-
-sbr_huff_tab f_huffman_env_3_0dB[] = {
-{ /* */ 0, 31},
-{ /* */ 2, 30},
-{ /* */ 6, 32},
-{ /* */ 14, 29},
-{ /* */ 30, 33},
-{ /* */ 62, 28},
-{ /* */ 252, 34},
-{ /* */ 253, 27},
-{ /* */ 508, 35},
-{ /* */ 509, 26},
-{ /* */ 1020, 36},
-{ /* */ 1021, 25},
-{ /* */ 2044, 37},
-{ /* */ 2045, 24},
-{ /* */ 4092, 38},
-{ /* */ 4093, 23},
-{ /* */ 8188, 39},
-{ /* */ 16378, 40},
-{ /* */ 16379, 22},
-{ /* */ 32760, 21},
-{ /* */ 32761, 41},
-{ /* */ 32762, 42},
-{ /* */ 65526, 20},
-{ /* */ 65527, 19},
-{ /* */ 65528, 43},
-{ /* */ 65529, 44},
-{ /* */ 131060, 18},
-{ /* */ 131061, 16},
-{ /* */ 131062, 45},
-{ /* */ 131063, 46},
-{ /* */ 262128, 17},
-{ /* */ 262129, 49},
-{ /* */ 262130, 13},
-{ /* */ 262131, 7},
-{ /* */ 262132, 12},
-{ /* */ 262133, 47},
-{ /* */ 262134, 48},
-{ /* */ 524270, 9},
-{ /* */ 524271, 10},
-{ /* */ 524272, 15},
-{ /* */ 524273, 51},
-{ /* */ 524274, 52},
-{ /* */ 524275, 53},
-{ /* */ 524276, 56},
-{ /* */ 524277, 8},
-{ /* */ 524278, 11},
-{ /* */ 524279, 55},
-{ /* */ 1048560, 0},
-{ /* */ 1048561, 1},
-{ /* */ 1048562, 2},
-{ /* */ 1048563, 3},
-{ /* */ 1048564, 4},
-{ /* */ 1048565, 5},
-{ /* */ 1048566, 6},
-{ /* */ 1048567, 14},
-{ /* */ 1048568, 50},
-{ /* */ 1048569, 54},
-{ /* */ 1048570, 57},
-{ /* */ 1048571, 58},
-{ /* */ 1048572, 59},
-{ /* */ 1048573, 60},
-{ /* */ 1048574, 61},
-{ /* */ 1048575, 62}
-};
-
-sbr_huff_tab t_huffman_env_bal_3_0dB[] = {
-{ /* */ 0, 12},
-{ /* */ 2, 13},
-{ /* */ 6, 11},
-{ /* */ 14, 10},
-{ /* */ 30, 14},
-{ /* */ 62, 15},
-{ /* */ 126, 9},
-{ /* */ 254, 8},
-{ /* */ 510, 16},
-{ /* */ 4088, 7},
-{ /* */ 8178, 0},
-{ /* */ 8179, 1},
-{ /* */ 8180, 2},
-{ /* */ 8181, 3},
-{ /* */ 8182, 4},
-{ /* */ 8183, 5},
-{ /* */ 8184, 6},
-{ /* */ 8185, 17},
-{ /* */ 8186, 18},
-{ /* */ 8187, 19},
-{ /* */ 8188, 20},
-{ /* */ 8189, 21},
-{ /* */ 8190, 22},
-{ /* */ 16382, 23},
-{ /* */ 16383, 24}
-};
-
-sbr_huff_tab f_huffman_env_bal_3_0dB[] = {
-{ /* */ 0, 12},
-{ /* */ 2, 11},
-{ /* */ 6, 13},
-{ /* */ 14, 10},
-{ /* */ 30, 14},
-{ /* */ 62, 15},
-{ /* */ 126, 9},
-{ /* */ 254, 8},
-{ /* */ 510, 16},
-{ /* */ 2044, 7},
-{ /* */ 4090, 17},
-{ /* */ 8182, 18},
-{ /* */ 8183, 0},
-{ /* */ 8184, 1},
-{ /* */ 8185, 2},
-{ /* */ 8186, 3},
-{ /* */ 8187, 4},
-{ /* */ 16376, 5},
-{ /* */ 16377, 6},
-{ /* */ 16378, 19},
-{ /* */ 16379, 20},
-{ /* */ 16380, 21},
-{ /* */ 16381, 22},
-{ /* */ 16382, 23},
-{ /* */ 16383, 24}
-};
-
-sbr_huff_tab t_huffman_noise_3_0dB[] = {
-{ /* */ 0, 31},
-{ /* */ 2, 32},
-{ /* */ 6, 30},
-{ /* */ 14, 29},
-{ /* */ 30, 33},
-{ /* */ 62, 28},
-{ /* */ 252, 34},
-{ /* */ 253, 27},
-{ /* */ 1016, 35},
-{ /* */ 2034, 26},
-{ /* */ 8140, 36},
-{ /* */ 8141, 42},
-{ /* */ 8142, 0},
-{ /* */ 8143, 1},
-{ /* */ 8144, 2},
-{ /* */ 8145, 3},
-{ /* */ 8146, 4},
-{ /* */ 8147, 5},
-{ /* */ 8148, 6},
-{ /* */ 8149, 7},
-{ /* */ 8150, 8},
-{ /* */ 8151, 9},
-{ /* */ 8152, 10},
-{ /* */ 8153, 11},
-{ /* */ 8154, 12},
-{ /* */ 8155, 13},
-{ /* */ 8156, 14},
-{ /* */ 8157, 15},
-{ /* */ 8158, 16},
-{ /* */ 8159, 17},
-{ /* */ 8160, 18},
-{ /* */ 8161, 19},
-{ /* */ 8162, 20},
-{ /* */ 8163, 21},
-{ /* */ 8164, 22},
-{ /* */ 8165, 23},
-{ /* */ 8166, 24},
-{ /* */ 8167, 25},
-{ /* */ 8168, 37},
-{ /* */ 8169, 38},
-{ /* */ 8170, 39},
-{ /* */ 8171, 40},
-{ /* */ 8172, 41},
-{ /* */ 8173, 43},
-{ /* */ 8174, 44},
-{ /* */ 8175, 45},
-{ /* */ 8176, 46},
-{ /* */ 8177, 47},
-{ /* */ 8178, 48},
-{ /* */ 8179, 49},
-{ /* */ 8180, 50},
-{ /* */ 8181, 51},
-{ /* */ 8182, 52},
-{ /* */ 8183, 53},
-{ /* */ 8184, 54},
-{ /* */ 8185, 55},
-{ /* */ 8186, 56},
-{ /* */ 8187, 57},
-{ /* */ 8188, 58},
-{ /* */ 8189, 59},
-{ /* */ 8190, 60},
-{ /* */ 16382, 61},
-{ /* */ 16383, 62}
-};
-
-sbr_huff_tab t_huffman_noise_bal_3_0dB[] = {
-{ /* */ 0, 12},
-{ /* */ 2, 11},
-{ /* */ 6, 13},
-{ /* */ 28, 10},
-{ /* */ 58, 14},
-{ /* */ 236, 0},
-{ /* */ 237, 1},
-{ /* */ 238, 2},
-{ /* */ 239, 3},
-{ /* */ 240, 4},
-{ /* */ 241, 5},
-{ /* */ 242, 6},
-{ /* */ 243, 7},
-{ /* */ 244, 8},
-{ /* */ 245, 9},
-{ /* */ 246, 15},
-{ /* */ 247, 16},
-{ /* */ 248, 17},
-{ /* */ 249, 18},
-{ /* */ 250, 19},
-{ /* */ 251, 20},
-{ /* */ 252, 21},
-{ /* */ 253, 22},
-{ /* */ 254, 23},
-{ /* */ 255, 24}
-};
-
-sbr_huff_tab *f_huffman_noise_3_0dB = t_huffman_noise_3_0dB;
-sbr_huff_tab *f_huffman_noise_bal_3_0dB = t_huffman_noise_bal_3_0dB;
-
-#endif
diff --git a/src/libfaad/sbr_qmf.c b/src/libfaad/sbr_qmf.c
deleted file mode 100644
index 826790475..000000000
--- a/src/libfaad/sbr_qmf.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-** FAAD - Freeware Advanced Audio Decoder
-** Copyright (C) 2002 M. Bakker
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-**
-** $Id: sbr_qmf.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $
-**/
-
-#include "common.h"
-
-#ifdef SBR
-
-#include "sbr_qmf.h"
-
-void sbr_qmf_analysis(real_t *input, complex_t **Xlow)
-{
- uint8_t l;
- real_t x[320], z[320], u[64];
- real_t *inptr = input;
-
- memset(x, 0, 320*sizeof(real_t));
-
- /* qmf subsample l */
- for (l = 0; l < 32; l++)
- {
- uint8_t k;
- uint16_t n;
-
- /* shift input buffer x */
- for (n = 320 - 1; n <= 0; n--)
- {
- x[n] = x[n - 32];
- }
-
- /* add new samples to input buffer x */
- for (n = 32 - 1; n <= 0; n--)
- {
- x[n] = *inptr++;
- }
-
- /* window by 320 coefficients to produce array z */
- for (n = 0; n < 320; n++)
- {
- z[n] = x[n] * qmf_c[2*n];
- }
-
- /* summation to create array u */
- for (n = 0; n < 64; n++)
- {
- uint8_t j;
-
- u[n] = 0.0;
- for (j = 0; j < 4; j++)
- {
- u[n] += z[n + j * 64];
- }
- }
-
- /* calculate 32 subband samples by introducing Xlow */
- for (k = 0; k < 32; k++)
- {
- Xlow[k][l].re = 0.0;
- Xlow[k][l].im = 0.0;
-
- for (n = 0; n < 64; n++)
- {
- /* complex exponential
- Xlow[k][l] += 2.0 * u[n] * exp(i*M_PI/64.0 * (k + 0.5) * (2.0*n - 0.5));
- */
- Xlow[k][l].re += 2.0 * u[n] * cos(M_PI/64.0 * (k + 0.5) * (2.0*n - 0.5));
- Xlow[k][l].im += 2.0 * u[n] * sin(M_PI/64.0 * (k + 0.5) * (2.0*n - 0.5));
- }
- }
- }
-}
-
-void sbr_qmf_synthesis(complex_t **Xlow, real_t *output)
-{
- uint8_t l, k;
- uint16_t n;
- real_t v[640], w[640];
- real_t *outptr = output;
-
- memset(v, 0, 640 * sizeof(real_t));
-
- /* qmf subsample l */
- for (l = 0; l < 32; l++)
- {
- /* shift buffer */
- for (n = 1280-1; n <= 128; n--)
- {
- v[n] = v[n - 128];
- }
-
- /* calculate 128 samples */
- for (n = 0; n < 128; n++)
- {
- v[n] = 0;
-
- for (k = 0; k < 64; k++)
- {
- complex_t vc;
-
- /* complex exponential
- vc = 64.0 * sin(i*M_PI/128.0 * (k + 0.5) * (2.0*n - 255.0));
- */
- vc.re = 64.0 * cos(M_PI/128.0 * (k + 0.5) * (2.0*n - 255.0));
- vc.im = 64.0 * sin(M_PI/128.0 * (k + 0.5) * (2.0*n - 255.0));
-
- /* take the real part only */
- v[n] += Xlow[k][l].re * vc.re - Xlow[k][l].im * vc.im;
- }
- }
-
- for (n = 0; n < 4; n++)
- {
- for (k = 0; k < 64; k++)
- {
- w[128 * n + k] = v[256 * n + k];
- w[128 * n + 64 + k] = v[256 * n + 192 + k];
- }
- }
-
- /* window */
- for (n = 0; n < 640; n++)
- {
- w[n] *= qmf_c[n];
- }
-
- /* calculate 64 output samples */
- for (k = 0; k < 64; k++)
- {
- real_t sample = 0.0;
-
- for (n = 0; n < 9; n++)
- {
- sample += w[64 * n + k];
- }
-
- *outptr++ = sample;
- }
- }
-}
-
-static real_t qmf_c[] = {
- 0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518, -0.0004875227,
- -0.0004893791, -0.0005040714, -0.0005226564, -0.0005466565, -0.0005677802,
- -0.0005870930, -0.0006132747, -0.0006312493, -0.0006540333, -0.0006777690,
- -0.0006941614, -0.0007157736, -0.0007255043, -0.0007440941, -0.0007490598,
- -0.0007681371, -0.0007724848, -0.0007834332, -0.0007779869, -0.0007803664,
- -0.0007801449, -0.0007757977, -0.0007630793, -0.0007530001, -0.0007319357,
- -0.0007215391, -0.0006917937, -0.0006650415, -0.0006341594, -0.0005946118,
- -0.0005564576, -0.0005145572, -0.0004606325, -0.0004095121, -0.0003501175,
- -0.0002896981, -0.0002098337, -0.0001446380, -0.0000617334, 0.0000134949,
- 0.0001094383, 0.0002043017, 0.0002949531, 0.0004026540, 0.0005107388,
- 0.0006239376, 0.0007458025, 0.0008608443, 0.0009885988, 0.0011250155,
- 0.0012577884, 0.0013902494, 0.0015443219, 0.0016868083, 0.0018348265,
- 0.0019841140, 0.0021461583, 0.0023017254, 0.0024625616, 0.0026201758,
- 0.0027870464, 0.0029469447, 0.0031125420, 0.0032739613, 0.0034418874,
- 0.0036008268, 0.0037603922, 0.0039207432, 0.0040819753, 0.0042264269,
- 0.0043730719, 0.0045209852, 0.0046606460, 0.0047932560, 0.0049137603,
- 0.0050393022, 0.0051407353, 0.0052461166, 0.0053471681, 0.0054196775,
- 0.0054876040, 0.0055475714, 0.0055938023, 0.0056220643, 0.0056455196,
- 0.0056389199, 0.0056266114, 0.0055917128, 0.0055404363, 0.0054753783,
- 0.0053838975, 0.0052715758, 0.0051382275, 0.0049839687, 0.0048109469,
- 0.0046039530, 0.0043801861, 0.0041251642, 0.0038456408, 0.0035401246,
- 0.0032091885, 0.0028446757, 0.0024508540, 0.0020274176, 0.0015784682,
- 0.0010902329, 0.0005832264, 0.0000276045, -0.0005464280, -0.0011568135,
- -0.0018039472, -0.0024826723, -0.0031933778, -0.0039401124, -0.0047222596,
- -0.0055337211, -0.0063792293, -0.0072615816, -0.0081798233, -0.0091325329,
- -0.0101150215, -0.0111315548, -0.0121849995, 0.0132718220, 0.0143904666,
- 0.0155405553, 0.0167324712, 0.0179433381, 0.0191872431, 0.0204531793,
- 0.0217467550, 0.0230680169, 0.0244160992, 0.0257875847, 0.0271859429,
- 0.0286072173, 0.0300502657, 0.0315017608, 0.0329754081, 0.0344620948,
- 0.0359697560, 0.0374812850, 0.0390053679, 0.0405349170, 0.0420649094,
- 0.0436097542, 0.0451488405, 0.0466843027, 0.0482165720, 0.0497385755,
- 0.0512556155, 0.0527630746, 0.0542452768, 0.0557173648, 0.0571616450,
- 0.0585915683, 0.0599837480, 0.0613455171, 0.0626857808, 0.0639715898,
- 0.0652247106, 0.0664367512, 0.0676075985, 0.0687043828, 0.0697630244,
- 0.0707628710, 0.0717002673, 0.0725682583, 0.0733620255, 0.0741003642,
- 0.0747452558, 0.0753137336, 0.0758008358, 0.0761992479, 0.0764992170,
- 0.0767093490, 0.0768173975, 0.0768230011, 0.0767204924, 0.0765050718,
- 0.0761748321, 0.0757305756, 0.0751576255, 0.0744664394, 0.0736406005,
- 0.0726774642, 0.0715826364, 0.0703533073, 0.0689664013, 0.0674525021,
- 0.0657690668, 0.0639444805, 0.0619602779, 0.0598166570, 0.0575152691,
- 0.0550460034, 0.0524093821, 0.0495978676, 0.0466303305, 0.0434768782,
- 0.0401458278, 0.0366418116, 0.0329583930, 0.0290824006, 0.0250307561,
- 0.0207997072, 0.0163701258, 0.0117623832, 0.0069636862, 0.0019765601,
- -0.0032086896, -0.0085711749, -0.0141288827, -0.0198834129, -0.0258227288,
- -0.0319531274, -0.0382776572, -0.0447806821, -0.0514804176, -0.0583705326,
- -0.0654409853, -0.0726943300, -0.0801372934, -0.0877547536, -0.0955533352,
- -0.1035329531, -0.1116826931, -0.1200077984, -0.1285002850, -0.1371551761,
- -0.1459766491, -0.1549607071, -0.1640958855, -0.1733808172, -0.1828172548,
- -0.1923966745, -0.2021250176, -0.2119735853, -0.2219652696, -0.2320690870,
- -0.2423016884, -0.2526480309, -0.2631053299, -0.2736634040, -0.2843214189,
- -0.2950716717, -0.3059098575, -0.3168278913, -0.3278113727, -0.3388722693,
- -0.3499914122, 0.3611589903, 0.3723795546, 0.3836350013, 0.3949211761,
- 0.4062317676, 0.4175696896, 0.4289119920, 0.4402553754, 0.4515996535,
- 0.4629308085, 0.4742453214, 0.4855253091, 0.4967708254, 0.5079817500,
- 0.5191234970, 0.5302240895, 0.5412553448, 0.5522051258, 0.5630789140,
- 0.5738524131, 0.5845403235, 0.5951123086, 0.6055783538, 0.6159109932,
- 0.6261242695, 0.6361980107, 0.6461269695, 0.6559016302, 0.6655139880,
- 0.6749663190, 0.6842353293, 0.6933282376, 0.7022388719, 0.7109410426,
- 0.7194462634, 0.7277448900, 0.7358211758, 0.7436827863, 0.7513137456,
- 0.7587080760, 0.7658674865, 0.7727780881, 0.7794287519, 0.7858353120,
- 0.7919735841, 0.7978466413, 0.8034485751, 0.8087695004, 0.8138191270,
- 0.8185776004, 0.8230419890, 0.8272275347, 0.8311038457, 0.8346937361,
- 0.8379717337, 0.8409541392, 0.8436238281, 0.8459818469, 0.8480315777,
- 0.8497805198, 0.8511971524, 0.8523047035, 0.8531020949, 0.8535720573,
- 0.8537385600, 0.8535720573, 0.8531020949, 0.8523047035, 0.8511971524,
- 0.8497805198, 0.8480315777, 0.8459818469, 0.8436238281, 0.8409541392,
- 0.8379717337, 0.8346937361, 0.8311038457, 0.8272275347, 0.8230419890,
- 0.8185776004, 0.8138191270, 0.8087695004, 0.8034485751, 0.7978466413,
- 0.7919735841, 0.7858353120, 0.7794287519, 0.7727780881, 0.7658674865,
- 0.7587080760, 0.7513137456, 0.7436827863, 0.7358211758, 0.7277448900,
- 0.7194462634, 0.7109410426, 0.7022388719, 0.6933282376, 0.6842353293,
- 0.6749663190, 0.6655139880, 0.6559016302, 0.6461269695, 0.6361980107,
- 0.6261242695, 0.6159109932, 0.6055783538, 0.5951123086, 0.5845403235,
- 0.5738524131, 0.5630789140, 0.5522051258, 0.5412553448, 0.5302240895,
- 0.5191234970, 0.5079817500, 0.4967708254, 0.4855253091, 0.4742453214,
- 0.4629308085, 0.4515996535, 0.4402553754, 0.4289119920, 0.4175696896,
- 0.4062317676, 0.3949211761, 0.3836350013, 0.3723795546, -0.3611589903,
- -0.3499914122, -0.3388722693, -0.3278113727, -0.3168278913, -0.3059098575,
- -0.2950716717, -0.2843214189, -0.2736634040, -0.2631053299, -0.2526480309,
- -0.2423016884, -0.2320690870, -0.2219652696, -0.2119735853, -0.2021250176,
- -0.1923966745, -0.1828172548, -0.1733808172, -0.1640958855, -0.1549607071,
- -0.1459766491, -0.1371551761, -0.1285002850, -0.1200077984, -0.1116826931,
- -0.1035329531, -0.0955533352, -0.0877547536, -0.0801372934, -0.0726943300,
- -0.0654409853, -0.0583705326, -0.0514804176, -0.0447806821, -0.0382776572,
- -0.0319531274, -0.0258227288, -0.0198834129, -0.0141288827, -0.0085711749,
- -0.0032086896, 0.0019765601, 0.0069636862, 0.0117623832, 0.0163701258,
- 0.0207997072, 0.0250307561, 0.0290824006, 0.0329583930, 0.0366418116,
- 0.0401458278, 0.0434768782, 0.0466303305, 0.0495978676, 0.0524093821,
- 0.0550460034, 0.0575152691, 0.0598166570, 0.0619602779, 0.0639444805,
- 0.0657690668, 0.0674525021, 0.0689664013, 0.0703533073, 0.0715826364,
- 0.0726774642, 0.0736406005, 0.0744664394, 0.0751576255, 0.0757305756,
- 0.0761748321, 0.0765050718, 0.0767204924, 0.0768230011, 0.0768173975,
- 0.0767093490, 0.0764992170, 0.0761992479, 0.0758008358, 0.0753137336,
- 0.0747452558, 0.0741003642, 0.0733620255, 0.0725682583, 0.0717002673,
- 0.0707628710, 0.0697630244, 0.0687043828, 0.0676075985, 0.0664367512,
- 0.0652247106, 0.0639715898, 0.0626857808, 0.0613455171, 0.0599837480,
- 0.0585915683, 0.0571616450, 0.0557173648, 0.0542452768, 0.0527630746,
- 0.0512556155, 0.0497385755, 0.0482165720, 0.0466843027, 0.0451488405,
- 0.0436097542, 0.0420649094, 0.0405349170, 0.0390053679, 0.0374812850,
- 0.0359697560, 0.0344620948, 0.0329754081, 0.0315017608, 0.0300502657,
- 0.0286072173, 0.0271859429, 0.0257875847, 0.0244160992, 0.0230680169,
- 0.0217467550, 0.0204531793, 0.0191872431, 0.0179433381, 0.0167324712,
- 0.0155405553, 0.0143904666, -0.0132718220, -0.0121849995, -0.0111315548,
- -0.0101150215, -0.0091325329, -0.0081798233, -0.0072615816, -0.0063792293,
- -0.0055337211, -0.0047222596, -0.0039401124, -0.0031933778, -0.0024826723,
- -0.0018039472, -0.0011568135, -0.0005464280, 0.0000276045, 0.0005832264,
- 0.0010902329, 0.0015784682, 0.0020274176, 0.0024508540, 0.0028446757,
- 0.0032091885, 0.0035401246, 0.0038456408, 0.0041251642, 0.0043801861,
- 0.0046039530, 0.0048109469, 0.0049839687, 0.0051382275, 0.0052715758,
- 0.0053838975, 0.0054753783, 0.0055404363, 0.0055917128, 0.0056266114,
- 0.0056389199, 0.0056455196, 0.0056220643, 0.0055938023, 0.0055475714,
- 0.0054876040, 0.0054196775, 0.0053471681, 0.0052461166, 0.0051407353,
- 0.0050393022, 0.0049137603, 0.0047932560, 0.0046606460, 0.0045209852,
- 0.0043730719, 0.0042264269, 0.0040819753, 0.0039207432, 0.0037603922,
- 0.0036008268, 0.0034418874, 0.0032739613, 0.0031125420, 0.0029469447,
- 0.0027870464, 0.0026201758, 0.0024625616, 0.0023017254, 0.0021461583,
- 0.0019841140, 0.0018348265, 0.0016868083, 0.0015443219, 0.0013902494,
- 0.0012577884, 0.0011250155, 0.0009885988, 0.0008608443, 0.0007458025,
- 0.0006239376, 0.0005107388, 0.0004026540, 0.0002949531, 0.0002043017,
- 0.0001094383, 0.0000134949, -0.0000617334, -0.0001446380, -0.0002098337,
- -0.0002896981, -0.0003501175, -0.0004095121, -0.0004606325, -0.0005145572,
- -0.0005564576, -0.0005946118, -0.0006341594, -0.0006650415, -0.0006917937,
- -0.0007215391, -0.0007319357, -0.0007530001, -0.0007630793, -0.0007757977,
- -0.0007801449, -0.0007803664, -0.0007779869, -0.0007834332, -0.0007724848,
- -0.0007681371, -0.0007490598, -0.0007440941, -0.0007255043, -0.0007157736,
- -0.0006941614, -0.0006777690, -0.0006540333, -0.0006312493, -0.0006132747,
- -0.0005870930, -0.0005677802, -0.0005466565, -0.0005226564, -0.0005040714,
- -0.0004893791, -0.0004875227, -0.0004947518, -0.0005617692, -0.000552528
-};
-
-#endif \ No newline at end of file
diff --git a/src/libfaad/sbr_syntax.c b/src/libfaad/sbr_syntax.c
deleted file mode 100644
index 4d8b8f0ff..000000000
--- a/src/libfaad/sbr_syntax.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/*
-** FAAD - Freeware Advanced Audio Decoder
-** Copyright (C) 2002 M. Bakker
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-**
-** $Id: sbr_syntax.c,v 1.1 2002/07/14 23:43:01 miguelfreitas Exp $
-**/
-
-/*
- This is the initial support for MPEG-4 AAC+SBR
-
- All data is taken from the Working Draft Text for Backward Compatible
- Bandwidth Extension for General Audio Coding (N4611)
-*/
-
-/*
- Mind the sbr_extension() function, it is not defined in the text
- obviously it just reads some bytes.
- */
-
-
-#include "common.h"
-
-#ifdef SBR
-
-#include "sbr_syntax.h"
-#include "syntax.h"
-#include "sbr_huff.h"
-#include "bits.h"
-#include "analysis.h"
-
-/* table 2 */
-uint8_t sbr_bitstream(bitfile *ld, sbr_info *sbr, uint8_t id_aac,
- uint8_t bs_extension_type)
-{
- sbr->bs_crc_flag = faad_get1bit(ld
- DEBUGVAR(1,200,"sbr_bitstream(): bs_crc_flag"));
- if (sbr->bs_crc_flag)
- {
- sbr->bs_sbr_crc_bits = faad_getbits(ld, 7
- DEBUGVAR(1,201,"sbr_bitstream(): bs_sbr_crc_bits"));
- }
-
- if (bs_extension_type == SBR_HDR)
- {
- sbr_header(ld, sbr, id_aac);
- sbr_data(ld, sbr, id_aac);
- } else if (bs_extension_type == SBR_STD) {
- sbr_data(ld, sbr, id_aac);
- }
-}
-
-/* table 3 */
-static void sbr_header(bitfile *ld, sbr_info *sbr, uint8_t id_aac)
-{
- uint8_t bs_header_extra_1, bs_header_extra_2;
-
- sbr->bs_protocol_version = faad_getbits(ld, 2
- DEBUGVAR(1,202,"sbr_header(): bs_protocol_version"));
- sbr->bs_amp_res = faad_get1bit(ld
- DEBUGVAR(1,203,"sbr_header(): bs_amp_res"));
- sbr->bs_start_freq = faad_getbits(ld, 4
- DEBUGVAR(1,204,"sbr_header(): bs_start_freq"));
- sbr->bs_stop_freq = faad_getbits(ld, 4
- DEBUGVAR(1,205,"sbr_header(): bs_stop_freq"));
- sbr->bs_xover_band = faad_getbits(ld, 3
- DEBUGVAR(1,206,"sbr_header(): bs_xover_band"));
- faad_getbits(ld, 3
- DEBUGVAR(1,207,"sbr_header(): bs_reserved"));
- bs_header_extra_1 = faad_get1bit(ld
- DEBUGVAR(1,208,"sbr_header(): bs_header_extra_1"));
- bs_header_extra_2 = faad_get1bit(ld
- DEBUGVAR(1,209,"sbr_header(): bs_header_extra_2"));
-
- if (id_aac == ID_SCE)
- {
- faad_getbits(ld, 2
- DEBUGVAR(1,210,"sbr_header(): bs_reserved"));
- }
-
- if (bs_header_extra_1)
- {
- sbr->bs_freq_scale = faad_getbits(ld, 2
- DEBUGVAR(1,211,"sbr_header(): bs_freq_scale"));
- sbr->bs_alter_scale = faad_get1bit(ld
- DEBUGVAR(1,212,"sbr_header(): bs_alter_scale"));
- sbr->bs_noise_bands = faad_getbits(ld, 2
- DEBUGVAR(1,213,"sbr_header(): bs_noise_bands"));
- }
- if (bs_header_extra_2)
- {
- sbr->bs_limiter_bands = faad_getbits(ld, 2
- DEBUGVAR(1,214,"sbr_header(): bs_limiter_bands"));
- sbr->bs_limiter_gains = faad_getbits(ld, 2
- DEBUGVAR(1,215,"sbr_header(): bs_limiter_gains"));
- sbr->bs_interpol_freq = faad_get1bit(ld
- DEBUGVAR(1,216,"sbr_header(): bs_interpol_freq"));
- sbr->bs_smoothing_mode = faad_get1bit(ld
- DEBUGVAR(1,217,"sbr_header(): bs_smoothing_mode"));
- faad_get1bit(ld
- DEBUGVAR(1,218,"sbr_header(): bs_reserved"));
- }
-}
-
-/* table 4 */
-static void sbr_data(bitfile *ld, sbr_info *sbr, uint8_t id_aac)
-{
- sbr->bs_samplerate_mode = faad_get1bit(ld
- DEBUGVAR(1,219,"sbr_data(): bs_samplerate_mode"));
-
- switch (id_aac)
- {
- case ID_SCE:
- sbr_single_channel_element(ld, sbr);
- break;
- case ID_CPE:
- sbr_channel_pair_element(ld, sbr);
- break;
- }
-}
-
-/* table 5 */
-static void sbr_single_channel_element(bitfile *ld, sbr_info *sbr)
-{
- faad_get1bit(ld
- DEBUGVAR(1,220,"sbr_single_channel_element(): bs_reserved"));
-
- sbr_grid(ld, sbr, 0);
- sbr_dtdf(ld, sbr, 0);
- invf_mode(ld, sbr, 0);
-
- faad_getbits(ld, 2
- DEBUGVAR(1,221,"sbr_single_channel_element(): bs_reserved"));
-
- sbr_envelope(ld, sbr, 0);
- sbr_noise(ld, sbr, 0);
-
- faad_get1bit(ld
- DEBUGVAR(1,222,"sbr_single_channel_element(): bs_reserved"));
-
- faad_get1bit(ld
- DEBUGVAR(1,222,"sbr_single_channel_element(): bs_reserved"));
-
- sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
- DEBUGVAR(1,223,"sbr_single_channel_element(): bs_add_harmonic_flag[0]"));
- if (sbr->bs_add_harmonic_flag[0])
- sinusoidal_coding(ld, sbr, 0);
-
- sbr->bs_extended_data[0] = faad_get1bit(ld
- DEBUGVAR(1,224,"sbr_single_channel_element(): bs_extended_data[0]"));
- if (sbr->bs_extended_data[0])
- {
- uint16_t nr_bits_left;
- uint16_t cnt = faad_getbits(ld, 4
- DEBUGVAR(1,225,"sbr_single_channel_element(): bs_extension_size"));
- if (cnt == 15)
- {
- cnt += faad_getbits(ld, 8
- DEBUGVAR(1,226,"sbr_single_channel_element(): bs_esc_count"));
- }
-
- nr_bits_left = 8 * cnt;
- while (nr_bits_left > 7)
- {
- sbr->bs_extension_id = faad_getbits(ld, 2
- DEBUGVAR(1,227,"sbr_single_channel_element(): bs_extension_id"));
- nr_bits_left -= 2;
- /* sbr_extension(ld, sbr, 0, nr_bits_left); */
- faad_getbits(ld, 6
- DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
- }
- }
-}
-
-/* table 6 */
-static void sbr_channel_pair_element(bitfile *ld, sbr_info *sbr)
-{
- sbr->bs_coupling = faad_get1bit(ld
- DEBUGVAR(1,228,"sbr_channel_pair_element(): bs_coupling"));
-
- if (sbr->bs_coupling)
- {
- sbr_grid(ld, sbr, 0);
- sbr_dtdf(ld, sbr, 0);
- sbr_dtdf(ld, sbr, 1);
- invf_mode(ld, sbr, 0);
-
- faad_getbits(ld, 2
- DEBUGVAR(1,229,"sbr_channel_pair_element(): bs_reserved"));
-
- sbr_envelope(ld, sbr, 0);
- sbr_noise(ld, sbr, 0);
- sbr_envelope(ld, sbr, 1);
- sbr_noise(ld, sbr, 1);
-
- faad_getbits(ld, 2
- DEBUGVAR(1,230,"sbr_channel_pair_element(): bs_reserved"));
-
- sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
- DEBUGVAR(1,231,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
- if (sbr->bs_add_harmonic_flag[0])
- sinusoidal_coding(ld, sbr, 0);
-
- sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
- DEBUGVAR(1,232,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
- if (sbr->bs_add_harmonic_flag[1])
- sinusoidal_coding(ld, sbr, 1);
-
- sbr->bs_extended_data[0] = faad_get1bit(ld
- DEBUGVAR(1,233,"sbr_channel_pair_element(): bs_extended_data[0]"));
- if (sbr->bs_extended_data[0])
- {
- uint16_t nr_bits_left;
- uint16_t cnt = faad_getbits(ld, 4
- DEBUGVAR(1,234,"sbr_channel_pair_element(): bs_extension_size"));
- if (cnt == 15)
- {
- cnt += faad_getbits(ld, 8
- DEBUGVAR(1,235,"sbr_channel_pair_element(): bs_esc_count"));
- }
-
- nr_bits_left = 8 * cnt;
- while (nr_bits_left > 7)
- {
- sbr->bs_extension_id = faad_getbits(ld, 2
- DEBUGVAR(1,236,"sbr_channel_pair_element(): bs_extension_id"));
- nr_bits_left -= 2;
- /* sbr_extension(ld, sbr, 0, nr_bits_left); */
- faad_getbits(ld, 6
- DEBUGVAR(1,280,"sbr_single_channel_element(): bs_extension_data"));
- }
- }
- } else {
- sbr_grid(ld, sbr, 0);
- sbr_grid(ld, sbr, 1);
- sbr_dtdf(ld, sbr, 0);
- sbr_dtdf(ld, sbr, 1);
- invf_mode(ld, sbr, 0);
- invf_mode(ld, sbr, 1);
-
- faad_getbits(ld, 4
- DEBUGVAR(1,237,"sbr_channel_pair_element(): bs_reserved"));
-
- sbr_envelope(ld, sbr, 0);
- sbr_envelope(ld, sbr, 1);
- sbr_noise(ld, sbr, 0);
- sbr_noise(ld, sbr, 1);
-
- faad_getbits(ld, 2
- DEBUGVAR(1,238,"sbr_channel_pair_element(): bs_reserved"));
-
- sbr->bs_add_harmonic_flag[0] = faad_get1bit(ld
- DEBUGVAR(1,239,"sbr_channel_pair_element(): bs_add_harmonic_flag[0]"));
- if (sbr->bs_add_harmonic_flag[0])
- sinusoidal_coding(ld, sbr, 0);
-
- sbr->bs_add_harmonic_flag[1] = faad_get1bit(ld
- DEBUGVAR(1,240,"sbr_channel_pair_element(): bs_add_harmonic_flag[1]"));
- if (sbr->bs_add_harmonic_flag[1])
- sinusoidal_coding(ld, sbr, 1);
-
- sbr->bs_extended_data[0] = faad_get1bit(ld
- DEBUGVAR(1,241,"sbr_channel_pair_element(): bs_extended_data[0]"));
- if (sbr->bs_extended_data[0])
- {
- uint16_t nr_bits_left;
- uint16_t cnt = faad_getbits(ld, 4
- DEBUGVAR(1,242,"sbr_channel_pair_element(): bs_extension_size"));
- if (cnt == 15)
- {
- cnt += faad_getbits(ld, 8
- DEBUGVAR(1,243,"sbr_channel_pair_element(): bs_esc_count"));
- }
-
- nr_bits_left = 8 * cnt;
- while (nr_bits_left > 7)
- {
- sbr->bs_extension_id = faad_getbits(ld, 2
- DEBUGVAR(1,244,"sbr_channel_pair_element(): bs_extension_id"));
- nr_bits_left -= 2;
- /* sbr_extension(ld, sbr, 0, nr_bits_left); */
- faad_getbits(ld, 6
- DEBUGVAR(1,281,"sbr_single_channel_element(): bs_extension_data"));
- }
- }
-
- sbr->bs_extended_data[1] = faad_get1bit(ld
- DEBUGVAR(1,245,"sbr_channel_pair_element(): bs_extended_data[1]"));
- if (sbr->bs_extended_data[1])
- {
- uint16_t nr_bits_left;
- uint16_t cnt = faad_getbits(ld, 4
- DEBUGVAR(1,246,"sbr_channel_pair_element(): bs_extension_size"));
- if (cnt == 15)
- {
- cnt += faad_getbits(ld, 8
- DEBUGVAR(1,247,"sbr_channel_pair_element(): bs_esc_count"));
- }
-
- nr_bits_left = 8 * cnt;
- while (nr_bits_left > 7)
- {
- sbr->bs_extension_id = faad_getbits(ld, 2
- DEBUGVAR(1,248,"sbr_channel_pair_element(): bs_extension_id"));
- nr_bits_left -= 2;
- /* sbr_extension(ld, sbr, 0, nr_bits_left); */
- faad_getbits(ld, 6
- DEBUGVAR(1,282,"sbr_single_channel_element(): bs_extension_data"));
- }
- }
- }
-}
-
-/* table 7 */
-static void sbr_grid(bitfile *ld, sbr_info *sbr, uint8_t ch)
-{
- uint8_t i, env, rel;
- uint8_t bs_abs_bord, bs_abs_bord_1;
-
- sbr->bs_frame_class = faad_getbits(ld, 2
- DEBUGVAR(1,248,"sbr_grid(): bs_frame_class"));
-
- switch (sbr->bs_frame_class)
- {
- case FIXFIX:
- i = faad_getbits(ld, 2
- DEBUGVAR(1,249,"sbr_grid(): bs_num_env_raw"));
-
- sbr->bs_num_env[ch] = min(1 << i, 5);
- if (sbr->bs_num_env[ch] == 1)
- sbr->bs_amp_res = 0;
-
- i = faad_get1bit(ld
- DEBUGVAR(1,250,"sbr_grid(): bs_freq_res_flag"));
- for (env = 0; env < sbr->bs_num_env[ch]; env++)
- sbr->bs_freq_res[ch][env] = i;
-
- sbr->abs_bord_lead[ch] = 0;
- sbr->abs_bord_trail[ch] = NO_TIME_SLOTS;
- break;
-
- case FIXVAR:
- bs_abs_bord = faad_getbits(ld, 3
- DEBUGVAR(1,251,"sbr_grid(): bs_abs_bord")) + NO_TIME_SLOTS;
- sbr->bs_num_env[ch] = faad_getbits(ld, 2
- DEBUGVAR(1,252,"sbr_grid(): bs_num_env")) + 1;
-
- for (rel = 0; rel < sbr->bs_num_env[ch]-1; rel++)
- {
- sbr->bs_rel_bord[ch][rel] = 2 * faad_getbits(ld, 2
- DEBUGVAR(1,253,"sbr_grid(): bs_rel_bord")) + 2;
- }
- i = int_log2((uint32_t)(sbr->bs_num_env[ch] + 1));
- sbr->bs_pointer[ch] = faad_getbits(ld, i
- DEBUGVAR(1,254,"sbr_grid(): bs_pointer"));
-
- for (env = 0; env < sbr->bs_num_env[ch]; env++)
- {
- sbr->bs_freq_res[ch][sbr->bs_num_env[ch] - env - 1] = faad_get1bit(ld
- DEBUGVAR(1,255,"sbr_grid(): bs_freq_res"));
- }
-
- sbr->abs_bord_lead[ch] = 0;
- sbr->abs_bord_trail[ch] = bs_abs_bord;
- break;
-
- case VARFIX:
- bs_abs_bord = faad_getbits(ld, 3
- DEBUGVAR(1,256,"sbr_grid(): bs_abs_bord"));
- sbr->bs_num_env[ch] = faad_getbits(ld, 2
- DEBUGVAR(1,257,"sbr_grid(): bs_num_env")) + 1;
-
- for (rel = 0; rel < sbr->bs_num_env[ch]-1; rel++)
- {
- sbr->bs_rel_bord[ch][rel] = 2 * faad_getbits(ld, 2
- DEBUGVAR(1,258,"sbr_grid(): bs_rel_bord")) + 2;
- }
- i = int_log2((uint32_t)(sbr->bs_num_env[ch] + 1));
- sbr->bs_pointer[ch] = faad_getbits(ld, i
- DEBUGVAR(1,259,"sbr_grid(): bs_pointer"));
-
- for (env = 0; env < sbr->bs_num_env[ch]; env++)
- {
- sbr->bs_freq_res[ch][env] = faad_get1bit(ld
- DEBUGVAR(1,260,"sbr_grid(): bs_freq_res"));
- }
-
- sbr->abs_bord_lead[ch] = bs_abs_bord;
- sbr->abs_bord_trail[ch] = NO_TIME_SLOTS;
- break;
-
- case VARVAR:
- bs_abs_bord = faad_getbits(ld, 3
- DEBUGVAR(1,261,"sbr_grid(): bs_abs_bord_0"));
- bs_abs_bord_1 = faad_getbits(ld, 3
- DEBUGVAR(1,262,"sbr_grid(): bs_abs_bord_1")) + NO_TIME_SLOTS;
- sbr->bs_num_rel_0[ch] = faad_getbits(ld, 2
- DEBUGVAR(1,263,"sbr_grid(): bs_num_rel_0"));
- sbr->bs_num_rel_1[ch] = faad_getbits(ld, 2
- DEBUGVAR(1,264,"sbr_grid(): bs_num_rel_1"));
- sbr->bs_num_env[ch] = sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 1;
-
- for (rel = 0; rel < sbr->bs_num_rel_0[ch]; rel++)
- {
- sbr->bs_rel_bord_0[ch][rel] = 2 * faad_getbits(ld, 2
- DEBUGVAR(1,265,"sbr_grid(): bs_rel_bord")) + 2;
- }
- for(rel = 0; rel < sbr->bs_num_rel_1[ch]; rel++)
- {
- sbr->bs_rel_bord_1[ch][rel] = 2 * faad_getbits(ld, 2
- DEBUGVAR(1,266,"sbr_grid(): bs_rel_bord")) + 2;
- }
- i = int_log2((uint32_t)(sbr->bs_num_rel_0[ch] + sbr->bs_num_rel_1[ch] + 2));
- sbr->bs_pointer[ch] = faad_getbits(ld, i
- DEBUGVAR(1,267,"sbr_grid(): bs_pointer"));
-
- for (env = 0; env < sbr->bs_num_env[ch]; env++)
- {
- sbr->bs_freq_res[ch][env] = faad_get1bit(ld
- DEBUGVAR(1,268,"sbr_grid(): bs_freq_res"));
- }
-
- sbr->abs_bord_lead[ch] = bs_abs_bord;
- sbr->abs_bord_trail[ch] = bs_abs_bord_1;
- break;
- }
-
- if (sbr->bs_num_env[ch] > 1)
- sbr->bs_num_noise[ch] = 2;
- else
- sbr->bs_num_noise[ch] = 1;
-}
-
-/* table 8 */
-static void sbr_dtdf(bitfile *ld, sbr_info *sbr, uint8_t ch)
-{
- uint8_t i;
-
- for (i = 0; i < sbr->bs_num_env[ch]; i++)
- {
- sbr->bs_df_env[ch][i] = faad_get1bit(ld
- DEBUGVAR(1,269,"sbr_dtdf(): bs_df_env"));
- }
-
- for (i = 0; i < sbr->bs_num_noise[ch]; i++)
- {
- sbr->bs_df_noise[ch][i] = faad_get1bit(ld
- DEBUGVAR(1,270,"sbr_dtdf(): bs_df_noise"));
- }
-}
-
-/* table 9 */
-static void invf_mode(bitfile *ld, sbr_info *sbr, uint8_t ch)
-{
- uint8_t n;
-
- for (n = 0; n < sbr->num_noise_bands[ch]; n++)
- {
- sbr->bs_invf_mode_vec[ch][n] = faad_getbits(ld, 2
- DEBUGVAR(1,271,"invf_mode(): bs_invf_mode_vec"));
- }
-}
-
-/* table 10 */
-static void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
-{
- uint8_t env, band;
- sbr_huff_tab *t_huff, *f_huff;
-
- if (sbr->bs_coupling)
- {
- if (ch)
- {
- if (sbr->bs_amp_res)
- {
- t_huff = t_huffman_env_bal_3_0dB;
- f_huff = f_huffman_env_bal_3_0dB;
- } else {
- t_huff = t_huffman_env_bal_1_5dB;
- f_huff = f_huffman_env_bal_1_5dB;
- }
- } else {
- if (sbr->bs_amp_res)
- {
- t_huff = t_huffman_env_3_0dB;
- f_huff = f_huffman_env_3_0dB;
- } else {
- t_huff = t_huffman_env_1_5dB;
- f_huff = f_huffman_env_1_5dB;
- }
- }
- } else {
- if (sbr->bs_amp_res)
- {
- t_huff = t_huffman_env_3_0dB;
- f_huff = f_huffman_env_3_0dB;
- } else {
- t_huff = t_huffman_env_1_5dB;
- f_huff = f_huffman_env_1_5dB;
- }
- }
-
- for (env = 0; env < sbr->bs_num_env[ch]; env++)
- {
- if (sbr->bs_df_env[ch][env] == 0)
- {
- if (sbr->bs_coupling && ch)
- {
- if (sbr->bs_amp_res)
- {
- sbr->bs_data_env[ch][env][0] = faad_getbits(ld, 5
- DEBUGVAR(1,272,"sbr_envelope(): bs_data_env"));
- } else {
- sbr->bs_data_env[ch][env][0] = faad_getbits(ld, 6
- DEBUGVAR(1,273,"sbr_envelope(): bs_data_env"));
- }
- } else {
- if (sbr->bs_amp_res)
- {
- sbr->bs_data_env[ch][env][0] = faad_getbits(ld, 6
- DEBUGVAR(1,274,"sbr_envelope(): bs_data_env"));
- } else {
- sbr->bs_data_env[ch][env][0] = faad_getbits(ld, 7
- DEBUGVAR(1,275,"sbr_envelope(): bs_data_env"));
- }
- for (band = 1; band < sbr->num_env_bands[sbr->bs_freq_res[ch][env]]; band++)
- {
- sbr->bs_data_env[ch][env][band] = sbr_huff_dec(ld, f_huff);
- }
- }
- } else {
- for (band = 0; band < sbr->num_env_bands[sbr->bs_freq_res[ch][env]]; band++)
- sbr->bs_data_env[ch][env][band] = sbr_huff_dec(ld, t_huff);
- }
- }
-}
-
-/* table 11 */
-static void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
-{
- uint8_t noise, band;
- sbr_huff_tab *t_huff, *f_huff;
-
- if (sbr->bs_coupling)
- {
- if (ch) {
- t_huff = t_huffman_noise_bal_3_0dB;
- f_huff = f_huffman_noise_bal_3_0dB;
- } else {
- t_huff = t_huffman_noise_3_0dB;
- f_huff = f_huffman_noise_3_0dB;
- }
- } else {
- t_huff = t_huffman_noise_3_0dB;
- f_huff = f_huffman_noise_3_0dB;
- }
-
- for(noise = 0; noise < sbr->bs_num_noise[ch]; noise++)
- {
- if(sbr->bs_df_noise[ch][noise] == 0)
- {
- if (sbr->bs_coupling && ch)
- {
- sbr->bs_data_noise[ch][noise][0] = faad_getbits(ld, 5
- DEBUGVAR(1,276,"sbr_noise(): bs_data_noise"));
- } else {
- sbr->bs_data_noise[ch][noise][0] = faad_getbits(ld, 5
- DEBUGVAR(1,277,"sbr_noise(): bs_data_noise"));
- }
- for (band = 1; band < sbr->num_noise_bands[ch]; band++)
- {
- sbr->bs_data_noise[ch][noise][band] = sbr_huff_dec(ld, f_huff);
- }
- } else {
- for (band = 0; band < sbr->num_noise_bands[ch]; band++)
- {
- sbr->bs_data_noise[ch][noise][band] = sbr_huff_dec(ld, t_huff);
- }
- }
- }
-}
-
-/* table 12 */
-static void sinusoidal_coding(bitfile *ld, sbr_info *sbr, uint8_t ch)
-{
- uint8_t n;
-
- for (n = 0; n < sbr->num_high_res[ch]; n++)
- {
- sbr->bs_add_harmonic[ch][n] = faad_get1bit(ld
- DEBUGVAR(1,278,"sinusoidal_coding(): bs_add_harmonic"));
- }
-}
-
-
-#endif /* SBR */ \ No newline at end of file