options: Make dynamic dup hack work with new options
[mplayer.git] / libfaad2 / local_changes.diff
blobd7b1a7b0816661df8bd92e716cb7a8d6c7957595
1 --- libfaad2.orig/bits.h 2006-03-16 20:15:04.000000000 +0100
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 changelog at http://svn.mplayerhq.hu/mplayer/trunk/
10 +** local_changes.diff contains the exact changes to this file.
11 **/
13 #ifndef __BITS_H__
14 @@ -58,7 +61,7 @@
16 #if defined (_WIN32) && !defined(_WIN32_WCE) && !defined(__MINGW32__)
17 #define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax
18 -#elif defined(LINUX) || defined(DJGPP) || defined(__MINGW32__)
19 +#elif defined(LINUX) || defined(DJGPP)
20 #define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) )
21 #else
22 #define BSWAP(a) \
23 --- libfaad2.orig/common.h 2006-03-16 20:15:04.000000000 +0100
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.
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 changelog at http://svn.mplayerhq.hu/mplayer/trunk/
32 +** local_changes.diff contains the exact changes to this file.
33 **/
35 #ifndef __COMMON_H__
36 @@ -32,8 +35,13 @@
38 #ifdef HAVE_CONFIG_H
39 # include "../config.h"
40 #endif
42 +/* Allow build on Cygwin*/
43 +#if defined(__CYGWIN__)
44 +#define __STRICT_ANSI__
45 +#endif
47 #define INLINE __inline
48 #if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
49 #define ALIGN __declspec(align(16))
50 @@ -61,7 +67,7 @@
51 /* Use if target platform has address generators with autoincrement */
52 //#define PREFER_POINTERS
54 -#ifdef _WIN32_WCE
55 +#if defined(_WIN32_WCE) || defined(__arm__)
56 #define FIXED_POINT
57 #endif
59 @@ -117,6 +123,9 @@
60 # ifdef MAIN_DEC
61 # undef MAIN_DEC
62 # endif
63 +# ifdef SBR_DEC
64 +# undef SBR_DEC
65 +# endif
66 #endif // FIXED_POINT
68 #ifdef DRM
69 @@ -151,6 +160,7 @@
71 #include <stdlib.h>
73 +#if 0
74 typedef unsigned __int64 uint64_t;
75 typedef unsigned __int32 uint32_t;
76 typedef unsigned __int16 uint16_t;
77 @@ -159,5 +169,9 @@
78 typedef __int32 int32_t;
79 typedef __int16 int16_t;
80 typedef __int8 int8_t;
81 +#else
82 +#include <inttypes.h>
83 +#endif
85 typedef float float32_t;
87 @@ -289,7 +319,7 @@
91 - #if defined(_WIN32) && !defined(__MINGW32__)
92 + #if defined(_WIN32) && !defined(__MINGW32__) && !defined(HAVE_LRINTF)
93 #define HAS_LRINTF
94 static INLINE int lrintf(float f)
96 @@ -301,7 +331,7 @@
98 return i;
100 - #elif (defined(__i386__) && defined(__GNUC__))
101 + #elif (defined(__i386__) && defined(__GNUC__)) && !defined(HAVE_LRINTF)
102 #define HAS_LRINTF
103 // from http://www.stereopsis.com/FPU.html
104 static INLINE int lrintf(float f)
105 @@ -330,6 +360,8 @@
107 #else
109 +#include <math.h>
111 #ifdef HAVE_LRINTF
112 # define HAS_LRINTF
113 # define _ISOC9X_SOURCE 1
114 @@ -338,8 +370,6 @@
115 # define __USE_ISOC99 1
116 #endif
118 - #include <math.h>
120 #ifdef HAVE_SINF
121 # define sin sinf
122 #error
123 --- libfaad2.orig/output.c 2006-03-16 20:15:04.000000000 +0100
124 +++ libfaad2/output.c 2006-04-18 19:50:26.000000000 +0200
125 @@ -19,10 +19,9 @@
126 ** Any non-GPL usage of this software or parts of this software is strictly
127 ** forbidden.
129 -** Commercial non-GPL licensing of this software is possible.
130 -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
132 -** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $
133 +** Initially modified for use with MPlayer by Rich Felker on 2005/03/29
134 +** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $
135 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
138 #include "common.h"
139 @@ -463,7 +462,7 @@
143 -void* output_to_PCM(NeAACDecHandle hDecoder,
144 +void* output_to_PCM_sux(NeAACDecHandle hDecoder,
145 real_t **input, void *sample_buffer, uint8_t channels,
146 uint16_t frame_len, uint8_t format)
148 @@ -554,4 +553,51 @@
149 return sample_buffer;
152 +void* output_to_PCM(NeAACDecHandle hDecoder,
153 + real_t **input, void *sample_buffer, uint8_t channels,
154 + uint16_t frame_len, uint8_t format)
156 + int ch;
157 + int i;
158 + int16_t *short_sample_buffer = (int16_t*)sample_buffer;
159 + real_t *ch0 = input[hDecoder->internal_channel[0]];
160 + real_t *ch1 = input[hDecoder->internal_channel[1]];
161 + real_t *ch2 = input[hDecoder->internal_channel[2]];
162 + real_t *ch3 = input[hDecoder->internal_channel[3]];
163 + real_t *ch4 = input[hDecoder->internal_channel[4]];
165 + if (format != FAAD_FMT_16BIT)
166 + return output_to_PCM_sux(hDecoder, input, sample_buffer, channels, frame_len, format);
168 + if (hDecoder->downMatrix) {
169 + for(i = 0; i < frame_len; i++)
171 + int32_t tmp;
172 + tmp = (ch1[i] + ((ch0[i]+ch3[i])>>1) + ((ch0[i]+ch3[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1);
173 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
174 + short_sample_buffer[0] = tmp;
175 + tmp = (ch2[i] + ((ch0[i]+ch4[i])>>1) + ((ch0[i]+ch4[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1);
176 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
177 + short_sample_buffer[1] = tmp;
178 + short_sample_buffer += channels;
180 + return sample_buffer;
183 + /* Copy output to a standard PCM buffer */
184 + for(i = 0; i < frame_len; i++)
186 + for (ch = 0; ch < channels; ch++)
188 + int32_t tmp = input[hDecoder->internal_channel[ch]][i];
189 + tmp += (1 << (REAL_BITS-1));
190 + tmp >>= REAL_BITS;
191 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000;
192 + *(short_sample_buffer++) = tmp;
196 + return sample_buffer;
199 #endif
200 --- libfaad2.orig/ps_dec.c 2006-03-16 20:15:04.000000000 +0100
201 +++ libfaad2/ps_dec.c 2006-04-18 20:29:38.000000000 +0200
202 @@ -22,7 +22,10 @@
203 ** Commercial non-GPL licensing of this software is possible.
204 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
206 +** Initially modified for use with MPlayer on 2005/12/05
207 ** $Id: ps_dec.c,v 1.10 2004/09/04 14:56:28 menno Exp $
208 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
209 +** local_changes.diff contains the exact changes to this file.
212 #include "common.h"
213 @@ -159,7 +162,7 @@
215 /* static function declarations */
216 static void ps_data_decode(ps_info *ps);
217 -static hyb_info *hybrid_init();
218 +static hyb_info *hybrid_init(void);
219 static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter,
220 qmf_t *buffer, qmf_t **X_hybrid);
221 static void INLINE DCT3_4_unscaled(real_t *y, real_t *x);
222 @@ -189,7 +192,7 @@
223 /* */
226 -static hyb_info *hybrid_init()
227 +static hyb_info *hybrid_init(void)
229 uint8_t i;
231 @@ -1935,8 +1938,8 @@
232 /* main Parametric Stereo decoding function */
233 uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
235 - qmf_t X_hybrid_left[32][32] = {{0}};
236 - qmf_t X_hybrid_right[32][32] = {{0}};
237 + qmf_t X_hybrid_left[32][32] = {{{0}}};
238 + qmf_t X_hybrid_right[32][32] = {{{0}}};
240 /* delta decoding of the bitstream data */
241 ps_data_decode(ps);
242 --- libfaad2.orig/sbr_dec.c 2006-03-16 20:15:04.000000000 +0100
243 +++ libfaad2/sbr_dec.c 2006-04-18 20:33:57.000000000 +0200
244 @@ -22,7 +22,10 @@
245 ** Commercial non-GPL licensing of this software is possible.
246 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
248 +** Initially modified for use with MPlayer on 2005/12/05
249 ** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $
250 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
251 +** local_changes.diff contains the exact changes to this file.
255 @@ -526,8 +529,8 @@
256 uint8_t l, k;
257 uint8_t dont_process = 0;
258 uint8_t ret = 0;
259 - ALIGN qmf_t X_left[38][64] = {{0}};
260 - ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */
261 + ALIGN qmf_t X_left[38][64] = {{{0}}};
262 + ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */
264 if (sbr == NULL)
265 return 20;
266 --- libfaad2.orig/specrec.c 2006-03-16 20:15:04.000000000 +0100
267 +++ libfaad2/specrec.c 2006-04-18 20:38:09.000000000 +0200
268 @@ -19,10 +19,10 @@
269 ** Any non-GPL usage of this software or parts of this software is strictly
270 ** forbidden.
272 -** Commercial non-GPL licensing of this software is possible.
273 -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
275 +** Initially modified for use with MPlayer on 2006/04/18
276 ** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $
277 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/
278 +** local_changes.diff contains the exact changes to this file.
282 @@ -673,29 +673,19 @@
283 /* MAIN object type prediction */
284 if (hDecoder->object_type == MAIN)
286 - /* allocate the state only when needed */
287 - if (hDecoder->pred_stat[channel] == NULL)
289 - hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state));
290 + hDecoder->pred_stat[channel] = (pred_state*)realloc(hDecoder->pred_stat[channel], hDecoder->frameLength * sizeof(pred_state));
291 reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength);
294 #endif
296 #ifdef LTP_DEC
297 if (is_ltp_ot(hDecoder->object_type))
299 - /* allocate the state only when needed */
300 - if (hDecoder->lt_pred_stat[channel] == NULL)
302 - hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t));
303 + hDecoder->lt_pred_stat[channel] = (int16_t*)realloc(hDecoder->lt_pred_stat[channel], hDecoder->frameLength*4 * sizeof(int16_t));
304 memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t));
307 #endif
309 - if (hDecoder->time_out[channel] == NULL)
311 mul = 1;
312 #ifdef SBR_DEC
313 hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0;
314 @@ -706,41 +696,28 @@
315 hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1;
317 #endif
318 - hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
319 + hDecoder->time_out[channel] = (real_t*)realloc(hDecoder->time_out[channel], mul*hDecoder->frameLength*sizeof(real_t));
320 memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t));
322 #if (defined(PS_DEC) || defined(DRM_PS))
323 if (output_channels == 2)
325 - if (hDecoder->time_out[channel+1] == NULL)
327 - hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t));
328 + hDecoder->time_out[channel+1] = (real_t*)realloc(hDecoder->time_out[channel+1], mul*hDecoder->frameLength*sizeof(real_t));
329 memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t));
332 #endif
334 - if (hDecoder->fb_intermed[channel] == NULL)
336 - hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t));
337 + hDecoder->fb_intermed[channel] = (real_t*)realloc(hDecoder->fb_intermed[channel], hDecoder->frameLength*sizeof(real_t));
338 memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t));
341 #ifdef SSR_DEC
342 if (hDecoder->object_type == SSR)
344 - if (hDecoder->ssr_overlap[channel] == NULL)
346 - hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
347 - memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
349 - if (hDecoder->prev_fmd[channel] == NULL)
351 uint16_t k;
352 - hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t));
353 + hDecoder->ssr_overlap[channel] = (real_t*)realloc(hDecoder->ssr_overlap[channel], 2*hDecoder->frameLength*sizeof(real_t));
354 + memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t));
355 + hDecoder->prev_fmd[channel] = (real_t*)realloc(hDecoder->prev_fmd[channel], 2*hDecoder->frameLength*sizeof(real_t));
356 for (k = 0; k < 2*hDecoder->frameLength; k++)
357 hDecoder->prev_fmd[channel][k] = REAL_CONST(-1);
360 #endif
362 @@ -865,22 +842,13 @@
364 /* always allocate 2 channels, PS can always "suddenly" turn up */
365 #if (defined(PS_DEC) || defined(DRM_PS))
366 - output_channels = 2;
367 + output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1;
368 #else
369 output_channels = 1;
370 #endif
372 - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0)
374 - /* element_output_channels not set yet */
375 + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) {
376 hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
377 - } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
378 - /* element inconsistency */
379 - return 21;
382 - if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)
384 retval = allocate_single_channel(hDecoder, sce->channel, output_channels);
385 if (retval > 0)
386 return retval;
387 @@ -1026,11 +994,10 @@
389 return 23;
391 -#endif
393 /* copy L to R when no PS is used */
394 #if (defined(PS_DEC) || defined(DRM_PS))
395 - if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0))
396 + if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (output_channels == 2))
398 uint8_t ele = hDecoder->fr_ch_ele;
399 uint8_t ch = sce->channel;
400 @@ -1040,6 +1007,7 @@
401 memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size);
403 #endif
404 +#endif
406 return 0;