FFmpeg
Loading...
Searching...
No Matches
g723_1.h File Reference

G.723.1 types, functions and data tables. More...

#include <stdint.h>
#include "libavutil/log.h"

Go to the source code of this file.

Data Structures

struct  G723_1_Subframe
 G723.1 unpacked data subframe. More...
 
struct  PPFParam
 Pitch postfilter parameters. More...
 
struct  HFParam
 Harmonic filter parameters. More...
 
struct  FCBParam
 Optimized fixed codebook excitation parameters. More...
 
struct  G723_1_ChannelContext
 
struct  G723_1_Context
 

Macros

#define SUBFRAMES   4
 
#define SUBFRAME_LEN   60
 
#define FRAME_LEN   (SUBFRAME_LEN << 2)
 
#define HALF_FRAME_LEN   (FRAME_LEN / 2)
 
#define LPC_FRAME   (HALF_FRAME_LEN + SUBFRAME_LEN)
 
#define LPC_ORDER   10
 
#define LSP_BANDS   3
 
#define LSP_CB_SIZE   256
 
#define PITCH_MIN   18
 
#define PITCH_MAX   (PITCH_MIN + 127)
 
#define PITCH_ORDER   5
 
#define GRID_SIZE   2
 
#define PULSE_MAX   6
 
#define GAIN_LEVELS   24
 
#define COS_TBL_SIZE   512
 
#define MULL2(a, b)
 Bitexact implementation of 2ab scaled by 1/2^16.
 
#define G723_1_COS_TAB_FIRST_ELEMENT   16384
 

Enumerations

enum  FrameType { ACTIVE_FRAME , SID_FRAME , UNTRANSMITTED_FRAME }
 G723.1 frame types. More...
 
enum  Rate { RATE_6300 , RATE_5300 }
 G723.1 rate values. More...
 

Functions

int ff_g723_1_scale_vector (int16_t *dst, const int16_t *vector, int length)
 Scale vector contents based on the largest of their absolutes.
 
int ff_g723_1_normalize_bits (int num, int width)
 Calculate the number of left-shifts required for normalizing the input.
 
int ff_g723_1_dot_product (const int16_t *a, const int16_t *b, int length)
 
void ff_g723_1_get_residual (int16_t *residual, int16_t *prev_excitation, int lag)
 Get delayed contribution from the previous excitation vector.
 
void ff_g723_1_gen_dirac_train (int16_t *buf, int pitch_lag)
 Generate a train of dirac functions with period as pitch lag.
 
void ff_g723_1_gen_acb_excitation (int16_t *vector, int16_t *prev_excitation, int pitch_lag, G723_1_Subframe *subfrm, enum Rate cur_rate)
 Generate adaptive codebook excitation.
 
void ff_g723_1_lsp_interpolate (int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp)
 Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients.
 
void ff_g723_1_inverse_quant (int16_t *cur_lsp, int16_t *prev_lsp, uint8_t *lsp_index, int bad_frame)
 Perform inverse quantization of LSP frequencies.
 

Variables

static const uint8_t frame_size [4] = { 24, 20, 4, 1 }
 
static const int16_t dc_lsp [LPC_ORDER]
 LSP DC component.
 
const int16_t ff_g723_1_cos_tab [COS_TBL_SIZE+1]
 
const int16_t ff_g723_1_lsp_band0 [LSP_CB_SIZE][3]
 LSP VQ tables.
 
const int16_t ff_g723_1_lsp_band1 [LSP_CB_SIZE][3]
 
const int16_t ff_g723_1_lsp_band2 [LSP_CB_SIZE][4]
 
const int32_t ff_g723_1_combinatorial_table [PULSE_MAX][SUBFRAME_LEN/GRID_SIZE]
 Used for the coding/decoding of the pulses positions for the MP-MLQ codebook.
 
static const int8_t pulses [4] = {6, 5, 6, 5}
 Number of non-zero pulses in the MP-MLQ excitation.
 
const int16_t ff_g723_1_fixed_cb_gain [GAIN_LEVELS]
 
const int16_t ff_g723_1_adaptive_cb_gain85 [85 *20]
 
const int16_t ff_g723_1_adaptive_cb_gain170 [170 *20]
 

