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 ENCODE(type, endian, src, dst, n, shift, offset)
 Write PCM samples macro.
#define DECODE(type, endian, src, dst, n, shift, offset)
 Read PCM samples macro.
#define PCM_ENCODER(id, sample_fmt_, name, long_name_)
#define PCM_DECODER(id, sample_fmt_, name, long_name_)
#define PCM_CODEC(id, sample_fmt_, name, long_name_)   PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_)

Functions

static av_cold int alaw2linear (unsigned char a_val)
static av_cold int ulaw2linear (unsigned char u_val)
static av_cold void build_xlaw_table (uint8_t *linear_to_xlaw, int(*xlaw2linear)(unsigned char), int mask)
static av_cold int pcm_encode_init (AVCodecContext *avctx)
static av_cold int pcm_encode_close (AVCodecContext *avctx)
static int pcm_encode_frame (AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data)
static av_cold int pcm_decode_init (AVCodecContext *avctx)
static int pcm_decode_frame (AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size)
 PCM_CODEC (CODEC_ID_PCM_ALAW, SAMPLE_FMT_S16, pcm_alaw,"PCM A-law")
 PCM_CODEC (CODEC_ID_PCM_DVD, SAMPLE_FMT_S32, pcm_dvd,"PCM signed 20|24-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_F32BE, SAMPLE_FMT_FLT, pcm_f32be,"PCM 32-bit floating point big-endian")
 PCM_CODEC (CODEC_ID_PCM_F32LE, SAMPLE_FMT_FLT, pcm_f32le,"PCM 32-bit floating point little-endian")
 PCM_CODEC (CODEC_ID_PCM_F64BE, SAMPLE_FMT_DBL, pcm_f64be,"PCM 64-bit floating point big-endian")
 PCM_CODEC (CODEC_ID_PCM_F64LE, SAMPLE_FMT_DBL, pcm_f64le,"PCM 64-bit floating point little-endian")
 PCM_CODEC (CODEC_ID_PCM_MULAW, SAMPLE_FMT_S16, pcm_mulaw,"PCM mu-law")
 PCM_CODEC (CODEC_ID_PCM_S8, SAMPLE_FMT_U8, pcm_s8,"PCM signed 8-bit")
 PCM_CODEC (CODEC_ID_PCM_S16BE, SAMPLE_FMT_S16, pcm_s16be,"PCM signed 16-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_S16LE, SAMPLE_FMT_S16, pcm_s16le,"PCM signed 16-bit little-endian")
 PCM_DECODER (CODEC_ID_PCM_S16LE_PLANAR, SAMPLE_FMT_S16, pcm_s16le_planar,"PCM 16-bit little-endian planar")
 PCM_CODEC (CODEC_ID_PCM_S24BE, SAMPLE_FMT_S32, pcm_s24be,"PCM signed 24-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_S24DAUD, SAMPLE_FMT_S16, pcm_s24daud,"PCM D-Cinema audio signed 24-bit")
 PCM_CODEC (CODEC_ID_PCM_S24LE, SAMPLE_FMT_S32, pcm_s24le,"PCM signed 24-bit little-endian")
 PCM_CODEC (CODEC_ID_PCM_S32BE, SAMPLE_FMT_S32, pcm_s32be,"PCM signed 32-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_S32LE, SAMPLE_FMT_S32, pcm_s32le,"PCM signed 32-bit little-endian")
 PCM_CODEC (CODEC_ID_PCM_U8, SAMPLE_FMT_U8, pcm_u8,"PCM unsigned 8-bit")
 PCM_CODEC (CODEC_ID_PCM_U16BE, SAMPLE_FMT_S16, pcm_u16be,"PCM unsigned 16-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_U16LE, SAMPLE_FMT_S16, pcm_u16le,"PCM unsigned 16-bit little-endian")
 PCM_CODEC (CODEC_ID_PCM_U24BE, SAMPLE_FMT_S32, pcm_u24be,"PCM unsigned 24-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_U24LE, SAMPLE_FMT_S32, pcm_u24le,"PCM unsigned 24-bit little-endian")
 PCM_CODEC (CODEC_ID_PCM_U32BE, SAMPLE_FMT_S32, pcm_u32be,"PCM unsigned 32-bit big-endian")
 PCM_CODEC (CODEC_ID_PCM_U32LE, SAMPLE_FMT_S32, pcm_u32le,"PCM unsigned 32-bit little-endian")
 PCM_CODEC (CODEC_ID_PCM_ZORK, SAMPLE_FMT_S16, 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 DECODE ( type,
endian,
src,
dst,
n,
shift,
offset   ) 

Value:

dst_##type = (type*)dst; \
    for(;n>0;n--) { \
        register type v = bytestream_get_##endian(&src); \
        *dst_##type++ = (v - offset) << shift; \
    } \
    dst = (short*)dst_##type;
Read PCM samples macro.

Parameters:
type Datatype of native machine format
endian bytestream_get_xxx() endian suffix
src Source pointer (variable name)
dst Destination pointer (variable name)
n Total number of samples (variable name)
shift Bitshift (bits)
offset Sample value offset

Definition at line 316 of file pcm.c.

Referenced by pcm_decode_frame().

#define ENCODE ( type,
endian,
src,
dst,
n,
shift,
offset   ) 

Value:

samples_##type = (type*)src; \
    for(;n>0;n--) { \
        register type v = (*samples_##type++ >> shift) + offset; \
        bytestream_put_##endian(&dst, v); \
    }
Write PCM samples macro.

Parameters:
type Datatype of native machine format
endian bytestream_put_xxx() suffix
src Source pointer (variable name)
dst Destination pointer (variable name)
n Total number of samples (variable name)
shift Bitshift (bits)
offset Sample value offset

Definition at line 146 of file pcm.c.

Referenced by pcm_encode_frame().

#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,
sample_fmt_,
name,
long_name_   )     PCM_ENCODER(id,sample_fmt_,name,long_name_) PCM_DECODER(id,sample_fmt_,name,long_name_)

Definition at line 546 of file pcm.c.

#define PCM_DECODER ( id,
sample_fmt_,
name,
long_name_   ) 

Definition at line 543 of file pcm.c.

#define PCM_ENCODER ( id,
sample_fmt_,
name,
long_name_   ) 

Definition at line 525 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 av_cold 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 av_cold 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().

PCM_CODEC ( CODEC_ID_PCM_ZORK  ,
SAMPLE_FMT_S16  ,
pcm_zork  ,
"PCM Zork"   
)

PCM_CODEC ( CODEC_ID_PCM_U32LE  ,
SAMPLE_FMT_S32  ,
pcm_u32le  ,
"PCM unsigned 32-bit little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_U32BE  ,
SAMPLE_FMT_S32  ,
pcm_u32be  ,
"PCM unsigned 32-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_U24LE  ,
SAMPLE_FMT_S32  ,
pcm_u24le  ,
"PCM unsigned 24-bit little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_U24BE  ,
SAMPLE_FMT_S32  ,
pcm_u24be  ,
"PCM unsigned 24-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_U16LE  ,
SAMPLE_FMT_S16  ,
pcm_u16le  ,
"PCM unsigned 16-bit little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_U16BE  ,
SAMPLE_FMT_S16  ,
pcm_u16be  ,
"PCM unsigned 16-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_U8  ,
SAMPLE_FMT_U8  ,
pcm_u8  ,
"PCM unsigned 8-bit"   
)

PCM_CODEC ( CODEC_ID_PCM_S32LE  ,
SAMPLE_FMT_S32  ,
pcm_s32le  ,
"PCM signed 32-bit little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_S32BE  ,
SAMPLE_FMT_S32  ,
pcm_s32be  ,
"PCM signed 32-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_S24LE  ,
SAMPLE_FMT_S32  ,
pcm_s24le  ,
"PCM signed 24-bit little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_S24DAUD  ,
SAMPLE_FMT_S16  ,
pcm_s24daud  ,
"PCM D-Cinema audio signed 24-bit"   
)

PCM_CODEC ( CODEC_ID_PCM_S24BE  ,
SAMPLE_FMT_S32  ,
pcm_s24be  ,
"PCM signed 24-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_S16LE  ,
SAMPLE_FMT_S16  ,
pcm_s16le  ,
"PCM signed 16-bit little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_S16BE  ,
SAMPLE_FMT_S16  ,
pcm_s16be  ,
"PCM signed 16-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_S8  ,
SAMPLE_FMT_U8  ,
pcm_s8  ,
"PCM signed 8-bit"   
)

PCM_CODEC ( CODEC_ID_PCM_MULAW  ,
SAMPLE_FMT_S16  ,
pcm_mulaw  ,
"PCM mu-law"   
)

PCM_CODEC ( CODEC_ID_PCM_F64LE  ,
SAMPLE_FMT_DBL  ,
pcm_f64le  ,
"PCM 64-bit floating point little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_F64BE  ,
SAMPLE_FMT_DBL  ,
pcm_f64be  ,
"PCM 64-bit floating point big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_F32LE  ,
SAMPLE_FMT_FLT  ,
pcm_f32le  ,
"PCM 32-bit floating point little-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_F32BE  ,
SAMPLE_FMT_FLT  ,
pcm_f32be  ,
"PCM 32-bit floating point big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_DVD  ,
SAMPLE_FMT_S32  ,
pcm_dvd  ,
"PCM signed 20|24-bit big-endian"   
)

PCM_CODEC ( CODEC_ID_PCM_ALAW  ,
SAMPLE_FMT_S16  ,
pcm_alaw  ,
"PCM A-law"   
)

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

Definition at line 324 of file pcm.c.

static av_cold int pcm_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 284 of file pcm.c.

PCM_DECODER ( CODEC_ID_PCM_S16LE_PLANAR  ,
SAMPLE_FMT_S16  ,
pcm_s16le_planar  ,
"PCM 16-bit little-endian planar"   
)

static av_cold int pcm_encode_close ( AVCodecContext avctx  )  [static]

Definition at line 129 of file pcm.c.

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

Definition at line 153 of file pcm.c.

static av_cold int pcm_encode_init ( AVCodecContext avctx  )  [static]

Definition at line 107 of file pcm.c.

static av_cold 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 Fri Oct 26 02:35:44 2012 for FFmpeg by  doxygen 1.5.8