#include "avcodec.h"
#include "bitstream.h"
#include "bytestream.h"
Go to the source code of this file.
Data Structures | |
| struct | ADPCMChannelStatus |
| struct | ADPCMContext |
Defines | |
| #define | BLKSIZE 1024 |
| #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_sbpro_expand_nibble (ADPCMChannelStatus *c, char nibble, int size, int shift) |
| 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, const uint8_t *buf, int buf_size) |
| ADPCM_DECODER (CODEC_ID_ADPCM_4XM, adpcm_4xm) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_CT, adpcm_ct) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_EA, adpcm_ea) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_EA_R1, adpcm_ea_r1) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_EA_R2, adpcm_ea_r2) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_EA_R3, adpcm_ea_r3) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_EA_XAS, adpcm_ea_xas) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_AMV, adpcm_ima_amv) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_DK3, adpcm_ima_dk3) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_DK4, adpcm_ima_dk4) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_IMA_WS, adpcm_ima_ws) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_MS, adpcm_ms) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_SBPRO_4, adpcm_sbpro_4) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_SBPRO_3, adpcm_sbpro_3) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_SBPRO_2, adpcm_sbpro_2) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_SWF, adpcm_swf) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_THP, adpcm_thp) | |
| ADPCM_DECODER (CODEC_ID_ADPCM_XA, adpcm_xa) | |
| ADPCM_CODEC (CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha) | |
Variables | |
| static const int | index_table [16] |
| static const int | step_table [89] |
| This is the step table. | |
| 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 [] |
First version by Francois Revol (revol@free.fr) Fringe ADPCM codecs (e.g., DK3, DK4, Westwood) by Mike Melanson (melanson@pcisys.net) CD-ROM XA ADPCM codec by BERO EA ADPCM decoder by Robin Kay (komadori@myrealbox.com) EA ADPCM R1/R2/R3 decoder by Peter Ross (pross@xvid.org) EA IMA EACS decoder by Peter Ross (pross@xvid.org) EA IMA SEAD decoder by Peter Ross (pross@xvid.org) EA ADPCM XAS decoder by Peter Ross (pross@xvid.org) THP ADPCM decoder by Marco Gerards (mgerards@xs4all.nl)
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 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 828 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_MS | , | |
| adpcm_ms | ||||
| ) |
| ADPCM_CODEC | ( | CODEC_ID_ADPCM_IMA_WAV | , | |
| adpcm_ima_wav | ||||
| ) |
| static short adpcm_ct_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble | |||
| ) | [inline, static] |
| static int adpcm_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| const uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
| static int adpcm_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_XA | , | |
| adpcm_xa | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_THP | , | |
| adpcm_thp | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_SBPRO_2 | , | |
| adpcm_sbpro_2 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_SBPRO_3 | , | |
| adpcm_sbpro_3 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_SBPRO_4 | , | |
| adpcm_sbpro_4 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_WS | , | |
| adpcm_ima_ws | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_SMJPEG | , | |
| adpcm_ima_smjpeg | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_QT | , | |
| adpcm_ima_qt | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_EA_SEAD | , | |
| adpcm_ima_ea_sead | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_EA_EACS | , | |
| adpcm_ima_ea_eacs | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_DK4 | , | |
| adpcm_ima_dk4 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_DK3 | , | |
| adpcm_ima_dk3 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_IMA_AMV | , | |
| adpcm_ima_amv | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_EA_XAS | , | |
| adpcm_ea_xas | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_EA_R3 | , | |
| adpcm_ea_r3 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_EA_R2 | , | |
| adpcm_ea_r2 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_EA_R1 | , | |
| adpcm_ea_r1 | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_EA | , | |
| adpcm_ea | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_CT | , | |
| adpcm_ct | ||||
| ) |
| ADPCM_DECODER | ( | CODEC_ID_ADPCM_4XM | , | |
| adpcm_4xm | ||||
| ) |
| static short adpcm_ima_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble, | |||
| int | shift | |||
| ) | [inline, static] |
| static short adpcm_ms_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble | |||
| ) | [inline, static] |
| static short adpcm_sbpro_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| char | nibble, | |||
| int | size, | |||
| int | shift | |||
| ) | [inline, static] |
| static short adpcm_yamaha_expand_nibble | ( | ADPCMChannelStatus * | c, | |
| unsigned char | nibble | |||
| ) | [inline, static] |
| static void xa_decode | ( | short * | out, | |
| const unsigned char * | in, | |||
| ADPCMChannelStatus * | left, | |||
| ADPCMChannelStatus * | right, | |||
| int | inc | |||
| ) | [static] |
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 82 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 87 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 91 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 109 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 104 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 59 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
}
Note that many programs use slight deviations from this table, but such deviations are negligible:
Definition at line 68 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 115 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 96 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 127 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 122 of file adpcm.c.
Referenced by adpcm_yamaha_expand_nibble().
1.5.6