FFmpeg
Macros | Functions | Variables
g722enc.c File Reference
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "internal.h"
#include "g722.h"
#include "libavutil/common.h"

Go to the source code of this file.

Macros

#define FREEZE_INTERVAL   128
 
#define MAX_FRAME_SIZE   32768
 
#define MIN_TRELLIS   0
 
#define MAX_TRELLIS   16
 
#define STORE_NODE(index, UPDATE, VALUE)
 

Functions

static av_cold int g722_encode_close (AVCodecContext *avctx)
 
static av_cold int g722_encode_init (AVCodecContext *avctx)
 
static void filter_samples (G722Context *c, const int16_t *samples, int *xlow, int *xhigh)
 
static int encode_high (const struct G722Band *state, int xhigh)
 
static int encode_low (const struct G722Band *state, int xlow)
 
static void g722_encode_trellis (G722Context *c, int trellis, uint8_t *dst, int nb_samples, const int16_t *samples)
 
static av_always_inline void encode_byte (G722Context *c, uint8_t *dst, const int16_t *samples)
 
static void g722_encode_no_trellis (G722Context *c, uint8_t *dst, int nb_samples, const int16_t *samples)
 
static int g722_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 

Variables

static const int16_t low_quant [33]
 
AVCodec ff_adpcm_g722_encoder
 

Detailed Description

G.722 ADPCM audio encoder

Definition in file g722enc.c.

Macro Definition Documentation

◆ FREEZE_INTERVAL

#define FREEZE_INTERVAL   128

Definition at line 36 of file g722enc.c.

◆ MAX_FRAME_SIZE

#define MAX_FRAME_SIZE   32768

Definition at line 40 of file g722enc.c.

◆ MIN_TRELLIS

#define MIN_TRELLIS   0

Definition at line 44 of file g722enc.c.

◆ MAX_TRELLIS

#define MAX_TRELLIS   16

Definition at line 45 of file g722enc.c.

◆ STORE_NODE

#define STORE_NODE (   index,
  UPDATE,
  VALUE 
)

Function Documentation

◆ g722_encode_close()

static av_cold int g722_encode_close ( AVCodecContext avctx)
static

Definition at line 47 of file g722enc.c.

Referenced by g722_encode_init().

◆ g722_encode_init()

static av_cold int g722_encode_init ( AVCodecContext avctx)
static

Definition at line 59 of file g722enc.c.

◆ filter_samples()

static void filter_samples ( G722Context c,
const int16_t *  samples,
int xlow,
int xhigh 
)
inlinestatic

Definition at line 133 of file g722enc.c.

Referenced by g722_encode_trellis().

◆ encode_high()

static int encode_high ( const struct G722Band *  state,
int  xhigh 
)
inlinestatic

Definition at line 150 of file g722enc.c.

◆ encode_low()

static int encode_low ( const struct G722Band *  state,
int  xlow 
)
inlinestatic

Definition at line 158 of file g722enc.c.

Referenced by g722_encode_trellis().

◆ g722_encode_trellis()

static void g722_encode_trellis ( G722Context c,
int  trellis,
uint8_t dst,
int  nb_samples,
const int16_t *  samples 
)
static

Definition at line 172 of file g722enc.c.

◆ encode_byte()

static av_always_inline void encode_byte ( G722Context c,
uint8_t dst,
const int16_t *  samples 
)
static

Definition at line 323 of file g722enc.c.

◆ g722_encode_no_trellis()

static void g722_encode_no_trellis ( G722Context c,
uint8_t dst,
int  nb_samples,
const int16_t *  samples 
)
static

Definition at line 336 of file g722enc.c.

◆ g722_encode_frame()

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

Definition at line 345 of file g722enc.c.

Variable Documentation

◆ low_quant

const int16_t low_quant[33]
static
Initial value:
= {
35, 72, 110, 150, 190, 233, 276, 323,
370, 422, 473, 530, 587, 650, 714, 786,
858, 940, 1023, 1121, 1219, 1339, 1458, 1612,
1765, 1980, 2195, 2557, 2919
}

Definition at line 126 of file g722enc.c.

Referenced by encode_low().

◆ ff_adpcm_g722_encoder

AVCodec ff_adpcm_g722_encoder
Initial value:
= {
.name = "g722",
.long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"),
.priv_data_size = sizeof(G722Context),
.encode2 = g722_encode_frame,
.channel_layouts = (const uint64_t[]){ AV_CH_LAYOUT_MONO, 0 },
}

Definition at line 375 of file g722enc.c.

init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:686
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:85
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: avcodec.h:530
g722_encode_init
static av_cold int g722_encode_init(AVCodecContext *avctx)
Definition: g722enc.c:59
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
G722Context
Definition: g722.h:34
g722_encode_close
static av_cold int g722_encode_close(AVCodecContext *avctx)
Definition: g722enc.c:47
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
g722_encode_frame
static int g722_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: g722enc.c:345
AV_CODEC_CAP_SMALL_LAST_FRAME
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
Definition: avcodec.h:1011