FFmpeg
Macros | Functions | Variables
g722dec.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
#include "g722.h"

Go to the source code of this file.

Macros

#define OFFSET(x)   offsetof(G722Context, x)
 
#define AD   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 

Functions

static av_cold int g722_decode_init (AVCodecContext *avctx)
 
static int g722_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
 

Variables

static const AVOption options []
 
static const AVClass g722_decoder_class
 
static const int16_t low_inv_quant5 [32]
 
static const int16_t *const low_inv_quants [3]
 
const FFCodec ff_adpcm_g722_decoder
 

Detailed Description

G.722 ADPCM audio decoder

This G.722 decoder is a bit-exact implementation of the ITU G.722 specification for all three specified bitrates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.

Note
For the 56000bps and 48000bps bitrates, the lowest 1 or 2 bits respectively of each byte are ignored.

Definition in file g722dec.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(G722Context, x)

Definition at line 45 of file g722dec.c.

◆ AD

Definition at line 46 of file g722dec.c.

Function Documentation

◆ g722_decode_init()

static av_cold int g722_decode_init ( AVCodecContext avctx)
static

Definition at line 59 of file g722dec.c.

◆ g722_decode_frame()

static int g722_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 87 of file g722dec.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "bits_per_codeword", "Bits per G722 codeword", OFFSET(bits_per_codeword), AV_OPT_TYPE_INT, { .i64 = 8 }, 6, 8, AD },
{ NULL }
}

Definition at line 47 of file g722dec.c.

◆ g722_decoder_class

const AVClass g722_decoder_class
static
Initial value:
= {
.class_name = "g722 decoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 52 of file g722dec.c.

◆ low_inv_quant5

const int16_t low_inv_quant5[32]
static
Initial value:
= {
-35, -35, -2919, -2195, -1765, -1458, -1219, -1023,
-858, -714, -587, -473, -370, -276, -190, -110,
2919, 2195, 1765, 1458, 1219, 1023, 858, 714,
587, 473, 370, 276, 190, 110, 35, -35
}

Definition at line 76 of file g722dec.c.

◆ low_inv_quants

const int16_t* const low_inv_quants[3]
static
Initial value:

Definition at line 83 of file g722dec.c.

Referenced by g722_decode_frame().

◆ ff_adpcm_g722_decoder

const FFCodec ff_adpcm_g722_decoder
Initial value:
= {
.p.name = "g722",
CODEC_LONG_NAME("G.722 ADPCM"),
.p.type = AVMEDIA_TYPE_AUDIO,
.priv_data_size = sizeof(G722Context),
.p.priv_class = &g722_decoder_class,
}

Definition at line 142 of file g722dec.c.

OFFSET
#define OFFSET(x)
Definition: g722dec.c:45
ff_g722_low_inv_quant4
const int16_t ff_g722_low_inv_quant4[16]
Definition: g722.c:59
AV_CODEC_ID_ADPCM_G722
@ AV_CODEC_ID_ADPCM_G722
Definition: codec_id.h:401
g722_decode_init
static av_cold int g722_decode_init(AVCodecContext *avctx)
Definition: g722dec.c:59
ff_g722_low_inv_quant6
const int16_t ff_g722_low_inv_quant6[64]
Definition: g722.c:63
g722_decode_frame
static int g722_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: g722dec.c:87
g722_decoder_class
static const AVClass g722_decoder_class
Definition: g722dec.c:52
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:311
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
low_inv_quant5
static const int16_t low_inv_quant5[32]
Definition: g722dec.c:76
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
G722Context
Definition: g722.h:34
NULL
#define NULL
Definition: coverity.c:32
options
static const AVOption options[]
Definition: g722dec.c:47
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AD
#define AD
Definition: g722dec.c:46
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259