diff libfaad2/local_changes.diff @ 18141:59b6fa5b4201

Update to faad2 cvs 20040915+MPlayer fixes Patch by me and Emanuele Giaquinta
author rtognimp
date Tue, 18 Apr 2006 19:39:34 +0000
parents 53c3eaaf8b49
children 0783dd397f74
line wrap: on
line diff
--- a/libfaad2/local_changes.diff	Tue Apr 18 19:33:46 2006 +0000
+++ b/libfaad2/local_changes.diff	Tue Apr 18 19:39:34 2006 +0000
@@ -1,5 +1,16 @@
---- libfaad/bits.h	2004-03-11 14:32:39.000000000 +0100
-+++ libfaad2/bits.h	2004-06-24 10:47:02.000000000 +0200
+--- libfaad2.orig/bits.h	2006-03-16 20:15:04.000000000 +0100
++++ libfaad2/bits.h	2006-03-16 20:37:21.000000000 +0100
+@@ -22,7 +22,10 @@
+ ** Commercial non-GPL licensing of this software is possible.
+ ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+ **
++** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
+ ** $Id: bits.h,v 1.40 2004/09/04 14:56:27 menno Exp $
++** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
++** local_changes.diff contains the exact changes to this file.
+ **/
+ 
+ #ifndef __BITS_H__
 @@ -58,7 +61,7 @@
  
  #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
@@ -9,8 +20,19 @@
  #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
  #else
  #define BSWAP(a) \
---- libfaad/common.h	2004-06-30 14:45:56.000000000 +0200
-+++ libfaad2/common.h	2004-10-19 03:16:03.000000000 +0200
+--- libfaad2.orig/common.h	2006-03-16 20:15:04.000000000 +0100
++++ libfaad2/common.h	2006-03-16 20:56:56.000000000 +0100
+@@ -22,7 +22,10 @@
+ ** Commercial non-GPL licensing of this software is possible.
+ ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+ **
++** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30
+ ** $Id: common.h,v 1.65 2004/09/08 09:43:11 gcp Exp $
++** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
++** local_changes.diff contains the exact changes to this file.
+ **/
+ 
+ #ifndef __COMMON_H__
 @@ -32,10 +35,13 @@
  extern "C" {
  #endif
@@ -27,7 +49,7 @@
  #define INLINE __inline
  #if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
  #define ALIGN __declspec(align(16))
-@@ -67,6 +67,6 @@
+@@ -61,7 +67,7 @@
  /* Use if target platform has address generators with autoincrement */
  //#define PREFER_POINTERS
  
@@ -35,6 +57,7 @@
 +#if defined(_WIN32_WCE) || defined(__arm__)
  #define FIXED_POINT
  #endif
+ 
 @@ -117,6 +123,9 @@
  # ifdef MAIN_DEC
  #  undef MAIN_DEC
@@ -45,7 +68,7 @@
  #endif // FIXED_POINT
  
  #ifdef DRM
-@@ -157,6 +166,7 @@
+@@ -151,6 +160,7 @@
  
  #include <stdlib.h>
  
@@ -53,7 +76,7 @@
  typedef unsigned __int64 uint64_t;
  typedef unsigned __int32 uint32_t;
  typedef unsigned __int16 uint16_t;
-@@ -165,11 +175,31 @@
+@@ -159,11 +169,31 @@
  typedef __int32 int32_t;
  typedef __int16 int16_t;
  typedef __int8  int8_t;
@@ -85,7 +108,7 @@
  #include <stdio.h>
  #if HAVE_SYS_TYPES_H
  # include <sys/types.h>
-@@ -329,7 +329,7 @@
+@@ -289,7 +319,7 @@
    }
  
  
@@ -94,16 +117,16 @@
      #define HAS_LRINTF
      static INLINE int lrintf(float f)
      {
-@@ -341,7 +341,7 @@
+@@ -301,7 +331,7 @@
          }
          return i;
      }
--  #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__)
-+  #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__) && !defined(HAVE_LRINTF)
+-  #elif (defined(__i386__) && defined(__GNUC__))
++  #elif (defined(__i386__) && defined(__GNUC__)) && !defined(HAVE_LRINTF)
      #define HAS_LRINTF
      // from http://www.stereopsis.com/FPU.html
      static INLINE int lrintf(float f)
-@@ -340,6 +370,8 @@
+@@ -330,6 +360,8 @@
  
    #else
  
@@ -112,7 +135,7 @@
  #ifdef HAVE_LRINTF
  #  define HAS_LRINTF
  #  define _ISOC9X_SOURCE 1
-@@ -348,8 +380,6 @@
+@@ -338,8 +370,6 @@
  #  define __USE_ISOC99   1
  #endif
  
@@ -121,8 +144,8 @@
  #ifdef HAVE_SINF
  #  define sin sinf
  #error
---- libfaad2/output.c	2005/02/19 01:21:19	1.7
-+++ libfaad2/output.c	2005/03/29 18:14:24	1.8
+--- libfaad2.orig/output.c	2006-03-16 20:15:04.000000000 +0100
++++ libfaad2/output.c	2006-04-18 19:50:26.000000000 +0200
 @@ -19,10 +19,9 @@
  ** Any non-GPL usage of this software or parts of this software is strictly
  ** forbidden.
@@ -137,7 +160,7 @@
  **/
  
  #include "common.h"
-@@ -462,7 +462,7 @@
+@@ -463,7 +462,7 @@
      }
  }
  
@@ -146,7 +169,7 @@
                      real_t **input, void *sample_buffer, uint8_t channels,
                      uint16_t frame_len, uint8_t format)
  {
-@@ -553,4 +553,51 @@
+@@ -554,4 +553,51 @@
      return sample_buffer;
  }
  
