shithub: aacdec

Download patch

ref: e8d63fca010802f97552a4e3aaebc61f6802e640
parent: 8375349476e7df19b35005f148e6175fa8d05d0e
author: menno <menno>
date: Thu May 30 14:31:51 EDT 2002

More updates for ER

--- a/libfaad/common.h
+++ b/libfaad/common.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: common.h,v 1.12 2002/05/30 17:55:08 menno Exp $
+** $Id: common.h,v 1.13 2002/05/30 18:31:51 menno Exp $
 **/
 
 #ifndef __COMMON_H__
@@ -57,7 +57,10 @@
 /* use double precision */
 /* #define USE_DOUBLE_PRECISION */
 
+//#define SBR
+#define ERROR_RESILIENCE
 
+
 /* Allow decoding of MAIN profile AAC */
 #define MAIN_DEC
 /* Allow decoding of LTP profile AAC */
@@ -67,13 +70,14 @@
 
 /* LD can't do without LTP */
 #ifdef LD_DEC
+#ifndef ERROR_RESILIENCE
+#define ERROR_RESILIENCE
+#endif
 #ifndef LTP_DEC
 #define LTP_DEC
 #endif
 #endif
 
-//#define SBR
-//#define ERROR_RESILIENCE
 
 /* END COMPILE TIME DEFINITIONS */
 
--- a/libfaad/decoder.c
+++ b/libfaad/decoder.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: decoder.c,v 1.14 2002/05/30 17:55:08 menno Exp $
+** $Id: decoder.c,v 1.15 2002/05/30 18:31:51 menno Exp $
 **/
 
 #include <stdlib.h>
@@ -151,6 +151,17 @@
 #else
         return -1;
 #endif
+
+    /* ER object types */
+#ifdef ERROR_RESILIENCE
+    case ER_LC:
+        return 0;
+    case ER_LTP:
+#ifdef LTP_DEC
+        return 0;
+#else
+        return -1;
+#endif
     case LD:
 #ifdef LD_DEC
         return 0;
@@ -157,6 +168,7 @@
 #else
         return -1;
 #endif
+#endif
     }
 
     return -1;
@@ -241,9 +253,7 @@
         &hDecoder->aacSectionDataResilienceFlag,
         &hDecoder->aacScalefactorDataResilienceFlag,
         &hDecoder->aacSpectralDataResilienceFlag);
-#ifdef LD_DEC
-    if (hDecoder->object_type != LD)
-#endif
+    if (hDecoder->object_type < 4)
         hDecoder->object_type--; /* For AAC differs from MPEG-4 */
     if (rc != 0)
     {
@@ -452,8 +462,8 @@
     dbg_count = 0;
 #endif
 
-#ifdef LD_DEC
-    if (object_type != LD)
+#ifdef ERROR_RESILIENCE
+    if (object_type < ER_OBJECT_START)
     {
 #endif
         /* Table 4.4.3: raw_data_block() */
@@ -486,7 +496,7 @@
             }
             ele++;
         }
