ref: ceb107d19c8719a75edd2be1fae4666cfbc91936
parent: e8d63fca010802f97552a4e3aaebc61f6802e640
author: menno <menno>
date: Fri May 31 13:18:34 EDT 2002
More ER updates - VCB11 now working - temporarily added gain_control_data() so that the conformance files can be decoded
--- a/libfaad/huffman.h
+++ b/libfaad/huffman.h
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: huffman.h,v 1.5 2002/02/18 10:01:05 menno Exp $
+** $Id: huffman.h,v 1.6 2002/05/31 17:18:34 menno Exp $
**/
#ifndef __HUFFMAN_H__
@@ -102,7 +102,15 @@
case 8:
case 10:
case 11:
+#ifdef ERROR_RESILIENCE
+ /* VCB11 uses codebook 11 */
+ case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+ case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+ /* TODO: If ER is used, some extra error checking should be done */
+ if (cb >= 16)
+ cb = 11;
+#endif
cw = faad_showbits(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
--- a/libfaad/syntax.c
+++ b/libfaad/syntax.c
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: syntax.c,v 1.14 2002/05/30 18:31:51 menno Exp $
+** $Id: syntax.c,v 1.15 2002/05/31 17:18:34 menno Exp $
**/
/*
@@ -498,6 +498,102 @@
return 0;
}
+/* Table 4.4.12 */
+static void gain_control_data(bitfile *ld, ic_stream *ics)
+{
+ uint8_t bd, wd, ad;
+ uint8_t adjust_num[4][8];
+ uint8_t alevcode[4][8][8];
+ uint8_t aloccode[4][8][8];
+
+ uint8_t max_band = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1000,"gain_control_data(): max_band"));
+
+ if (ics->window_sequence == ONLY_LONG_SEQUENCE)
+ {
+ for (bd = 1; bd <= max_band; bd++)
+ {
+ for (wd=0; wd<1; wd++)
+ {
+ adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < adjust_num[bd][wd]; ad++)
+ {
+ alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ } else if (ics->window_sequence == LONG_START_SEQUENCE) {
+ for (bd = 1; bd <= max_band; bd++)
+ {
+ for (wd = 0; wd < 2; wd++)
+ {
+ adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < adjust_num[bd][wd]; ad++)
+ {
+ alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ if (wd == 0)
+ {
+ aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ } else {
+ aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ }
+ } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) {
+ for (bd = 1; bd <= max_band; bd++)
+ {
+ for(wd=0; wd<8; wd++)
+ {
+ adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < adjust_num[bd][wd]; ad++)
+ {
+ alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+ aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ } else if (ics->window_sequence == LONG_STOP_SEQUENCE) {
+ for (bd = 1; bd <= max_band; bd++)
+ {
+ for (wd = 0; wd < 2; wd++)
+ {
+ adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3
+ DEBUGVAR(1,1001,"gain_control_data(): adjust_num"));
+
+ for (ad = 0; ad < adjust_num[bd][wd]; ad++)
+ {
+ alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1002,"gain_control_data(): alevcode"));
+
+ if (wd == 0)
+ {
+ aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ } else {
+ aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5
+ DEBUGVAR(1,1003,"gain_control_data(): aloccode"));
+ }
+ }
+ }
+ }
+ }
+}
+
/* Table 4.4.24 */
static uint8_t individual_channel_stream(element *ele, bitfile *ld,
ic_stream *ics, uint8_t scal_flag,
@@ -563,7 +659,11 @@
if ((ics->gain_control_data_present = faad_get1bit(ld
DEBUGVAR(1,70,"individual_channel_stream(): gain_control_data_present"))) & 1)
{
+#if 0
return 1;
+#else
+ gain_control_data(ld, ics);
+#endif
}
}
--- a/libfaad/syntax.h
+++ b/libfaad/syntax.h
@@ -16,7 +16,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** $Id: syntax.h,v 1.9 2002/05/30 18:31:51 menno Exp $
+** $Id: syntax.h,v 1.10 2002/05/31 17:18:34 menno Exp $
**/
#ifndef __SYNTAX_H__
@@ -330,6 +330,7 @@
,uint8_t aacScalefactorDataResilienceFlag
#endif
);
+static void gain_control_data(bitfile *ld, ic_stream *ics);
static uint8_t spectral_data(ic_stream *ics, bitfile *ld, int16_t *spectral_data,
uint16_t frame_len);
static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);