hvirtual/quicktime/ffmpeg/libavcodec/adpcm.c File Reference

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

Include dependency graph for adpcm.c:

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 []


Detailed Description

ADPCM codecs. 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)

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 Documentation

#define ADPCM_CODEC ( id,
name   )     ADPCM_ENCODER(id,name) ADPCM_DECODER(id,name)

Definition at line 1103 of file adpcm.c.

#define ADPCM_DECODER ( id,
name   ) 

Definition at line 1100 of file adpcm.c.

#define ADPCM_ENCODER ( id,
name   ) 

Definition at line 1084 of file adpcm.c.

#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().


Function Documentation

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]

static int adpcm_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
uint8_t *  buf,
int  buf_size 
) [static]

static int adpcm_decode_init ( AVCodecContext avctx  )  [static]

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_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]

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().

Here is the call graph for this function:


Variable Documentation

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
}
This is the step table. Note that many programs use slight deviations from this table, but such deviations are negligible:

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().


Generated on Mon Apr 28 14:03:14 2008 for Cinelerra by  doxygen 1.5.5