comparison libmpcodecs/ad_msadpcm.c @ 27224:f9b5d028f097

Copy macro simplification from imaadpcm to msadpcm
author reimar
date Fri, 11 Jul 2008 18:36:21 +0000
parents ffe50e8b6e1c
children 46bcd3f1b123
comparison
equal deleted inserted replaced
27223:ffe50e8b6e1c 27224:f9b5d028f097
10 #include <stdio.h> 10 #include <stdio.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <unistd.h> 12 #include <unistd.h>
13 13
14 #include "config.h" 14 #include "config.h"
15 #include "libavutil/common.h"
15 #include "mpbswap.h" 16 #include "mpbswap.h"
16 #include "ad_internal.h" 17 #include "ad_internal.h"
17 18
18 static ad_info_t info = 19 static ad_info_t info =
19 { 20 {
45 #define MS_ADPCM_PREAMBLE_SIZE 6 46 #define MS_ADPCM_PREAMBLE_SIZE 6
46 47
47 #define LE_16(x) ((x)[0]+(256*((x)[1]))) 48 #define LE_16(x) ((x)[0]+(256*((x)[1])))
48 49
49 // clamp a number between 0 and 88 50 // clamp a number between 0 and 88
50 #define CLAMP_0_TO_88(x) if (x < 0) x = 0; else if (x > 88) x = 88; 51 #define CLAMP_0_TO_88(x) x = av_clip(x, 0, 88);
51 // clamp a number within a signed 16-bit range 52 // clamp a number within a signed 16-bit range
52 #define CLAMP_S16(x) if (x < -32768) x = -32768; \ 53 #define CLAMP_S16(x) x = av_clip_int16(x);
53 else if (x > 32767) x = 32767;
54 // clamp a number above 16 54 // clamp a number above 16
55 #define CLAMP_ABOVE_16(x) if (x < 16) x = 16; 55 #define CLAMP_ABOVE_16(x) if (x < 16) x = 16;
56 // sign extend a 16-bit value 56 // sign extend a 16-bit value
57 #define SE_16BIT(x) if (x & 0x8000) x -= 0x10000; 57 #define SE_16BIT(x) if (x & 0x8000) x -= 0x10000;
58 // sign extend a 4-bit value 58 // sign extend a 4-bit value