Mercurial > mplayer.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 18140:e371c7e18402 | 18141:59b6fa5b4201 |
|---|---|
| 1 --- libfaad/bits.h 2004-03-11 14:32:39.000000000 +0100 | 1 --- libfaad2.orig/bits.h 2006-03-16 20:15:04.000000000 +0100 |
| 2 +++ libfaad2/bits.h 2004-06-24 10:47:02.000000000 +0200 | 2 +++ libfaad2/bits.h 2006-03-16 20:37:21.000000000 +0100 |
| 3 @@ -22,7 +22,10 @@ | |
| 4 ** Commercial non-GPL licensing of this software is possible. | |
| 5 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
| 6 ** | |
| 7 +** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 | |
| 8 ** $Id: bits.h,v 1.40 2004/09/04 14:56:27 menno Exp $ | |
| 9 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | |
| 10 +** local_changes.diff contains the exact changes to this file. | |
| 11 **/ | |
| 12 | |
| 13 #ifndef __BITS_H__ | |
| 3 @@ -58,7 +61,7 @@ | 14 @@ -58,7 +61,7 @@ |
| 4 | 15 |
| 5 #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) | 16 #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__) |
| 6 #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax | 17 #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
| 7 -#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__) | 18 -#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__) |
| 8 +#elif defined(LINUX) || defined(DJGPP) | 19 +#elif defined(LINUX) || defined(DJGPP) |
| 9 #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) | 20 #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) |
| 10 #else | 21 #else |
| 11 #define BSWAP(a) \ | 22 #define BSWAP(a) \ |
| 12 --- libfaad/common.h 2004-06-30 14:45:56.000000000 +0200 | 23 --- libfaad2.orig/common.h 2006-03-16 20:15:04.000000000 +0100 |
| 13 +++ libfaad2/common.h 2004-10-19 03:16:03.000000000 +0200 | 24 +++ libfaad2/common.h 2006-03-16 20:56:56.000000000 +0100 |
| 25 @@ -22,7 +22,10 @@ | |
| 26 ** Commercial non-GPL licensing of this software is possible. | |
| 27 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
| 28 ** | |
| 29 +** Initially modified for use with MPlayer by Arpad Gereöffy on 2003/08/30 | |
| 30 ** $Id: common.h,v 1.65 2004/09/08 09:43:11 gcp Exp $ | |
| 31 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | |
| 32 +** local_changes.diff contains the exact changes to this file. | |
| 33 **/ | |
| 34 | |
| 35 #ifndef __COMMON_H__ | |
| 14 @@ -32,10 +35,13 @@ | 36 @@ -32,10 +35,13 @@ |
| 15 extern "C" { | 37 extern "C" { |
| 16 #endif | 38 #endif |
| 17 | 39 |
| 18 -#ifdef HAVE_CONFIG_H | 40 -#ifdef HAVE_CONFIG_H |
| 25 +#include "../config.h" | 47 +#include "../config.h" |
| 26 + | 48 + |
| 27 #define INLINE __inline | 49 #define INLINE __inline |
| 28 #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) | 50 #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) |
| 29 #define ALIGN __declspec(align(16)) | 51 #define ALIGN __declspec(align(16)) |
| 30 @@ -67,6 +67,6 @@ | 52 @@ -61,7 +67,7 @@ |
| 31 /* Use if target platform has address generators with autoincrement */ | 53 /* Use if target platform has address generators with autoincrement */ |
| 32 //#define PREFER_POINTERS | 54 //#define PREFER_POINTERS |
| 33 | 55 |
| 34 -#ifdef _WIN32_WCE | 56 -#ifdef _WIN32_WCE |
| 35 +#if defined(_WIN32_WCE) || defined(__arm__) | 57 +#if defined(_WIN32_WCE) || defined(__arm__) |
| 36 #define FIXED_POINT | 58 #define FIXED_POINT |
| 37 #endif | 59 #endif |
| 60 | |
| 38 @@ -117,6 +123,9 @@ | 61 @@ -117,6 +123,9 @@ |
| 39 # ifdef MAIN_DEC | 62 # ifdef MAIN_DEC |
| 40 # undef MAIN_DEC | 63 # undef MAIN_DEC |
| 41 # endif | 64 # endif |
| 42 +# ifdef SBR_DEC | 65 +# ifdef SBR_DEC |
| 43 +# undef SBR_DEC | 66 +# undef SBR_DEC |
| 44 +# endif | 67 +# endif |
| 45 #endif // FIXED_POINT | 68 #endif // FIXED_POINT |
| 46 | 69 |
| 47 #ifdef DRM | 70 #ifdef DRM |
| 48 @@ -157,6 +166,7 @@ | 71 @@ -151,6 +160,7 @@ |
| 49 | 72 |
| 50 #include <stdlib.h> | 73 #include <stdlib.h> |
| 51 | 74 |
| 52 +#if 0 | 75 +#if 0 |
| 53 typedef unsigned __int64 uint64_t; | 76 typedef unsigned __int64 uint64_t; |
| 54 typedef unsigned __int32 uint32_t; | 77 typedef unsigned __int32 uint32_t; |
| 55 typedef unsigned __int16 uint16_t; | 78 typedef unsigned __int16 uint16_t; |
| 56 @@ -165,11 +175,31 @@ | 79 @@ -159,11 +169,31 @@ |
| 57 typedef __int32 int32_t; | 80 typedef __int32 int32_t; |
| 58 typedef __int16 int16_t; | 81 typedef __int16 int16_t; |
| 59 typedef __int8 int8_t; | 82 typedef __int8 int8_t; |
| 60 +#else | 83 +#else |
| 61 +#include <inttypes.h> | 84 +#include <inttypes.h> |
| 83 +#define STDC_HEADERS 1 | 106 +#define STDC_HEADERS 1 |
| 84 + | 107 + |
| 85 #include <stdio.h> | 108 #include <stdio.h> |
| 86 #if HAVE_SYS_TYPES_H | 109 #if HAVE_SYS_TYPES_H |
| 87 # include <sys/types.h> | 110 # include <sys/types.h> |
| 88 @@ -329,7 +329,7 @@ | 111 @@ -289,7 +319,7 @@ |
| 89 } | 112 } |
| 90 | 113 |
| 91 | 114 |
| 92 - #if defined(_WIN32) && !defined(__MINGW32__) | 115 - #if defined(_WIN32) && !defined(__MINGW32__) |
| 93 + #if defined(_WIN32) && !defined(__MINGW32__) && !defined(HAVE_LRINTF) | 116 + #if defined(_WIN32) && !defined(__MINGW32__) && !defined(HAVE_LRINTF) |
| 94 #define HAS_LRINTF | 117 #define HAS_LRINTF |
| 95 static INLINE int lrintf(float f) | 118 static INLINE int lrintf(float f) |
| 96 { | 119 { |
| 97 @@ -341,7 +341,7 @@ | 120 @@ -301,7 +331,7 @@ |
| 98 } | 121 } |
| 99 return i; | 122 return i; |
| 100 } | 123 } |
| 101 - #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__) | 124 - #elif (defined(__i386__) && defined(__GNUC__)) |
| 102 + #elif (defined(__i386__) && defined(__GNUC__)) && !defined(__MINGW32__) && !defined(HAVE_LRINTF) | 125 + #elif (defined(__i386__) && defined(__GNUC__)) && !defined(HAVE_LRINTF) |
| 103 #define HAS_LRINTF | 126 #define HAS_LRINTF |
| 104 // from http://www.stereopsis.com/FPU.html | 127 // from http://www.stereopsis.com/FPU.html |
| 105 static INLINE int lrintf(float f) | 128 static INLINE int lrintf(float f) |
| 106 @@ -340,6 +370,8 @@ | 129 @@ -330,6 +360,8 @@ |
| 107 | 130 |
| 108 #else | 131 #else |
| 109 | 132 |
| 110 +#include <math.h> | 133 +#include <math.h> |
| 111 + | 134 + |
| 112 #ifdef HAVE_LRINTF | 135 #ifdef HAVE_LRINTF |
| 113 # define HAS_LRINTF | 136 # define HAS_LRINTF |
| 114 # define _ISOC9X_SOURCE 1 | 137 # define _ISOC9X_SOURCE 1 |
| 115 @@ -348,8 +380,6 @@ | 138 @@ -338,8 +370,6 @@ |
| 116 # define __USE_ISOC99 1 | 139 # define __USE_ISOC99 1 |
| 117 #endif | 140 #endif |
| 118 | 141 |
| 119 - #include <math.h> | 142 - #include <math.h> |
| 120 - | 143 - |
| 121 #ifdef HAVE_SINF | 144 #ifdef HAVE_SINF |
| 122 # define sin sinf | 145 # define sin sinf |
| 123 #error | 146 #error |
| 124 --- libfaad2/output.c 2005/02/19 01:21:19 1.7 | 147 --- libfaad2.orig/output.c 2006-03-16 20:15:04.000000000 +0100 |
| 125 +++ libfaad2/output.c 2005/03/29 18:14:24 1.8 | 148 +++ libfaad2/output.c 2006-04-18 19:50:26.000000000 +0200 |
| 126 @@ -19,10 +19,9 @@ | 149 @@ -19,10 +19,9 @@ |
| 127 ** Any non-GPL usage of this software or parts of this software is strictly | 150 ** Any non-GPL usage of this software or parts of this software is strictly |
| 128 ** forbidden. | 151 ** forbidden. |
| 129 ** | 152 ** |
| 130 -** Commercial non-GPL licensing of this software is possible. | 153 -** Commercial non-GPL licensing of this software is possible. |
| 135 +** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $ | 158 +** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $ |
| 136 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | 159 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
| 137 **/ | 160 **/ |
| 138 | 161 |
| 139 #include "common.h" | 162 #include "common.h" |
| 140 @@ -462,7 +462,7 @@ | 163 @@ -463,7 +462,7 @@ |
| 141 } | 164 } |
| 142 } | 165 } |
| 143 | 166 |
| 144 -void* output_to_PCM(NeAACDecHandle hDecoder, | 167 -void* output_to_PCM(NeAACDecHandle hDecoder, |
| 145 +void* output_to_PCM_sux(NeAACDecHandle hDecoder, | 168 +void* output_to_PCM_sux(NeAACDecHandle hDecoder, |
| 146 real_t **input, void *sample_buffer, uint8_t channels, | 169 real_t **input, void *sample_buffer, uint8_t channels, |
| 147 uint16_t frame_len, uint8_t format) | 170 uint16_t frame_len, uint8_t format) |
| 148 { | 171 { |
| 149 @@ -553,4 +553,51 @@ | 172 @@ -554,4 +553,51 @@ |
| 150 return sample_buffer; | 173 return sample_buffer; |
| 151 } | 174 } |
| 152 | 175 |
| 153 +void* output_to_PCM(NeAACDecHandle hDecoder, | 176 +void* output_to_PCM(NeAACDecHandle hDecoder, |
| 154 + real_t **input, void *sample_buffer, uint8_t channels, | 177 + real_t **input, void *sample_buffer, uint8_t channels, |
| 184 + /* Copy output to a standard PCM buffer */ | 207 + /* Copy output to a standard PCM buffer */ |
| 185 + for(i = 0; i < frame_len; i++) | 208 + for(i = 0; i < frame_len; i++) |
| 186 + { | 209 + { |
| 187 + for (ch = 0; ch < channels; ch++) | 210 + for (ch = 0; ch < channels; ch++) |
| 188 + { | 211 + { |
| 189 + int32_t tmp = input[ch][i]; | 212 + int32_t tmp = input[hDecoder->internal_channel[ch]][i]; |
| 190 + tmp += (1 << (REAL_BITS-1)); | 213 + tmp += (1 << (REAL_BITS-1)); |
| 191 + tmp >>= REAL_BITS; | 214 + tmp >>= REAL_BITS; |
| 192 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; | 215 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; |
| 193 + *(short_sample_buffer++) = tmp; | 216 + *(short_sample_buffer++) = tmp; |
| 194 + } | 217 + } |
| 196 + | 219 + |
| 197 + return sample_buffer; | 220 + return sample_buffer; |
| 198 +} | 221 +} |
| 199 + | 222 + |
| 200 #endif | 223 #endif |
| 201 --- libfaad/ps_dec.c 2005-02-01 14:15:58.000000000 +0100 | 224 --- libfaad2.orig/ps_dec.c 2006-03-16 20:15:04.000000000 +0100 |
| 202 +++ libfaad2/ps_dec.c 2005-12-07 22:52:31.000000000 +0100 | 225 +++ libfaad2/ps_dec.c 2006-04-18 20:29:38.000000000 +0200 |
| 203 @@ -1960,8 +1935,8 @@ | 226 @@ -22,7 +22,10 @@ |
| 227 ** Commercial non-GPL licensing of this software is possible. | |
| 228 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
| 229 ** | |
| 230 +** Initially modified for use with MPlayer on 2005/12/05 | |
| 231 ** $Id: ps_dec.c,v 1.10 2004/09/04 14:56:28 menno Exp $ | |
| 232 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | |
| 233 +** local_changes.diff contains the exact changes to this file. | |
| 234 **/ | |
| 235 | |
| 236 #include "common.h" | |
| 237 @@ -159,7 +162,7 @@ | |
| 238 | |
| 239 /* static function declarations */ | |
| 240 static void ps_data_decode(ps_info *ps); | |
| 241 -static hyb_info *hybrid_init(); | |
| 242 +static hyb_info *hybrid_init(void); | |
| 243 static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, | |
| 244 qmf_t *buffer, qmf_t **X_hybrid); | |
| 245 static void INLINE DCT3_4_unscaled(real_t *y, real_t *x); | |
| 246 @@ -189,7 +192,7 @@ | |
| 247 /* */ | |
| 248 | |
| 249 | |
| 250 -static hyb_info *hybrid_init() | |
| 251 +static hyb_info *hybrid_init(void) | |
| 252 { | |
| 253 uint8_t i; | |
| 254 | |
| 255 @@ -1935,8 +1938,8 @@ | |
| 204 /* main Parametric Stereo decoding function */ | 256 /* main Parametric Stereo decoding function */ |
| 205 uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) | 257 uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) |
| 206 { | 258 { |
| 207 - qmf_t X_hybrid_left[32][32] = {{0}}; | 259 - qmf_t X_hybrid_left[32][32] = {{0}}; |
| 208 - qmf_t X_hybrid_right[32][32] = {{0}}; | 260 - qmf_t X_hybrid_right[32][32] = {{0}}; |
| 209 + qmf_t X_hybrid_left[32][32] = {{{0}}}; | 261 + qmf_t X_hybrid_left[32][32] = {{{0}}}; |
| 210 + qmf_t X_hybrid_right[32][32] = {{{0}}}; | 262 + qmf_t X_hybrid_right[32][32] = {{{0}}}; |
| 211 | 263 |
| 212 /* delta decoding of the bitstream data */ | 264 /* delta decoding of the bitstream data */ |
| 213 ps_data_decode(ps); | 265 ps_data_decode(ps); |
| 214 --- libfaad/sbr_dec.c 2005-12-07 22:52:03.000000000 +0100 | 266 --- libfaad2.orig/sbr_dec.c 2006-03-16 20:15:04.000000000 +0100 |
| 215 +++ libfaad2/sbr_dec.c 2005-12-07 22:52:31.000000000 +0100 | 267 +++ libfaad2/sbr_dec.c 2006-04-18 20:33:57.000000000 +0200 |
| 216 @@ -604,8 +527,8 @@ | 268 @@ -22,7 +22,10 @@ |
| 269 ** Commercial non-GPL licensing of this software is possible. | |
| 270 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
| 271 ** | |
| 272 +** Initially modified for use with MPlayer on 2005/12/05 | |
| 273 ** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $ | |
| 274 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | |
| 275 +** local_changes.diff contains the exact changes to this file. | |
| 276 **/ | |
| 277 | |
| 278 | |
| 279 @@ -526,8 +529,8 @@ | |
| 217 uint8_t l, k; | 280 uint8_t l, k; |
| 218 uint8_t dont_process = 0; | 281 uint8_t dont_process = 0; |
| 219 uint8_t ret = 0; | 282 uint8_t ret = 0; |
| 220 - ALIGN qmf_t X_left[38][64] = {{0}}; | 283 - ALIGN qmf_t X_left[38][64] = {{0}}; |
| 221 - ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */ | 284 - ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */ |
| 222 + ALIGN qmf_t X_left[38][64] = {{{0}}}; | 285 + ALIGN qmf_t X_left[38][64] = {{{0}}}; |
| 223 + ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */ | 286 + ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */ |
| 224 | 287 |
| 225 if (sbr == NULL) | 288 if (sbr == NULL) |
| 226 return 20; | 289 return 20; |
| 290 --- libfaad2.orig/specrec.c 2006-03-16 20:15:04.000000000 +0100 | |
| 291 +++ libfaad2/specrec.c 2006-04-18 20:38:09.000000000 +0200 | |
| 292 @@ -19,10 +19,10 @@ | |
| 293 ** Any non-GPL usage of this software or parts of this software is strictly | |
| 294 ** forbidden. | |
| 295 ** | |
| 296 -** Commercial non-GPL licensing of this software is possible. | |
| 297 -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
| 298 -** | |
| 299 +** Initially modified for use with MPlayer on 2006/04/18 | |
| 300 ** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $ | |
| 301 +** detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ | |
| 302 +** local_changes.diff contains the exact changes to this file. | |
| 303 **/ | |
| 304 | |
| 305 /* | |
| 306 @@ -673,29 +673,19 @@ | |
| 307 /* MAIN object type prediction */ | |
| 308 if (hDecoder->object_type == MAIN) | |
| 309 { | |
| 310 - /* allocate the state only when needed */ | |
| 311 - if (hDecoder->pred_stat[channel] == NULL) | |
| 312 - { | |
| 313 - hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | |
| 314 + hDecoder->pred_stat[channel] = (pred_state*)realloc(hDecoder->pred_stat[channel], hDecoder->frameLength * sizeof(pred_state)); | |
| 315 reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); | |
| 316 - } | |
| 317 } | |
| 318 #endif | |
| 319 | |
| 320 #ifdef LTP_DEC | |
| 321 if (is_ltp_ot(hDecoder->object_type)) | |
| 322 { | |
| 323 - /* allocate the state only when needed */ | |
| 324 - if (hDecoder->lt_pred_stat[channel] == NULL) | |
| 325 - { | |
| 326 - hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | |
| 327 + hDecoder->lt_pred_stat[channel] = (int16_t*)realloc(hDecoder->lt_pred_stat[channel], hDecoder->frameLength*4 * sizeof(int16_t)); | |
| 328 memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | |
| 329 - } | |
| 330 } | |
| 331 #endif | |
| 332 | |
| 333 - if (hDecoder->time_out[channel] == NULL) | |
| 334 - { | |
| 335 mul = 1; | |
| 336 #ifdef SBR_DEC | |
| 337 hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; | |
| 338 @@ -706,41 +696,28 @@ | |
| 339 hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; | |
| 340 } | |
| 341 #endif | |
| 342 - hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | |
| 343 + hDecoder->time_out[channel] = (real_t*)realloc(hDecoder->time_out[channel], mul*hDecoder->frameLength*sizeof(real_t)); | |
| 344 memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | |
| 345 - } | |
| 346 #if (defined(PS_DEC) || defined(DRM_PS)) | |
| 347 if (output_channels == 2) | |
| 348 { | |
| 349 - if (hDecoder->time_out[channel+1] == NULL) | |
| 350 - { | |
| 351 - hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | |
| 352 + hDecoder->time_out[channel+1] = (real_t*)realloc(hDecoder->time_out[channel+1], mul*hDecoder->frameLength*sizeof(real_t)); | |
| 353 memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t)); | |
| 354 - } | |
| 355 } | |
| 356 #endif | |
| 357 | |
| 358 - if (hDecoder->fb_intermed[channel] == NULL) | |
| 359 - { | |
| 360 - hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | |
| 361 + hDecoder->fb_intermed[channel] = (real_t*)realloc(hDecoder->fb_intermed[channel], hDecoder->frameLength*sizeof(real_t)); | |
| 362 memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); | |
| 363 - } | |
| 364 | |
| 365 #ifdef SSR_DEC | |
| 366 if (hDecoder->object_type == SSR) | |
| 367 { | |
| 368 - if (hDecoder->ssr_overlap[channel] == NULL) | |
| 369 - { | |
| 370 - hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | |
| 371 - memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | |
| 372 - } | |
| 373 - if (hDecoder->prev_fmd[channel] == NULL) | |
| 374 - { | |
| 375 uint16_t k; | |
| 376 - hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | |
| 377 + hDecoder->ssr_overlap[channel] = (real_t*)realloc(hDecoder->ssr_overlap[channel], 2*hDecoder->frameLength*sizeof(real_t)); | |
| 378 + memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | |
| 379 + hDecoder->prev_fmd[channel] = (real_t*)realloc(hDecoder->prev_fmd[channel], 2*hDecoder->frameLength*sizeof(real_t)); | |
| 380 for (k = 0; k < 2*hDecoder->frameLength; k++) | |
| 381 hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); | |
| 382 - } | |
| 383 } | |
| 384 #endif | |
| 385 | |
| 386 @@ -865,22 +842,13 @@ | |
| 387 | |
| 388 /* always allocate 2 channels, PS can always "suddenly" turn up */ | |
| 389 #if (defined(PS_DEC) || defined(DRM_PS)) | |
| 390 - output_channels = 2; | |
| 391 + output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1; | |
| 392 #else | |
| 393 output_channels = 1; | |
| 394 #endif | |
| 395 | |
| 396 - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) | |
| 397 - { | |
| 398 - /* element_output_channels not set yet */ | |
| 399 + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) { | |
| 400 hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; | |
| 401 - } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { | |
| 402 - /* element inconsistency */ | |
| 403 - return 21; | |
| 404 - } | |
| 405 - | |
| 406 - if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) | |
| 407 - { | |
| 408 retval = allocate_single_channel(hDecoder, sce->channel, output_channels); | |
| 409 if (retval > 0) | |
| 410 return retval; | |
| 411 @@ -1026,11 +994,10 @@ | |
| 412 { | |
| 413 return 23; | |
| 414 } | |
| 415 -#endif | |
| 416 | |
| 417 /* copy L to R when no PS is used */ | |
| 418 #if (defined(PS_DEC) || defined(DRM_PS)) | |
| 419 - if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0)) | |
| 420 + if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (output_channels == 2)) | |
| 421 { | |
| 422 uint8_t ele = hDecoder->fr_ch_ele; | |
| 423 uint8_t ch = sce->channel; | |
| 424 @@ -1040,6 +1007,7 @@ | |
| 425 memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); | |
| 426 } | |
| 427 #endif | |
| 428 +#endif | |
| 429 | |
| 430 return 0; | |
| 431 } |
