FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
adpcmenc.c File Reference

ADPCM encoders See ADPCM decoder reference documents for codec information. More...

#include "avcodec.h"
#include "put_bits.h"
#include "bytestream.h"
#include "adpcm.h"
#include "adpcm_data.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  TrellisPath
 
struct  TrellisNode
 
struct  ADPCMEncodeContext
 

Macros

#define FREEZE_INTERVAL   128
 
#define STORE_NODE(NAME, STEP_INDEX)
 
#define LOOP_NODES(NAME, STEP_TABLE, STEP_INDEX)
 
#define ADPCM_ENCODER(id_, name_, sample_fmts_, long_name_)
 

Functions

static av_cold int adpcm_encode_close (AVCodecContext *avctx)
 
static av_cold int adpcm_encode_init (AVCodecContext *avctx)
 
static uint8_t adpcm_ima_compress_sample (ADPCMChannelStatus *c, int16_t sample)
 
static uint8_t adpcm_ima_qt_compress_sample (ADPCMChannelStatus *c, int16_t sample)
 
static uint8_t adpcm_ms_compress_sample (ADPCMChannelStatus *c, int16_t sample)
 
static uint8_t adpcm_yamaha_compress_sample (ADPCMChannelStatus *c, int16_t sample)
 
static void adpcm_compress_trellis (AVCodecContext *avctx, const int16_t *samples, uint8_t *dst, ADPCMChannelStatus *c, int n, int stride)
 
static int adpcm_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 
 ADPCM_ENCODER (AV_CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, sample_fmts_p,"ADPCM IMA QuickTime")
 
 ADPCM_ENCODER (AV_CODEC_ID_ADPCM_IMA_WAV, adpcm_ima_wav, sample_fmts_p,"ADPCM IMA WAV")
 
 ADPCM_ENCODER (AV_CODEC_ID_ADPCM_MS, adpcm_ms, sample_fmts,"ADPCM Microsoft")
 
 ADPCM_ENCODER (AV_CODEC_ID_ADPCM_SWF, adpcm_swf, sample_fmts,"ADPCM Shockwave Flash")
 
 ADPCM_ENCODER (AV_CODEC_ID_ADPCM_YAMAHA, adpcm_yamaha, sample_fmts,"ADPCM Yamaha")
 

Variables

static enum AVSampleFormat sample_fmts []
 
static enum AVSampleFormat sample_fmts_p []
 

Detailed Description

ADPCM encoders See ADPCM decoder reference documents for codec information.

Definition in file adpcmenc.c.

Macro Definition Documentation

#define FREEZE_INTERVAL   128

Definition at line 59 of file adpcmenc.c.

Referenced by adpcm_compress_trellis(), and adpcm_encode_init().

#define STORE_NODE (   NAME,
  STEP_INDEX 
)

Referenced by adpcm_compress_trellis().

#define LOOP_NODES (   NAME,
  STEP_TABLE,
  STEP_INDEX 
)
Value:
const int predictor = nodes[j]->sample1;\
const int div = (sample - predictor) * 4 / STEP_TABLE;\
int nmin = av_clip(div - range, -7, 6);\
int nmax = av_clip(div + range, -6, 7);\
if (nmin <= 0)\
nmin--; /* distinguish -0 from +0 */\
if (nmax < 0)\
nmax--;\
for (nidx = nmin; nidx <= nmax; nidx++) {\
const int nibble = nidx < 0 ? 7 - nidx : nidx;\
int dec_sample = predictor +\
(STEP_TABLE *\
STORE_NODE(NAME, STEP_INDEX);\
}
#define sample
static void predictor(uint8_t *src, int size)
Definition: exr.c:251
#define STORE_NODE(NAME, STEP_INDEX)
const int8_t ff_adpcm_yamaha_difflookup[]
Definition: adpcm_data.c:104
if(ret< 0)
Definition: vf_mcdeint.c:282
for(j=16;j >0;--j)

Referenced by adpcm_compress_trellis().

#define ADPCM_ENCODER (   id_,
  name_,
  sample_fmts_,
  long_name_ 
)
Value:
AVCodec ff_ ## name_ ## _encoder = { \
.name = #name_, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \
.type = AVMEDIA_TYPE_AUDIO, \
.id = id_, \
.priv_data_size = sizeof(ADPCMEncodeContext), \
.encode2 = adpcm_encode_frame, \
.close = adpcm_encode_close, \
.sample_fmts = sample_fmts_, \
}
static av_cold int adpcm_encode_init(AVCodecContext *avctx)
Definition: adpcmenc.c:63
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int adpcm_encode_close(AVCodecContext *avctx)
Definition: adpcmenc.c:153
AVCodec.
Definition: avcodec.h:3535
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
const char * name
Name of the codec implementation.
Definition: avcodec.h:3542
static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: adpcmenc.c:471
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701

