Mercurial > mplayer.hg
annotate libfaad2/local_changes.diff @ 28511:db19e31a2c7c
Add a calc_src_dst_rects that calculates from window size, panscan etc.
which part of the video source must be scaled onto which part of the window.
Direct3D and (future) VDPAU need this, for XvMC it makes it easier to add
cropping support and Xv is changed to keep the diff to XvMC small.
author | reimar |
---|---|
date | Thu, 12 Feb 2009 17:40:53 +0000 |
parents | 1a5cd79b2e6e |
children | 8c9ed8e6fc99 |
rev | line source |
---|---|
18141 | 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 $ | |
18783 | 9 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
18141 | 10 +** local_changes.diff contains the exact changes to this file. |
11 **/ | |
12 | |
13 #ifndef __BITS_H__ | |
14858 | 14 @@ -58,7 +61,7 @@ |
14712 | 15 |
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) \ | |
18141 | 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. | |
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 $ | |
18783 | 31 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
18141 | 32 +** local_changes.diff contains the exact changes to this file. |
33 **/ | |
34 | |
35 #ifndef __COMMON_H__ | |
24023 | 36 @@ -32,8 +35,13 @@ |
37 | |
38 #ifdef HAVE_CONFIG_H | |
39 # include "../config.h" | |
14712 | 40 #endif |
24023 | 41 + |
14712 | 42 +/* Allow build on Cygwin*/ |
43 +#if defined(__CYGWIN__) | |
44 +#define __STRICT_ANSI__ | |
24023 | 45 +#endif |
14712 | 46 |
47 #define INLINE __inline | |
48 #if 0 //defined(_WIN32) && !defined(_WIN32_WCE) | |
49 #define ALIGN __declspec(align(16)) | |
18141 | 50 @@ -61,7 +67,7 @@ |
16249 | 51 /* Use if target platform has address generators with autoincrement */ |
52 //#define PREFER_POINTERS | |
53 | |
54 -#ifdef _WIN32_WCE | |
55 +#if defined(_WIN32_WCE) || defined(__arm__) | |
56 #define FIXED_POINT | |
57 #endif | |
18141 | 58 |
14858 | 59 @@ -117,6 +123,9 @@ |
14712 | 60 # ifdef MAIN_DEC |
61 # undef MAIN_DEC | |
62 # endif | |
63 +# ifdef SBR_DEC | |
64 +# undef SBR_DEC | |
65 +# endif | |
66 #endif // FIXED_POINT | |
67 | |
68 #ifdef DRM | |
18141 | 69 @@ -151,6 +160,7 @@ |
14712 | 70 |
71 #include <stdlib.h> | |
72 | |
73 +#if 0 | |
74 typedef unsigned __int64 uint64_t; | |
75 typedef unsigned __int32 uint32_t; | |
76 typedef unsigned __int16 uint16_t; | |
24011 | 77 @@ -159,5 +169,9 @@ |
14712 | 78 typedef __int32 int32_t; |
79 typedef __int16 int16_t; | |
80 typedef __int8 int8_t; | |
81 +#else | |
82 +#include <inttypes.h> | |
83 +#endif | |
84 + | |
85 typedef float float32_t; | |
86 | |
18141 | 87 @@ -289,7 +319,7 @@ |
16249 | 88 } |
89 | |
90 | |
91 - #if defined(_WIN32) && !defined(__MINGW32__) | |
28336
1a5cd79b2e6e
HAVE_LRINTF is now always defined to either 0 or 1, not defined/undefined.
diego
parents:
24023
diff
changeset
|
92 + #if defined(_WIN32) && !defined(__MINGW32__) && !HAVE_LRINTF |
16249 | 93 #define HAS_LRINTF |
94 static INLINE int lrintf(float f) | |
95 { | |
18141 | 96 @@ -301,7 +331,7 @@ |
14712 | 97 } |
98 return i; | |
99 } | |
18141 | 100 - #elif (defined(__i386__) && defined(__GNUC__)) |
28336
1a5cd79b2e6e
HAVE_LRINTF is now always defined to either 0 or 1, not defined/undefined.
diego
parents:
24023
diff
changeset
|
101 + #elif (defined(__i386__) && defined(__GNUC__)) && !HAVE_LRINTF |
14712 | 102 #define HAS_LRINTF |
103 // from http://www.stereopsis.com/FPU.html | |
104 static INLINE int lrintf(float f) | |
28336
1a5cd79b2e6e
HAVE_LRINTF is now always defined to either 0 or 1, not defined/undefined.
diego
parents:
24023
diff
changeset
|
105 @@ -330,7 +360,7 @@ |
14712 | 106 |
107 #else | |
108 | |
109 +#include <math.h> | |
110 + | |
28336
1a5cd79b2e6e
HAVE_LRINTF is now always defined to either 0 or 1, not defined/undefined.
diego
parents:
24023
diff
changeset
|
111 -#ifdef HAVE_LRINTF |
1a5cd79b2e6e
HAVE_LRINTF is now always defined to either 0 or 1, not defined/undefined.
diego
parents:
24023
diff
changeset
|
112 -#if HAVE_LRINTF |
14712 | 113 # define HAS_LRINTF |
114 # define _ISOC9X_SOURCE 1 | |
18141 | 115 @@ -338,8 +370,6 @@ |
14712 | 116 # define __USE_ISOC99 1 |
117 #endif | |
118 | |
119 - #include <math.h> | |
120 - | |
121 #ifdef HAVE_SINF | |
122 # define sin sinf | |
123 #error | |
18141 | 124 --- libfaad2.orig/output.c 2006-03-16 20:15:04.000000000 +0100 |
125 +++ libfaad2/output.c 2006-04-18 19:50:26.000000000 +0200 | |
16249 | 126 @@ -19,10 +19,9 @@ |
127 ** Any non-GPL usage of this software or parts of this software is strictly | |
128 ** forbidden. | |
129 ** | |
130 -** Commercial non-GPL licensing of this software is possible. | |
131 -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
132 -** | |
17181
53c3eaaf8b49
Unify paths in patch and fix recent breakage, no -ko keyword expansion
diego
parents:
17137
diff
changeset
|
133 -** $Id: output.c,v 1.42 2004/09/04 14:56:28 menno Exp $ |
16249 | 134 +** Initially modified for use with MPlayer by Rich Felker on 2005/03/29 |
17181
53c3eaaf8b49
Unify paths in patch and fix recent breakage, no -ko keyword expansion
diego
parents:
17137
diff
changeset
|
135 +** $Id: output.c,v 1.11 2005/04/05 05:43:41 rfelker Exp $ |
18783 | 136 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
16249 | 137 **/ |
138 | |
139 #include "common.h" | |
18141 | 140 @@ -463,7 +462,7 @@ |
16249 | 141 } |
142 } | |
143 | |
144 -void* output_to_PCM(NeAACDecHandle hDecoder, | |
145 +void* output_to_PCM_sux(NeAACDecHandle hDecoder, | |
146 real_t **input, void *sample_buffer, uint8_t channels, | |
147 uint16_t frame_len, uint8_t format) | |
148 { | |
18141 | 149 @@ -554,4 +553,51 @@ |
16249 | 150 return sample_buffer; |
151 } | |
152 | |
153 +void* output_to_PCM(NeAACDecHandle hDecoder, | |
154 + real_t **input, void *sample_buffer, uint8_t channels, | |
155 + uint16_t frame_len, uint8_t format) | |
156 +{ | |
157 + int ch; | |
158 + int i; | |
159 + int16_t *short_sample_buffer = (int16_t*)sample_buffer; | |
160 + real_t *ch0 = input[hDecoder->internal_channel[0]]; | |
161 + real_t *ch1 = input[hDecoder->internal_channel[1]]; | |
162 + real_t *ch2 = input[hDecoder->internal_channel[2]]; | |
163 + real_t *ch3 = input[hDecoder->internal_channel[3]]; | |
164 + real_t *ch4 = input[hDecoder->internal_channel[4]]; | |
165 + | |
166 + if (format != FAAD_FMT_16BIT) | |
167 + return output_to_PCM_sux(hDecoder, input, sample_buffer, channels, frame_len, format); | |
168 + | |
169 + if (hDecoder->downMatrix) { | |
170 + for(i = 0; i < frame_len; i++) | |
171 + { | |
172 + int32_t tmp; | |
173 + tmp = (ch1[i] + ((ch0[i]+ch3[i])>>1) + ((ch0[i]+ch3[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1); | |
174 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; | |
175 + short_sample_buffer[0] = tmp; | |
176 + tmp = (ch2[i] + ((ch0[i]+ch4[i])>>1) + ((ch0[i]+ch4[i])>>2) + (1<<(REAL_BITS))) >> (REAL_BITS+1); | |
177 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; | |
178 + short_sample_buffer[1] = tmp; | |
179 + short_sample_buffer += channels; | |
180 + } | |
181 + return sample_buffer; | |
182 + } | |
183 + | |
184 + /* Copy output to a standard PCM buffer */ | |
185 + for(i = 0; i < frame_len; i++) | |
186 + { | |
187 + for (ch = 0; ch < channels; ch++) | |
188 + { | |
18141 | 189 + int32_t tmp = input[hDecoder->internal_channel[ch]][i]; |
16249 | 190 + tmp += (1 << (REAL_BITS-1)); |
191 + tmp >>= REAL_BITS; | |
192 + if ((tmp+0x8000) & ~0xffff) tmp = ~(tmp>>31)-0x8000; | |
193 + *(short_sample_buffer++) = tmp; | |
194 + } | |
195 + } | |
196 + | |
197 + return sample_buffer; | |
198 +} | |
199 + | |
200 #endif | |
18141 | 201 --- libfaad2.orig/ps_dec.c 2006-03-16 20:15:04.000000000 +0100 |
202 +++ libfaad2/ps_dec.c 2006-04-18 20:29:38.000000000 +0200 | |
203 @@ -22,7 +22,10 @@ | |
204 ** Commercial non-GPL licensing of this software is possible. | |
205 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
206 ** | |
207 +** Initially modified for use with MPlayer on 2005/12/05 | |
208 ** $Id: ps_dec.c,v 1.10 2004/09/04 14:56:28 menno Exp $ | |
18783 | 209 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
18141 | 210 +** local_changes.diff contains the exact changes to this file. |
211 **/ | |
212 | |
213 #include "common.h" | |
214 @@ -159,7 +162,7 @@ | |
215 | |
216 /* static function declarations */ | |
217 static void ps_data_decode(ps_info *ps); | |
218 -static hyb_info *hybrid_init(); | |
219 +static hyb_info *hybrid_init(void); | |
220 static void channel_filter2(hyb_info *hyb, uint8_t frame_len, const real_t *filter, | |
221 qmf_t *buffer, qmf_t **X_hybrid); | |
222 static void INLINE DCT3_4_unscaled(real_t *y, real_t *x); | |
223 @@ -189,7 +192,7 @@ | |
224 /* */ | |
225 | |
226 | |
227 -static hyb_info *hybrid_init() | |
228 +static hyb_info *hybrid_init(void) | |
229 { | |
230 uint8_t i; | |
231 | |
232 @@ -1935,8 +1938,8 @@ | |
17136 | 233 /* main Parametric Stereo decoding function */ |
234 uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]) | |
235 { | |
236 - qmf_t X_hybrid_left[32][32] = {{0}}; | |
237 - qmf_t X_hybrid_right[32][32] = {{0}}; | |
238 + qmf_t X_hybrid_left[32][32] = {{{0}}}; | |
239 + qmf_t X_hybrid_right[32][32] = {{{0}}}; | |
240 | |
241 /* delta decoding of the bitstream data */ | |
242 ps_data_decode(ps); | |
18141 | 243 --- libfaad2.orig/sbr_dec.c 2006-03-16 20:15:04.000000000 +0100 |
244 +++ libfaad2/sbr_dec.c 2006-04-18 20:33:57.000000000 +0200 | |
245 @@ -22,7 +22,10 @@ | |
246 ** Commercial non-GPL licensing of this software is possible. | |
247 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
248 ** | |
249 +** Initially modified for use with MPlayer on 2005/12/05 | |
250 ** $Id: sbr_dec.c,v 1.39 2004/09/04 14:56:28 menno Exp $ | |
18783 | 251 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
18141 | 252 +** local_changes.diff contains the exact changes to this file. |
253 **/ | |
254 | |
255 | |
256 @@ -526,8 +529,8 @@ | |
17137 | 257 uint8_t l, k; |
258 uint8_t dont_process = 0; | |
259 uint8_t ret = 0; | |
260 - ALIGN qmf_t X_left[38][64] = {{0}}; | |
261 - ALIGN qmf_t X_right[38][64] = {{0}}; /* must set this to 0 */ | |
262 + ALIGN qmf_t X_left[38][64] = {{{0}}}; | |
263 + ALIGN qmf_t X_right[38][64] = {{{0}}}; /* must set this to 0 */ | |
264 | |
265 if (sbr == NULL) | |
266 return 20; | |
18141 | 267 --- libfaad2.orig/specrec.c 2006-03-16 20:15:04.000000000 +0100 |
268 +++ libfaad2/specrec.c 2006-04-18 20:38:09.000000000 +0200 | |
269 @@ -19,10 +19,10 @@ | |
270 ** Any non-GPL usage of this software or parts of this software is strictly | |
271 ** forbidden. | |
272 ** | |
273 -** Commercial non-GPL licensing of this software is possible. | |
274 -** For more info contact Ahead Software through Mpeg4AAClicense@nero.com. | |
275 -** | |
276 +** Initially modified for use with MPlayer on 2006/04/18 | |
277 ** $Id: specrec.c,v 1.56 2004/09/08 09:43:11 gcp Exp $ | |
18783 | 278 +** detailed changelog at http://svn.mplayerhq.hu/mplayer/trunk/ |
18141 | 279 +** local_changes.diff contains the exact changes to this file. |
280 **/ | |
281 | |
282 /* | |
283 @@ -673,29 +673,19 @@ | |
284 /* MAIN object type prediction */ | |
285 if (hDecoder->object_type == MAIN) | |
286 { | |
287 - /* allocate the state only when needed */ | |
288 - if (hDecoder->pred_stat[channel] == NULL) | |
289 - { | |
290 - hDecoder->pred_stat[channel] = (pred_state*)faad_malloc(hDecoder->frameLength * sizeof(pred_state)); | |
291 + hDecoder->pred_stat[channel] = (pred_state*)realloc(hDecoder->pred_stat[channel], hDecoder->frameLength * sizeof(pred_state)); | |
292 reset_all_predictors(hDecoder->pred_stat[channel], hDecoder->frameLength); | |
293 - } | |
294 } | |
295 #endif | |
296 | |
297 #ifdef LTP_DEC | |
298 if (is_ltp_ot(hDecoder->object_type)) | |
299 { | |
300 - /* allocate the state only when needed */ | |
301 - if (hDecoder->lt_pred_stat[channel] == NULL) | |
302 - { | |
303 - hDecoder->lt_pred_stat[channel] = (int16_t*)faad_malloc(hDecoder->frameLength*4 * sizeof(int16_t)); | |
304 + hDecoder->lt_pred_stat[channel] = (int16_t*)realloc(hDecoder->lt_pred_stat[channel], hDecoder->frameLength*4 * sizeof(int16_t)); | |
305 memset(hDecoder->lt_pred_stat[channel], 0, hDecoder->frameLength*4 * sizeof(int16_t)); | |
306 - } | |
307 } | |
308 #endif | |
309 | |
310 - if (hDecoder->time_out[channel] == NULL) | |
311 - { | |
312 mul = 1; | |
313 #ifdef SBR_DEC | |
314 hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 0; | |
315 @@ -706,41 +696,28 @@ | |
316 hDecoder->sbr_alloced[hDecoder->fr_ch_ele] = 1; | |
317 } | |
318 #endif | |
319 - hDecoder->time_out[channel] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | |
320 + hDecoder->time_out[channel] = (real_t*)realloc(hDecoder->time_out[channel], mul*hDecoder->frameLength*sizeof(real_t)); | |
321 memset(hDecoder->time_out[channel], 0, mul*hDecoder->frameLength*sizeof(real_t)); | |
322 - } | |
323 #if (defined(PS_DEC) || defined(DRM_PS)) | |
324 if (output_channels == 2) | |
325 { | |
326 - if (hDecoder->time_out[channel+1] == NULL) | |
327 - { | |
328 - hDecoder->time_out[channel+1] = (real_t*)faad_malloc(mul*hDecoder->frameLength*sizeof(real_t)); | |
329 + hDecoder->time_out[channel+1] = (real_t*)realloc(hDecoder->time_out[channel+1], mul*hDecoder->frameLength*sizeof(real_t)); | |
330 memset(hDecoder->time_out[channel+1], 0, mul*hDecoder->frameLength*sizeof(real_t)); | |
331 - } | |
332 } | |
333 #endif | |
334 | |
335 - if (hDecoder->fb_intermed[channel] == NULL) | |
336 - { | |
337 - hDecoder->fb_intermed[channel] = (real_t*)faad_malloc(hDecoder->frameLength*sizeof(real_t)); | |
338 + hDecoder->fb_intermed[channel] = (real_t*)realloc(hDecoder->fb_intermed[channel], hDecoder->frameLength*sizeof(real_t)); | |
339 memset(hDecoder->fb_intermed[channel], 0, hDecoder->frameLength*sizeof(real_t)); | |
340 - } | |
341 | |
342 #ifdef SSR_DEC | |
343 if (hDecoder->object_type == SSR) | |
344 { | |
345 - if (hDecoder->ssr_overlap[channel] == NULL) | |
346 - { | |
347 - hDecoder->ssr_overlap[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | |
348 - memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | |
349 - } | |
350 - if (hDecoder->prev_fmd[channel] == NULL) | |
351 - { | |
352 uint16_t k; | |
353 - hDecoder->prev_fmd[channel] = (real_t*)faad_malloc(2*hDecoder->frameLength*sizeof(real_t)); | |
354 + hDecoder->ssr_overlap[channel] = (real_t*)realloc(hDecoder->ssr_overlap[channel], 2*hDecoder->frameLength*sizeof(real_t)); | |
355 + memset(hDecoder->ssr_overlap[channel], 0, 2*hDecoder->frameLength*sizeof(real_t)); | |
356 + hDecoder->prev_fmd[channel] = (real_t*)realloc(hDecoder->prev_fmd[channel], 2*hDecoder->frameLength*sizeof(real_t)); | |
357 for (k = 0; k < 2*hDecoder->frameLength; k++) | |
358 hDecoder->prev_fmd[channel][k] = REAL_CONST(-1); | |
359 - } | |
360 } | |
361 #endif | |
362 | |
363 @@ -865,22 +842,13 @@ | |
364 | |
365 /* always allocate 2 channels, PS can always "suddenly" turn up */ | |
366 #if (defined(PS_DEC) || defined(DRM_PS)) | |
367 - output_channels = 2; | |
368 + output_channels = hDecoder->ps_used[hDecoder->fr_ch_ele] ? 2 : 1; | |
369 #else | |
370 output_channels = 1; | |
371 #endif | |
372 | |
373 - if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] == 0) | |
374 - { | |
375 - /* element_output_channels not set yet */ | |
376 + if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] < output_channels) { | |
377 hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels; | |
378 - } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) { | |
379 - /* element inconsistency */ | |
380 - return 21; | |
381 - } | |
382 - | |
383 - if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0) | |
384 - { | |
385 retval = allocate_single_channel(hDecoder, sce->channel, output_channels); | |
386 if (retval > 0) | |
387 return retval; | |
388 @@ -1026,11 +994,10 @@ | |
389 { | |
390 return 23; | |
391 } | |
392 -#endif | |
393 | |
394 /* copy L to R when no PS is used */ | |
395 #if (defined(PS_DEC) || defined(DRM_PS)) | |
396 - if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0)) | |
397 + if ((hDecoder->ps_used[hDecoder->fr_ch_ele] == 0) && (output_channels == 2)) | |
398 { | |
399 uint8_t ele = hDecoder->fr_ch_ele; | |
400 uint8_t ch = sce->channel; | |
401 @@ -1040,6 +1007,7 @@ | |
402 memcpy(hDecoder->time_out[ch+1], hDecoder->time_out[ch], frame_size); | |
403 } | |
404 #endif | |
405 +#endif | |
406 | |
407 return 0; | |
408 } |