diff Plugins/Input/aac/libfaad2/sbr_dec.h @ 199:0a2ad94e8607 trunk

[svn] Synced with bmp-mp4. Build system is fragile, but should work now.
author chainsaw
date Wed, 16 Nov 2005 16:21:11 -0800
parents fa848bd484d8
children 29feaace84d0
line wrap: on
line diff
--- a/Plugins/Input/aac/libfaad2/sbr_dec.h	Wed Nov 16 01:12:05 2005 -0800
+++ b/Plugins/Input/aac/libfaad2/sbr_dec.h	Wed Nov 16 16:21:11 2005 -0800
@@ -1,19 +1,19 @@
 /*
 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
+** 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: sbr_dec.h,v 1.12 2003/11/12 20:47:58 menno Exp $
+** $Id: sbr_dec.h,v 1.35 2004/09/04 14:56:28 menno Exp $
 **/
 
 #ifndef __SBR_DEC_H__
@@ -32,33 +32,42 @@
 extern "C" {
 #endif
 
+#ifdef PS_DEC
+#include "ps_dec.h"
+#endif
+#ifdef DRM_PS
+#include "drm_dec.h"
+#endif
 
-/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. DRM: 15*2+32, else 16*2+8 */
-#ifdef DRM
-# define MAX_NTSRHFG 62
-#else
-# define MAX_NTSRHFG 40
-#endif
-#define MAX_NTSR     32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
+/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
+#define MAX_NTSRHFG 40
+#define MAX_NTSR    32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
 
+/* MAX_M: maximum value for M */
+#define MAX_M       49
+/* MAX_L_E: maximum value for L_E */
+#define MAX_L_E      5
 
 typedef struct {
     real_t *x;
+    int16_t x_index;
     uint8_t channels;
 } qmfa_info;
 
 typedef struct {
-    real_t *v[2];
-    uint8_t v_index;
+    real_t *v;
+    int16_t v_index;
     uint8_t channels;
 } qmfs_info;
 
 typedef struct
 {
     uint32_t sample_rate;
+    uint32_t maxAACLine;
 
     uint8_t rate;
     uint8_t just_seeked;
+    uint8_t ret;
 
     uint8_t amp_res[2];
 
@@ -92,27 +101,33 @@
     uint8_t L_E_prev[2];
     uint8_t L_Q[2];
 
-    uint8_t t_E[2][6];
+    uint8_t t_E[2][MAX_L_E+1];
     uint8_t t_Q[2][3];
-    uint8_t f[2][6];
+    uint8_t f[2][MAX_L_E+1];
     uint8_t f_prev[2];
 
     real_t *G_temp_prev[2][5];
     real_t *Q_temp_prev[2][5];
+    int8_t GQ_ringbuf_index[2];
 
-    int16_t E[2][64][5];
+    int16_t E[2][64][MAX_L_E];
     int16_t E_prev[2][64];
-    real_t E_orig[2][64][5];
-    real_t E_curr[2][64][5];
+#ifndef FIXED_POINT
+    real_t E_orig[2][64][MAX_L_E];
+#endif
+    real_t E_curr[2][64][MAX_L_E];
     int32_t Q[2][64][2];
+#ifndef FIXED_POINT
+    real_t Q_div[2][64][2];
+    real_t Q_div2[2][64][2];
+#endif
     int32_t Q_prev[2][64];
-    real_t Q_orig[2][64][2];
 
     int8_t l_A[2];
     int8_t l_A_prev[2];
 
-    uint8_t bs_invf_mode[2][5];
-    uint8_t bs_invf_mode_prev[2][5];
+    uint8_t bs_invf_mode[2][MAX_L_E];
+    uint8_t bs_invf_mode_prev[2][MAX_L_E];
     real_t bwArray[2][64];
     real_t bwArray_prev[2][64];
 
@@ -136,32 +151,39 @@
     int8_t prevEnvIsShort[2];
 
     int8_t kx_prev;
+    uint8_t bsco;
+    uint8_t bsco_prev;
+    uint8_t M_prev;
+    uint16_t frame_len;
 
     uint8_t Reset;
     uint32_t frame;
     uint32_t header_count;
 
-    uint8_t *data;
-    uint16_t data_size;
-
     uint8_t id_aac;
     qmfa_info *qmfa[2];
     qmfs_info *qmfs[2];
 
     qmf_t Xsbr[2][MAX_NTSRHFG][64];
-    qmf_t Xcodec[2][MAX_NTSRHFG][32];
 
 #ifdef DRM
-	int8_t lcstereo_flag;
-	uint8_t bs_dataextra;
-	uint16_t data_size_bits;
     uint8_t Is_DRM_SBR;
+#ifdef DRM_PS
+    drm_ps_info *drm_ps;
+#endif
 #endif
 
-	uint16_t numTimeSlotsRate;
-	uint16_t numTimeSlots;
-	uint8_t tHFGen;
-	uint8_t tHFAdj;
+    uint8_t numTimeSlotsRate;
+    uint8_t numTimeSlots;
+    uint8_t tHFGen;
+    uint8_t tHFAdj;
+
+#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
@@ -202,16 +224,22 @@
     uint8_t bs_df_noise[2][3];
 } sbr_info;
 
-sbr_info *sbrDecodeInit(uint16_t framelength
+sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
+                        uint32_t sample_rate, uint8_t downSampledSBR
 #ifdef DRM
-						, uint8_t IsDRM
+                        , uint8_t IsDRM
 #endif
-						);
+                        );
 void sbrDecodeEnd(sbr_info *sbr);
 
-void sbrDecodeFrame(sbr_info *sbr, real_t *left_channel,
-                    real_t *right_channel,
-                    const uint8_t just_seeked, const uint8_t upsample_only);
+uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
+uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
+                             const uint8_t just_seeked, const uint8_t downSampledSBR);
+#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 downSampledSBR);
+#endif
 
 
 #ifdef __cplusplus