diff src/aac/libfaad2/ic_predict.c @ 681:1d8b08df98c3 trunk

[svn] - synchronise with FAAD 2.5
author nenolod
date Tue, 20 Feb 2007 04:37:37 -0800
parents 3da1b8942b8b
children e6c5fdae6e88
line wrap: on
line diff
--- a/src/aac/libfaad2/ic_predict.c	Tue Feb 20 04:36:01 2007 -0800
+++ b/src/aac/libfaad2/ic_predict.c	Tue Feb 20 04:37:37 2007 -0800
@@ -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-2005 M. Bakker, Nero 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
@@ -14,15 +14,20 @@
 ** 
 ** You should have received a copy of the GNU General Public License
 ** along with this program; if not, write to the Free Software 
-** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+** 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
 ** forbidden.
 **
+** Software using this code must display the following message visibly in or
+** on each copy of the software:
+** "FAAD2 AAC/HE-AAC/HE-AACv2/DRM decoder (c) Nero AG, www.nero.com"
+** in, for example, the about-box or help/startup screen.
+**
 ** Commercial non-GPL licensing of this software is possible.
-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: ic_predict.c,v 1.23 2004/09/04 14:56:28 menno Exp $
+** $Id: ic_predict.c,v 1.26 2006/05/17 18:49:21 menno Exp $
 **/
 
 #include "common.h"
@@ -39,11 +44,7 @@
 {
     int32_t flg;
     uint32_t tmp, tmp1, tmp2;
-    uint32_t *tmp3, *tmp4, *tmp5;
-    tmp3 = &tmp;
-    tmp4 = &tmp1;
-    tmp5 = &tmp2;
- 
+
     tmp = *(uint32_t*)pf;
     flg = tmp & (uint32_t)0x00008000;
     tmp &= (uint32_t)0xffff0000;
@@ -55,18 +56,17 @@
         tmp |= (uint32_t)0x00010000;       /* insert 1 lsb */
         tmp2 = tmp;                             /* add 1 lsb and elided one */
         tmp &= (uint32_t)0xff800000;       /* extract exponent and sign */
- 
-        *pf = *(float32_t*)tmp4 + *(float32_t*)tmp4 - *(float32_t*)tmp5;
+        
+        *pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
     } else {
-        *pf = *(float32_t*)tmp3;
+        *pf = *(float32_t*)&tmp;
     }
 }
 
 static int16_t quant_pred(float32_t x)
 {
     int16_t q;
-    float32_t *tmp1 = &x;
-    uint32_t *tmp = (uint32_t*)tmp1;
+    uint32_t *tmp = (uint32_t*)&x;
 
     q = (int16_t)(*tmp>>16);
 
@@ -76,8 +76,7 @@
 static float32_t inv_quant_pred(int16_t q)
 {
     float32_t x;
-    float32_t *tmp1 = &x;
-    uint32_t *tmp = (uint32_t*)tmp1;
+    uint32_t *tmp = (uint32_t*)&x;
     *tmp = ((uint32_t)q)<<16;
 
     return x;
@@ -87,7 +86,8 @@
 {
     uint16_t tmp;
     int16_t i, j;
-    real_t dr1, predictedvalue;
+    real_t dr1;
+	float32_t predictedvalue;
     real_t e0, e1;
     real_t k1, k2;
 
@@ -120,7 +120,7 @@
 #define B 0.953125
         real_t c = COR[0];
         real_t v = VAR[0];
-        real_t tmp;
+        float32_t tmp;
         if (c == 0 || v <= 1)
         {
             k1 = 0;
@@ -150,7 +150,7 @@
 #define B 0.953125
         real_t c = COR[1];
         real_t v = VAR[1];
-        real_t tmp;
+        float32_t tmp;
         if (c == 0 || v <= 1)
         {
             k2 = 0;
@@ -215,7 +215,7 @@
                 if (is_noise(ics, g, sfb))
                 {
                     offs = ics->swb_offset[sfb];
-                    offs2 = ics->swb_offset[sfb+1];
+                    offs2 = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
 
                     for (i = offs; i < offs2; i++)
                         reset_pred_state(&state[i]);
@@ -247,7 +247,7 @@
         for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
         {
             uint16_t low  = ics->swb_offset[sfb];
-            uint16_t high = ics->swb_offset[sfb+1];
+            uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
 
             for (bin = low; bin < high; bin++)
             {