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

AAC encoder utilities. More...

#include "aac.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 void abs_pow34_v (float *out, const float *in, const int size)
 
static float pos_pow34 (float a)
 
static int quant (float coef, const float Q, const float rounding)
 Quantize one coefficient. More...
 
static void quantize_bands (int *out, const float *in, const float *scaled, int size, float Q34, int is_signed, int maxval, const float rounding)
 
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)
 

Detailed Description

AAC encoder utilities.

Author
Rostislav Pehlivanov ( atomnuker gmail com )

Definition in file aacenc_utils.h.

Macro Definition Documentation

#define ROUND_STANDARD   0.4054f

Definition at line 35 of file aacenc_utils.h.

#define ROUND_TO_ZERO   0.1054f

Definition at line 36 of file aacenc_utils.h.

#define C_QUANT   0.4054f

Definition at line 37 of file aacenc_utils.h.

Referenced by find_min_book().

#define ERROR_IF (   cond,
  ... 
)
Value:
if (cond) { \
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
return AVERROR(EINVAL); \
}
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define AVERROR(e)
Definition: error.h:43
return

Definition at line 252 of file aacenc_utils.h.

Referenced by aac_encode_init().

#define WARN_IF (   cond,
  ... 
)
Value:
if (cond) { \
av_log(avctx, AV_LOG_WARNING, __VA_ARGS__); \
}
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define av_log(a,...)

Definition at line 258 of file aacenc_utils.h.

Referenced by aac_encode_init().

Function Documentation

static void abs_pow34_v ( float *  out,
const float *  in,
const int  size 
)
inlinestatic
static float pos_pow34 ( float  a)
inlinestatic

Definition at line 48 of file aacenc_utils.h.

Referenced by ff_aac_is_encoding_err().

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 58 of file aacenc_utils.h.

static void quantize_bands ( int *  out,
const float *  in,
const float *  scaled,
int  size,
float  Q34,
int  is_signed,
int  maxval,
const float  rounding 
)
inlinestatic

Definition at line 64 of file aacenc_utils.h.

Referenced by quantize_and_encode_band_cost_template().

static float find_max_val ( int  group_len,
int  swb_size,
const float *  scaled 
)
inlinestatic
static int find_min_book ( float  maxval,
int  sf 
)
inlinestatic
static float find_form_factor ( int  group_len,
int  swb_size,
float  thresh,
const float *  scaled,
float  nzslope 
)
inlinestatic

compute variance

Definition at line 104 of file aacenc_utils.h.

Referenced by search_for_quantizers_twoloop().

static uint8_t coef2minsf ( float  coef)
inlinestatic

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

Definition at line 154 of file aacenc_utils.h.

Referenced by search_for_quantizers_anmr().

static uint8_t coef2maxsf ( float  coef)
inlinestatic

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

Definition at line 160 of file aacenc_utils.h.

Referenced by search_for_quantizers_anmr().

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

Definition at line 168 of file aacenc_utils.h.

Referenced by get_lag(), and quantize_coefs().

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 185 of file aacenc_utils.h.

Referenced by search_for_ms().

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 196 of file aacenc_utils.h.

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

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

Definition at line 218 of file aacenc_utils.h.

static int ff_sfdelta_can_remove_band ( const SingleChannelElement sce,
const uint8_t nextband,
int  prev_sf,
int  band 
)
inlinestatic
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 243 of file aacenc_utils.h.

Referenced by search_for_ms().