#include "avcodec.h"#include "bitstream.h"

Go to the source code of this file.
Data Structures | |
| struct | ADPCMChannelStatus |
| struct | ADPCMContext |
Defines | |
| #define | BLKSIZE 1024 |
| #define | CLAMP_TO_SHORT(value) |
| #define | DK3_GET_NEXT_NIBBLE() |
| #define | ADPCM_ENCODER(id, name) |
| #define | ADPCM_DECODER(id, name) |
| #define | ADPCM_CODEC(id, name) ADPCM_ENCODER(id,name) ADPCM_DECODER(id,name) |
Functions | |
| static int | adpcm_decode_init (AVCodecContext *avctx) |
| static short | adpcm_ima_expand_nibble (ADPCMChannelStatus *c, char nibble, int shift) |
| static short | adpcm_ms_expand_nibble (ADPCMChannelStatus *c, char nibble) |
| static short | adpcm_ct_expand_nibble (ADPCMChannelStatus *c, char nibble) |
| static short | adpcm_yamaha_expand_nibble (ADPCMChannelStatus *c, unsigned char nibble) |
| static void | xa_decode (short *out, const unsigned char *in, ADPCMChannelStatus *left, ADPCMChannelStatus *right, int inc) |
| static int | adpcm_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_MS, adpcm_ms) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_4XM, adpcm_4xm) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_XA, adpcm_xa) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_ADX, adpcm_adx) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_EA, adpcm_ea) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_CT, adpcm_ct) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_SWF, adpcm_swf) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha) | |
Variables | |
| static const int | index_table [16] |
| static const int | step_table [89] |
| static const int | AdaptationTable [] |
| static const int | AdaptCoeff1 [] |
| static const int | AdaptCoeff2 [] |
| static const int | xa_adpcm_table [5][2] |
| static const int | ea_adpcm_table [] |
| static const int | ct_adpcm_table [8] |
| static const int | swf_index_tables [4][16] |
| static const int | yamaha_indexscale [] |
| static const int | yamaha_difflookup [] |
Features and limitations:
Reference documents: http://www.pcisys.net/~melanson/codecs/simpleaudio.html http://www.geocities.com/SiliconValley/8682/aud3.txt http://openquicktime.sourceforge.net/plugins.htm XAnim sources (xa_codec.c) http://www.rasnaimaging.com/people/lapus/download.html http://www.cs.ucla.edu/~leec/mediabench/applications.html SoX source code http://home.sprynet.com/~cbagwell/sox.html
CD-ROM XA: http://ku-www.ss.titech.ac.jp/~yatsushi/xaadpcm.html vagpack & depack http://homepages.compuserve.de/bITmASTER32/psx-index.html readstr http://www.geocities.co.jp/Playtown/2004/
Definition in file adpcm.c.
| #define ADPCM_CODEC | ( | id, | |||
| name | ) | ADPCM_ENCODER(id,name) ADPCM_DECODER(id,name) |
| #define BLKSIZE 1024 |
Definition at line 47 of file adpcm.c.
Referenced by psycho_2_init(), psycho_3(), psycho_3_init(), and psycho_4_init().
| #define CLAMP_TO_SHORT | ( | value | ) |
Value:
if (value > 32767) \ value = 32767; \ else if (value < -32768) \ value = -32768; \
Definition at line 49 of file adpcm.c.
Referenced by adpcm_ct_expand_nibble(), adpcm_decode_frame(), adpcm_ima_expand_nibble(), adpcm_ms_expand_nibble(), adpcm_yamaha_expand_nibble(), and xa_decode().
| #define DK3_GET_NEXT_NIBBLE | ( | ) |
Value:
if (decode_top_nibble_next) \ { \ nibble = (last_byte >> 4) & 0x0F; \ decode_top_nibble_next = 0; \ } \ else \ { \ last_byte = *src++; \ if (src >= buf + buf_size) break; \ nibble = last_byte & 0x0F; \ decode_top_nibble_next = 1; \ }
Definition at line 600 of file adpcm.c.
Referenced by adpcm_decode_frame().
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_YAMAHA | , | |
| adpcm_yamaha | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_SWF | , | |
| adpcm_swf | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_CT | , | |
| adpcm_ct | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_EA | , | |
| adpcm_ea | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_ADX | , | |
| adpcm_adx | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_XA | , | |
| adpcm_xa | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_4XM | , | |
| adpcm_4xm | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_MS | , | |
| adpcm_ms | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_SMJPEG | , | |
| adpcm_ima_smjpeg | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_WS | , | |
| adpcm_ima_ws | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_DK4 | , | |
| adpcm_ima_dk4 | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_DK3 | , | |
| adpcm_ima_dk3 | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_WAV | , | |
| adpcm_ima_wav | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_QT | , | |
| adpcm_ima_qt | ||||
| ) |
| static short adpcm_ct_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble | |||
| ) | [inline, static] |
Definition at line 486 of file adpcm.c.
References CLAMP_TO_SHORT, ct_adpcm_table, ADPCMChannelStatus::predictor, and ADPCMChannelStatus::step.
Referenced by adpcm_decode_frame().
| static int adpcm_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
Definition at line 614 of file adpcm.c.
References AdaptCoeff1, AdaptCoeff2, adpcm_ct_expand_nibble(), adpcm_ima_expand_nibble(), adpcm_ms_expand_nibble(), adpcm_yamaha_expand_nibble(), av_log(), AV_LOG_ERROR, AVCodecContext::block_align, ADPCMContext::channel, AVCodecContext::channels, CLAMP_TO_SHORT, AVCodecContext::codec, CODEC_ID_ADPCM_4XM, CODEC_ID_ADPCM_CT, CODEC_ID_ADPCM_EA, CODEC_ID_ADPCM_IMA_DK3, CODEC_ID_ADPCM_IMA_DK4, CODEC_ID_ADPCM_IMA_QT, CODEC_ID_ADPCM_IMA_SMJPEG, CODEC_ID_ADPCM_IMA_WAV, CODEC_ID_ADPCM_IMA_WS, CODEC_ID_ADPCM_MS, CODEC_ID_ADPCM_SWF, CODEC_ID_ADPCM_XA, CODEC_ID_ADPCM_YAMAHA, ADPCMChannelStatus::coeff1, ADPCMChannelStatus::coeff2, DK3_GET_NEXT_NIBBLE, ea_adpcm_table, get_bits(), get_bits_count(), get_sbits(), AVCodec::id, ADPCMChannelStatus::idelta, init_get_bits(), LE_16, LE_32, ADPCMContext::nb_bits, ADPCMContext::nb_samples, ADPCMChannelStatus::predictor, AVCodecContext::priv_data, ADPCMChannelStatus::sample1, ADPCMChannelStatus::sample2, signmask, src, ADPCMContext::status, step, ADPCMChannelStatus::step, ADPCMChannelStatus::step_index, step_table, swf_index_tables, and xa_decode().

