changeset 27118:5798fb7fceb6

Simplify some imaadpcm macros
author reimar
date Sun, 29 Jun 2008 08:42:53 +0000
parents 95495e636ba8
children 7c07e13eeae3
files libmpcodecs/ad_imaadpcm.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ad_imaadpcm.c	Sun Jun 29 08:35:27 2008 +0000
+++ b/libmpcodecs/ad_imaadpcm.c	Sun Jun 29 08:42:53 2008 +0000
@@ -58,14 +58,13 @@
 
 // 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;