FFmpeg
Loading...
Searching...
No Matches
aacenc_tns.c File Reference

AAC encoder temporal noise shaping. More...

#include "libavutil/libm.h"
#include "aacenc.h"
#include <float.h>
#include "aacenc_tns.h"
#include "aactab.h"
#include "aacenc_utils.h"
#include "lpc_functions.h"

Go to the source code of this file.

Macros

#define TNS_Q_BITS   4
 
#define TNS_Q_BITS_IS8   4
 
#define TNS_ENABLE_COEF_COMPRESSION
 
#define TNS_PREDGAIN_GATE   1.4f /* first gate: predicted LPC gain */
 
#define TNS_PG_C1_LONG   1.4f /* min measured gain, long blocks */
 
#define TNS_PG_C1_SHORT   3.2f /* min measured gain, short blocks */
 
#define TNS_PG_CLAMP   6.0f /* upper bound: poles near unit circle → noise blowup */
 
#define TNS_WEIGHT_FLOOR   0.01f /* per-bin masking floor for the weighted spectrum */
 

Functions

static int compress_coeffs (int *coef, int order, int c_bits)
 
void ff_aac_encode_tns_info (AACEncContext *s, SingleChannelElement *sce)
 Encode TNS data.
 
static int tns_max_nonpns (const SingleChannelElement *sce, int mmm)
 
void ff_aac_apply_tns (AACEncContext *s, SingleChannelElement *sce)
 
static void quantize_coefs (double *coef, int *idx, float *lpc, int order, int c_bits)
 
static void search_for_tns_short_pooled (AACEncContext *s, SingleChannelElement *sce)
 
void ff_aac_search_for_tns (AACEncContext *s, SingleChannelElement *sce)
 

Detailed Description

AAC encoder temporal noise shaping.

Author
Rostislav Pehlivanov ( atomnuker gmail com )

Definition in file aacenc_tns.c.

Macro Definition Documentation

◆ TNS_Q_BITS

#define TNS_Q_BITS   4

Definition at line 37 of file aacenc_tns.c.

Referenced by ff_aac_encode_tns_info(), and ff_aac_search_for_tns().

◆ TNS_Q_BITS_IS8

#define TNS_Q_BITS_IS8   4

◆ TNS_ENABLE_COEF_COMPRESSION

#define TNS_ENABLE_COEF_COMPRESSION

Definition at line 43 of file aacenc_tns.c.

◆ TNS_PREDGAIN_GATE

#define TNS_PREDGAIN_GATE   1.4f /* first gate: predicted LPC gain */

Definition at line 47 of file aacenc_tns.c.

◆ TNS_PG_C1_LONG

#define TNS_PG_C1_LONG   1.4f /* min measured gain, long blocks */

Definition at line 48 of file aacenc_tns.c.

Referenced by ff_aac_search_for_tns().

◆ TNS_PG_C1_SHORT

#define TNS_PG_C1_SHORT   3.2f /* min measured gain, short blocks */

Definition at line 49 of file aacenc_tns.c.

Referenced by ff_aac_search_for_tns(), and search_for_tns_short_pooled().

◆ TNS_PG_CLAMP

#define TNS_PG_CLAMP   6.0f /* upper bound: poles near unit circle → noise blowup */

Definition at line 50 of file aacenc_tns.c.

Referenced by ff_aac_search_for_tns(), and search_for_tns_short_pooled().

◆ TNS_WEIGHT_FLOOR

#define TNS_WEIGHT_FLOOR   0.01f /* per-bin masking floor for the weighted spectrum */

Definition at line 51 of file aacenc_tns.c.

Referenced by ff_aac_search_for_tns(), and search_for_tns_short_pooled().

Function Documentation

◆ compress_coeffs()

static int compress_coeffs ( int * coef,
int order,
int c_bits )
inlinestatic

Definition at line 53 of file aacenc_tns.c.

Referenced by ff_aac_encode_tns_info().

◆ ff_aac_encode_tns_info()

void ff_aac_encode_tns_info ( AACEncContext * s,
SingleChannelElement * sce )

Encode TNS data.

Definition at line 71 of file aacenc_tns.c.

◆ tns_max_nonpns()

static int tns_max_nonpns ( const SingleChannelElement * sce,
int mmm )
static

◆ ff_aac_apply_tns()

void ff_aac_apply_tns ( AACEncContext * s,
SingleChannelElement * sce )

Definition at line 112 of file aacenc_tns.c.

◆ quantize_coefs()

static void quantize_coefs ( double * coef,
int * idx,
float * lpc,
int order,
int c_bits )
inlinestatic

Definition at line 165 of file aacenc_tns.c.

Referenced by ff_aac_search_for_tns(), and search_for_tns_short_pooled().

◆ search_for_tns_short_pooled()

static void search_for_tns_short_pooled ( AACEncContext * s,
SingleChannelElement * sce )
static

Definition at line 182 of file aacenc_tns.c.

Referenced by ff_aac_search_for_tns().

◆ ff_aac_search_for_tns()

void ff_aac_search_for_tns ( AACEncContext * s,
SingleChannelElement * sce )

Definition at line 281 of file aacenc_tns.c.