| static int adpcm_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 423 of file adpcm.c.
References ADPCMContext::channel, AVCodecContext::codec, CODEC_ID_ADPCM_CT, AVCodec::id, ADPCMChannelStatus::predictor, AVCodecContext::priv_data, ADPCMContext::status, ADPCMChannelStatus::step, and ADPCMChannelStatus::step_index.
| static short adpcm_ima_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble, | |||
| int | shift | |||
| ) | [inline, static] |
Definition at line 442 of file adpcm.c.
References CLAMP_TO_SHORT, index_table, ADPCMChannelStatus::predictor, step, ADPCMChannelStatus::step_index, and step_table.
Referenced by adpcm_decode_frame().
| static short adpcm_ms_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble | |||
| ) | [inline, static] |
Definition at line 470 of file adpcm.c.
References AdaptationTable, CLAMP_TO_SHORT, ADPCMChannelStatus::coeff1, ADPCMChannelStatus::coeff2, ADPCMChannelStatus::idelta, ADPCMChannelStatus::sample1, and ADPCMChannelStatus::sample2.
Referenced by adpcm_decode_frame().
| static short adpcm_yamaha_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| unsigned char | nibble | |||
| ) | [inline, static] |
Definition at line 517 of file adpcm.c.
References CLAMP_TO_SHORT, ADPCMChannelStatus::predictor, ADPCMChannelStatus::step, yamaha_difflookup, and yamaha_indexscale.
Referenced by adpcm_decode_frame().
| static void xa_decode | ( | short * | out, | |
| const unsigned char * | in, | |||
| ADPCMChannelStatus * | left, | |||
| ADPCMChannelStatus * | right, | |||
| int | inc | |||
| ) | [static] |
Definition at line 531 of file adpcm.c.
References CLAMP_TO_SHORT, filter(), s, ADPCMChannelStatus::sample1, ADPCMChannelStatus::sample2, shift(), t, and xa_adpcm_table.
Referenced by adpcm_decode_frame().

