diff options
author | v0lt <v0lt@users.sourceforge.net> | 2012-06-10 22:41:19 +0400 |
---|---|---|
committer | v0lt <v0lt@users.sourceforge.net> | 2012-06-10 22:41:19 +0400 |
commit | 5bdb0965b69ca1574503e16110a0a82c98edd49d (patch) | |
tree | 227cb6eafbcafa3c291f73b67b69c6ba9fe04cf3 /src | |
parent | 61e9b784914ff6f80bfccd6bc31dac39cf1d94d0 (diff) |
AudioSwitcher: fixed limits for int24
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5080 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
-rw-r--r-- | src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp index f6015def2..883a58fbe 100644 --- a/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp +++ b/src/filters/switcher/AudioSwitcher/AudioSwitcher.cpp @@ -38,6 +38,8 @@ #endif
#include <moreuuids.h>
+#define INT24_MAX 8388607
+#define INT24_MIN (-8388608)
#ifdef REGISTER_FILTER
@@ -157,7 +159,7 @@ __forceinline void mix(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst) }
template<>
-__forceinline void mix<int, INT64, (-1<<24), (+1<<24)-1>(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
+__forceinline void mix<int, INT64, INT24_MIN, INT24_MAX>(DWORD mask, int ch, int bps, BYTE* src, BYTE* dst)
{
INT64 sum = 0;
@@ -169,7 +171,7 @@ __forceinline void mix<int, INT64, (-1<<24), (+1<<24)-1>(DWORD mask, int ch, int }
}
- sum = min(max(sum, (-1<<24)), (+1<<24)-1);
+ sum = min(max(sum, INT24_MIN), INT24_MAX);
memcpy(dst, (BYTE*)&sum, 3);
}
@@ -312,7 +314,7 @@ HRESULT CAudioSwitcherFilter::Transform(IMediaSample* pIn, IMediaSample* pOut) }
} else if (fPCM && wfe->wBitsPerSample == 24) {
for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
- mix<int, INT64, (-1<<24), (+1<<24)-1>(mask, channels, bps, src, dst);
+ mix<int, INT64, INT24_MIN, INT24_MAX>(mask, channels, bps, src, dst);
}
} else if (fPCM && wfe->wBitsPerSample == 32) {
for (int k = 0; k < len; k++, src += srcstep, dst += dststep) {
|