diff options
author | Thibaut Mattern <tmattern@users.sourceforge.net> | 2004-12-03 01:15:29 +0000 |
---|---|---|
committer | Thibaut Mattern <tmattern@users.sourceforge.net> | 2004-12-03 01:15:29 +0000 |
commit | 177aca572a9e0f4256034e51ffded0b3815d4f61 (patch) | |
tree | 071a5f96a627a1c0124ff57a4b806d52068fdba0 | |
parent | 575782a9f76583abd8c4374466472b376023f8dd (diff) | |
download | xine-lib-177aca572a9e0f4256034e51ffded0b3815d4f61.tar.gz xine-lib-177aca572a9e0f4256034e51ffded0b3815d4f61.tar.bz2 |
Update to libfaad2 2.0.
CVS patchset: 7185
CVS date: 2004/12/03 01:15:29
95 files changed, 879 insertions, 368 deletions
diff --git a/src/libfaad/analysis.h b/src/libfaad/analysis.h index 7130699cf..8cec20eb4 100644 --- a/src/libfaad/analysis.h +++ b/src/libfaad/analysis.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: analysis.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: analysis.h,v 1.6 2004/12/03 01:15:29 tmattern Exp $ **/ #ifndef __ANALYSIS_H__ diff --git a/src/libfaad/bits.c b/src/libfaad/bits.c index 15c91da4d..98d0f6730 100644 --- a/src/libfaad/bits.c +++ b/src/libfaad/bits.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: bits.c,v 1.7 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: bits.c,v 1.8 2004/12/03 01:15:29 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/bits.h b/src/libfaad/bits.h index 68153dd5f..c17e4931e 100644 --- a/src/libfaad/bits.h +++ b/src/libfaad/bits.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: bits.h,v 1.8 2004/08/27 19:33:20 valtri Exp $ +** $Id: bits.h,v 1.9 2004/12/03 01:15:29 tmattern Exp $ **/ #ifndef __BITS_H__ @@ -271,7 +271,7 @@ static uint8_t faad_check_CRC(bitfile *ld, uint16_t len) faad_rewindbits(ld); - CRC = ~faad_getbits(ld, 8 + CRC = (uint8_t) ~faad_getbits(ld, 8 DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */ for (; len>0; len--) diff --git a/src/libfaad/cfft.c b/src/libfaad/cfft.c index e8aff8ea3..73811e62d 100644 --- a/src/libfaad/cfft.c +++ b/src/libfaad/cfft.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: cfft.c,v 1.9 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: cfft.c,v 1.10 2004/12/03 01:15:29 tmattern Exp $ **/ /* diff --git a/src/libfaad/cfft.h b/src/libfaad/cfft.h index 199cdf4d2..db567a17d 100644 --- a/src/libfaad/cfft.h +++ b/src/libfaad/cfft.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: cfft.h,v 1.7 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: cfft.h,v 1.8 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __CFFT_H__ diff --git a/src/libfaad/cfft_tab.h b/src/libfaad/cfft_tab.h index ae3c2df68..45a79fcea 100644 --- a/src/libfaad/cfft_tab.h +++ b/src/libfaad/cfft_tab.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: cfft_tab.h,v 1.4 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: cfft_tab.h,v 1.5 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __CFFT_TAB_H__ diff --git a/src/libfaad/codebook/hcb.h b/src/libfaad/codebook/hcb.h index e1df4f398..cb6cdb1b1 100644 --- a/src/libfaad/codebook/hcb.h +++ b/src/libfaad/codebook/hcb.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb.h,v 1.4 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb.h,v 1.5 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __HCB_H__ diff --git a/src/libfaad/codebook/hcb_1.h b/src/libfaad/codebook/hcb_1.h index eeae02e79..e49e19a84 100644 --- a/src/libfaad/codebook/hcb_1.h +++ b/src/libfaad/codebook/hcb_1.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_1.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_1.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_1 */ diff --git a/src/libfaad/codebook/hcb_10.h b/src/libfaad/codebook/hcb_10.h index 8ce4ae2ac..6d69970d2 100644 --- a/src/libfaad/codebook/hcb_10.h +++ b/src/libfaad/codebook/hcb_10.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_10.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_10.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_10 */ diff --git a/src/libfaad/codebook/hcb_11.h b/src/libfaad/codebook/hcb_11.h index b1eb534b7..a03352c07 100644 --- a/src/libfaad/codebook/hcb_11.h +++ b/src/libfaad/codebook/hcb_11.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_11.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_11.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_11 */ diff --git a/src/libfaad/codebook/hcb_2.h b/src/libfaad/codebook/hcb_2.h index 80f2c5883..d90e3360a 100644 --- a/src/libfaad/codebook/hcb_2.h +++ b/src/libfaad/codebook/hcb_2.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_2.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_2.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_2 */ diff --git a/src/libfaad/codebook/hcb_3.h b/src/libfaad/codebook/hcb_3.h index 5efc8f626..57c4383f9 100644 --- a/src/libfaad/codebook/hcb_3.h +++ b/src/libfaad/codebook/hcb_3.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_3.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_3.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* Binary search huffman table HCB_3 */ diff --git a/src/libfaad/codebook/hcb_4.h b/src/libfaad/codebook/hcb_4.h index 68bd8df5d..0fc6be5d1 100644 --- a/src/libfaad/codebook/hcb_4.h +++ b/src/libfaad/codebook/hcb_4.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_4.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_4.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_4 */ diff --git a/src/libfaad/codebook/hcb_5.h b/src/libfaad/codebook/hcb_5.h index ac615c77a..7f6168ddf 100644 --- a/src/libfaad/codebook/hcb_5.h +++ b/src/libfaad/codebook/hcb_5.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_5.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_5.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* Binary search huffman table HCB_5 */ diff --git a/src/libfaad/codebook/hcb_6.h b/src/libfaad/codebook/hcb_6.h index 4f6bcaba6..438420612 100644 --- a/src/libfaad/codebook/hcb_6.h +++ b/src/libfaad/codebook/hcb_6.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_6.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_6.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_6 */ diff --git a/src/libfaad/codebook/hcb_7.h b/src/libfaad/codebook/hcb_7.h index 54bdb8b2a..910b05b32 100644 --- a/src/libfaad/codebook/hcb_7.h +++ b/src/libfaad/codebook/hcb_7.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_7.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_7.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* Binary search huffman table HCB_7 */ diff --git a/src/libfaad/codebook/hcb_8.h b/src/libfaad/codebook/hcb_8.h index 2770882b9..960e3cda2 100644 --- a/src/libfaad/codebook/hcb_8.h +++ b/src/libfaad/codebook/hcb_8.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_8.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_8.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* 2-step huffman table HCB_8 */ diff --git a/src/libfaad/codebook/hcb_9.h b/src/libfaad/codebook/hcb_9.h index 9497d3701..f3eabc79e 100644 --- a/src/libfaad/codebook/hcb_9.h +++ b/src/libfaad/codebook/hcb_9.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_9.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_9.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* Binary search huffman table HCB_9 */ diff --git a/src/libfaad/codebook/hcb_sf.h b/src/libfaad/codebook/hcb_sf.h index 257fd9d35..efdc63e03 100644 --- a/src/libfaad/codebook/hcb_sf.h +++ b/src/libfaad/codebook/hcb_sf.h @@ -1,6 +1,6 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding -** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com +** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com ** ** 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 @@ -22,31 +22,252 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcb_sf.h,v 1.2 2004/01/26 22:34:12 jstembridge Exp $ +** $Id: hcb_sf.h,v 1.3 2004/12/03 01:15:31 tmattern Exp $ **/ /* Binary search huffman table HCB_SF */ -ALIGN static const int8_t hcb_sf[][2] = { - { -61, 1 }, { 2, 3 }, { -62, 4 }, { 5, 6 }, { -60, -63 }, { -59, 7 }, - { 8, 9 }, { -64, -58 }, { 10, 11 }, { 12, 13 }, { -65, -57 }, { -66, -56 }, - { 14, 15 }, { 16, 17 }, { -55, -67 }, { -54, 18 }, { 19, 20 }, { 21, 22 }, - { -68, -53 }, { -69, -52 }, { -70, 23 }, { 24, 25 }, { 26, 27 }, { -51, -71 }, - { -72, -50 }, { 28, 29 }, { 30, 31 }, { 32, 33 }, { -49, -73 }, { -48, -74 }, - { -47, -75 }, { 34, 35 }, { 36, 37 }, { 38, 39 }, { -45, -46 }, { -44, -43 }, - { -76, -78 }, { 40, 41 }, { 42, 43 }, { 44, 45 }, { -77, -42 }, { -79, -80 }, - { -41, -81 }, { 46, 47 }, { 48, 49 }, { 50, 51 }, { -40, -82 }, { -39, -83 }, - { -38, 52 }, { 53, 54 }, { 55, 56 }, { 57, 58 }, { -84, -86 }, { -36, -88 }, - { -85, -87 }, { -37, -89 }, { 59, 60 }, { 61, 62 }, { 63, 64 }, { -34, -32 }, - { -91, -90 }, { 65, 66 }, { 67, 68 }, { 69, 70 }, { 71, 72 }, { -35, -92 }, - { -95, -94 }, { -93, -97 }, { -33, 73 }, { 74, 75 }, { 76, 77 }, { 78, 79 }, - { 80, 81 }, { -96, -99 }, { -98, 82 }, { 83, 84 }, { 85, 86 }, { 87, 88 }, - { 89, 90 }, { 91, 92 }, { 93, 94 }, { 95, 96 }, { -31, -100 }, { -102, -118 }, - { -120, -119 }, { -121, 97 }, { 98, 99 }, { 100, 101 }, { 102, 103 }, - { 104, 105 }, { 106, 107 }, { 108, 109 }, { 110, 111 }, { 112, 113 }, - { 114, 115 }, { 116, 117 }, { 118, 119 }, { -23, -22 }, { -21, -20 }, - { -19, -4 }, { -24, -30 }, { -29, -28 }, { -27, -26 }, { -25, -17 }, - { -10, -9 }, { -8, -7 }, { -6, -5 }, { -11, -16 }, { -15, -14 }, { -13, -12 }, - { -3, -115 }, { -113, -112 }, { -111, -116 }, { -18, -1 }, { -2, -117 }, - { -114, -106 }, { -105, -103 }, { -101, -104 }, { -110, -109 } + +static uint8_t hcb_sf[][2] = { + { /* 0 */ 1, 2 }, + { /* 1 */ 60, 0 }, + { /* 2 */ 1, 2 }, + { /* 3 */ 2, 3 }, + { /* 4 */ 3, 4 }, + { /* 5 */ 59, 0 }, + { /* 6 */ 3, 4 }, + { /* 7 */ 4, 5 }, + { /* 8 */ 5, 6 }, + { /* 9 */ 61, 0 }, + { /* 10 */ 58, 0 }, + { /* 11 */ 62, 0 }, + { /* 12 */ 3, 4 }, + { /* 13 */ 4, 5 }, + { /* 14 */ 5, 6 }, + { /* 15 */ 57, 0 }, + { /* 16 */ 63, 0 }, + { /* 17 */ 4, 5 }, + { /* 18 */ 5, 6 }, + { /* 19 */ 6, 7 }, + { /* 20 */ 7, 8 }, + { /* 21 */ 56, 0 }, + { /* 22 */ 64, 0 }, + { /* 23 */ 55, 0 }, + { /* 24 */ 65, 0 }, + { /* 25 */ 4, 5 }, + { /* 26 */ 5, 6 }, + { /* 27 */ 6, 7 }, + { /* 28 */ 7, 8 }, + { /* 29 */ 66, 0 }, + { /* 30 */ 54, 0 }, + { /* 31 */ 67, 0 }, + { /* 32 */ 5, 6 }, + { /* 33 */ 6, 7 }, + { /* 34 */ 7, 8 }, + { /* 35 */ 8, 9 }, + { /* 36 */ 9, 10 }, + { /* 37 */ 53, 0 }, + { /* 38 */ 68, 0 }, + { /* 39 */ 52, 0 }, + { /* 40 */ 69, 0 }, + { /* 41 */ 51, 0 }, + { /* 42 */ 5, 6 }, + { /* 43 */ 6, 7 }, + { /* 44 */ 7, 8 }, + { /* 45 */ 8, 9 }, + { /* 46 */ 9, 10 }, + { /* 47 */ 70, 0 }, + { /* 48 */ 50, 0 }, + { /* 49 */ 49, 0 }, + { /* 50 */ 71, 0 }, + { /* 51 */ 6, 7 }, + { /* 52 */ 7, 8 }, + { /* 53 */ 8, 9 }, + { /* 54 */ 9, 10 }, + { /* 55 */ 10, 11 }, + { /* 56 */ 11, 12 }, + { /* 57 */ 72, 0 }, + { /* 58 */ 48, 0 }, + { /* 59 */ 73, 0 }, + { /* 60 */ 47, 0 }, + { /* 61 */ 74, 0 }, + { /* 62 */ 46, 0 }, + { /* 63 */ 6, 7 }, + { /* 64 */ 7, 8 }, + { /* 65 */ 8, 9 }, + { /* 66 */ 9, 10 }, + { /* 67 */ 10, 11 }, + { /* 68 */ 11, 12 }, + { /* 69 */ 76, 0 }, + { /* 70 */ 75, 0 }, + { /* 71 */ 77, 0 }, + { /* 72 */ 78, 0 }, + { /* 73 */ 45, 0 }, + { /* 74 */ 43, 0 }, + { /* 75 */ 6, 7 }, + { /* 76 */ 7, 8 }, + { /* 77 */ 8, 9 }, + { /* 78 */ 9, 10 }, + { /* 79 */ 10, 11 }, + { /* 80 */ 11, 12 }, + { /* 81 */ 44, 0 }, + { /* 82 */ 79, 0 }, + { /* 83 */ 42, 0 }, + { /* 84 */ 41, 0 }, + { /* 85 */ 80, 0 }, + { /* 86 */ 40, 0 }, + { /* 87 */ 6, 7 }, + { /* 88 */ 7, 8 }, + { /* 89 */ 8, 9 }, + { /* 90 */ 9, 10 }, + { /* 91 */ 10, 11 }, + { /* 92 */ 11, 12 }, + { /* 93 */ 81, 0 }, + { /* 94 */ 39, 0 }, + { /* 95 */ 82, 0 }, + { /* 96 */ 38, 0 }, + { /* 97 */ 83, 0 }, + { /* 98 */ 7, 8 }, + { /* 99 */ 8, 9 }, + { /* 00 */ 9, 10 }, + { /* 01 */ 10, 11 }, + { /* 02 */ 11, 12 }, + { /* 03 */ 12, 13 }, + { /* 04 */ 13, 14 }, + { /* 05 */ 37, 0 }, + { /* 06 */ 35, 0 }, + { /* 07 */ 85, 0 }, + { /* 08 */ 33, 0 }, + { /* 09 */ 36, 0 }, + { /* 10 */ 34, 0 }, + { /* 11 */ 84, 0 }, + { /* 12 */ 32, 0 }, + { /* 13 */ 6, 7 }, + { /* 14 */ 7, 8 }, + { /* 15 */ 8, 9 }, + { /* 16 */ 9, 10 }, + { /* 17 */ 10, 11 }, + { /* 18 */ 11, 12 }, + { /* 19 */ 87, 0 }, + { /* 20 */ 89, 0 }, + { /* 21 */ 30, 0 }, + { /* 22 */ 31, 0 }, + { /* 23 */ 8, 9 }, + { /* 24 */ 9, 10 }, + { /* 25 */ 10, 11 }, + { /* 26 */ 11, 12 }, + { /* 27 */ 12, 13 }, + { /* 28 */ 13, 14 }, + { /* 29 */ 14, 15 }, + { /* 30 */ 15, 16 }, + { /* 31 */ 86, 0 }, + { /* 32 */ 29, 0 }, + { /* 33 */ 26, 0 }, + { /* 34 */ 27, 0 }, + { /* 35 */ 28, 0 }, + { /* 36 */ 24, 0 }, + { /* 37 */ 88, 0 }, + { /* 38 */ 9, 10 }, + { /* 39 */ 10, 11 }, + { /* 40 */ 11, 12 }, + { /* 41 */ 12, 13 }, + { /* 42 */ 13, 14 }, + { /* 43 */ 14, 15 }, + { /* 44 */ 15, 16 }, + { /* 45 */ 16, 17 }, + { /* 46 */ 17, 18 }, + { /* 47 */ 25, 0 }, + { /* 48 */ 22, 0 }, + { /* 49 */ 23, 0 }, + { /* 50 */ 15, 16 }, + { /* 51 */ 16, 17 }, + { /* 52 */ 17, 18 }, + { /* 53 */ 18, 19 }, + { /* 54 */ 19, 20 }, + { /* 55 */ 20, 21 }, + { /* 56 */ 21, 22 }, + { /* 57 */ 22, 23 }, + { /* 58 */ 23, 24 }, + { /* 59 */ 24, 25 }, + { /* 60 */ 25, 26 }, + { /* 61 */ 26, 27 }, + { /* 62 */ 27, 28 }, + { /* 63 */ 28, 29 }, + { /* 64 */ 29, 30 }, + { /* 65 */ 90, 0 }, + { /* 66 */ 21, 0 }, + { /* 67 */ 19, 0 }, + { /* 68 */ 3, 0 }, + { /* 69 */ 1, 0 }, + { /* 70 */ 2, 0 }, + { /* 71 */ 0, 0 }, + { /* 72 */ 23, 24 }, + { /* 73 */ 24, 25 }, + { /* 74 */ 25, 26 }, + { /* 75 */ 26, 27 }, + { /* 76 */ 27, 28 }, + { /* 77 */ 28, 29 }, + { /* 78 */ 29, 30 }, + { /* 79 */ 30, 31 }, + { /* 80 */ 31, 32 }, + { /* 81 */ 32, 33 }, + { /* 82 */ 33, 34 }, + { /* 83 */ 34, 35 }, + { /* 84 */ 35, 36 }, + { /* 85 */ 36, 37 }, + { /* 86 */ 37, 38 }, + { /* 87 */ 38, 39 }, + { /* 88 */ 39, 40 }, + { /* 89 */ 40, 41 }, + { /* 90 */ 41, 42 }, + { /* 91 */ 42, 43 }, + { /* 92 */ 43, 44 }, + { /* 93 */ 44, 45 }, + { /* 94 */ 45, 46 }, + { /* 95 */ 98, 0 }, + { /* 96 */ 99, 0 }, + { /* 97 */ 100, 0 }, + { /* 98 */ 101, 0 }, + { /* 99 */ 102, 0 }, + { /* 00 */ 117, 0 }, + { /* 01 */ 97, 0 }, + { /* 02 */ 91, 0 }, + { /* 03 */ 92, 0 }, + { /* 04 */ 93, 0 }, + { /* 05 */ 94, 0 }, + { /* 06 */ 95, 0 }, + { /* 07 */ 96, 0 }, + { /* 08 */ 104, 0 }, + { /* 09 */ 111, 0 }, + { /* 10 */ 112, 0 }, + { /* 11 */ 113, 0 }, + { /* 12 */ 114, 0 }, + { /* 13 */ 115, 0 }, + { /* 14 */ 116, 0 }, + { /* 15 */ 110, 0 }, + { /* 16 */ 105, 0 }, + { /* 17 */ 106, 0 }, + { /* 18 */ 107, 0 }, + { /* 19 */ 108, 0 }, + { /* 20 */ 109, 0 }, + { /* 21 */ 118, 0 }, + { /* 22 */ 6, 0 }, + { /* 23 */ 8, 0 }, + { /* 24 */ 9, 0 }, + { /* 25 */ 10, 0 }, + { /* 26 */ 5, 0 }, + { /* 27 */ 103, 0 }, + { /* 28 */ 120, 0 }, + { /* 29 */ 119, 0 }, + { /* 30 */ 4, 0 }, + { /* 31 */ 7, 0 }, + { /* 32 */ 15, 0 }, + { /* 33 */ 16, 0 }, + { /* 34 */ 18, 0 }, + { /* 35 */ 20, 0 }, + { /* 36 */ 17, 0 }, + { /* 37 */ 11, 0 }, + { /* 38 */ 12, 0 }, + { /* 39 */ 14, 0 }, + { /* 40 */ 13, 0 } }; diff --git a/src/libfaad/common.c b/src/libfaad/common.c index e4e587ae6..954d5dee6 100644 --- a/src/libfaad/common.c +++ b/src/libfaad/common.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: common.c,v 1.6 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: common.c,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ /* just some common functions that could be used anywhere */ diff --git a/src/libfaad/common.h b/src/libfaad/common.h index 744df0e45..fb7e27f2b 100644 --- a/src/libfaad/common.h +++ b/src/libfaad/common.h @@ -1,19 +1,19 @@ /* ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding ** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com -** +** ** 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 +** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** ** Any non-GPL usage of this software or parts of this software is strictly @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: common.h,v 1.13 2004/08/27 19:33:20 valtri Exp $ +** $Id: common.h,v 1.14 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __COMMON_H__ @@ -103,13 +103,16 @@ extern "C" { //#define SBR_LOW_POWER //#define PS_DEC -/* FIXED POINT: No MAIN decoding, forced SBR Low Power decoder */ +/* FIXED POINT: No MAIN decoding, no SBR decoding */ #ifdef FIXED_POINT # ifdef MAIN_DEC # undef MAIN_DEC # endif -# ifndef SBR_LOW_POWER -# define SBR_LOW_POWER +//# ifndef SBR_LOW_POWER +//# define SBR_LOW_POWER +//# endif +# ifdef SBR_DEC +# undef SBR_DEC # endif #endif // FIXED_POINT @@ -317,7 +320,6 @@ char *strchr(), *strrchr(); #endif #endif - #ifdef __ICL /* only Intel C compiler has fmath ??? */ #include <mathf.h> diff --git a/src/libfaad/decoder.c b/src/libfaad/decoder.c index 208e4f5e0..3a1dc86de 100644 --- a/src/libfaad/decoder.c +++ b/src/libfaad/decoder.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: decoder.c,v 1.8 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: decoder.c,v 1.9 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" @@ -414,6 +414,7 @@ int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate, /* Take care of buffers */ if (hDecoder->sample_buffer) faad_free(hDecoder->sample_buffer); hDecoder->sample_buffer = NULL; + hDecoder->alloced_channels = 0; for (i = 0; i < MAX_CHANNELS; i++) { @@ -440,13 +441,17 @@ int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate, #endif } -#ifdef SBR_DEC for (i = 0; i < MAX_SYNTAX_ELEMENTS; i++) { +#ifdef SBR_DEC if (hDecoder->sbr[i]) sbrDecodeEnd(hDecoder->sbr[i]); - } + + hDecoder->sbr_alloced[i] = 0; #endif + hDecoder->element_alloced[i] = 0; + hDecoder->element_output_channels[i] = 0; + } hDecoder->fb = filter_bank_init(hDecoder->frameLength); diff --git a/src/libfaad/decoder.h b/src/libfaad/decoder.h index 2b0d3d03a..ad7de8898 100644 --- a/src/libfaad/decoder.h +++ b/src/libfaad/decoder.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: decoder.h,v 1.7 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: decoder.h,v 1.8 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __DECODER_H__ diff --git a/src/libfaad/diff_to_faad2_cvs.patch b/src/libfaad/diff_to_faad2_cvs.patch index c32825f3b..b9772f941 100644 --- a/src/libfaad/diff_to_faad2_cvs.patch +++ b/src/libfaad/diff_to_faad2_cvs.patch @@ -1,7 +1,7 @@ -diff -u -p -r1.1.1.1 common.h ---- common.h 26 Jul 2004 15:27:56 -0000 1.1.1.1 -+++ common.h 30 Jul 2004 00:08:55 -0000 -@@ -145,22 +145,6 @@ extern "C" { +diff -urw /home/thibaut/faad2/libfaad/common.h ./common.h +--- /home/thibaut/faad2/libfaad/common.h 2004-02-06 13:55:24.000000000 +0100 ++++ ./common.h 2004-12-03 01:39:52.000000000 +0100 +@@ -148,24 +148,8 @@ /* END COMPILE TIME DEFINITIONS */ @@ -22,9 +22,12 @@ diff -u -p -r1.1.1.1 common.h -#else - #ifdef HAVE_CONFIG_H - # include "config.h" +-# include "../config.h" ++# include "config.h" #endif -@@ -189,6 +173,8 @@ typedef float float32_t; + + #include <stdio.h> +@@ -192,6 +176,8 @@ #if HAVE_STRINGS_H # include <strings.h> #endif @@ -33,7 +36,7 @@ diff -u -p -r1.1.1.1 common.h #if HAVE_INTTYPES_H # include <inttypes.h> #else -@@ -196,6 +182,17 @@ typedef float float32_t; +@@ -199,6 +185,17 @@ # include <stdint.h> # else /* we need these... */ @@ -51,7 +54,7 @@ diff -u -p -r1.1.1.1 common.h typedef unsigned long long uint64_t; typedef unsigned long uint32_t; typedef unsigned short uint16_t; -@@ -204,6 +201,7 @@ typedef long long int64_t; +@@ -207,6 +204,7 @@ typedef long int32_t; typedef short int16_t; typedef char int8_t; @@ -59,16 +62,16 @@ diff -u -p -r1.1.1.1 common.h # endif #endif #if HAVE_UNISTD_H -@@ -226,8 +224,6 @@ char *strchr(), *strrchr(); - # define memcpy(d, s, n) bcopy((s), (d), (n)) - # define memmove(d, s, n) bcopy((s), (d), (n)) +@@ -231,8 +229,6 @@ # endif --#endif -- #endif +-#endif +- #ifdef WORDS_BIGENDIAN -@@ -292,6 +290,7 @@ + #define ARCH_IS_BIG_ENDIAN + #endif +@@ -295,6 +291,7 @@ } @@ -76,18 +79,19 @@ diff -u -p -r1.1.1.1 common.h #ifdef _WIN32 #define HAS_LRINTF static INLINE int lrintf(float f) -@@ -318,6 +317,7 @@ +@@ -321,7 +318,7 @@ return i; } #endif +- +#endif - #ifdef __ICL /* only Intel C compiler has fmath ??? */ -diff -u -p -r1.1.1.1 bits.h ---- bits.h 26 Jul 2004 15:27:56 -0000 1.1.1.1 -+++ bits.h 30 Jul 2004 09:35:55 -0000 -@@ -56,9 +56,9 @@ typedef struct _bitfile + +diff -urw /home/thibaut/faad2/libfaad/bits.h ./bits.h +--- /home/thibaut/faad2/libfaad/bits.h 2004-02-04 21:07:24.000000000 +0100 ++++ ./bits.h 2004-12-03 01:45:15.000000000 +0100 +@@ -56,9 +56,9 @@ } bitfile; diff --git a/src/libfaad/drc.c b/src/libfaad/drc.c index b361e877f..44fdca7bc 100644 --- a/src/libfaad/drc.c +++ b/src/libfaad/drc.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: drc.c,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: drc.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/drc.h b/src/libfaad/drc.h index 86266c324..5ecebb9fb 100644 --- a/src/libfaad/drc.h +++ b/src/libfaad/drc.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: drc.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: drc.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __DRC_H__ diff --git a/src/libfaad/error.c b/src/libfaad/error.c index bf832e740..8bff809cc 100644 --- a/src/libfaad/error.c +++ b/src/libfaad/error.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: error.c,v 1.6 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: error.c,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/error.h b/src/libfaad/error.h index de0b417a0..3ed783bf8 100644 --- a/src/libfaad/error.h +++ b/src/libfaad/error.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: error.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: error.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __ERROR_H__ diff --git a/src/libfaad/faad.h b/src/libfaad/faad.h index 640f66de1..e46c31d87 100644 --- a/src/libfaad/faad.h +++ b/src/libfaad/faad.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: faad.h,v 1.6 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: faad.h,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __AACDEC_H__ @@ -43,7 +43,7 @@ extern "C" { #endif #endif -#define FAAD2_VERSION "2.0 RC3 " +#define FAAD2_VERSION "2.0 " /* object types for AAC */ #define MAIN 1 diff --git a/src/libfaad/filtbank.c b/src/libfaad/filtbank.c index a664486bf..3fc2cf456 100644 --- a/src/libfaad/filtbank.c +++ b/src/libfaad/filtbank.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: filtbank.c,v 1.8 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: filtbank.c,v 1.9 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/filtbank.h b/src/libfaad/filtbank.h index 8bec0e0ab..04cf9e3c5 100644 --- a/src/libfaad/filtbank.h +++ b/src/libfaad/filtbank.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: filtbank.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: filtbank.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __FILTBANK_H__ diff --git a/src/libfaad/fixed.h b/src/libfaad/fixed.h index a5c44b33b..adca27b80 100644 --- a/src/libfaad/fixed.h +++ b/src/libfaad/fixed.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: fixed.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: fixed.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __FIXED_H__ diff --git a/src/libfaad/hcr.c b/src/libfaad/hcr.c index 8fb614969..34fcf6a7b 100644 --- a/src/libfaad/hcr.c +++ b/src/libfaad/hcr.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: hcr.c,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: hcr.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/huffman.c b/src/libfaad/huffman.c index ae0559ebc..44b78c029 100644 --- a/src/libfaad/huffman.c +++ b/src/libfaad/huffman.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: huffman.c,v 1.3 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: huffman.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" @@ -53,16 +53,22 @@ static int16_t huffman_codebook(uint8_t i); int8_t huffman_scale_factor(bitfile *ld) { - uint8_t bit; - int16_t index = 0; + uint16_t offset = 0; - while (index >= 0) + while (hcb_sf[offset][1]) { - bit = (uint8_t)faad_get1bit(ld); - index = hcb_sf[index][bit]; + uint8_t b = faad_get1bit(ld + DEBUGVAR(1,255,"huffman_scale_factor()")); + offset += hcb_sf[offset][b]; + + if (offset > 240) + { + /* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */ + return -1; + } } - return index + 121; + return hcb_sf[offset][0]; } diff --git a/src/libfaad/huffman.h b/src/libfaad/huffman.h index e34afc9dc..b5968063a 100644 --- a/src/libfaad/huffman.h +++ b/src/libfaad/huffman.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: huffman.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: huffman.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __HUFFMAN_H__ diff --git a/src/libfaad/ic_predict.c b/src/libfaad/ic_predict.c index 7eb18ab5d..f817b77bd 100644 --- a/src/libfaad/ic_predict.c +++ b/src/libfaad/ic_predict.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ic_predict.c,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: ic_predict.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/ic_predict.h b/src/libfaad/ic_predict.h index e7fce1b4f..477ab1d6d 100644 --- a/src/libfaad/ic_predict.h +++ b/src/libfaad/ic_predict.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ic_predict.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: ic_predict.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifdef MAIN_DEC diff --git a/src/libfaad/iq_table.h b/src/libfaad/iq_table.h index f2e326973..ac28224e1 100644 --- a/src/libfaad/iq_table.h +++ b/src/libfaad/iq_table.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: iq_table.h,v 1.4 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: iq_table.h,v 1.5 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef IQ_TABLE_H__ diff --git a/src/libfaad/is.c b/src/libfaad/is.c index 5dc12e8c9..4b998e1fc 100644 --- a/src/libfaad/is.c +++ b/src/libfaad/is.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: is.c,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: is.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/is.h b/src/libfaad/is.h index 66b0cad28..ceaf163cd 100644 --- a/src/libfaad/is.h +++ b/src/libfaad/is.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: is.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: is.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __IS_H__ diff --git a/src/libfaad/kbd_win.h b/src/libfaad/kbd_win.h index 778606419..f25378664 100644 --- a/src/libfaad/kbd_win.h +++ b/src/libfaad/kbd_win.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: kbd_win.h,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: kbd_win.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __KBD_WIN_H__ diff --git a/src/libfaad/lt_predict.c b/src/libfaad/lt_predict.c index cb7b0ad32..447d8a841 100644 --- a/src/libfaad/lt_predict.c +++ b/src/libfaad/lt_predict.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: lt_predict.c,v 1.5 2004/01/26 22:34:10 jstembridge Exp $ +** $Id: lt_predict.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ diff --git a/src/libfaad/lt_predict.h b/src/libfaad/lt_predict.h index 3fcf49bb7..b92f717b4 100644 --- a/src/libfaad/lt_predict.h +++ b/src/libfaad/lt_predict.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: lt_predict.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: lt_predict.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifdef LTP_DEC diff --git a/src/libfaad/mdct.c b/src/libfaad/mdct.c index 54f3a3285..f2564f16a 100644 --- a/src/libfaad/mdct.c +++ b/src/libfaad/mdct.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: mdct.c,v 1.9 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: mdct.c,v 1.10 2004/12/03 01:15:30 tmattern Exp $ **/ /* diff --git a/src/libfaad/mdct.h b/src/libfaad/mdct.h index ef9d274b3..4a42f2344 100644 --- a/src/libfaad/mdct.h +++ b/src/libfaad/mdct.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: mdct.h,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: mdct.h,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __MDCT_H__ diff --git a/src/libfaad/mp4.c b/src/libfaad/mp4.c index 2079f3e48..230dd6b65 100644 --- a/src/libfaad/mp4.c +++ b/src/libfaad/mp4.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: mp4.c,v 1.7 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: mp4.c,v 1.8 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/mp4.h b/src/libfaad/mp4.h index 9d3d07f0f..2cbf4723f 100644 --- a/src/libfaad/mp4.h +++ b/src/libfaad/mp4.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: mp4.h,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: mp4.h,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __MP4_H__ diff --git a/src/libfaad/ms.c b/src/libfaad/ms.c index d94f2e15b..c2a532899 100644 --- a/src/libfaad/ms.c +++ b/src/libfaad/ms.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ms.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ms.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/ms.h b/src/libfaad/ms.h index 29a37b77a..a6cf295ab 100644 --- a/src/libfaad/ms.h +++ b/src/libfaad/ms.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ms.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ms.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __MS_H__ diff --git a/src/libfaad/output.c b/src/libfaad/output.c index adb29db02..5b370c4bd 100644 --- a/src/libfaad/output.c +++ b/src/libfaad/output.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: output.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: output.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" @@ -36,7 +36,7 @@ #define FLOAT_SCALE (1.0f/(1<<15)) -#define DM_MUL REAL_CONST(0.4142135623730950488) // 1/(1+sqrt(2)) +#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) #define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2) @@ -370,6 +370,29 @@ void *output_to_PCM(faacDecHandle hDecoder, #else +#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2)) +#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2) + +static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample, + uint8_t down_matrix, uint8_t *internal_channel) +{ + if (!down_matrix) + return input[internal_channel[channel]][sample]; + + if (channel == 0) + { + real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); + real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2); + real_t cum = input[internal_channel[1]][sample] + C + L_S; + return MUL_F(cum, DM_MUL); + } else { + real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2); + real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2); + real_t cum = input[internal_channel[2]][sample] + C + R_S; + return MUL_F(cum, DM_MUL); + } +} + void* output_to_PCM(faacDecHandle hDecoder, real_t **input, void *sample_buffer, uint8_t channels, uint16_t frame_len, uint8_t format) @@ -387,7 +410,8 @@ void* output_to_PCM(faacDecHandle hDecoder, case FAAD_FMT_16BIT: for(i = 0; i < frame_len; i++) { - int32_t tmp = input[ch][i]; + //int32_t tmp = input[ch][i]; + int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); if (tmp >= 0) { tmp += (1 << (REAL_BITS-1)); @@ -409,7 +433,8 @@ void* output_to_PCM(faacDecHandle hDecoder, case FAAD_FMT_24BIT: for(i = 0; i < frame_len; i++) { - int32_t tmp = input[ch][i]; + //int32_t tmp = input[ch][i]; + int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); if (tmp >= 0) { tmp += (1 << (REAL_BITS-9)); @@ -432,7 +457,8 @@ void* output_to_PCM(faacDecHandle hDecoder, case FAAD_FMT_32BIT: for(i = 0; i < frame_len; i++) { - int32_t tmp = input[ch][i]; + //int32_t tmp = input[ch][i]; + int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel); if (tmp >= 0) { tmp += (1 << (16-REAL_BITS-1)); diff --git a/src/libfaad/output.h b/src/libfaad/output.h index bf3c9ea9d..79a7cd5ea 100644 --- a/src/libfaad/output.h +++ b/src/libfaad/output.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: output.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: output.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __OUTPUT_H__ diff --git a/src/libfaad/pns.c b/src/libfaad/pns.c index 4588d11ef..79beacab7 100644 --- a/src/libfaad/pns.c +++ b/src/libfaad/pns.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: pns.c,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: pns.c,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/pns.h b/src/libfaad/pns.h index 30a52a1b7..2502c21ff 100644 --- a/src/libfaad/pns.h +++ b/src/libfaad/pns.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: pns.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: pns.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __PNS_H__ diff --git a/src/libfaad/pulse.c b/src/libfaad/pulse.c index 28d8b58b2..8a9c335d9 100644 --- a/src/libfaad/pulse.c +++ b/src/libfaad/pulse.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: pulse.c,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: pulse.c,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/pulse.h b/src/libfaad/pulse.h index 9844392df..a3d6d8ce4 100644 --- a/src/libfaad/pulse.h +++ b/src/libfaad/pulse.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: pulse.h,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: pulse.h,v 1.7 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __PULSE_H__ diff --git a/src/libfaad/rvlc.c b/src/libfaad/rvlc.c index 5c7b279f7..a10fe3ca6 100644 --- a/src/libfaad/rvlc.c +++ b/src/libfaad/rvlc.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: rvlc.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: rvlc.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ /* RVLC scalefactor decoding diff --git a/src/libfaad/rvlc.h b/src/libfaad/rvlc.h index 8028a93dd..dbf912db2 100644 --- a/src/libfaad/rvlc.h +++ b/src/libfaad/rvlc.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: rvlc.h,v 1.4 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: rvlc.h,v 1.5 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __RVLC_SCF_H__ diff --git a/src/libfaad/sbr_dct.c b/src/libfaad/sbr_dct.c index 9cfb955cd..b03483795 100644 --- a/src/libfaad/sbr_dct.c +++ b/src/libfaad/sbr_dct.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_dct.c,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_dct.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/sbr_dct.h b/src/libfaad/sbr_dct.h index 1fb1b2230..4eadc5056 100644 --- a/src/libfaad/sbr_dct.h +++ b/src/libfaad/sbr_dct.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_dct.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_dct.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_DCT_H__ diff --git a/src/libfaad/sbr_dec.c b/src/libfaad/sbr_dec.c index e522c787c..1307af4f9 100644 --- a/src/libfaad/sbr_dec.c +++ b/src/libfaad/sbr_dec.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_dec.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_dec.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ @@ -102,7 +102,7 @@ void sbrDecodeEnd(sbr_info *sbr) { qmfa_end(sbr->qmfa[0]); qmfs_end(sbr->qmfs[0]); - if (sbr->id_aac == ID_CPE) + if (sbr->qmfs[1] != NULL) { qmfa_end(sbr->qmfa[1]); qmfs_end(sbr->qmfs[1]); @@ -154,12 +154,11 @@ static uint8_t sbr_save_prev_data(sbr_info *sbr, uint8_t ch) return 0; } -static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, +static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, qmf_t X[MAX_NTSR][64], uint8_t ch, uint8_t dont_process) { int16_t i, k, l; - ALIGN qmf_t X[MAX_NTSR][64]; #ifdef SBR_LOW_POWER ALIGN real_t deg[64]; #endif @@ -267,13 +266,6 @@ static void sbr_process_channel(sbr_info *sbr, real_t *channel_buf, } } - /* subband synthesis */ -#ifndef USE_SSE - sbr_qmf_synthesis_64(sbr, sbr->qmfs[ch], X, channel_buf); -#else - sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[ch], X, channel_buf); -#endif - for (i = 0; i < sbr->tHFGen; i++) { memmove(sbr->Xcodec[ch][i], sbr->Xcodec[ch][i+sbr->numTimeSlotsRate], 32 * sizeof(qmf_t)); @@ -286,6 +278,7 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha { uint8_t dont_process = 0; uint8_t ret = 0; + ALIGN qmf_t X[MAX_NTSR][64]; if (sbr == NULL) return 20; @@ -311,8 +304,21 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha sbr->just_seeked = 0; } - sbr_process_channel(sbr, left_chan, 0, dont_process); - sbr_process_channel(sbr, right_chan, 1, dont_process); + sbr_process_channel(sbr, left_chan, X, 0, dont_process); + /* subband synthesis */ +#ifndef USE_SSE + sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, left_chan); +#else + sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, left_chan); +#endif + + sbr_process_channel(sbr, right_chan, X, 1, dont_process); + /* subband synthesis */ +#ifndef USE_SSE + sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X, right_chan); +#else + sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X, right_chan); +#endif if (sbr->bs_header_flag) sbr->just_seeked = 0; @@ -335,6 +341,7 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, { uint8_t dont_process = 0; uint8_t ret = 0; + ALIGN qmf_t X[MAX_NTSR][64]; if (sbr == NULL) return 20; @@ -360,7 +367,13 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, sbr->just_seeked = 0; } - sbr_process_channel(sbr, channel, 0, dont_process); + sbr_process_channel(sbr, channel, X, 0, dont_process); + /* subband synthesis */ +#ifndef USE_SSE + sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X, channel); +#else + sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X, channel); +#endif if (sbr->bs_header_flag) sbr->just_seeked = 0; @@ -376,4 +389,91 @@ uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, return 0; } +static void ps_dummy_function(qmf_t X_mono[MAX_NTSR][64], + qmf_t X_left[MAX_NTSR][64], qmf_t X_right[MAX_NTSR][64]) +{ + uint8_t i, j; + + for (i = 0; i < MAX_NTSR; i++) + { + for (j = 0; j < 64; j++) + { + QMF_RE(X_left[i][j]) = QMF_RE(X_mono[i][j]); + QMF_RE(X_right[i][j]) = QMF_RE(X_mono[i][j]); +#ifndef SBR_LOW_POWER + QMF_IM(X_left[i][j]) = QMF_IM(X_mono[i][j]); + QMF_IM(X_right[i][j]) = QMF_IM(X_mono[i][j]); +#endif + } + } +} + +#if (defined(PS_DEC) || defined(DRM_PS)) +uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, + const uint8_t just_seeked, const uint8_t upsample_only) +{ + uint8_t dont_process = 0; + uint8_t ret = 0; + ALIGN qmf_t X_mono[MAX_NTSR][64]; + ALIGN qmf_t X_left[MAX_NTSR][64]; + ALIGN qmf_t X_right[MAX_NTSR][64]; + + if (sbr == NULL) + return 20; + + /* case can occur due to bit errors */ + if (sbr->id_aac != ID_SCE && sbr->id_aac != ID_LFE) + return 21; + + if (sbr->ret || (sbr->header_count == 0)) + { + /* don't process just upsample */ + dont_process = 1; + + /* Re-activate reset for next frame */ + if (sbr->ret && sbr->Reset) + sbr->bs_start_freq_prev = -1; + } + + if (just_seeked) + { + sbr->just_seeked = 1; + } else { + sbr->just_seeked = 0; + } + + if (sbr->frame == 0) + { + sbr->qmfs[1] = qmfs_init(64); + } + + sbr_process_channel(sbr, left_channel, X_mono, 0, dont_process); + + /* perform parametric stereo */ + ps_dummy_function(X_mono, X_left, X_right); + + /* subband synthesis */ +#ifndef USE_SSE + sbr_qmf_synthesis_64(sbr, sbr->qmfs[0], X_left, left_channel); + sbr_qmf_synthesis_64(sbr, sbr->qmfs[1], X_right, right_channel); +#else + sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[0], X_left, left_channel); + sbr->qmfs[ch]->qmf_func(sbr, sbr->qmfs[1], X_right, right_channel); +#endif + + if (sbr->bs_header_flag) + sbr->just_seeked = 0; + + if (sbr->header_count != 0 && sbr->ret == 0) + { + ret = sbr_save_prev_data(sbr, 0); + if (ret) return ret; + } + + sbr->frame++; + + return 0; +} +#endif + #endif diff --git a/src/libfaad/sbr_dec.h b/src/libfaad/sbr_dec.h index bf8d82cef..46feaa120 100644 --- a/src/libfaad/sbr_dec.h +++ b/src/libfaad/sbr_dec.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_dec.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_dec.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_DEC_H__ @@ -158,8 +158,10 @@ typedef struct int8_t lcstereo_flag; uint8_t bs_dataextra; uint8_t Is_DRM_SBR; +#ifdef DRM_PS drm_ps_info drm_ps; #endif +#endif uint8_t numTimeSlotsRate; uint8_t numTimeSlots; @@ -169,6 +171,9 @@ typedef struct #ifdef PS_DEC ps_info ps; #endif +#if (defined(PS_DEC) || defined(DRM_PS)) + uint8_t ps_used; +#endif /* to get it compiling */ /* we'll see during the coding of all the tools, whether @@ -221,6 +226,10 @@ uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_cha const uint8_t just_seeked, const uint8_t upsample_only); uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel, const uint8_t just_seeked, const uint8_t upsample_only); +#if (defined(PS_DEC) || defined(DRM_PS)) +uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel, + const uint8_t just_seeked, const uint8_t upsample_only); +#endif #ifdef __cplusplus diff --git a/src/libfaad/sbr_e_nf.c b/src/libfaad/sbr_e_nf.c index 2ba64219f..53d082278 100644 --- a/src/libfaad/sbr_e_nf.c +++ b/src/libfaad/sbr_e_nf.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_e_nf.c,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_e_nf.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/sbr_e_nf.h b/src/libfaad/sbr_e_nf.h index 89ecc47dc..74be8c377 100644 --- a/src/libfaad/sbr_e_nf.h +++ b/src/libfaad/sbr_e_nf.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_e_nf.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_e_nf.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_E_NF_H__ diff --git a/src/libfaad/sbr_fbt.c b/src/libfaad/sbr_fbt.c index ae241a01e..ef7dd7185 100644 --- a/src/libfaad/sbr_fbt.c +++ b/src/libfaad/sbr_fbt.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_fbt.c,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_fbt.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ /* Calculate frequency band tables */ diff --git a/src/libfaad/sbr_fbt.h b/src/libfaad/sbr_fbt.h index a5b29a27b..0a5e0d6ee 100644 --- a/src/libfaad/sbr_fbt.h +++ b/src/libfaad/sbr_fbt.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_fbt.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_fbt.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_FBT_H__ diff --git a/src/libfaad/sbr_hfadj.c b/src/libfaad/sbr_hfadj.c index dad4cc675..55049ce30 100644 --- a/src/libfaad/sbr_hfadj.c +++ b/src/libfaad/sbr_hfadj.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_hfadj.c,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_hfadj.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ /* High Frequency adjustment */ diff --git a/src/libfaad/sbr_hfadj.h b/src/libfaad/sbr_hfadj.h index 3df909159..3fa319eca 100644 --- a/src/libfaad/sbr_hfadj.h +++ b/src/libfaad/sbr_hfadj.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_hfadj.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_hfadj.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_HFADJ_H__ diff --git a/src/libfaad/sbr_hfgen.c b/src/libfaad/sbr_hfgen.c index 01785bdd2..78bab9aa5 100644 --- a/src/libfaad/sbr_hfgen.c +++ b/src/libfaad/sbr_hfgen.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_hfgen.c,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_hfgen.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ /* High Frequency generation */ diff --git a/src/libfaad/sbr_hfgen.h b/src/libfaad/sbr_hfgen.h index d8909abc0..044202e3d 100644 --- a/src/libfaad/sbr_hfgen.h +++ b/src/libfaad/sbr_hfgen.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_hfgen.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_hfgen.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_HFGEN_H__ diff --git a/src/libfaad/sbr_huff.c b/src/libfaad/sbr_huff.c index 954eb2ea7..0c7f5bc44 100644 --- a/src/libfaad/sbr_huff.c +++ b/src/libfaad/sbr_huff.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_huff.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_huff.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/sbr_huff.h b/src/libfaad/sbr_huff.h index 38a1170b2..bd4e79f6e 100644 --- a/src/libfaad/sbr_huff.h +++ b/src/libfaad/sbr_huff.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_huff.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_huff.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_HUFF_H__ diff --git a/src/libfaad/sbr_noise.h b/src/libfaad/sbr_noise.h index 7e39fd8bb..dfb00388a 100644 --- a/src/libfaad/sbr_noise.h +++ b/src/libfaad/sbr_noise.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_noise.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_noise.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_NOISE_H__ diff --git a/src/libfaad/sbr_qmf.c b/src/libfaad/sbr_qmf.c index 93a39ed81..3204e908a 100644 --- a/src/libfaad/sbr_qmf.c +++ b/src/libfaad/sbr_qmf.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_qmf.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_qmf.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/sbr_qmf.h b/src/libfaad/sbr_qmf.h index 9cd0045e2..cfb4f4f17 100644 --- a/src/libfaad/sbr_qmf.h +++ b/src/libfaad/sbr_qmf.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_qmf.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_qmf.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_QMF_H__ diff --git a/src/libfaad/sbr_qmf_c.h b/src/libfaad/sbr_qmf_c.h index df94edbdf..1b9c19286 100644 --- a/src/libfaad/sbr_qmf_c.h +++ b/src/libfaad/sbr_qmf_c.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_qmf_c.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_qmf_c.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_QMF_C_H__ diff --git a/src/libfaad/sbr_syntax.c b/src/libfaad/sbr_syntax.c index 473c90fac..ef649277f 100644 --- a/src/libfaad/sbr_syntax.c +++ b/src/libfaad/sbr_syntax.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_syntax.c,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_syntax.c,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #include "common.h" @@ -693,10 +693,12 @@ static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr, { #ifdef PS_DEC case EXTENSION_ID_PS: + sbr->ps_used = 1; return ps_data(&(sbr->ps), ld); #endif #ifdef DRM_PS case DRM_PARAMETRIC_STEREO: + sbr->ps_used = 1; return drm_ps_data(&(sbr->drm_ps), ld); #endif default: diff --git a/src/libfaad/sbr_syntax.h b/src/libfaad/sbr_syntax.h index 0d91cee91..85b6a1b43 100644 --- a/src/libfaad/sbr_syntax.h +++ b/src/libfaad/sbr_syntax.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_syntax.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_syntax.h,v 1.6 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_SYNTAX_H__ diff --git a/src/libfaad/sbr_tf_grid.c b/src/libfaad/sbr_tf_grid.c index 68ec86d63..db5fc4e2b 100644 --- a/src/libfaad/sbr_tf_grid.c +++ b/src/libfaad/sbr_tf_grid.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_tf_grid.c,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_tf_grid.c,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ /* Time/Frequency grid */ diff --git a/src/libfaad/sbr_tf_grid.h b/src/libfaad/sbr_tf_grid.h index 58b03bc1e..cf9749805 100644 --- a/src/libfaad/sbr_tf_grid.h +++ b/src/libfaad/sbr_tf_grid.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sbr_tf_grid.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sbr_tf_grid.h,v 1.4 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SBR_TF_GRID_H__ diff --git a/src/libfaad/sine_win.h b/src/libfaad/sine_win.h index 341427d53..b5dfd6815 100644 --- a/src/libfaad/sine_win.h +++ b/src/libfaad/sine_win.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: sine_win.h,v 1.4 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: sine_win.h,v 1.5 2004/12/03 01:15:30 tmattern Exp $ **/ #ifndef __SINE_WIN_H__ diff --git a/src/libfaad/specrec.c b/src/libfaad/specrec.c index ed1e2e7b3..f56144807 100644 --- a/src/libfaad/specrec.c +++ b/src/libfaad/specrec.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: specrec.c,v 1.7 2004/02/12 18:30:43 mroi Exp $ +** $Id: specrec.c,v 1.8 2004/12/03 01:15:31 tmattern Exp $ **/ /* @@ -688,16 +688,231 @@ void apply_scalefactors_sse(faacDecHandle hDecoder, ic_stream *ics, } #endif +static uint8_t allocate_single_channel(faacDecHandle hDecoder, uint8_t channel, + uint8_t output_channels) +{ + uint8_t mul = 1; + +#ifdef MAIN_DEC + /* MAIN object type prediction */ + if (hDecoder->object_type == MAIN) + { + /* allocate the state only when needed */ + if (hDecoder->pred_stat[channel] == NULL) + { + hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); + reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); + } + } +#endif + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + /* allocate the state only when needed */ + if (hDecoder->lt_pred_stat[channel] == NULL) + { + hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); + memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); + } + } +#endif + + if (hDecoder->time_out[channel] == NULL) + { + mul = 1; +#ifdef SBR_DEC + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; + if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + { + /* SBR requires 2 times as much output data */ + mul = 2; + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; + } +#endif + hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } +#if (defined(PS_DEC) || defined(DRM_PS)) + if (output_channels == 2) + { + if (hDecoder->time_out[channel+1] == NULL) + { + hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } + } +#endif + + if (hDecoder->fb_intermed[channel] == NULL) + { + hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); + } + +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + { + if (hDecoder->ssr_overlap[channel] == NULL) + { + hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->prev_fmd[channel] == NULL) + { + uint16_t k; + hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + for (k = 0; k < 2*hDecoder->frameLength; k++) + hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); + } + } +#endif + + return 0; +} + +static uint8_t allocate_channel_pair(faacDecHandle hDecoder, + uint8_t channel, uint8_t paired_channel) +{ + uint8_t mul = 1; + +#ifdef MAIN_DEC + /* MAIN object type prediction */ + if (hDecoder->object_type == MAIN) + { + /* allocate the state only when needed */ + if (hDecoder->pred_stat[channel] == NULL) + { + hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); + reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); + } + if (hDecoder->pred_stat[paired_channel] == NULL) + { + hDecoder->pred_stat[paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); + reset_all_predictors(hDecoder->pred_stat[paired_channel], hDecoder->frameLength); + } + } +#endif + +#ifdef LTP_DEC + if (is_ltp_ot(hDecoder->object_type)) + { + /* allocate the state only when needed */ + if (hDecoder->lt_pred_stat[channel] == NULL) + { + hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); + memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); + } + if (hDecoder->lt_pred_stat[paired_channel] == NULL) + { + hDecoder->lt_pred_stat[paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); + memset(hDecoder->lt_pred_stat[paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); + } + } +#endif + + if (hDecoder->time_out[channel] == NULL) + { + mul = 1; +#ifdef SBR_DEC + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; + if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) + { + /* SBR requires 2 times as much output data */ + mul = 2; + hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; + } +#endif + hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->time_out[paired_channel] == NULL) + { + hDecoder->time_out[paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->time_out[paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); + } + + if (hDecoder->fb_intermed[channel] == NULL) + { + hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->fb_intermed[paired_channel] == NULL) + { + hDecoder->fb_intermed[paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->fb_intermed[paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); + } + +#ifdef SSR_DEC + if (hDecoder->object_type == SSR) + { + if (hDecoder->ssr_overlap[cpe->channel] == NULL) + { + hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) + { + hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); + } + if (hDecoder->prev_fmd[cpe->channel] == NULL) + { + uint16_t k; + hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + for (k = 0; k < 2*hDecoder->frameLength; k++) + hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); + } + if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) + { + uint16_t k; + hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); + for (k = 0; k < 2*hDecoder->frameLength; k++) + hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); + } + } +#endif + + return 0; +} + uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, element *sce, int16_t *spec_data) { - uint8_t retval, mul; + uint8_t retval, output_channels; ALIGN real_t spec_coef[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); #endif + + /* determine whether some mono->stereo tool is used */ +#if (defined(PS_DEC) || defined(DRM_PS)) + output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1; +#else + output_channels = 1; +#endif + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) + { + /* element_output_channels not set yet */ + hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; + } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { + /* element inconsistency */ + return 21; + } + + + if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) + { + retval = allocate_single_channel(hDecoder, sce->channel, output_channels); + if (retval > 0) + return retval; + + hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; + } + + /* inverse quantization */ retval = inverse_quantization(spec_coef, spec_data, hDecoder->frameLength); if (retval > 0) @@ -727,13 +942,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { - /* allocate the state only when needed */ - if (hDecoder->pred_stat[sce->channel] == NULL) - { - hDecoder->pred_stat[sce->channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); - reset_all_predictors(hDecoder->pred_stat[sce->channel], hDecoder->frameLength); - } - /* intra channel prediction */ ic_prediction(ics, spec_coef, hDecoder->pred_stat[sce->channel], hDecoder->frameLength, hDecoder->sf_index); @@ -761,13 +969,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, } #endif - /* allocate the state only when needed */ - if (hDecoder->lt_pred_stat[sce->channel] == NULL) - { - hDecoder->lt_pred_stat[sce->channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); - memset(hDecoder->lt_pred_stat[sce->channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); - } - /* long term prediction */ lt_prediction(ics, &(ics->ltp), spec_coef, hDecoder->lt_pred_stat[sce->channel], hDecoder->fb, ics->window_shape, hDecoder->window_shape_prev[sce->channel], @@ -787,28 +988,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, } - if (hDecoder->time_out[sce->channel] == NULL) - { - mul = 1; -#ifdef SBR_DEC - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; - if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - { - /* SBR requires 2 times as much output data */ - mul = 2; - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; - } -#endif - hDecoder->time_out[sce->channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->time_out[sce->channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); - } - - if (hDecoder->fb_intermed[sce->channel] == NULL) - { - hDecoder->fb_intermed[sce->channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->fb_intermed[sce->channel], 0, hDecoder->frameLength*sizeof(real_t)); - } - /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) @@ -826,19 +1005,6 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, #endif #ifdef SSR_DEC } else { - if (hDecoder->ssr_overlap[sce->channel] == NULL) - { - hDecoder->ssr_overlap[sce->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->ssr_overlap[sce->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->prev_fmd[sce->channel] == NULL) - { - uint16_t k; - hDecoder->prev_fmd[sce->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - for (k = 0; k < 2*hDecoder->frameLength; k++) - hDecoder->prev_fmd[sce->channel][k] = REAL_CONST(-1); - } - ssr_decode(&(ics->ssr), hDecoder->fb, ics->window_sequence, ics->window_shape, hDecoder->window_shape_prev[sce->channel], spec_coef, hDecoder->time_out[sce->channel], hDecoder->ssr_overlap[sce->channel], hDecoder->ipqf_buffer[sce->channel], hDecoder->prev_fmd[sce->channel], @@ -875,8 +1041,20 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, ); } - retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch], - hDecoder->postSeekResetFlag, hDecoder->forceUpSampling); + /* check if any of the PS tools is used */ +#if (defined(PS_DEC) || defined(DRM_PS)) + if (output_channels == 1) + { +#endif + retval = sbrDecodeSingleFrame(hDecoder->sbr[ele], hDecoder->time_out[ch], + hDecoder->postSeekResetFlag, hDecoder->forceUpSampling); +#if (defined(PS_DEC) || defined(DRM_PS)) + } else { + retval = sbrDecodeSingleFramePS(hDecoder->sbr[ele], hDecoder->time_out[ch], + hDecoder->time_out[ch+1], hDecoder->postSeekResetFlag, + hDecoder->forceUpSampling); + } +#endif if (retval > 0) return retval; } else if (((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) @@ -892,13 +1070,21 @@ uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2, element *cpe, int16_t *spec_data1, int16_t *spec_data2) { - uint8_t retval, mul = 1; + uint8_t retval; ALIGN real_t spec_coef1[1024]; ALIGN real_t spec_coef2[1024]; #ifdef PROFILE int64_t count = faad_get_ts(); #endif + if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) + { + retval = allocate_channel_pair(hDecoder, cpe->channel, cpe->paired_channel); + if (retval > 0) + return retval; + + hDecoder->element_alloced[hDecoder->fr_ch_ele] = 1; + } /* inverse quantization */ retval = inverse_quantization(spec_coef1, spec_data1, hDecoder->frameLength); @@ -949,18 +1135,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str /* MAIN object type prediction */ if (hDecoder->object_type == MAIN) { - /* allocate the state only when needed */ - if (hDecoder->pred_stat[cpe->channel] == NULL) - { - hDecoder->pred_stat[cpe->channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); - reset_all_predictors(hDecoder->pred_stat[cpe->channel], hDecoder->frameLength); - } - if (hDecoder->pred_stat[cpe->paired_channel] == NULL) - { - hDecoder->pred_stat[cpe->paired_channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); - reset_all_predictors(hDecoder->pred_stat[cpe->paired_channel], hDecoder->frameLength); - } - /* intra channel prediction */ ic_prediction(ics1, spec_coef1, hDecoder->pred_stat[cpe->channel], hDecoder->frameLength, hDecoder->sf_index); @@ -999,18 +1173,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str } #endif - /* allocate the state only when needed */ - if (hDecoder->lt_pred_stat[cpe->channel] == NULL) - { - hDecoder->lt_pred_stat[cpe->channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); - memset(hDecoder->lt_pred_stat[cpe->channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); - } - if (hDecoder->lt_pred_stat[cpe->paired_channel] == NULL) - { - hDecoder->lt_pred_stat[cpe->paired_channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); - memset(hDecoder->lt_pred_stat[cpe->paired_channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); - } - /* long term prediction */ lt_prediction(ics1, ltp1, spec_coef1, hDecoder->lt_pred_stat[cpe->channel], hDecoder->fb, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], @@ -1036,38 +1198,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str drc_decode(hDecoder->drc, spec_coef2); } - if (hDecoder->time_out[cpe->channel] == NULL) - { - mul = 1; -#ifdef SBR_DEC - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; - if ((hDecoder->sbr_present_flag == 1) || (hDecoder->forceUpSampling == 1)) - { - /* SBR requires 2 times as much output data */ - mul = 2; - hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; - } -#endif - hDecoder->time_out[cpe->channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->time_out[cpe->channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->time_out[cpe->paired_channel] == NULL) - { - hDecoder->time_out[cpe->paired_channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->time_out[cpe->paired_channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); - } - - if (hDecoder->fb_intermed[cpe->channel] == NULL) - { - hDecoder->fb_intermed[cpe->channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->fb_intermed[cpe->channel], 0, hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->fb_intermed[cpe->paired_channel] == NULL) - { - hDecoder->fb_intermed[cpe->paired_channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->fb_intermed[cpe->paired_channel], 0, hDecoder->frameLength*sizeof(real_t)); - } - /* filter bank */ #ifdef SSR_DEC if (hDecoder->object_type != SSR) @@ -1092,31 +1222,6 @@ uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_str #endif #ifdef SSR_DEC } else { - if (hDecoder->ssr_overlap[cpe->channel] == NULL) - { - hDecoder->ssr_overlap[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->ssr_overlap[cpe->channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->ssr_overlap[cpe->paired_channel] == NULL) - { - hDecoder->ssr_overlap[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - memset(hDecoder->ssr_overlap[cpe->paired_channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); - } - if (hDecoder->prev_fmd[cpe->channel] == NULL) - { - uint16_t k; - hDecoder->prev_fmd[cpe->channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - for (k = 0; k < 2*hDecoder->frameLength; k++) - hDecoder->prev_fmd[cpe->channel][k] = REAL_CONST(-1); - } - if (hDecoder->prev_fmd[cpe->paired_channel] == NULL) - { - uint16_t k; - hDecoder->prev_fmd[cpe->paired_channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); - for (k = 0; k < 2*hDecoder->frameLength; k++) - hDecoder->prev_fmd[cpe->paired_channel][k] = REAL_CONST(-1); - } - ssr_decode(&(ics1->ssr), hDecoder->fb, ics1->window_sequence, ics1->window_shape, hDecoder->window_shape_prev[cpe->channel], spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->ssr_overlap[cpe->channel], hDecoder->ipqf_buffer[cpe->channel], diff --git a/src/libfaad/specrec.h b/src/libfaad/specrec.h index 83c2a0ade..d64af557b 100644 --- a/src/libfaad/specrec.h +++ b/src/libfaad/specrec.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: specrec.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: specrec.h,v 1.6 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __SPECREC_H__ diff --git a/src/libfaad/ssr.c b/src/libfaad/ssr.c index cb6a19b48..ba0f16554 100644 --- a/src/libfaad/ssr.c +++ b/src/libfaad/ssr.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ssr.c,v 1.4 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr.c,v 1.5 2004/12/03 01:15:31 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/ssr.h b/src/libfaad/ssr.h index 1bd5cd7b1..0c6e3781b 100644 --- a/src/libfaad/ssr.h +++ b/src/libfaad/ssr.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ssr.h,v 1.4 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr.h,v 1.5 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __SSR_H__ diff --git a/src/libfaad/ssr_fb.c b/src/libfaad/ssr_fb.c index 99fea3c95..5fb798976 100644 --- a/src/libfaad/ssr_fb.c +++ b/src/libfaad/ssr_fb.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ssr_fb.c,v 1.4 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr_fb.c,v 1.5 2004/12/03 01:15:31 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/ssr_fb.h b/src/libfaad/ssr_fb.h index e0a49b3ec..96a9be67a 100644 --- a/src/libfaad/ssr_fb.h +++ b/src/libfaad/ssr_fb.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: ssr_fb.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr_fb.h,v 1.4 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __SSR_FB_H__ diff --git a/src/libfaad/ssr_ipqf.c b/src/libfaad/ssr_ipqf.c index 20beaa04f..ef44df1b4 100644 --- a/src/libfaad/ssr_ipqf.c +++ b/src/libfaad/ssr_ipqf.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: ssr_ipqf.c,v 1.4 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr_ipqf.c,v 1.5 2004/12/03 01:15:31 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/ssr_ipqf.h b/src/libfaad/ssr_ipqf.h index d07664b03..c5da651a0 100644 --- a/src/libfaad/ssr_ipqf.h +++ b/src/libfaad/ssr_ipqf.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: ssr_ipqf.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr_ipqf.h,v 1.4 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __SSR_IPQF_H__ diff --git a/src/libfaad/ssr_win.h b/src/libfaad/ssr_win.h index a68517bc6..2276698b5 100644 --- a/src/libfaad/ssr_win.h +++ b/src/libfaad/ssr_win.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: ssr_win.h,v 1.3 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: ssr_win.h,v 1.4 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __SSR_WIN_H__ diff --git a/src/libfaad/structs.h b/src/libfaad/structs.h index c69abf9bc..3defe7a10 100644 --- a/src/libfaad/structs.h +++ b/src/libfaad/structs.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: structs.h,v 1.5 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: structs.h,v 1.6 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __STRUCTS_H__ @@ -381,12 +381,27 @@ typedef struct uint8_t downMatrix; uint8_t first_syn_ele; uint8_t has_lfe; + /* number of channels in current frame */ uint8_t fr_channels; + /* number of elements in current frame */ uint8_t fr_ch_ele; - void *sample_buffer; + /* element_output_channels: + determines the number of channels the element will output + */ + uint8_t element_output_channels[MAX_SYNTAX_ELEMENTS]; + /* element_alloced: + determines whether the data needed for the element is allocated or not + */ + uint8_t element_alloced[MAX_SYNTAX_ELEMENTS]; + /* alloced_channels: + determines the number of channels where output data is allocated for + */ uint8_t alloced_channels; + /* output data buffer */ + void *sample_buffer; + uint8_t window_shape_prev[MAX_CHANNELS]; #ifdef LTP_DEC uint16_t ltp_lag[MAX_CHANNELS]; @@ -400,6 +415,7 @@ typedef struct #ifdef SBR_DEC int8_t sbr_present_flag; int8_t forceUpSampling; + /* determines whether SBR data is allocated for the gives element */ uint8_t sbr_alloced[MAX_SYNTAX_ELEMENTS]; sbr_info *sbr[MAX_SYNTAX_ELEMENTS]; @@ -407,6 +423,9 @@ typedef struct int8_t lcstereo_flag; #endif #endif +#if (defined(PS_DEC) || defined(DRM_PS)) + uint8_t ps_used[MAX_SYNTAX_ELEMENTS]; +#endif #ifdef SSR_DEC real_t *ssr_overlap[MAX_CHANNELS]; @@ -425,7 +444,6 @@ typedef struct uint8_t pce_set; program_config pce; uint8_t element_id[MAX_CHANNELS]; - uint8_t channel_element[MAX_CHANNELS]; uint8_t internal_channel[MAX_CHANNELS]; /* Configuration data */ diff --git a/src/libfaad/syntax.c b/src/libfaad/syntax.c index db79a0c15..5f3657361 100644 --- a/src/libfaad/syntax.c +++ b/src/libfaad/syntax.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: syntax.c,v 1.7 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: syntax.c,v 1.8 2004/12/03 01:15:31 tmattern Exp $ **/ /* @@ -52,6 +52,10 @@ /* static function declarations */ +static void decode_sce_lfe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele); +static void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele); static uint8_t single_lfe_channel_element(faacDecHandle hDecoder, bitfile *ld, uint8_t channel, uint8_t *tag); static uint8_t channel_pair_element(faacDecHandle hDecoder, bitfile *ld, @@ -310,9 +314,9 @@ static uint8_t program_config_element(program_config *pce, bitfile *ld) return 0; } -void decode_sce_lfe(faacDecHandle hDecoder, - faacDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele) +static void decode_sce_lfe(faacDecHandle hDecoder, + faacDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; uint8_t tag = 0; @@ -328,25 +332,35 @@ void decode_sce_lfe(faacDecHandle hDecoder, return; } - if (hDecoder->pce_set) - hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; - else - hDecoder->internal_channel[channels] = channels; + /* for SCE hDecoder->element_output_channels[] is not set here because this + can become 2 when some form of Parametric Stereo coding is used + */ - if (id_syn_ele == ID_SCE) - hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; - else /* LFE */ - hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; + /* save the syntax element id */ hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; + /* decode the element */ hInfo->error = single_lfe_channel_element(hDecoder, ld, channels, &tag); - hDecoder->fr_channels++; + /* map output channels position to internal data channels */ + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) + { + /* this might be faulty when pce_set is true */ + hDecoder->internal_channel[channels] = channels; + hDecoder->internal_channel[channels+1] = channels+1; + } else { + if (hDecoder->pce_set) + hDecoder->internal_channel[hDecoder->pce.sce_channel[tag]] = channels; + else + hDecoder->internal_channel[channels] = channels; + } + + hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; hDecoder->fr_ch_ele++; } -void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele) +static void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, + uint8_t id_syn_ele) { uint8_t channels = hDecoder->fr_channels; uint8_t tag = 0; @@ -362,6 +376,24 @@ void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, return; } + /* for CPE the number of output channels is always 2 */ + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) + { + /* element_output_channels not set yet */ + hDecoder->element_output_channels[hDecoder->fr_ch_ele] = 2; + } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != 2) { + /* element inconsistency */ + hInfo->error = 21; + return; + } + + /* save the syntax element id */ + hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; + + /* decode the element */ + hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); + + /* map output channel position to internal data channels */ if (hDecoder->pce_set) { hDecoder->internal_channel[hDecoder->pce.cpe_channel[tag]] = channels; @@ -371,12 +403,6 @@ void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, hDecoder->internal_channel[channels+1] = channels+1; } - hDecoder->channel_element[channels] = hDecoder->fr_ch_ele; - hDecoder->channel_element[channels+1] = hDecoder->fr_ch_ele; - hDecoder->element_id[hDecoder->fr_ch_ele] = id_syn_ele; - - hInfo->error = channel_pair_element(hDecoder, ld, channels, &tag); - hDecoder->fr_channels += 2; hDecoder->fr_ch_ele++; } @@ -385,7 +411,6 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc) { uint8_t id_syn_ele; - uint8_t ch_ele = 0; hDecoder->fr_channels = 0; hDecoder->fr_ch_ele = 0; @@ -404,21 +429,18 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, case ID_SCE: if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); - ch_ele++; if (hInfo->error > 0) return; break; case ID_CPE: if (hDecoder->first_syn_ele == 25) hDecoder->first_syn_ele = id_syn_ele; decode_cpe(hDecoder, hInfo, ld, id_syn_ele); - ch_ele++; if (hInfo->error > 0) return; break; case ID_LFE: hDecoder->has_lfe++; decode_sce_lfe(hDecoder, hInfo, ld, id_syn_ele); - ch_ele++; if (hInfo->error > 0) return; break; @@ -448,7 +470,6 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, /* SBR data will be read directly in the SCE/LFE/CPE element */ if ((hInfo->error = fill_element(hDecoder, ld, drc #ifdef SBR_DEC - //, (ch_ele == 0) ? INVALID_SBR_ELEMENT : (ch_ele-1) , INVALID_SBR_ELEMENT #endif )) > 0) @@ -463,67 +484,48 @@ void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, { case 1: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; if (hInfo->error > 0) return; break; case 2: decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; if (hInfo->error > 0) return; break; case 3: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; if (hInfo->error > 0) return; break; case 4: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; if (hInfo->error > 0) return; break; case 5: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; if (hInfo->error > 0) return; break; case 6: decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); - ch_ele++; if (hInfo->error > 0) return; break; - case 7: + case 7: /* 8 channels */ decode_sce_lfe(hDecoder, hInfo, ld, ID_SCE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_cpe(hDecoder, hInfo, ld, ID_CPE); - ch_ele++; decode_sce_lfe(hDecoder, hInfo, ld, ID_LFE); - ch_ele++; if (hInfo->error > 0) return; break; @@ -995,6 +997,12 @@ static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc /* parse the SBR data */ hDecoder->sbr[sbr_ele]->ret = sbr_extension_data(ld, hDecoder->sbr[sbr_ele], count); +#if (defined(PS_DEC) || defined(DRM_PS)) + if (hDecoder->sbr[sbr_ele]->ps_used) + { + hDecoder->ps_used[sbr_ele] = 1; + } +#endif } else { #endif while (count > 0) @@ -1133,6 +1141,8 @@ void aac_scalable_main_element(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, else cpe.ele_id = ID_SCE; + hDecoder->element_output_channels[hDecoder->fr_ch_ele] = (this_layer_stereo ? 2 : 0); + for (ch = 0; ch < (this_layer_stereo ? 2 : 1); ch++) { ic_stream *ics; @@ -1145,9 +1155,6 @@ void aac_scalable_main_element(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, spec_data = spec_data2; } - hDecoder->internal_channel[channels+ch] = channels+ch; - hDecoder->channel_element[channels+ch] = hDecoder->fr_ch_ele; - hInfo->error = individual_channel_stream(hDecoder, &cpe, ld, ics, 1, spec_data); if (hInfo->error > 0) return; @@ -1202,6 +1209,12 @@ void aac_scalable_main_element(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, faad_getbits(&ld_sbr, 8); /* Skip 8-bit CRC */ hDecoder->sbr[0]->ret = sbr_extension_data(&ld_sbr, hDecoder->sbr[0], count); +#if (defined(PS_DEC) || defined(DRM_PS)) + if (hDecoder->sbr[0]->ps_used) + { + hDecoder->ps_used[0] = 1; + } +#endif /* check CRC */ /* no need to check it if there was already an error */ @@ -1227,9 +1240,19 @@ void aac_scalable_main_element(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, return; } + /* map output channels position to internal data channels */ + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 2) + { + /* this might be faulty when pce_set is true */ + hDecoder->internal_channel[channels] = channels; + hDecoder->internal_channel[channels+1] = channels+1; + } else { + hDecoder->internal_channel[channels] = channels; + } + hDecoder->element_id[hDecoder->fr_ch_ele] = cpe.ele_id; - hDecoder->fr_channels += (this_layer_stereo ? 2 : 1); + hDecoder->fr_channels += hDecoder->element_output_channels[hDecoder->fr_ch_ele]; hDecoder->fr_ch_ele++; return; @@ -1624,8 +1647,6 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) /* decode intensity position */ t = huffman_scale_factor(ld); - if (t < 0) - return 9; is_position += (t - 60); ics->scale_factors[g][sfb] = is_position; @@ -1640,8 +1661,6 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) DEBUGVAR(1,73,"scale_factor_data(): first noise")) - 256; } else { t = huffman_scale_factor(ld); - if (t < 0) - return 9; t -= 60; } noise_energy += t; @@ -1656,8 +1675,6 @@ static uint8_t decode_scale_factors(ic_stream *ics, bitfile *ld) /* decode scale factor */ t = huffman_scale_factor(ld); - if (t < 0) - return 9; scale_factor += (t - 60); if (scale_factor < 0 || scale_factor > 255) return 4; diff --git a/src/libfaad/syntax.h b/src/libfaad/syntax.h index 3f1eb0042..c9b3a32e5 100644 --- a/src/libfaad/syntax.h +++ b/src/libfaad/syntax.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: syntax.h,v 1.8 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: syntax.h,v 1.9 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __SYNTAX_H__ @@ -110,10 +110,6 @@ int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC, uint8_t adts_frame(adts_header *adts, bitfile *ld); void get_adif_header(adif_header *adif, bitfile *ld); -void decode_sce_lfe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele); -void decode_cpe(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, - uint8_t id_syn_ele); void raw_data_block(faacDecHandle hDecoder, faacDecFrameInfo *hInfo, bitfile *ld, program_config *pce, drc_info *drc); uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld, diff --git a/src/libfaad/tns.c b/src/libfaad/tns.c index e5414a6af..2252e02d2 100644 --- a/src/libfaad/tns.c +++ b/src/libfaad/tns.c @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: tns.c,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: tns.c,v 1.7 2004/12/03 01:15:31 tmattern Exp $ **/ #include "common.h" diff --git a/src/libfaad/tns.h b/src/libfaad/tns.h index fb635a7ba..921304751 100644 --- a/src/libfaad/tns.h +++ b/src/libfaad/tns.h @@ -22,7 +22,7 @@ ** Commercial non-GPL licensing of this software is possible. ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. ** -** $Id: tns.h,v 1.6 2004/01/26 22:34:11 jstembridge Exp $ +** $Id: tns.h,v 1.7 2004/12/03 01:15:31 tmattern Exp $ **/ #ifndef __TNS_H__ diff --git a/src/libfaad/xine_decoder.c b/src/libfaad/xine_decoder.c index 17e73da4c..d86d3fd41 100644 --- a/src/libfaad/xine_decoder.c +++ b/src/libfaad/xine_decoder.c @@ -17,7 +17,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: xine_decoder.c,v 1.35 2004/11/29 23:02:31 tmattern Exp $ + * $Id: xine_decoder.c,v 1.36 2004/12/03 01:15:31 tmattern Exp $ * */ @@ -30,7 +30,6 @@ #define LOG_MODULE "libfaad" #define LOG_VERBOSE - /* #define LOG */ @@ -115,6 +114,7 @@ static int faad_open_dec( faad_decoder_t *this ) { faacDecSetConfiguration(this->faac_dec, this->faac_cfg); } + used = faacDecInit(this->faac_dec, this->buf, this->size, &this->rate, &this->num_channels); |