Definition at line 709 of file adpcmenc.c.

Function Documentation

static av_cold int adpcm_encode_close ( AVCodecContext avctx)
static

Definition at line 153 of file adpcmenc.c.

Referenced by adpcm_encode_init().

static av_cold int adpcm_encode_init ( AVCodecContext avctx)
static

Definition at line 63 of file adpcmenc.c.

static uint8_t adpcm_ima_compress_sample ( ADPCMChannelStatus c,
int16_t  sample 
)
inlinestatic

Definition at line 165 of file adpcmenc.c.

Referenced by adpcm_encode_frame().

static uint8_t adpcm_ima_qt_compress_sample ( ADPCMChannelStatus c,
int16_t  sample 
)
inlinestatic

Definition at line 178 of file adpcmenc.c.

Referenced by adpcm_encode_frame().

static uint8_t adpcm_ms_compress_sample ( ADPCMChannelStatus c,
int16_t  sample 
)
inlinestatic

Definition at line 215 of file adpcmenc.c.

Referenced by adpcm_encode_frame().

static uint8_t adpcm_yamaha_compress_sample ( ADPCMChannelStatus c,
int16_t  sample 
)
inlinestatic

Definition at line 244 of file adpcmenc.c.

Referenced by adpcm_encode_frame().

static void adpcm_compress_trellis ( AVCodecContext avctx,
const int16_t *  samples,
uint8_t dst,
ADPCMChannelStatus c,
int  n,
int  stride 
)
static

Definition at line 266 of file adpcmenc.c.

Referenced by adpcm_encode_frame().

static int adpcm_encode_frame ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int *  got_packet_ptr 
)
static

Definition at line 471 of file adpcmenc.c.

ADPCM_ENCODER ( AV_CODEC_ID_ADPCM_IMA_QT  ,
adpcm_ima_qt  ,
sample_fmts_p  ,
"ADPCM IMA QuickTime"   
)
ADPCM_ENCODER ( AV_CODEC_ID_ADPCM_IMA_WAV  ,
adpcm_ima_wav  ,
sample_fmts_p  ,
"ADPCM IMA WAV"   
)
ADPCM_ENCODER ( AV_CODEC_ID_ADPCM_MS  ,
adpcm_ms  ,
sample_fmts  ,
"ADPCM Microsoft"   
)
ADPCM_ENCODER ( AV_CODEC_ID_ADPCM_SWF  ,
adpcm_swf  ,
sample_fmts  ,
"ADPCM Shockwave Flash"   
)
ADPCM_ENCODER ( AV_CODEC_ID_ADPCM_YAMAHA  ,
adpcm_yamaha  ,
sample_fmts  ,
"ADPCM Yamaha"   
)

Variable Documentation

enum AVSampleFormat sample_fmts[]
static
enum AVSampleFormat sample_fmts_p[]
static
Initial value:

Definition at line 705 of file adpcmenc.c.