FFmpeg
Macros | Functions
aacenc_utils.h File Reference
#include "libavutil/ffmath.h"
#include "aacenc.h"
#include "aacenctab.h"
#include "aactab.h"

Go to the source code of this file.

Macros

#define ROUND_STANDARD   0.4054f
 
#define ROUND_TO_ZERO   0.1054f
 
#define C_QUANT   0.4054f
 
#define ERROR_IF(cond, ...)
 
#define WARN_IF(cond, ...)
 

Functions

static float pos_pow34 (float a)
 
static int quant (float coef, const float Q, const float rounding)
 Quantize one coefficient. More...
 
static float find_max_val (int group_len, int swb_size, const float *scaled)
 
static int find_min_book (float maxval, int sf)
 
static float find_form_factor (int group_len, int swb_size, float thresh, const float *scaled, float nzslope)
 
static uint8_t coef2minsf (float coef)
 Return the minimum scalefactor where the quantized coef does not clip. More...
 
static uint8_t coef2maxsf (float coef)
 Return the maximum scalefactor where the quantized coef is not zero. More...
 
static int quant_array_idx (const float val, const float *arr, const int num)
 
static av_always_inline float bval2bmax (float b)
 approximates exp10f(-3.0f*(0.5f + 0.5f * cosf(FFMIN(b,15.5f) / 15.5f))) More...
 
static void ff_init_nextband_map (const SingleChannelElement *sce, uint8_t *nextband)
 
static void ff_nextband_remove (uint8_t *nextband, int prevband, int band)
 
static int ff_sfdelta_can_remove_band (const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int band)
 
static int ff_sfdelta_can_replace (const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int new_sf, int band)
 
static av_always_inline int lcg_random (unsigned previous_val)
 linear congruential pseudorandom number generator More...
 

Detailed Description

AAC encoder utilities

Author
Rostislav Pehlivanov ( atomnuker gmail com )

Definition in file aacenc_utils.h.

Macro Definition Documentation

◆ ROUND_STANDARD

#define ROUND_STANDARD   0.4054f

Definition at line 36 of file aacenc_utils.h.

◆ ROUND_TO_ZERO

#define ROUND_TO_ZERO   0.1054f

Definition at line 37 of file aacenc_utils.h.

◆ C_QUANT

#define C_QUANT   0.4054f

Definition at line 38 of file aacenc_utils.h.

◆ ERROR_IF

#define ERROR_IF (   cond,
  ... 
)
Value:
if (cond) { \
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
return AVERROR(EINVAL); \
}

Definition at line 244 of file aacenc_utils.h.

◆ WARN_IF

#define WARN_IF (   cond,
  ... 
)
Value:
if (cond) { \
av_log(avctx, AV_LOG_WARNING, __VA_ARGS__); \
}

Definition at line 250 of file aacenc_utils.h.

Function Documentation

◆ pos_pow34()

static float pos_pow34 ( float  a)
inlinestatic

Definition at line 40 of file aacenc_utils.h.

Referenced by ff_aac_is_encoding_err().

◆ quant()

static int quant ( float  coef,
const float  Q,
const float  rounding 
)
inlinestatic

Quantize one coefficient.

Returns
absolute value of the quantized coefficient
See also
3GPP TS26.403 5.6.2 "Scalefactor determination"

Definition at line 50 of file aacenc_utils.h.

◆ find_max_val()

static float find_max_val ( int  group_len,
int  swb_size,
const float scaled 
)
inlinestatic

◆ find_min_book()

static int find_min_book ( float  maxval,
int  sf 
)
inlinestatic

◆ find_form_factor()

static float find_form_factor ( int  group_len,
int  swb_size,
float  thresh,
const float scaled,
float  nzslope 
)
inlinestatic

compute variance

Definition at line 80 of file aacenc_utils.h.

Referenced by search_for_quantizers_twoloop().

◆ coef2minsf()

static uint8_t coef2minsf ( float  coef)
inlinestatic

Return the minimum scalefactor where the quantized coef does not clip.

Definition at line 133 of file aacenc_utils.h.

Referenced by search_for_quantizers_anmr(), and search_for_quantizers_twoloop().

◆ coef2maxsf()

static uint8_t coef2maxsf ( float  coef)
inlinestatic

Return the maximum scalefactor where the quantized coef is not zero.

Definition at line 139 of file aacenc_utils.h.

Referenced by search_for_quantizers_anmr().

◆ quant_array_idx()

static int quant_array_idx ( const float  val,
const float arr,
const int  num 
)
inlinestatic

Definition at line 147 of file aacenc_utils.h.

Referenced by get_lag(), and quantize_coefs().

◆ bval2bmax()

static av_always_inline float bval2bmax ( float  b)
static

approximates exp10f(-3.0f*(0.5f + 0.5f * cosf(FFMIN(b,15.5f) / 15.5f)))

Definition at line 164 of file aacenc_utils.h.

Referenced by search_for_ms().

◆ ff_init_nextband_map()

static void ff_init_nextband_map ( const SingleChannelElement sce,
uint8_t *  nextband 
)
inlinestatic

Just a safe default

Now really navigate the nonzero band chain

Definition at line 175 of file aacenc_utils.h.

Referenced by ff_aac_search_for_is(), search_for_ms(), search_for_pns(), and search_for_quantizers_twoloop().

◆ ff_nextband_remove()

static void ff_nextband_remove ( uint8_t *  nextband,
int  prevband,
int  band 
)
inlinestatic

Definition at line 197 of file aacenc_utils.h.

◆ ff_sfdelta_can_remove_band()

static int ff_sfdelta_can_remove_band ( const SingleChannelElement sce,
const uint8_t *  nextband,
int  prev_sf,
int  band 
)
inlinestatic

◆ ff_sfdelta_can_replace()

static int ff_sfdelta_can_replace ( const SingleChannelElement sce,
const uint8_t *  nextband,
int  prev_sf,
int  new_sf,
int  band 
)
inlinestatic

Definition at line 222 of file aacenc_utils.h.

Referenced by search_for_ms().

◆ lcg_random()

static av_always_inline int lcg_random ( unsigned  previous_val)
static

linear congruential pseudorandom number generator

Parameters
previous_valpointer to the current state of the generator
Returns
Returns a 32-bit pseudorandom integer

Definition at line 238 of file aacenc_utils.h.

AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
cond
int(* cond)(enum AVPixelFormat pix_fmt)
Definition: pixdesc_query.c:28