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

G.722 ADPCM audio codec. More...

#include "mathops.h"
#include "g722.h"

Go to the source code of this file.

Functions

static void do_adaptive_prediction (struct G722Band *band, const int cur_diff)
 adaptive predictor
 
static int linear_scale_factor (const int log_factor)
 
void ff_g722_update_low_predictor (struct G722Band *band, const int ilow)
 
void ff_g722_update_high_predictor (struct G722Band *band, const int dhigh, const int ihigh)
 
void ff_g722_apply_qmf (const int16_t *prev_samples, int *xout1, int *xout2)
 

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 }
 
const int16_t ff_g722_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]]
 
const int16_t ff_g722_low_inv_quant4 [16]
 
const int16_t ff_g722_low_inv_quant6 [64]
 
static const int16_t qmf_coeffs [12]
 quadrature mirror filter (QMF) coefficients
 

Detailed Description

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.

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

Definition in file g722.c.

Function Documentation

static void do_adaptive_prediction ( struct G722Band *  band,
const int  cur_diff 
)
static

adaptive predictor

Parameters
cur_diffthe dequantized and scaled delta calculated from the current codeword

Definition at line 90 of file g722.c.

Referenced by ff_g722_update_high_predictor(), and ff_g722_update_low_predictor().

static int linear_scale_factor ( const int  log_factor)
inlinestatic

Definition at line 132 of file g722.c.

Referenced by ff_g722_update_high_predictor(), and ff_g722_update_low_predictor().

void ff_g722_update_low_predictor ( struct G722Band *  band,
const int  ilow 
)

Definition at line 139 of file g722.c.

Referenced by g722_decode_frame(), and g722_encode_trellis().

void ff_g722_update_high_predictor ( struct G722Band *  band,
const int  dhigh,
const int  ihigh 
)

Definition at line 150 of file g722.c.

Referenced by g722_decode_frame(), and g722_encode_trellis().

void ff_g722_apply_qmf ( const int16_t *  prev_samples,
int *  xout1,
int *  xout2 
)

Definition at line 161 of file g722.c.

Referenced by filter_samples(), and g722_decode_frame().

Variable Documentation

const int8_t sign_lookup[2] = { -1, 1 }
static

Definition at line 42 of file g722.c.

Referenced by do_adaptive_prediction().

const int16_t inv_log2_table[32]
static
Initial value:
= {
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 44 of file g722.c.

Referenced by linear_scale_factor().

const int16_t high_log_factor_step[2] = { 798, -214 }
static

Definition at line 50 of file g722.c.

Referenced by ff_g722_update_high_predictor().

const int16_t ff_g722_high_inv_quant[4] = { -926, -202, 926, 202 }

Definition at line 51 of file g722.c.

Referenced by g722_decode_frame(), and g722_encode_trellis().

const int16_t low_log_factor_step[16]
static
Initial value:
= {
-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 55 of file g722.c.

Referenced by ff_g722_update_low_predictor().

const int16_t ff_g722_low_inv_quant4[16]
Initial value:
= {
0, -2557, -1612, -1121, -786, -530, -323, -150,
2557, 1612, 1121, 786, 530, 323, 150, 0
}

Definition at line 59 of file g722.c.

Referenced by ff_g722_update_low_predictor().

const int16_t ff_g722_low_inv_quant6[64]
Initial value:
= {
-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 63 of file g722.c.

Referenced by g722_encode_trellis().

const int16_t qmf_coeffs[12]
static
Initial value:
= {
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 79 of file g722.c.

Referenced by ff_g722_apply_qmf().