G.722 ADPCM audio codec. More...
#include "avcodec.h"
#include "mathops.h"
#include "get_bits.h"
Go to the source code of this file.
Data Structures | |
struct | G722Context |
struct | G722Context::G722Band |
The band[0] and band[1] correspond respectively to the lower band and higher band. More... | |
struct | G722Context::TrellisNode |
struct | G722Context::TrellisPath |
Defines | |
#define | PREV_SAMPLES_BUF_SIZE 1024 |
#define | FREEZE_INTERVAL 128 |
#define | STORE_NODE(index, UPDATE, VALUE) |
Functions | |
static void | do_adaptive_prediction (struct G722Band *band, const int cur_diff) |
adaptive predictor | |
static int | linear_scale_factor (const int log_factor) |
static void | update_low_predictor (struct G722Band *band, const int ilow) |
static void | update_high_predictor (struct G722Band *band, const int dhigh, const int ihigh) |
static void | apply_qmf (const int16_t *prev_samples, int *xout1, int *xout2) |
static av_cold int | g722_init (AVCodecContext *avctx) |
static av_cold int | g722_close (AVCodecContext *avctx) |
static int | g722_decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) |
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 int | g722_encode_trellis (AVCodecContext *avctx, uint8_t *dst, int buf_size, void *data) |
static int | g722_encode_frame (AVCodecContext *avctx, uint8_t *dst, int buf_size, void *data) |
Variables | |
static const int8_t | sign_lookup [2] = { -1, 1 } |
static const int16_t | inv_log2_table [32] |
static const int16_t | high_log_factor_step [2] = { 798, -214 } |
static const int16_t | high_inv_quant [4] = { -926, -202, 926, 202 } |
static const int16_t | low_log_factor_step [16] |
low_log_factor_step[index] == wl[rl42[index]] | |
static const int16_t | low_inv_quant4 [16] |
static const int16_t | low_inv_quant6 [64] |
static const int16_t | qmf_coeffs [12] |
quadrature mirror filter (QMF) coefficients | |
static const int16_t | low_inv_quant5 [32] |
static const int16_t * | low_inv_quants [3] |
AVCodec | ff_adpcm_g722_decoder |
static const int16_t | low_quant [33] |
AVCodec | ff_adpcm_g722_encoder |
G.722 ADPCM audio codec.
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.
Definition in file g722.c.
#define FREEZE_INTERVAL 128 |
Definition at line 46 of file g722.c.
Referenced by g722_encode_trellis().
#define PREV_SAMPLES_BUF_SIZE 1024 |
Definition at line 44 of file g722.c.
Referenced by filter_samples(), and g722_decode_frame().
#define STORE_NODE | ( | index, | ||
UPDATE, | ||||
VALUE | ||||
) |
static void apply_qmf | ( | const int16_t * | prev_samples, | |
int * | xout1, | |||
int * | xout2 | |||
) | [static] |
Definition at line 199 of file g722.c.
Referenced by filter_samples(), and g722_decode_frame().
static void do_adaptive_prediction | ( | struct G722Band * | band, | |
const int | cur_diff | |||
) | [static] |
adaptive predictor
cur_diff | the dequantized and scaled delta calculated from the current codeword |
Definition at line 128 of file g722.c.
Referenced by update_high_predictor(), and update_low_predictor().
static int encode_high | ( | const struct G722Band * | state, | |
int | xhigh | |||
) | [inline, static] |
static int encode_low | ( | const struct G722Band * | state, | |
int | xlow | |||
) | [inline, static] |
Definition at line 376 of file g722.c.
Referenced by g722_encode_trellis().
static void filter_samples | ( | G722Context * | c, | |
const int16_t * | samples, | |||
int * | xlow, | |||
int * | xhigh | |||
) | [inline, static] |
Definition at line 351 of file g722.c.
Referenced by avfilter_filter_samples(), and g722_encode_trellis().
static av_cold int g722_close | ( | AVCodecContext * | avctx | ) | [static] |
static int g722_decode_frame | ( | AVCodecContext * | avctx, | |
void * | data, | |||
int * | data_size, | |||
AVPacket * | avpkt | |||
) | [static] |
static int g722_encode_frame | ( | AVCodecContext * | avctx, | |
uint8_t * | dst, | |||
int | buf_size, | |||
void * | data | |||
) | [static] |
static int g722_encode_trellis | ( | AVCodecContext * | avctx, | |
uint8_t * | dst, | |||
int | buf_size, | |||
void * | data | |||
) | [static] |
static av_cold int g722_init | ( | AVCodecContext * | avctx | ) | [static] |
static int linear_scale_factor | ( | const int | log_factor | ) | [inline, static] |
Definition at line 170 of file g722.c.
Referenced by update_high_predictor(), and update_low_predictor().
static void update_high_predictor | ( | struct G722Band * | band, | |
const int | dhigh, | |||
const int | ihigh | |||
) | [static] |
Definition at line 188 of file g722.c.
Referenced by g722_decode_frame(), and g722_encode_trellis().
static void update_low_predictor | ( | struct G722Band * | band, | |
const int | ilow | |||
) | [static] |
Definition at line 177 of file g722.c.
Referenced by g722_decode_frame(), and g722_encode_trellis().
{ .name = "g722", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_ADPCM_G722, .priv_data_size = sizeof(G722Context), .init = g722_init, .decode = g722_decode_frame, .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), .max_lowres = 1, }
{ .name = "g722", .type = AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_ADPCM_G722, .priv_data_size = sizeof(G722Context), .init = g722_init, .close = g722_close, .encode = g722_encode_frame, .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, }
const int16_t high_inv_quant[4] = { -926, -202, 926, 202 } [static] |
Definition at line 89 of file g722.c.
Referenced by g722_decode_frame(), and g722_encode_trellis().
const int16_t high_log_factor_step[2] = { 798, -214 } [static] |
Definition at line 88 of file g722.c.
Referenced by update_high_predictor().
const int16_t inv_log2_table[32] [static] |
{ 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383, 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834, 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371, 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008 }
Definition at line 82 of file g722.c.
Referenced by linear_scale_factor().
const int16_t low_inv_quant4[16] [static] |
{ 0, -2557, -1612, -1121, -786, -530, -323, -150, 2557, 1612, 1121, 786, 530, 323, 150, 0 }
Definition at line 97 of file g722.c.
Referenced by update_low_predictor().
const int16_t low_inv_quant5[32] [static] |
const int16_t low_inv_quant6[64] [static] |
{ -17, -17, -17, -17, -3101, -2738, -2376, -2088, -1873, -1689, -1535, -1399, -1279, -1170, -1072, -982, -899, -822, -750, -682, -618, -558, -501, -447, -396, -347, -300, -254, -211, -170, -130, -91, 3101, 2738, 2376, 2088, 1873, 1689, 1535, 1399, 1279, 1170, 1072, 982, 899, 822, 750, 682, 618, 558, 501, 447, 396, 347, 300, 254, 211, 170, 130, 91, 54, 17, -54, -17 }
Definition at line 101 of file g722.c.
Referenced by g722_encode_trellis().
const int16_t* low_inv_quants[3] [static] |
Definition at line 276 of file g722.c.
Referenced by g722_decode_frame().
const int16_t low_log_factor_step[16] [static] |
{ -60, 3042, 1198, 538, 334, 172, 58, -30, 3042, 1198, 538, 334, 172, 58, -30, -60 }
low_log_factor_step[index] == wl[rl42[index]]
Definition at line 93 of file g722.c.
Referenced by update_low_predictor().
const int16_t low_quant[33] [static] |
{ 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 344 of file g722.c.
Referenced by encode_low().
const int16_t qmf_coeffs[12] [static] |
{ 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, }
quadrature mirror filter (QMF) coefficients
ITU-T G.722 Table 11
Definition at line 117 of file g722.c.
Referenced by apply_qmf().
const int8_t sign_lookup[2] = { -1, 1 } [static] |
Definition at line 80 of file g722.c.
Referenced by do_adaptive_prediction().