const int AdaptationTable[] [static] |
Initial value:
{
230, 230, 230, 230, 307, 409, 512, 614,
768, 614, 512, 409, 307, 230, 230, 230
}
Definition at line 80 of file adpcm.c.
Referenced by adpcm_ms_expand_nibble().
const int AdaptCoeff1[] [static] |
Initial value:
{
256, 512, 0, 192, 240, 460, 392
}
Definition at line 85 of file adpcm.c.
Referenced by adpcm_decode_frame().
const int AdaptCoeff2[] [static] |
Initial value:
{
0, -256, 0, 64, 0, -208, -232
}
Definition at line 89 of file adpcm.c.
Referenced by adpcm_decode_frame().
const int ct_adpcm_table[8] [static] |
Initial value:
{
0x00E6, 0x00E6, 0x00E6, 0x00E6,
0x0133, 0x0199, 0x0200, 0x0266
}
Definition at line 107 of file adpcm.c.
Referenced by adpcm_ct_expand_nibble().
const int ea_adpcm_table[] [static] |
Initial value:
{
0, 240, 460, 392, 0, 0, -208, -220, 0, 1,
3, 4, 7, 8, 10, 11, 0, -1, -3, -4
}
Definition at line 102 of file adpcm.c.
Referenced by adpcm_decode_frame().
const int index_table[16] [static] |
Initial value:
{
-1, -1, -1, -1, 2, 4, 6, 8,
-1, -1, -1, -1, 2, 4, 6, 8,
}
Definition at line 57 of file adpcm.c.
Referenced by adpcm_ima_expand_nibble().
const int step_table[89] [static] |
Initial value:
{
7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
}
Definition at line 66 of file adpcm.c.
Referenced by adpcm_decode_frame(), and adpcm_ima_expand_nibble().
const int swf_index_tables[4][16] [static] |
Initial value:
{
{ -1, 2 },
{ -1, -1, 2, 4 },
{ -1, -1, -1, -1, 2, 4, 6, 8 },
{ -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 }
}
Definition at line 113 of file adpcm.c.
Referenced by adpcm_decode_frame().
const int xa_adpcm_table[5][2] [static] |
Initial value:
{
{ 0, 0 },
{ 60, 0 },
{ 115, -52 },
{ 98, -55 },
{ 122, -60 }
}
Definition at line 94 of file adpcm.c.
Referenced by xa_decode().
const int yamaha_difflookup[] [static] |
Initial value:
{
1, 3, 5, 7, 9, 11, 13, 15,
-1, -3, -5, -7, -9, -11, -13, -15
}
Definition at line 125 of file adpcm.c.
Referenced by adpcm_yamaha_expand_nibble().
const int yamaha_indexscale[] [static] |
Initial value:
{
230, 230, 230, 230, 307, 409, 512, 614,
230, 230, 230, 230, 307, 409, 512, 614
}
Definition at line 120 of file adpcm.c.
Referenced by adpcm_yamaha_expand_nibble().
1.5.5