Diffstat (limited to 'core/multimedia/opieplayer/libmad/fixed.h') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/fixed.h | 75 |
1 files changed, 69 insertions, 6 deletions
diff --git a/core/multimedia/opieplayer/libmad/fixed.h b/core/multimedia/opieplayer/libmad/fixed.h index 00ade62..c9b98ca 100644 --- a/core/multimedia/opieplayer/libmad/fixed.h +++ b/core/multimedia/opieplayer/libmad/fixed.h | |||
@@ -1,3 +1,3 @@ | |||
1 | /* | 1 | /* |
2 | * mad - MPEG audio decoder | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2001 Robert Leslie |
@@ -36,2 +36,14 @@ typedef unsigned long mad_fixed64lo_t; | |||
36 | 36 | ||
37 | # if defined(_MSC_VER) | ||
38 | # define mad_fixed64_t signed __int64 | ||
39 | # elif 1 || defined(__GNUC__) | ||
40 | # define mad_fixed64_t signed long long | ||
41 | # endif | ||
42 | |||
43 | # if defined(FPM_FLOAT) | ||
44 | typedef double mad_sample_t; | ||
45 | # else | ||
46 | typedef mad_fixed_t mad_sample_t; | ||
47 | # endif | ||
48 | |||
37 | /* | 49 | /* |
@@ -96,7 +108,18 @@ typedef unsigned long mad_fixed64lo_t; | |||
96 | 108 | ||
97 | # if defined(FPM_64BIT) | 109 | # if defined(FPM_FLOAT) |
110 | # error "FPM_FLOAT not yet supported" | ||
111 | |||
112 | # undef MAD_F | ||
113 | # define MAD_F(x) mad_f_todouble(x) | ||
114 | |||
115 | # define mad_f_mul(x, y)((x) * (y)) | ||
116 | # define mad_f_scale64 | ||
117 | |||
118 | # undef ASO_ZEROCHECK | ||
119 | |||
120 | # elif defined(FPM_64BIT) | ||
98 | 121 | ||
99 | /* | 122 | /* |
100 | * This version should be the most accurate if 64-bit (long long) types are | 123 | * This version should be the most accurate if 64-bit types are supported by |
101 | * supported by the compiler, although it may not be the most efficient. | 124 | * the compiler, although it may not be the most efficient. |
102 | */ | 125 | */ |
@@ -105,3 +128,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
105 | ((mad_fixed_t) \ | 128 | ((mad_fixed_t) \ |
106 | ((((signed long long) (x) * (y)) + \ | 129 | ((((mad_fixed64_t) (x) * (y)) + \ |
107 | (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) | 130 | (1L << (MAD_F_SCALEBITS - 1))) >> MAD_F_SCALEBITS)) |
@@ -109,3 +132,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
109 | # define mad_f_mul(x, y) \ | 132 | # define mad_f_mul(x, y) \ |
110 | ((mad_fixed_t) (((signed long long) (x) * (y)) >> MAD_F_SCALEBITS)) | 133 | ((mad_fixed_t) (((mad_fixed64_t) (x) * (y)) >> MAD_F_SCALEBITS)) |
111 | # endif | 134 | # endif |
@@ -118,2 +141,25 @@ typedef unsigned long mad_fixed64lo_t; | |||
118 | 141 | ||
142 | # if defined(_MSC_VER) | ||
143 | # pragma warning(push) | ||
144 | # pragma warning(disable: 4035) /* no return value */ | ||
145 | static __forceinline | ||
146 | mad_fixed_t mad_f_mul_inline(mad_fixed_t x, mad_fixed_t y) | ||
147 | { | ||
148 | enum { | ||
149 | fracbits = MAD_F_FRACBITS | ||
150 | }; | ||
151 | |||
152 | __asm { | ||
153 | mov eax, x | ||
154 | imul y | ||
155 | shrd eax, edx, fracbits | ||
156 | } | ||
157 | |||
158 | /* implicit return of eax */ | ||
159 | } | ||
160 | # pragma warning(pop) | ||
161 | |||
162 | # define mad_f_mul mad_f_mul_inline | ||
163 | # define mad_f_scale64 | ||
164 | # else | ||
119 | /* | 165 | /* |
@@ -176,2 +222,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
176 | # define MAD_F_SCALEBITS MAD_F_FRACBITS | 222 | # define MAD_F_SCALEBITS MAD_F_FRACBITS |
223 | # endif | ||
177 | 224 | ||
@@ -219,2 +266,9 @@ typedef unsigned long mad_fixed64lo_t; | |||
219 | 266 | ||
267 | # define MAD_F_MLN(hi, lo) \ | ||
268 | asm ("rsbs%0, %2, #0\n\t" \ | ||
269 | "rsc%1, %3, #0" \ | ||
270 | : "=r" (lo), "=r" (hi) \ | ||
271 | : "0" (lo), "1" (hi) \ | ||
272 | : "cc") | ||
273 | |||
220 | # define mad_f_scale64(hi, lo) \ | 274 | # define mad_f_scale64(hi, lo) \ |
@@ -359,4 +413,8 @@ typedef unsigned long mad_fixed64lo_t; | |||
359 | */ | 413 | */ |
414 | # if defined(OPT_SPEED) | ||
415 | # define mad_f_mul(x, y)(((x) >> 12) * ((y) >> 16)) | ||
416 | # else | ||
360 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ | 417 | # define mad_f_mul(x, y)((((x) + (1L << 11)) >> 12) * \ |
361 | (((y) + (1L << 15)) >> 16)) | 418 | (((y) + (1L << 15)) >> 16)) |
419 | # endif | ||
362 | 420 | ||
@@ -382,2 +440,3 @@ typedef unsigned long mad_fixed64lo_t; | |||
382 | # define MAD_F_MLA(hi, lo, x, y)((lo) += mad_f_mul((x), (y))) | 440 | # define MAD_F_MLA(hi, lo, x, y)((lo) += mad_f_mul((x), (y))) |
441 | # define MAD_F_MLN(hi, lo) ((lo) = -(lo)) | ||
383 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) | 442 | # define MAD_F_MLZ(hi, lo) ((void) (hi), (mad_fixed_t) (lo)) |
@@ -389,2 +448,6 @@ typedef unsigned long mad_fixed64lo_t; | |||
389 | 448 | ||
449 | # if !defined(MAD_F_MLN) | ||
450 | # define MAD_F_MLN(hi, lo) ((hi) = ((lo) = -(lo)) ? ~(hi) : -(hi)) | ||
451 | # endif | ||
452 | |||
390 | # if !defined(MAD_F_MLZ) | 453 | # if !defined(MAD_F_MLZ) |