summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/ad_imaadpcm.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-06-29 08:42:53 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-06-29 08:42:53 +0000
commit6767061f8bcc65d53ab979d159e4c758c1f73656 (patch)
tree608be9de4d0362135bd4d2aada403a9786e5d2b8 /libmpcodecs/ad_imaadpcm.c
parent5e97c2f9603d6cc1dc126d9a62f8b873c6121c17 (diff)
downloadmpv-6767061f8bcc65d53ab979d159e4c758c1f73656.tar.bz2
mpv-6767061f8bcc65d53ab979d159e4c758c1f73656.tar.xz
Simplify some imaadpcm macros
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27150 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/ad_imaadpcm.c')
-rw-r--r--libmpcodecs/ad_imaadpcm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c
index bbb30fbc6c..eb7d570f3b 100644
--- a/libmpcodecs/ad_imaadpcm.c
+++ b/libmpcodecs/ad_imaadpcm.c
@@ -58,14 +58,13 @@ static const int8_t adpcm_index[16] =
// useful macros
// clamp a number between 0 and 88
-#define CLAMP_0_TO_88(x) if (x < 0) x = 0; else if (x > 88) x = 88;
+#define CLAMP_0_TO_88(x) x = av_clip(x, 0, 88);
// clamp a number within a signed 16-bit range
-#define CLAMP_S16(x) if (x < -32768) x = -32768; \
- else if (x > 32767) x = 32767;
+#define CLAMP_S16(x) x = av_clip_int16(x);
// clamp a number above 16
#define CLAMP_ABOVE_16(x) if (x < 16) x = 16;
// sign extend a 16-bit value
-#define SE_16BIT(x) if (x & 0x8000) x -= 0x10000;
+#define SE_16BIT(x) x = (int16_t)x;
// sign extend a 4-bit value
#define SE_4BIT(x) if (x & 0x8) x -= 0x10;