-#ifdef LD_DEC
+#ifdef ERROR_RESILIENCE
     } else {
         /* Table 262: er_raw_data_block() */
         switch (channelConfiguration)
@@ -666,6 +676,9 @@
 #endif
 #ifdef LTP_DEC
         else if ((object_type == LTP)
+#ifdef ERROR_RESILIENCE
+            || (object_type == ER_LTP)
+#endif
 #ifdef LD_DEC
             || (object_type == LD)
 #endif
@@ -736,6 +749,9 @@
 
 #ifdef LTP_DEC
         if ((object_type == LTP)
+#ifdef ERROR_RESILIENCE
+            || (object_type == ER_LTP)
+#endif
 #ifdef LD_DEC
             || (object_type == LD)
 #endif
--- a/libfaad/mp4.c
+++ b/libfaad/mp4.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: mp4.c,v 1.6 2002/05/30 17:55:08 menno Exp $
+** $Id: mp4.c,v 1.7 2002/05/30 18:31:51 menno Exp $
 **/
 
 #include "common.h"
@@ -54,9 +54,14 @@
     0, /* Algorithmic Synthesis and Audio FX */
 
     /* MPEG-4 Version 2 */
-    0, /* ER AAC LC */
+#ifdef ERROR_RESILIENCE
+    1, /* ER AAC LC */
     0, /* (Reserved) */
+#ifdef LTP_DEC
+    1, /* ER AAC LTP */
+#else
     0, /* ER AAC LTP */
+#endif
     0, /* ER AAC scalable */
     0, /* ER TwinVQ */
     0, /* ER BSAC */
@@ -69,9 +74,22 @@
     0, /* ER HVXC */
     0, /* ER HILN */
     0, /* ER Parametric */
+#else /* No ER defined */
+    0, /* ER AAC LC */
     0, /* (Reserved) */
+    0, /* ER AAC LTP */
+    0, /* ER AAC scalable */
+    0, /* ER TwinVQ */
+    0, /* ER BSAC */
+    0, /* ER AAC LD */
+    0, /* ER CELP */
+    0, /* ER HVXC */
+    0, /* ER HILN */
+    0, /* ER Parametric */
+#endif
     0, /* (Reserved) */
     0, /* (Reserved) */
+    0, /* (Reserved) */
     0  /* (Reserved) */
 };
 
@@ -132,8 +150,8 @@
             aacSectionDataResilienceFlag,
             aacScalefactorDataResilienceFlag,
             aacSpectralDataResilienceFlag);
-#ifdef LD_DEC
-    } else if (ObjectTypeIndex == 23) { /* ER AAC LD */
+#ifdef ERROR_RESILIENCE
+    } else if (ObjectTypeIndex >= ER_OBJECT_START) { /* ER */
         uint8_t result = GASpecificConfig(&ld, channels, ObjectTypeIndex,
             aacSectionDataResilienceFlag,
             aacScalefactorDataResilienceFlag,
--- a/libfaad/syntax.c
+++ b/libfaad/syntax.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: syntax.c,v 1.13 2002/05/30 17:55:08 menno Exp $
+** $Id: syntax.c,v 1.14 2002/05/30 18:31:51 menno Exp $
 **/
 
 /*
@@ -78,7 +78,7 @@
     if (extensionFlag == 1)
     {
         /* Error resilience not supported yet */
-        if (object_type == 23)
+        if (object_type >= ER_OBJECT_START)
         {
             *aacSectionDataResilienceFlag = faad_get1bit(ld
                 DEBUGVAR(1,144,"GASpecificConfig(): aacSectionDataResilienceFlag"));
--- a/libfaad/syntax.h
+++ b/libfaad/syntax.h
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: syntax.h,v 1.8 2002/05/30 17:55:08 menno Exp $
+** $Id: syntax.h,v 1.9 2002/05/30 18:31:51 menno Exp $
 **/
 
 #ifndef __SYNTAX_H__
@@ -28,11 +28,16 @@
 
 #include "bits.h"
 
-#define MAIN 0
-#define LC   1
-#define SSR  2
-#define LTP  3
-#define LD   23
+#define MAIN    0
+#define LC      1
+#define SSR     2
+#define LTP     3
+#define LD      23
+#define ER_LC   17
+#define ER_LTP  19
+
+/* First object type that has ER */
+#define ER_OBJECT_START 17
 
 
 /* Bitstream */
--- a/libfaad/tns.c
+++ b/libfaad/tns.c
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software 
 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **
-** $Id: tns.c,v 1.10 2002/05/24 17:26:12 menno Exp $
+** $Id: tns.c,v 1.11 2002/05/30 18:31:51 menno Exp $
 **/
 
 #include "common.h"
@@ -269,7 +269,8 @@
 
     i = (ics->window_sequence == EIGHT_SHORT_SEQUENCE) ? 1 : 0;
 #ifdef LD_DEC
-    i = (object_type == LD) ? 4 : i;
+    if (object_type == LD)
+        i = 4;
 #endif
 
     return tns_max_bands_table[sr_index][i];