Detailed Description

G.723.1 types, functions and data tables.

Definition in file g723_1.h.

Macro Definition Documentation

◆ SUBFRAMES

#define SUBFRAMES   4

Definition at line 35 of file g723_1.h.

◆ SUBFRAME_LEN

◆ FRAME_LEN

◆ HALF_FRAME_LEN

#define HALF_FRAME_LEN   (FRAME_LEN / 2)

Definition at line 38 of file g723_1.h.

Referenced by estimate_pitch(), and g723_1_encode_frame().

◆ LPC_FRAME

#define LPC_FRAME   (HALF_FRAME_LEN + SUBFRAME_LEN)

Definition at line 39 of file g723_1.h.

Referenced by comp_autocorr().

◆ LPC_ORDER

◆ LSP_BANDS

#define LSP_BANDS   3

Definition at line 41 of file g723_1.h.

◆ LSP_CB_SIZE

#define LSP_CB_SIZE   256

Definition at line 42 of file g723_1.h.

◆ PITCH_MIN

#define PITCH_MIN   18

◆ PITCH_MAX

◆ PITCH_ORDER

#define PITCH_ORDER   5

◆ GRID_SIZE

#define GRID_SIZE   2

◆ PULSE_MAX

#define PULSE_MAX   6

Definition at line 47 of file g723_1.h.

◆ GAIN_LEVELS

#define GAIN_LEVELS   24

Definition at line 48 of file g723_1.h.

Referenced by get_fcb_param(), pack_bitstream(), and unpack_bitstream().

◆ COS_TBL_SIZE

#define COS_TBL_SIZE   512

Definition at line 49 of file g723_1.h.

Referenced by lpc2lsp().

◆ MULL2

#define MULL2 ( a,
b )
Value:
((((a) >> 16) * (b) * 2) + (((a) & 0xffff) * (b) >> 15))
int a
#define b
Definition input.c:43

Bitexact implementation of 2ab scaled by 1/2^16.

Parameters
a32 bit multiplicand
b16 bit multiplier

Definition at line 57 of file g723_1.h.

Referenced by comp_autocorr(), highpass_filter(), levinson_durbin(), and lsp2lpc().

◆ G723_1_COS_TAB_FIRST_ELEMENT

#define G723_1_COS_TAB_FIRST_ELEMENT   16384

Definition at line 242 of file g723_1.h.

Referenced by lpc2lsp().

Enumeration Type Documentation

◆ FrameType

enum FrameType

G723.1 frame types.

Enumerator
ACTIVE_FRAME 

Active speech.

SID_FRAME 

Silence Insertion Descriptor frame.

UNTRANSMITTED_FRAME 

Definition at line 63 of file g723_1.h.

◆ Rate

enum Rate

G723.1 rate values.

Enumerator
RATE_6300 
RATE_5300 

Definition at line 72 of file g723_1.h.

Function Documentation

◆ ff_g723_1_scale_vector()

int ff_g723_1_scale_vector ( int16_t * dst,
const int16_t * vector,
int length )

Scale vector contents based on the largest of their absolutes.

Definition at line 1104 of file g723_1.c.

Referenced by comp_autocorr(), comp_interp_index(), formant_postfilter(), and g723_1_encode_frame().

◆ ff_g723_1_normalize_bits()

int ff_g723_1_normalize_bits ( int num,
int width )

Calculate the number of left-shifts required for normalizing the input.

Parameters
numinput number
widthwidth of the input, 16 bits(0) / 32 bits(1)

Definition at line 1121 of file g723_1.c.

Referenced by acb_search(), comp_autocorr(), comp_harmonic_coeff(), comp_ppf_coeff(), estimate_pitch(), gain_scale(), get_fcb_param(), lpc2lsp(), and lsp_quantize().

◆ ff_g723_1_dot_product()

int ff_g723_1_dot_product ( const int16_t * a,
const int16_t * b,
int length )

◆ ff_g723_1_get_residual()

void ff_g723_1_get_residual ( int16_t * residual,
int16_t * prev_excitation,
int lag )

Get delayed contribution from the previous excitation vector.

Definition at line 1132 of file g723_1.c.

