Rev 1905 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1905 | Rev 3960 | ||
---|---|---|---|
Line 86... | Line 86... | ||
86 | 86 | ||
87 | 87 | ||
Line -... | Line 88... | ||
- | 88 | /* The actual storage of a decoded sample is separated in the following macros. |
|
- | 89 | We can handle different types, we could also handle dithering here. */ |
|
- | 90 | ||
- | 91 | #ifdef NEWOLD_WRITE_SAMPLE |
|
- | 92 | ||
- | 93 | /* This is the old new mpg123 WRITE_SAMPLE, fixed for newer GCC by MPlayer folks. |
|
- | 94 | Makes a huge difference on old machines. */ |
|
- | 95 | #if WORDS_BIGENDIAN |
|
- | 96 | #define MANTISSA_OFFSET 1 |
|
- | 97 | #else |
|
- | 98 | #define MANTISSA_OFFSET 0 |
|
- | 99 | #endif |
|
- | 100 | #define WRITE_SHORT_SAMPLE(samples,sum,clip) { \ |
|
- | 101 | union { double dtemp; int itemp[2]; } u; int v; \ |
|
- | 102 | u.dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\ |
|
- | 103 | v = u.itemp[MANTISSA_OFFSET] - 0x80000000; \ |
|
- | 104 | if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \ |
|
- | 105 | else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \ |
|
- | 106 | else { *(samples) = v; } \ |
|
88 | /* The actual storage of a decoded sample is separated in the following macros. |
107 | } |
89 | We can handle different types, we could also handle dithering here. */ |
108 | |
90 | 109 | #else |
|
91 | /* Macro to produce a short (signed 16bit) output sample from internal representation, |
110 | /* Macro to produce a short (signed 16bit) output sample from internal representation, |
92 | which may be float, double or indeed some integer for fixed point handling. */ |
111 | which may be float, double or indeed some integer for fixed point handling. */ |
93 | #define WRITE_SHORT_SAMPLE(samples,sum,clip) \ |
112 | #define WRITE_SHORT_SAMPLE(samples,sum,clip) \ |
- | 113 | if( (sum) > REAL_PLUS_32767) { *(samples) = 0x7fff; (clip)++; } \ |
|
Line 94... | Line 114... | ||
94 | if( (sum) > REAL_PLUS_32767) { *(samples) = 0x7fff; (clip)++; } \ |
114 | else if( (sum) < REAL_MINUS_32768) { *(samples) = -0x8000; (clip)++; } \ |
95 | else if( (sum) < REAL_MINUS_32768) { *(samples) = -0x8000; (clip)++; } \ |
115 | else { *(samples) = REAL_TO_SHORT(sum); } |
96 | else { *(samples) = REAL_TO_SHORT(sum); } |
116 | #endif |
97 | 117 |