libavcodec/pcm.c File Reference

PCM codecs. More...

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

Go to the source code of this file.

Data Structures

struct  PCMDecode

Defines

#define MAX_CHANNELS   64
#define SIGN_BIT   (0x80)
#define QUANT_MASK   (0xf)
#define NSEGS   (8)
#define SEG_SHIFT   (4)
#define SEG_MASK   (0x70)
#define BIAS   (0x84)
#define PCM_ENCODER(id, name)
#define PCM_DECODER(id, name)
#define PCM_CODEC(id, name)   PCM_ENCODER(id,name) PCM_DECODER(id,name)

Functions

static int alaw2linear (unsigned char a_val)
static int ulaw2linear (unsigned char u_val)
static void build_xlaw_table (uint8_t *linear_to_xlaw, int(*xlaw2linear)(unsigned char), int mask)
static int pcm_encode_init (AVCodecContext *avctx)
static int pcm_encode_close (AVCodecContext *avctx)
static void encode_from16 (int bps, int le, int us, short **samples, uint8_t **dst, int n)
 convert samples from 16 bit
static int pcm_encode_frame (AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data)
static int pcm_decode_init (AVCodecContext *avctx)
static void decode_to16 (int bps, int le, int us, const uint8_t **src, short **samples, int src_len)
 convert samples to 16 bit
static int pcm_decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
 PCM_CODEC (CODEC_ID_PCM_S32LE, pcm_s32le)
 PCM_CODEC (CODEC_ID_PCM_S32BE, pcm_s32be)
 PCM_CODEC (CODEC_ID_PCM_U32LE, pcm_u32le)
 PCM_CODEC (CODEC_ID_PCM_U32BE, pcm_u32be)
 PCM_CODEC (CODEC_ID_PCM_S24LE, pcm_s24le)
 PCM_CODEC (CODEC_ID_PCM_S24BE, pcm_s24be)
 PCM_CODEC (CODEC_ID_PCM_U24LE, pcm_u24le)
 PCM_CODEC (CODEC_ID_PCM_U24BE, pcm_u24be)
 PCM_CODEC (CODEC_ID_PCM_S24DAUD, pcm_s24daud)
 PCM_CODEC (CODEC_ID_PCM_S16LE, pcm_s16le)
 PCM_DECODER (CODEC_ID_PCM_S16LE_PLANAR, pcm_s16le_planar)
 PCM_CODEC (CODEC_ID_PCM_S16BE, pcm_s16be)
 PCM_CODEC (CODEC_ID_PCM_U16LE, pcm_u16le)
 PCM_CODEC (CODEC_ID_PCM_U16BE, pcm_u16be)
 PCM_CODEC (CODEC_ID_PCM_S8, pcm_s8)
 PCM_CODEC (CODEC_ID_PCM_U8, pcm_u8)
 PCM_CODEC (CODEC_ID_PCM_ALAW, pcm_alaw)
 PCM_CODEC (CODEC_ID_PCM_MULAW, pcm_mulaw)
 PCM_CODEC (CODEC_ID_PCM_ZORK, pcm_zork)

Variables

static uint8_t linear_to_alaw [16384]
static uint8_t linear_to_ulaw [16384]


Detailed Description

PCM codecs.

Definition in file pcm.c.


Define Documentation

#define BIAS   (0x84)

Definition at line 41 of file pcm.c.

Referenced by ulaw2linear().

#define MAX_CHANNELS   64

Definition at line 31 of file pcm.c.

#define NSEGS   (8)

Definition at line 37 of file pcm.c.

#define PCM_CODEC ( id,
name   )     PCM_ENCODER(id,name) PCM_DECODER(id,name)

Definition at line 534 of file pcm.c.

#define PCM_DECODER ( id,
name   ) 

Definition at line 531 of file pcm.c.

#define PCM_ENCODER ( id,
name   ) 

Definition at line 515 of file pcm.c.

#define QUANT_MASK   (0xf)

Definition at line 36 of file pcm.c.

Referenced by alaw2linear(), and ulaw2linear().

#define SEG_MASK   (0x70)

Definition at line 39 of file pcm.c.

Referenced by alaw2linear().

#define SEG_SHIFT   (4)

Definition at line 38 of file pcm.c.

Referenced by alaw2linear(), and ulaw2linear().

#define SIGN_BIT   (0x80)

Definition at line 35 of file pcm.c.

Referenced by alaw2linear(), and ulaw2linear().


Function Documentation