Referenced by acb_search(), and ff_g723_1_gen_acb_excitation().

◆ ff_g723_1_gen_dirac_train()

void ff_g723_1_gen_dirac_train ( int16_t * buf,
int pitch_lag )

Generate a train of dirac functions with period as pitch lag.

Definition at line 1146 of file g723_1.c.

Referenced by fcb_search(), gen_fcb_excitation(), and get_fcb_param().

◆ ff_g723_1_gen_acb_excitation()

void ff_g723_1_gen_acb_excitation ( int16_t * vector,
int16_t * prev_excitation,
int pitch_lag,
G723_1_Subframe * subfrm,
enum Rate cur_rate )

Generate adaptive codebook excitation.

Definition at line 1158 of file g723_1.c.

Referenced by g723_1_decode_frame(), g723_1_encode_frame(), and generate_noise().

◆ ff_g723_1_lsp_interpolate()

void ff_g723_1_lsp_interpolate ( int16_t * lpc,
int16_t * cur_lsp,
int16_t * prev_lsp )

Quantize LSP frequencies by interpolation and convert them to the corresponding LPC coefficients.

Parameters
lpcbuffer for LPC coefficients
cur_lspthe current LSP vector
prev_lspthe previous LSP vector

Definition at line 1252 of file g723_1.c.

Referenced by g723_1_decode_frame(), and g723_1_encode_frame().

◆ ff_g723_1_inverse_quant()

void ff_g723_1_inverse_quant ( int16_t * cur_lsp,
int16_t * prev_lsp,
uint8_t * lsp_index,
int bad_frame )

Perform inverse quantization of LSP frequencies.

Parameters
cur_lspthe current LSP vector
prev_lspthe previous LSP vector
lsp_indexVQ indices
bad_framebad frame flag

Definition at line 1273 of file g723_1.c.

Referenced by g723_1_decode_frame(), and g723_1_encode_frame().

Variable Documentation

◆ frame_size

const uint8_t frame_size[4] = { 24, 20, 4, 1 }
static

Definition at line 222 of file g723_1.h.

Referenced by ac3_eac3_probe(), activate(), add_samples_to_fifo(), aic_decode_header(), alac_entropy_coder(), alac_linear_predictor(), amr_handle_packet(), apply_filter(), asmgen_epilogue(), asmgen_prologue(), av_ac3_parse_header(), av_buffersink_set_frame_size(), avpriv_mpegaudio_decode_header(), bitpacked_decode_yuv422p10(), build_frame_code(), celt_gauge_psy_weight(), codec2_mode_bit_rate(), codec2_read_packet(), compute_bitrate(), compute_frame_duration(), config_input(), config_input(), convert_samples(), dca_parse_params(), dcadec_decode_frame(), decode_frame(), decode_frame(), decode_packet(), decode_packet(), dfa_read_packet(), dss_723_1_read_packet(), dvvideo_decode_frame(), enable_pcr_generation_for_stream(), encode_frame(), escape124_decode_frame(), ff_af_queue_remove(), ff_celt_decode_frame(), ff_dv_frame_profile(), ff_mpa_decode_header(), ff_opus_psy_postencode_update(), ff_put_wav_header(), ff_rtp_send_av1(), ff_rtp_send_h261(), ff_rtp_send_vc2hq(), ff_sipr_decode_frame_16k(), ff_vbv_update(), fill_model_input_th(), filter_frame(), find_expected_header(), flic_decode_frame_15_16BPP(), flic_decode_frame_1BPP(), flic_decode_frame_24BPP(), flic_decode_frame_8BPP(), flush_frame(), frame_size(), frame_size(), frame_size(), frame_size(), frame_size_with_refs(), frame_size_with_refs(), g723_1_decode_frame(), g723_1_encode_frame(), g723_1_parse(), g723_1_read_packet(), generate_raw_frame(), get_audio_frame_duration(), get_max_frame_size(), get_packet(), guess_pkt_duration(), init_converted_samples(), init_output_frame(), libopus_encode_init(), lmlm4_read_packet(), load_encode_and_write(), main(), move_audio(), mp3_read_header(), mpa_encode_frame(), mpegaudio_parse(), mxf_parse_h264_frame(), mxf_write_d10_audio_packet(), new_stream_subtitle(), new_stream_video(), on2avc_decode_frame(), opus_duration(), opus_duration(), opus_encode_frame(), pcm_bluray_encode_init(), pcm_dvd_encode_init(), process_command(), prores_encode_frame(), qdm2_decode(), qoa_decode_frame(), read_in_data(), read_packet(), return_stored_frame(), rm_write_header(), rpl_read_packet(), rtp_send_ilbc(), rv10_write_header(), s302m_decode_frame(), s302m_parse_frame_header(), samples_per_packet(), speex_decode_stereo(), store_packet(), str_probe(), str_read_packet(), svt_jpegxs_dec_decode(), swf_write_video(), uncompressed_header(), uncompressed_header(), vc1t_read_packet(), vorbis_encode_frame(), vp9_superframe_split_filter(), wavpack_decode_frame(), wgc_try_get_next_frame(), xan_wc3_copy_pixel_run(), xan_wc3_output_pixel_run(), and xmv_fetch_video_packet().