@@ -186,7 +209,7 @@
 +    {
 +        for (ch = 0; ch < channels; ch++)
 +        {
-+            int32_t tmp = input[ch][i];
++            int32_t tmp = input[hDecoder->internal_channel[ch]][i];
 +            tmp += (1 << (REAL_BITS-1));
 +            tmp >>= REAL_BITS;
 +	    if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
@@ -198,9 +221,38 @@
 +}
 +
  #endif
---- libfaad/ps_dec.c	2005-02-01 14:15:58.000000000 +0100
-+++ libfaad2/ps_dec.c	2005-12-07 22:52:31.000000000 +0100
-@@ -1960,8 +1935,8 @@
+--- libfaad2.orig/ps_dec.c	2006-03-16 20:15:04.000000000 +0100
++++ libfaad2/ps_dec.c	2006-04-18 20:29:38.000000000 +0200
+@@ -22,7 +22,10 @@
+ ** Commercial non-GPL licensing of this software is possible.
+ ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+ **
++** Initially modified for use with MPlayer on 2005/12/05
+ ** $Id: ps_dec.c,v 1.10 2004/09/04 14:56:28 menno Exp $
++** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
++** local_changes.diff contains the exact changes to this file.
+ **/
+ 
+ #include "common.h"
+@@ -159,7 +162,7 @@
+ 
+ /* static function declarations */
+ static void ps_data_decode(ps_info *ps);
+-static hyb_info *hybrid_init();
++static hyb_info *hybrid_init(void);
+ static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
+                             qmf_t *buffer, qmf_t **X_hybrid);
+ static void INLINE DCT3_4_unscaled(real_t *y, real_t *x);
+@@ -189,7 +192,7 @@
+ /*  */
+ 
+ 
+-static hyb_info *hybrid_init()
++static hyb_info *hybrid_init(void)
+ {
+     uint8_t i;
+ 
+@@ -1935,8 +1938,8 @@
  /* main Parametric Stereo decoding function */
  uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
  {
@@ -211,9 +263,20 @@
  
      /* delta decoding of the bitstream data */
      ps_data_decode(ps);
---- libfaad/sbr_dec.c	2005-12-07 22:52:03.000000000 +0100
-+++ libfaad2/sbr_dec.c	2005-12-07 22:52:31.000000000 +0100
-@@ -604,8 +527,8 @@
+--- libfaad2.orig/sbr_dec.c	2006-03-16 20:15:04.000000000 +0100
++++ libfaad2/sbr_dec.c	2006-04-18 20:33:57.000000000 +0200
+@@ -22,7 +22,10 @@
+ ** Commercial non-GPL licensing of this software is possible.
+ ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+ **
++** Initially modified for use with MPlayer on 2005/12/05
+ ** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $
++** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
++** local_changes.diff contains the exact changes to this file.
+ **/
+ 
+ 
+@@ -526,8 +529,8 @@
      uint8_t l, k;
      uint8_t dont_process = 0;
      uint8_t ret = 0;
@@ -224,3 +287,145 @@
  
      if (sbr == NULL)
          return 20;
+--- libfaad2.orig/specrec.c	2006-03-16 20:15:04.000000000 +0100
++++ libfaad2/specrec.c	2006-04-18 20:38:09.000000000 +0200
+@@ -19,10 +19,10 @@
+ ** Any non-GPL usage of this software or parts of this software is strictly
+ ** forbidden.
+ **
+-** Commercial non-GPL licensing of this software is possible.
+-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
+-**
++** Initially modified for use with MPlayer on 2006/04/18
+ ** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $
++** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
++** local_changes.diff contains the exact changes to this file.
+ **/
+ 
+ /*
+@@ -673,29 +673,19 @@
+     /* 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));
++            hDecoder->pred_stat[channel] = (pred_state*)realloc(hDecoder->pred_stat[channel], 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));
++            hDecoder->lt_pred_stat[channel] = (int16_t*)realloc(hDecoder->lt_pred_stat[channel], 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;
+@@ -706,41 +696,28 @@
+             hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
+         }
+ #endif
+-        hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
++        hDecoder->time_out[channel] = (real_t*)realloc(hDecoder->time_out[channel], 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));
++            hDecoder->time_out[channel+1] = (real_t*)realloc(hDecoder->time_out[channel+1], 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));
++        hDecoder->fb_intermed[channel] = (real_t*)realloc(hDecoder->fb_intermed[channel], 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));
++            hDecoder->ssr_overlap[channel] = (real_t*)realloc(hDecoder->ssr_overlap[channel], 2*hDecoder->frameLength*sizeof(real_t));
++            memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
++            hDecoder->prev_fmd[channel] = (real_t*)realloc(hDecoder->prev_fmd[channel], 2*hDecoder->frameLength*sizeof(real_t));
+             for (k = 0; k < 2*hDecoder->frameLength; k++)
+                 hDecoder->prev_fmd[channel][k] = REAL_CONST(-1);
+-        }
+     }
+ #endif
+ 
+@@ -865,22 +842,13 @@
+ 
+     /* always allocate 2 channels, PS can always "suddenly" turn up */
+ #if (defined(PS_DEC) || defined(DRM_PS))
+-    output_channels = 2;
++    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 */
++    if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
+         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;
+@@ -1026,11 +994,10 @@
+     {
+         return 23;
+     }
+-#endif
+ 
+     /* copy L to R when no PS is used */
+ #if (defined(PS_DEC) || defined(DRM_PS))
+-    if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0))
++    if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (output_channels == 2))
+     {
+         uint8_t ele = hDecoder->fr_ch_ele;
+         uint8_t ch = sce->channel;
+@@ -1040,6 +1007,7 @@
+         memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
+     }
+ #endif
++#endif
+ 
+     return 0;
+ }