static int alaw2linear ( unsigned char  a_val  )  [static]

Definition at line 47 of file pcm.c.

Referenced by pcm_decode_init(), and pcm_encode_init().

static void build_xlaw_table ( uint8_t linear_to_xlaw,
int(*)(unsigned char)  xlaw2linear,
int  mask 
) [static]

Definition at line 83 of file pcm.c.

Referenced by pcm_encode_init().

static void decode_to16 ( int  bps,
int  le,
int  us,
const uint8_t **  src,
short **  samples,
int  src_len 
) [inline, static]

convert samples to 16 bit

Parameters:
bps byte per sample for the source format, must be >= 2
le 0 for big-, 1 for little-endian
us 0 for signed, 1 for unsigned input
src input samples
samples output samples
src_len number of bytes in src

Definition at line 357 of file pcm.c.

Referenced by pcm_decode_frame().

static void encode_from16 ( int  bps,
int  le,
int  us,
short **  samples,
uint8_t **  dst,
int  n 
) [inline, static]

convert samples from 16 bit

Parameters:
bps byte per sample for the destination format, must be >= 2
le 0 for big-, 1 for little-endian
us 0 for signed, 1 for unsigned output
samples input samples
dst output samples
n number of samples in samples buffer.

Definition at line 173 of file pcm.c.

Referenced by pcm_encode_frame().

PCM_CODEC ( CODEC_ID_PCM_ZORK  ,
pcm_zork   
)

PCM_CODEC ( CODEC_ID_PCM_MULAW  ,
pcm_mulaw   
)

PCM_CODEC ( CODEC_ID_PCM_ALAW  ,
pcm_alaw   
)

PCM_CODEC ( CODEC_ID_PCM_U8  ,
pcm_u8   
)

PCM_CODEC ( CODEC_ID_PCM_S8  ,
pcm_s8   
)

PCM_CODEC ( CODEC_ID_PCM_U16BE  ,
pcm_u16be   
)

PCM_CODEC ( CODEC_ID_PCM_U16LE  ,
pcm_u16le   
)

PCM_CODEC ( CODEC_ID_PCM_S16BE  ,
pcm_s16be   
)

PCM_CODEC ( CODEC_ID_PCM_S16LE  ,
pcm_s16le   
)

PCM_CODEC ( CODEC_ID_PCM_S24DAUD  ,
pcm_s24daud   
)

PCM_CODEC ( CODEC_ID_PCM_U24BE  ,
pcm_u24be   
)

PCM_CODEC ( CODEC_ID_PCM_U24LE  ,
pcm_u24le   
)

PCM_CODEC ( CODEC_ID_PCM_S24BE  ,
pcm_s24be   
)

PCM_CODEC ( CODEC_ID_PCM_S24LE  ,
pcm_s24le   
)

PCM_CODEC ( CODEC_ID_PCM_U32BE  ,
pcm_u32be   
)

PCM_CODEC ( CODEC_ID_PCM_U32LE  ,
pcm_u32le   
)

PCM_CODEC ( CODEC_ID_PCM_S32BE  ,
pcm_s32be   
)

PCM_CODEC ( CODEC_ID_PCM_S32LE  ,
pcm_s32le   
)

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

Definition at line 374 of file pcm.c.

static int pcm_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 328 of file pcm.c.

PCM_DECODER ( CODEC_ID_PCM_S16LE_PLANAR  ,
pcm_s16le_planar   
)

static int pcm_encode_close ( AVCodecContext avctx  )  [static]

Definition at line 157 of file pcm.c.

static int pcm_encode_frame ( AVCodecContext avctx,
unsigned char *  frame,
int  buf_size,
void *  data 
) [static]

Definition at line 189 of file pcm.c.

static int pcm_encode_init ( AVCodecContext avctx  )  [static]

Definition at line 107 of file pcm.c.

static int ulaw2linear ( unsigned char  u_val  )  [static]

Definition at line 62 of file pcm.c.

Referenced by pcm_decode_init(), and pcm_encode_init().


Variable Documentation

uint8_t linear_to_alaw[16384] [static]

Definition at line 80 of file pcm.c.

Referenced by pcm_encode_frame(), and pcm_encode_init().

uint8_t linear_to_ulaw[16384] [static]

Definition at line 81 of file pcm.c.

Referenced by pcm_encode_frame(), and pcm_encode_init().


Generated on Thu Apr 2 07:15:42 2009 for ffmpeg by  doxygen 1.5.6