FFmpeg
|
AAC coefficients encoder. More...
#include "libavutil/libm.h"
#include <float.h>
#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "put_bits.h"
#include "aac.h"
#include "aacenc.h"
#include "aactab.h"
Go to the source code of this file.
Data Structures | |
struct | BandCodingPath |
structure used in optimal codebook search More... | |
struct | TrellisPath |
Macros | |
#define | NOISE_LOW_LIMIT 4000 |
Frequency in Hz for lower limit of noise substitution. More... | |
#define | CB_TOT 13 |
Total number of usable codebooks. More... | |
#define | QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE) |
#define | quantize_and_encode_band_cost(s, pb, in, scaled, size, scale_idx, cb, lambda, uplim, bits) |
#define | TRELLIS_STAGES 121 |
#define | TRELLIS_STATES (SCALE_MAX_DIFF+1) |
Functions | |
static av_always_inline int | quant (float coef, const float Q) |
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) |
static void | abs_pow34_v (float *out, const float *in, const int size) |
static av_always_inline float | quantize_and_encode_band_cost_template (struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, int BT_ZERO, int BT_UNSIGNED, int BT_PAIR, int BT_ESC, int BT_NOISE) |
Calculate rate distortion cost for quantizing with given codebook. More... | |
static float | quantize_and_encode_band_cost_NONE (struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) |
static float | quantize_band_cost (struct AACEncContext *s, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) |
static void | quantize_and_encode_band (struct AACEncContext *s, PutBitContext *pb, const float *in, int size, int scale_idx, int cb, const float lambda) |
static float | find_max_val (int group_len, int swb_size, const float *scaled) |
static int | find_min_book (float maxval, int sf) |
static void | encode_window_bands_info (AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda) |
Encode band info for single window group bands. More... | |
static void | codebook_trellis_rate (AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda) |
static av_always_inline uint8_t | coef2minsf (float coef) |
Return the minimum scalefactor where the quantized coef does not clip. More... | |
static av_always_inline uint8_t | coef2maxsf (float coef) |
Return the maximum scalefactor where the quantized coef is not zero. More... | |
static void | search_for_quantizers_anmr (AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda) |
static void | search_for_quantizers_twoloop (AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda) |
two-loop quantizers search taken from ISO 13818-7 Appendix C More... | |
static void | search_for_quantizers_faac (AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda) |
static void | search_for_quantizers_fast (AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda) |
static void | search_for_ms (AACEncContext *s, ChannelElement *cpe, const float lambda) |
Variables | |
static const uint8_t | run_value_bits_long [64] |
bits needed to code codebook run value for long windows More... | |
static const uint8_t | run_value_bits_short [16] |
bits needed to code codebook run value for short windows More... | |
static const uint8_t *const | run_value_bits [2] |
static const uint8_t | aac_cb_out_map [CB_TOT] = {0,1,2,3,4,5,6,7,8,9,10,11,13} |
Map to convert values from BandCodingPath index to a codebook index. More... | |
static const uint8_t | aac_cb_in_map [CB_TOT+1] = {0,1,2,3,4,5,6,7,8,9,10,11,0,12} |
Inverse map to convert from codebooks to BandCodingPath indices. More... | |
static const uint8_t | aac_cb_range [12] = {0, 3, 3, 3, 3, 9, 9, 8, 8, 13, 13, 17} |
static const uint8_t | aac_cb_maxval [12] = {0, 1, 1, 2, 2, 4, 4, 7, 7, 12, 12, 16} |
static float(*const | quantize_and_encode_band_cost_arr [])(struct AACEncContext *s, PutBitContext *pb, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits) |
AACCoefficientsEncoder | ff_aac_coders [AAC_CODER_NB] |
AAC coefficients encoder.
Definition in file aaccoder.c.
#define NOISE_LOW_LIMIT 4000 |
Frequency in Hz for lower limit of noise substitution.
Definition at line 44 of file aaccoder.c.
Referenced by search_for_quantizers_twoloop().
#define CB_TOT 13 |
Total number of usable codebooks.
Definition at line 47 of file aaccoder.c.
Referenced by codebook_trellis_rate(), and encode_window_bands_info().
#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC | ( | NAME, | |
BT_ZERO, | |||
BT_UNSIGNED, | |||
BT_PAIR, | |||
BT_ESC, | |||
BT_NOISE | |||
) |
Definition at line 234 of file aaccoder.c.
#define quantize_and_encode_band_cost | ( | s, | |
pb, | |||
in, | |||
scaled, | |||
size, | |||
scale_idx, | |||
cb, | |||
lambda, | |||
uplim, | |||
bits | |||
) |
Definition at line 277 of file aaccoder.c.
Referenced by quantize_and_encode_band(), and quantize_band_cost().
#define TRELLIS_STAGES 121 |
Definition at line 588 of file aaccoder.c.
Referenced by search_for_quantizers_anmr().
#define TRELLIS_STATES (SCALE_MAX_DIFF+1) |
Definition at line 589 of file aaccoder.c.
Referenced by search_for_quantizers_anmr().
|
static |
Quantize one coefficient.
Definition at line 76 of file aaccoder.c.
Referenced by quantize_and_encode_band_cost_template(), and search_for_quantizers_faac().
|
static |
Definition at line 82 of file aaccoder.c.
Referenced by quantize_and_encode_band_cost_template().
|
static |
Definition at line 96 of file aaccoder.c.
Referenced by codebook_trellis_rate(), encode_window_bands_info(), quantize_and_encode_band_cost_template(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), and search_for_quantizers_twoloop().
|
static |
Calculate rate distortion cost for quantizing with given codebook.
Definition at line 115 of file aaccoder.c.
|
static |
Definition at line 225 of file aaccoder.c.
|
static |
Definition at line 284 of file aaccoder.c.
Referenced by codebook_trellis_rate(), encode_window_bands_info(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), and search_for_quantizers_twoloop().
|
static |
Definition at line 293 of file aaccoder.c.
|
static |
Definition at line 301 of file aaccoder.c.
Referenced by search_for_quantizers_anmr(), and search_for_quantizers_twoloop().
|
static |
Definition at line 312 of file aaccoder.c.
Referenced by search_for_quantizers_anmr(), and search_for_quantizers_twoloop().
|
static |
Encode band info for single window group bands.
Definition at line 339 of file aaccoder.c.
|
static |
Definition at line 441 of file aaccoder.c.
|
static |
Return the minimum scalefactor where the quantized coef does not clip.
Definition at line 574 of file aaccoder.c.
Referenced by search_for_quantizers_anmr().
|
static |
Return the maximum scalefactor where the quantized coef is not zero.
Definition at line 579 of file aaccoder.c.
Referenced by search_for_quantizers_anmr().
|
static |
Definition at line 591 of file aaccoder.c.
|
static |
two-loop quantizers search taken from ISO 13818-7 Appendix C
Band type will be determined by the twoloop algorithm
Definition at line 744 of file aaccoder.c.
|
static |
Definition at line 913 of file aaccoder.c.
|
static |
Definition at line 1080 of file aaccoder.c.
|
static |
Definition at line 1114 of file aaccoder.c.
|
static |
bits needed to code codebook run value for long windows
Definition at line 50 of file aaccoder.c.
|
static |
bits needed to code codebook run value for short windows
Definition at line 58 of file aaccoder.c.
|
static |
Definition at line 62 of file aaccoder.c.
Referenced by codebook_trellis_rate(), and encode_window_bands_info().
Map to convert values from BandCodingPath index to a codebook index.
Definition at line 67 of file aaccoder.c.
Referenced by codebook_trellis_rate(), and encode_window_bands_info().
Inverse map to convert from codebooks to BandCodingPath indices.
Definition at line 69 of file aaccoder.c.
Referenced by codebook_trellis_rate().
|
static |
Definition at line 107 of file aaccoder.c.
Referenced by quantize_and_encode_band_cost_template().
|
static |
Definition at line 108 of file aaccoder.c.
Referenced by quantize_and_encode_band_cost_template().
|
static |
Definition at line 255 of file aaccoder.c.
AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] |
Definition at line 1175 of file aaccoder.c.
Referenced by aac_encode_init().