◆ dc_lsp

const int16_t dc_lsp[LPC_ORDER]
static
Initial value:
= {
0x0c3b,
0x1271,
0x1e0a,
0x2a36,
0x3630,
0x406f,
0x4d28,
0x56f4,
0x638c,
0x6c46
}

LSP DC component.

Definition at line 227 of file g723_1.h.

Referenced by ff_g723_1_inverse_quant(), g723_1_decode_init(), g723_1_encode_init(), and lsp_quantize().

◆ ff_g723_1_cos_tab

const int16_t ff_g723_1_cos_tab[COS_TBL_SIZE+1]
extern

Definition at line 33 of file g723_1.c.

Referenced by lpc2lsp(), and lsp2lpc().

◆ ff_g723_1_lsp_band0

const int16_t ff_g723_1_lsp_band0[LSP_CB_SIZE][3]
extern

LSP VQ tables.

Definition at line 101 of file g723_1.c.

Referenced by ff_g723_1_inverse_quant().

◆ ff_g723_1_lsp_band1

const int16_t ff_g723_1_lsp_band1[LSP_CB_SIZE][3]
extern

Definition at line 190 of file g723_1.c.

Referenced by ff_g723_1_inverse_quant().

◆ ff_g723_1_lsp_band2

const int16_t ff_g723_1_lsp_band2[LSP_CB_SIZE][4]
extern

Definition at line 279 of file g723_1.c.

Referenced by ff_g723_1_inverse_quant().

◆ ff_g723_1_combinatorial_table

const int32_t ff_g723_1_combinatorial_table[PULSE_MAX][SUBFRAME_LEN/GRID_SIZE]
extern

Used for the coding/decoding of the pulses positions for the MP-MLQ codebook.

Definition at line 410 of file g723_1.c.

Referenced by gen_fcb_excitation(), and pack_fcb_param().

◆ pulses

const int8_t pulses[4] = {6, 5, 6, 5}
static

Number of non-zero pulses in the MP-MLQ excitation.

Definition at line 260 of file g723_1.h.

Referenced by celt_pulses2bits(), convolute_with_sparse(), decode_fixed_sparse(), decode_fixed_sparse(), fcb_search(), gen_fcb_excitation(), generate_noise(), and synth_block_fcb_acb().

◆ ff_g723_1_fixed_cb_gain

const int16_t ff_g723_1_fixed_cb_gain[GAIN_LEVELS]
extern

Definition at line 454 of file g723_1.c.

Referenced by g723_1_decode_frame(), gen_fcb_excitation(), and get_fcb_param().

◆ ff_g723_1_adaptive_cb_gain85

const int16_t ff_g723_1_adaptive_cb_gain85[85 *20]
extern

Definition at line 460 of file g723_1.c.

Referenced by acb_search(), and ff_g723_1_gen_acb_excitation().

◆ ff_g723_1_adaptive_cb_gain170

const int16_t ff_g723_1_adaptive_cb_gain170[170 *20]
extern

Definition at line 676 of file g723_1.c.

Referenced by acb_search(), and ff_g723_1_gen_acb_excitation().