| 1 |
//////////////////////////////////////////////////////////////////////////// |
| 2 |
// **** ADPCM-XQ **** // |
| 3 |
// Xtreme Quality ADPCM Encoder/Decoder // |
| 4 |
// Copyright (c) 2015 David Bryant. // |
| 5 |
// All Rights Reserved. // |
| 6 |
// Distributed under the BSD Software License (see license.txt) // |
| 7 |
//////////////////////////////////////////////////////////////////////////// |
| 8 |
|
| 9 |
#ifndef ADPCMLIB_H_ |
| 10 |
#define ADPCMLIB_H_ |
| 11 |
|
| 12 |
#define NOISE_SHAPING_OFF 0 // flat noise (no shaping) |
| 13 |
#define NOISE_SHAPING_STATIC 1 // first-order highpass shaping |
| 14 |
#define NOISE_SHAPING_DYNAMIC 2 // dynamically tilted noise based on signal |
| 15 |
|
| 16 |
#if defined(_MSC_VER) && _MSC_VER < 1600 |
| 17 |
typedef unsigned __int64 uint64_t; |
| 18 |
typedef unsigned __int32 uint32_t; |
| 19 |
typedef unsigned __int16 uint16_t; |
| 20 |
typedef unsigned __int8 uint8_t; |
| 21 |
typedef __int64 int64_t; |
| 22 |
typedef __int32 int32_t; |
| 23 |
typedef __int16 int16_t; |
| 24 |
typedef __int8 int8_t; |
| 25 |
#else |
| 26 |
#include <stdint.h> |
| 27 |
#endif |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
#endif |
| 32 |
|
| 33 |
|
| 34 |
void *adpcm_create_context (int num_channels, int lookahead, int noise_shaping, int32_t initial_deltas [2]); |
| 35 |
int adpcm_encode_block (void *p, uint8_t *outbuf, size_t *outbufsize, const int16_t *inbuf, int inbufcount); |
| 36 |
int adpcm_decode_block (int16_t *outbuf, const uint8_t *inbuf, size_t inbufsize, size_t outbufsize); |
| 37 |
void adpcm_free_context (void *p); |
| 38 |
|
| 39 |
#ifdef __cplusplus |
| 40 |
} |
| 41 |
#endif |
| 42 |
|
| 43 |
|
| 44 |
#endif /* ADPCMLIB_H_ */ |