File syn_adpcm.c¶
FileList > audio > syn_adpcm.c
Go to the source code of this file
IMA/DVI ADPCM Speech and Audio Codec implementation.
#include "../util/syn_assert.h"#include "syn_adpcm.h"#include <string.h>
Public Static Attributes¶
| Type | Name |
|---|---|
| const int8_t | g_adpcm_index_table = /* multi line expression */ |
| const int16_t | g_adpcm_step_table = /* multi line expression */ |
Public Functions¶
| Type | Name |
|---|---|
| size_t | syn_adpcm_decode_block (SYN_ADPCM_State * state, const uint8_t * in, int16_t * out, size_t sample_count) Decode a buffer of packed 4-bit ADPCM bytes into 16-bit PCM samples. |
| int16_t | syn_adpcm_decode_sample (SYN_ADPCM_State * state, uint8_t nibble) Decode a single 4-bit ADPCM nibble to a 16-bit PCM sample. |
| size_t | syn_adpcm_encode_block (SYN_ADPCM_State * state, const int16_t * in, uint8_t * out, size_t sample_count) Encode 16-bit PCM samples into packed 4-bit ADPCM bytes. |
| uint8_t | syn_adpcm_encode_sample (SYN_ADPCM_State * state, int16_t sample) Encode a single 16-bit PCM sample to a 4-bit ADPCM nibble. |
| void | syn_adpcm_init (SYN_ADPCM_State * state) Initialize or reset an IMA-ADPCM state context. |
Public Static Attributes Documentation¶
variable g_adpcm_index_table¶
IMA-ADPCM Step Index Adjust Table (16 entries)
variable g_adpcm_step_table¶
IMA-ADPCM Quantization Step Table (89 entries)
Public Functions Documentation¶
function syn_adpcm_decode_block¶
Decode a buffer of packed 4-bit ADPCM bytes into 16-bit PCM samples.
size_t syn_adpcm_decode_block (
SYN_ADPCM_State * state,
const uint8_t * in,
int16_t * out,
size_t sample_count
)
Parameters:
stateState context pointer.inInput packed ADPCM byte buffer (2 nibbles per byte, low nibble first).outOutput 16-bit PCM sample buffer.sample_countTotal number of samples to decode.
Returns:
Number of samples successfully decoded.
function syn_adpcm_decode_sample¶
Decode a single 4-bit ADPCM nibble to a 16-bit PCM sample.
Parameters:
stateState context pointer.nibble4-bit ADPCM code (lower 4 bits used).
Returns:
Decoded 16-bit PCM sample.
function syn_adpcm_encode_block¶
Encode 16-bit PCM samples into packed 4-bit ADPCM bytes.
size_t syn_adpcm_encode_block (
SYN_ADPCM_State * state,
const int16_t * in,
uint8_t * out,
size_t sample_count
)
Parameters:
stateState context pointer.inInput 16-bit PCM sample buffer.outOutput packed ADPCM byte buffer (requires at least (sample_count + 1)/2 bytes).sample_countNumber of samples to encode.
Returns:
Number of packed bytes produced.
function syn_adpcm_encode_sample¶
Encode a single 16-bit PCM sample to a 4-bit ADPCM nibble.
Parameters:
stateState context pointer.sample16-bit linear PCM sample.
Returns:
Encoded 4-bit ADPCM nibble (in bits 0-3).
function syn_adpcm_init¶
Initialize or reset an IMA-ADPCM state context.
Parameters:
stateState context pointer.
The documentation for this class was generated from the following file src/syntropic/audio/syn_adpcm.c