Flag hot functions, and disable sanitizing for them

This commit is contained in:
Antoine SOULIER
2022-05-05 16:21:38 +02:00
parent 3568ee1cbf
commit 5a8617eba7
9 changed files with 103 additions and 77 deletions

View File

@@ -167,7 +167,7 @@ static inline void ac_put(struct lc3_bits_buffer *buffer, int byte)
* ac Arithmetic coder
* buffer Bitstream buffer
*/
static inline void ac_shift(
LC3_HOT static inline void ac_shift(
struct lc3_bits_ac *ac, struct lc3_bits_buffer *buffer)
{
if (ac->low < 0xff0000 || ac->carry)
@@ -262,7 +262,7 @@ void lc3_flush_bits(struct lc3_bits *bits)
* Write from 1 to 32 bits,
* exceeding the capacity of the accumulator
*/
void lc3_put_bits_generic(struct lc3_bits *bits, unsigned v, int n)
LC3_HOT void lc3_put_bits_generic(struct lc3_bits *bits, unsigned v, int n)
{
struct lc3_bits_accu *accu = &bits->accu;
@@ -285,7 +285,7 @@ void lc3_put_bits_generic(struct lc3_bits *bits, unsigned v, int n)
/**
* Arithmetic coder renormalization
*/
void lc3_ac_write_renorm(struct lc3_bits *bits)
LC3_HOT void lc3_ac_write_renorm(struct lc3_bits *bits)
{
struct lc3_bits_ac *ac = &bits->ac;
@@ -336,7 +336,7 @@ static inline void accu_load(struct lc3_bits_accu *accu,
* Read from 1 to 32 bits,
* exceeding the capacity of the accumulator
*/
unsigned lc3_get_bits_generic(struct lc3_bits *bits, int n)
LC3_HOT unsigned lc3_get_bits_generic(struct lc3_bits *bits, int n)
{
struct lc3_bits_accu *accu = &bits->accu;
struct lc3_bits_buffer *buffer = &bits->buffer;
@@ -366,7 +366,7 @@ unsigned lc3_get_bits_generic(struct lc3_bits *bits, int n)
/**
* Arithmetic coder renormalization
*/
void lc3_ac_read_renorm(struct lc3_bits *bits)
LC3_HOT void lc3_ac_read_renorm(struct lc3_bits *bits)
{
struct lc3_bits_ac *ac = &bits->ac;

View File

@@ -213,7 +213,7 @@ void lc3_ac_write_renorm(lc3_bits_t *bits);
/**
* Put a bit
*/
static inline void lc3_put_bit(lc3_bits_t *bits, int v)
LC3_HOT static inline void lc3_put_bit(lc3_bits_t *bits, int v)
{
lc3_put_bits(bits, v, 1);
}
@@ -221,7 +221,8 @@ static inline void lc3_put_bit(lc3_bits_t *bits, int v)
/**
* Put from 1 to 32 bits
*/
static inline void lc3_put_bits(struct lc3_bits *bits, unsigned v, int n)
LC3_HOT static inline void lc3_put_bits(
struct lc3_bits *bits, unsigned v, int n)
{
struct lc3_bits_accu *accu = &bits->accu;
@@ -236,7 +237,7 @@ static inline void lc3_put_bits(struct lc3_bits *bits, unsigned v, int n)
/**
* Get a bit
*/
static inline int lc3_get_bit(lc3_bits_t *bits)
LC3_HOT static inline int lc3_get_bit(lc3_bits_t *bits)
{
return lc3_get_bits(bits, 1);
}
@@ -244,7 +245,7 @@ static inline int lc3_get_bit(lc3_bits_t *bits)
/**
* Get from 1 to 32 bits
*/
static inline unsigned lc3_get_bits(struct lc3_bits *bits, int n)
LC3_HOT static inline unsigned lc3_get_bits(struct lc3_bits *bits, int n)
{
struct lc3_bits_accu *accu = &bits->accu;
@@ -260,7 +261,7 @@ static inline unsigned lc3_get_bits(struct lc3_bits *bits, int n)
/**
* Put arithmetic coder symbol
*/
static inline void lc3_put_symbol(
LC3_HOT static inline void lc3_put_symbol(
struct lc3_bits *bits, const struct lc3_ac_model *model, unsigned s)
{
const struct lc3_ac_symbol *symbols = model->s;
@@ -280,7 +281,7 @@ static inline void lc3_put_symbol(
/**
* Get arithmetic coder symbol
*/
static inline unsigned lc3_get_symbol(
LC3_HOT static inline unsigned lc3_get_symbol(
lc3_bits_t *bits, const struct lc3_ac_model *model)
{
const struct lc3_ac_symbol *symbols = model->s;

View File

@@ -35,6 +35,24 @@
#endif
/**
* Hot Function attribute
* Selectively disable sanitizer
*/
#ifdef __clang__
#define LC3_HOT \
__attribute__((no_sanitize("bounds"))) \
__attribute__((no_sanitize("integer")))
#else /* __clang__ */
#define LC3_HOT
#endif /* __clang__ */
/**
* Macros
* MIN/MAX Minimum and maximum between 2 values

View File

@@ -151,7 +151,7 @@ static const int16_t h_48k_12k8_q15[4*60] = {
* xn Input sample, in fixed Q30
* return Filtered sample, in fixed Q30
*/
static inline int32_t filter_hp50(
LC3_HOT static inline int32_t filter_hp50(
struct lc3_ltpf_hp50_state *hp50, int32_t xn)
{
int32_t yn;
@@ -178,7 +178,7 @@ static inline int32_t filter_hp50(
* The number of previous samples `d` accessed on `x` is :
* d: { 10, 20, 40 } - 1 for resampling factors 8, 4 and 2.
*/
static inline void resample_x64k_12k8(const int p, const int16_t *h,
LC3_HOT static inline void resample_x64k_12k8(const int p, const int16_t *h,
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
const int w = 2*(40 / p);
@@ -220,7 +220,7 @@ static inline void resample_x64k_12k8(const int p, const int16_t *h,
* The number of previous samples `d` accessed on `x` is :
* d: { 30, 60 } - 1 for resampling factors 8 and 4.
*/
static inline void resample_x192k_12k8(const int p, const int16_t *h,
LC3_HOT static inline void resample_x192k_12k8(const int p, const int16_t *h,
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
const int w = 2*(120 / p);
@@ -264,7 +264,7 @@ static inline void resample_x192k_12k8(const int p, const int16_t *h,
* The `x` vector is aligned on 32 bits
*/
#ifndef resample_8k_12k8
static void resample_8k_12k8(
LC3_HOT static void resample_8k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
resample_x64k_12k8(8, h_8k_12k8_q15, hp50, x, y, n);
@@ -280,7 +280,7 @@ static void resample_8k_12k8(
* The `x` vector is aligned on 32 bits
*/
#ifndef resample_16k_12k8
static void resample_16k_12k8(
LC3_HOT static void resample_16k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
resample_x64k_12k8(4, h_16k_12k8_q15, hp50, x, y, n);
@@ -296,7 +296,7 @@ static void resample_16k_12k8(
* The `x` vector is aligned on 32 bits
*/
#ifndef resample_32k_12k8
static void resample_32k_12k8(
LC3_HOT static void resample_32k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
resample_x64k_12k8(2, h_32k_12k8_q15, hp50, x, y, n);
@@ -312,7 +312,7 @@ static void resample_32k_12k8(
* The `x` vector is aligned on 32 bits
*/
#ifndef resample_24k_12k8
static void resample_24k_12k8(
LC3_HOT static void resample_24k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
resample_x192k_12k8(8, h_24k_12k8_q15, hp50, x, y, n);
@@ -328,8 +328,8 @@ static void resample_24k_12k8(
* The `x` vector is aligned on 32 bits
*/
#ifndef resample_48k_12k8
static void resample_48k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
LC3_HOT static void resample_48k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
resample_x192k_12k8(4, h_48k_12k8_q15, hp50, x, y, n);
}
@@ -343,7 +343,7 @@ struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
* The `x` vector is aligned on 32 bits
*/
#ifndef resample_6k4
static void resample_6k4(const int16_t *x, int16_t *y, int n)
LC3_HOT static void resample_6k4(const int16_t *x, int16_t *y, int n)
{
static const int16_t h[] = { 18477, 15424, 8105 };
const int16_t *ye = y + n;
@@ -381,7 +381,7 @@ static void (* const resample_12k8[])
* The size `n` of vectors must be multiple of 16, and less or equal to 128
*/
#ifndef dot
static inline float dot(const int16_t *a, const int16_t *b, int n)
LC3_HOT static inline float dot(const int16_t *a, const int16_t *b, int n)
{
int64_t v = 0;
@@ -403,7 +403,7 @@ static inline float dot(const int16_t *a, const int16_t *b, int n)
* The size `n` of vectors is multiple of 16, and less or equal to 128
*/
#ifndef correlate
static void correlate(
LC3_HOT static void correlate(
const int16_t *a, const int16_t *b, int n, float *y, int nc)
{
for (const float *ye = y + nc; y < ye; )
@@ -417,7 +417,7 @@ static void correlate(
* x_max Return the maximum value
* return Return the argument of the maximum
*/
static int argmax(const float *x, int n, float *x_max)
LC3_HOT static int argmax(const float *x, int n, float *x_max)
{
int arg = 0;
@@ -436,7 +436,7 @@ static int argmax(const float *x, int n, float *x_max)
* x_max, xw_max Return the maximum not weighted value
* return Return the argument of the weigthed maximum
*/
static int argmax_weighted(
LC3_HOT static int argmax_weighted(
const float *x, int n, float w_incr, float *x_max)
{
int arg;
@@ -459,7 +459,7 @@ static int argmax_weighted(
*
* The size `n` of vectors must be multiple of 4
*/
static void interpolate(const int16_t *x, int n, int d, int16_t *y)
LC3_HOT static void interpolate(const int16_t *x, int n, int d, int16_t *y)
{
static const int16_t h4_q15[][4] = {
{ 6877, 19121, 6877, 0 }, { 3506, 18025, 11000, 220 },
@@ -492,7 +492,7 @@ static void interpolate(const int16_t *x, int n, int d, int16_t *y)
* d The phase of interpolation (-3 to 3)
* return The interpolated value
*/
static float interpolate_corr(const float *x, int d)
LC3_HOT static float interpolate_corr(const float *x, int d)
{
static const float h4[][8] = {
{ 1.53572770e-02, -4.72963246e-02, 8.35788573e-02, 8.98638285e-01,
@@ -689,8 +689,10 @@ bool lc3_ltpf_analyse(
* c, w Coefficients `den` then `num`, and width of filter
* fade Fading mode of filter -1: Out 1: In 0: None
*/
static inline void synthesize_template(const float *xh, int nh, int lag,
const float *x0, float *x, int n, const float *c, const int w, int fade)
LC3_HOT static inline void synthesize_template(
const float *xh, int nh, int lag,
const float *x0, float *x, int n,
const float *c, const int w, int fade)
{
float g = (float)(fade <= 0);
float g_incr = (float)((fade > 0) - (fade < 0)) / n;
@@ -742,25 +744,25 @@ static inline void synthesize_template(const float *xh, int nh, int lag,
* Synthesis filter for each samplerates (width of filter)
*/
static void synthesize_4(const float *xh, int nh, int lag,
LC3_HOT static void synthesize_4(const float *xh, int nh, int lag,
const float *x0, float *x, int n, const float *c, int fade)
{
synthesize_template(xh, nh, lag, x0, x, n, c, 4, fade);
}
static void synthesize_6(const float *xh, int nh, int lag,
LC3_HOT static void synthesize_6(const float *xh, int nh, int lag,
const float *x0, float *x, int n, const float *c, int fade)
{
synthesize_template(xh, nh, lag, x0, x, n, c, 6, fade);
}
static void synthesize_8(const float *xh, int nh, int lag,
LC3_HOT static void synthesize_8(const float *xh, int nh, int lag,
const float *x0, float *x, int n, const float *c, int fade)
{
synthesize_template(xh, nh, lag, x0, x, n, c, 8, fade);
}
static void synthesize_12(const float *xh, int nh, int lag,
LC3_HOT static void synthesize_12(const float *xh, int nh, int lag,
const float *x0, float *x, int n, const float *c, int fade)
{
synthesize_template(xh, nh, lag, x0, x, n, c, 12, fade);

View File

@@ -46,7 +46,7 @@ static inline int32_t filter_hp50(struct lc3_ltpf_hp50_state *, int32_t);
/**
* Resample from 16 Khz to 12.8 KHz
*/
static void neon_resample_16k_12k8(
LC3_HOT static void neon_resample_16k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
static const int16_t h[4][20] = {
@@ -86,7 +86,7 @@ static void neon_resample_16k_12k8(
/**
* Resample from 32 Khz to 12.8 KHz
*/
static void neon_resample_32k_12k8(
LC3_HOT static void neon_resample_32k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
x -= 40 - 1;
@@ -125,7 +125,7 @@ static void neon_resample_32k_12k8(
/**
* Resample from 48 Khz to 12.8 KHz
*/
static void neon_resample_48k_12k8(
LC3_HOT static void neon_resample_48k_12k8(
struct lc3_ltpf_hp50_state *hp50, const int16_t *x, int16_t *y, int n)
{
static const int16_t alignas(16) h[4][64] = {
@@ -180,7 +180,7 @@ static void neon_resample_48k_12k8(
/**
* Return dot product of 2 vectors
*/
static inline float neon_dot(const int16_t *a, const int16_t *b, int n)
LC3_HOT static inline float neon_dot(const int16_t *a, const int16_t *b, int n)
{
int64x2_t v = vmovq_n_s64(0);
@@ -203,7 +203,7 @@ static inline float neon_dot(const int16_t *a, const int16_t *b, int n)
/**
* Return vector of correlations
*/
static void neon_correlate(
LC3_HOT static void neon_correlate(
const int16_t *a, const int16_t *b, int n, float *y, int nc)
{
for ( ; nc >= 4; nc -= 4, b -= 4) {

View File

@@ -28,7 +28,7 @@
* x, y Input and output coefficients, of size 5xn
* n Number of interleaved transform to perform
*/
static inline void fft_5(
LC3_HOT static inline void fft_5(
const struct lc3_complex *x, struct lc3_complex *y, int n)
{
static const float cos1 = 0.3090169944; /* cos(-2Pi 1/5) */
@@ -84,7 +84,7 @@ static inline void fft_5(
* twiddles Twiddles factors, determine size of transform
* n Number of interleaved transforms
*/
static inline void fft_bf3(
LC3_HOT static inline void fft_bf3(
const struct lc3_fft_bf3_twiddles *twiddles,
const struct lc3_complex *x, struct lc3_complex *y, int n)
{
@@ -126,7 +126,7 @@ static inline void fft_bf3(
* x, y Input and output coefficients
* n Number of interleaved transforms
*/
static inline void fft_bf2(
LC3_HOT static inline void fft_bf2(
const struct lc3_fft_bf2_twiddles *twiddles,
const struct lc3_complex *x, struct lc3_complex *y, int n)
{
@@ -196,7 +196,7 @@ static struct lc3_complex *fft(const struct lc3_complex *x, int n,
* x, y Input current and delayed samples
* y, d Output windowed samples, and delayed ones
*/
static void mdct_window(enum lc3_dt dt, enum lc3_srate sr,
LC3_HOT static void mdct_window(enum lc3_dt dt, enum lc3_srate sr,
const float *x, float *d, float *y)
{
int ns = LC3_NS(dt, sr), nd = LC3_ND(dt, sr);
@@ -232,7 +232,7 @@ static void mdct_window(enum lc3_dt dt, enum lc3_srate sr,
*
* `x` and y` can be the same buffer
*/
static void mdct_pre_fft(const struct lc3_mdct_rot_def *def,
LC3_HOT static void mdct_pre_fft(const struct lc3_mdct_rot_def *def,
const float *x, struct lc3_complex *y)
{
int n4 = def->n4;
@@ -263,7 +263,7 @@ static void mdct_pre_fft(const struct lc3_mdct_rot_def *def,
*
* `x` and y` can be the same buffer
*/
static void mdct_post_fft(const struct lc3_mdct_rot_def *def,
LC3_HOT static void mdct_post_fft(const struct lc3_mdct_rot_def *def,
const struct lc3_complex *x, float *y, float scale)
{
int n4 = def->n4, n8 = n4 >> 1;
@@ -295,7 +295,7 @@ static void mdct_post_fft(const struct lc3_mdct_rot_def *def,
* The real and imaginary parts of `y` are swapped,
* to operate on FFT instead of IFFT
*/
static void imdct_pre_fft(const struct lc3_mdct_rot_def *def,
LC3_HOT static void imdct_pre_fft(const struct lc3_mdct_rot_def *def,
const float *x, struct lc3_complex *y)
{
int n4 = def->n4;
@@ -328,7 +328,7 @@ static void imdct_pre_fft(const struct lc3_mdct_rot_def *def,
* The real and imaginary parts of `x` are swapped,
* to operate on FFT instead of IFFT
*/
static void imdct_post_fft(const struct lc3_mdct_rot_def *def,
LC3_HOT static void imdct_post_fft(const struct lc3_mdct_rot_def *def,
const struct lc3_complex *x, float *y, float scale)
{
int n4 = def->n4;
@@ -356,7 +356,7 @@ static void imdct_post_fft(const struct lc3_mdct_rot_def *def,
* x, d Middle half of IMDCT coefficients and delayed samples
* y, d Output samples and delayed ones
*/
static void imdct_window(enum lc3_dt dt, enum lc3_srate sr,
LC3_HOT static void imdct_window(enum lc3_dt dt, enum lc3_srate sr,
const float *x, float *d, float *y)
{
/* The full MDCT coefficients is given by symmetry :

View File

@@ -120,7 +120,7 @@ static const float dct16_m[16][16] = {
* Forward DCT-16 transformation
* x, y Input and output 16 values
*/
static void dct16_forward(const float *x, float *y)
LC3_HOT static void dct16_forward(const float *x, float *y)
{
for (int i = 0, j; i < 16; i++)
for (y[i] = 0, j = 0; j < 16; j++)
@@ -131,7 +131,7 @@ static void dct16_forward(const float *x, float *y)
* Inverse DCT-16 transformation
* x, y Input and output 16 values
*/
static void dct16_inverse(const float *x, float *y)
LC3_HOT static void dct16_inverse(const float *x, float *y)
{
for (int i = 0, j; i < 16; i++)
for (y[i] = 0, j = 0; j < 16; j++)
@@ -150,7 +150,8 @@ static void dct16_inverse(const float *x, float *y)
* att 1: Attack detected 0: Otherwise
* scf Output 16 scale factors
*/
static void compute_scale_factors(enum lc3_dt dt, enum lc3_srate sr,
LC3_HOT static void compute_scale_factors(
enum lc3_dt dt, enum lc3_srate sr,
const float *eb, bool att, float *scf)
{
/* Pre-emphasis gain table :
@@ -343,7 +344,8 @@ static void compute_scale_factors(enum lc3_dt dt, enum lc3_srate sr,
* scf Input 16 scale factors
* lf/hfcb_idx Output the low and high frequency codebooks index
*/
static void resolve_codebooks(const float *scf, int *lfcb_idx, int *hfcb_idx)
LC3_HOT static void resolve_codebooks(
const float *scf, int *lfcb_idx, int *hfcb_idx)
{
float dlfcb_max = 0, dhfcb_max = 0;
*lfcb_idx = *hfcb_idx = 0;
@@ -371,7 +373,7 @@ static void resolve_codebooks(const float *scf, int *lfcb_idx, int *hfcb_idx)
* c Pulse configuration
* cn Normalized pulse configuration
*/
static void normalize(const int *c, float *cn)
LC3_HOT static void normalize(const int *c, float *cn)
{
int c2_sum = 0;
for (int i = 0; i < 16; i++)
@@ -389,7 +391,7 @@ static void normalize(const int *c, float *cn)
* start, end Current number of pulses, limit to reach
* corr, energy Correlation (x,y) and y energy, updated at output
*/
static void add_pulse(const float *x, int *y, int n,
LC3_HOT static void add_pulse(const float *x, int *y, int n,
int start, int end, float *corr, float *energy)
{
for (int k = start; k < end; k++) {
@@ -418,7 +420,7 @@ static void add_pulse(const float *x, int *y, int n,
* c, cn Output 4 pulse configurations candidates, normalized
* shape/gain_idx Output selected shape/gain indexes
*/
static void quantize(const float *scf, int lfcb_idx, int hfcb_idx,
LC3_HOT static void quantize(const float *scf, int lfcb_idx, int hfcb_idx,
int (*c)[16], float (*cn)[16], int *shape_idx, int *gain_idx)
{
/* --- Residual --- */
@@ -539,7 +541,7 @@ static void quantize(const float *scf, int lfcb_idx, int hfcb_idx,
* shape/gain Selected shape/gain indexes
* scf Return unquantized scale factors
*/
static void unquantize(int lfcb_idx, int hfcb_idx,
LC3_HOT static void unquantize(int lfcb_idx, int hfcb_idx,
const float *c, int shape, int gain, float *scf)
{
const float *lfcb = lc3_sns_lfcb[lfcb_idx];
@@ -673,7 +675,7 @@ static void deenumerate(int shape,
*
* `x` and `y` can be the same buffer
*/
static void spectral_shaping(enum lc3_dt dt, enum lc3_srate sr,
LC3_HOT static void spectral_shaping(enum lc3_dt dt, enum lc3_srate sr,
const float *scf_q, bool inv, const float *x, float *y)
{
/* --- Interpolate scale factors --- */

View File

@@ -46,7 +46,7 @@ static int resolve_gain_offset(enum lc3_srate sr, int nbytes)
* reset_off Return True when the nbits_off must be reset
* return The quantized gain value
*/
static int estimate_gain(
LC3_HOT static int estimate_gain(
enum lc3_dt dt, enum lc3_srate sr, const float *x,
int nbits_budget, float nbits_off, int g_off, bool *reset_off)
{
@@ -121,8 +121,8 @@ static int estimate_gain(
* nbits_budget Number of bits available for coding the spectrum
* return Gain adjust value (-1 to 2)
*/
static int adjust_gain(enum lc3_srate sr,
int g_idx, int nbits, int nbits_budget)
LC3_HOT static int adjust_gain(
enum lc3_srate sr, int g_idx, int nbits, int nbits_budget)
{
/* --- Compute delta threshold --- */
@@ -202,7 +202,7 @@ static float unquantize_gain(int g_int)
* x Spectral coefficients, scaled as output
* xq, nq Output spectral quantized coefficients, and count
*/
static void quantize(enum lc3_dt dt, enum lc3_srate sr,
LC3_HOT static void quantize(enum lc3_dt dt, enum lc3_srate sr,
int g_int, float *x, int16_t *xq, int *nq)
{
float g_inv = 1 / unquantize_gain(g_int);
@@ -232,7 +232,7 @@ static void quantize(enum lc3_dt dt, enum lc3_srate sr,
* x, nq Spectral quantized, and count of significants
* return Unquantized gain value
*/
static float unquantize(enum lc3_dt dt, enum lc3_srate sr,
LC3_HOT static float unquantize(enum lc3_dt dt, enum lc3_srate sr,
int g_int, float *x, int nq)
{
float g = unquantize_gain(g_int);
@@ -271,7 +271,7 @@ static int resolve_high_rate(enum lc3_srate sr, int nbytes)
* p_lsb_mode Return True when LSB's are not AC coded, or NULL
* return The number of bits coding the spectrum
*/
static int compute_nbits(
LC3_HOT static int compute_nbits(
enum lc3_dt dt, enum lc3_srate sr, int nbytes,
const int16_t *x, int *n, int nbits_budget, bool *p_lsb_mode)
{
@@ -367,7 +367,7 @@ static int compute_nbits(
* x Spectral quantized
* nq, lsb_mode Count of significants, and LSB discard indication
*/
static void put_quantized(lc3_bits_t *bits,
LC3_HOT static void put_quantized(lc3_bits_t *bits,
enum lc3_dt dt, enum lc3_srate sr, int nbytes,
const int16_t *x, int nq, bool lsb_mode)
{
@@ -443,7 +443,7 @@ static void put_quantized(lc3_bits_t *bits,
* nf_seed Return the noise factor seed associated
* return 0: Ok -1: Invalid bitstream data
*/
static int get_quantized(lc3_bits_t *bits,
LC3_HOT static int get_quantized(lc3_bits_t *bits,
enum lc3_dt dt, enum lc3_srate sr, int nbytes,
int nq, bool lsb_mode, float *xq, uint16_t *nf_seed)
{
@@ -518,8 +518,8 @@ static int get_quantized(lc3_bits_t *bits,
* xq, n Spectral quantized, and count of significants
* xf Scaled spectral coefficients
*/
static void put_residual(lc3_bits_t *bits, int nbits,
const int16_t *xq, int n, const float *xf)
LC3_HOT static void put_residual(
lc3_bits_t *bits, int nbits, const int16_t *xq, int n, const float *xf)
{
for (int i = 0; i < n && nbits > 0; i++) {
@@ -537,7 +537,8 @@ static void put_residual(lc3_bits_t *bits, int nbits,
* nbits Maximum number of bits to output
* x, nq Spectral quantized, and count of significants
*/
static void get_residual(lc3_bits_t *bits, int nbits, float *x, int nq)
LC3_HOT static void get_residual(
lc3_bits_t *bits, int nbits, float *x, int nq)
{
for (int i = 0; i < nq && nbits > 0; i++) {
@@ -559,7 +560,8 @@ static void get_residual(lc3_bits_t *bits, int nbits, float *x, int nq)
* nbits Maximum number of bits to output
* x, n Spectral quantized, and count of significants
*/
static void put_lsb(lc3_bits_t *bits, int nbits, const int16_t *x, int n)
LC3_HOT static void put_lsb(
lc3_bits_t *bits, int nbits, const int16_t *x, int n)
{
for (int i = 0; i < n && nbits > 0; i += 2) {
@@ -590,7 +592,7 @@ static void put_lsb(lc3_bits_t *bits, int nbits, const int16_t *x, int n)
* x, nq Spectral quantized, and count of significants
* nf_seed Update the noise factor seed according
*/
static void get_lsb(lc3_bits_t *bits,
LC3_HOT static void get_lsb(lc3_bits_t *bits,
int nbits, float *x, int nq, uint16_t *nf_seed)
{
for (int i = 0; i < nq && nbits > 0; i += 2) {
@@ -634,7 +636,7 @@ static void get_lsb(lc3_bits_t *bits,
* x Quantization scaled spectrum coefficients
* return Noise factor (0 to 7)
*/
static int estimate_noise(enum lc3_dt dt, enum lc3_bandwidth bw,
LC3_HOT static int estimate_noise(enum lc3_dt dt, enum lc3_bandwidth bw,
const int16_t *xq, int nq, const float *x)
{
int bw_stop = (dt == LC3_DT_7M5 ? 60 : 80) * (1 + bw);
@@ -665,7 +667,7 @@ static int estimate_noise(enum lc3_dt dt, enum lc3_bandwidth bw,
* g Quantization gain
* x, nq Spectral quantized, and count of significants
*/
static void fill_noise(enum lc3_dt dt, enum lc3_bandwidth bw,
LC3_HOT static void fill_noise(enum lc3_dt dt, enum lc3_bandwidth bw,
int nf, uint16_t nf_seed, float g, float *x, int nq)
{
int bw_stop = (dt == LC3_DT_7M5 ? 60 : 80) * (1 + bw);

View File

@@ -39,7 +39,7 @@ static bool resolve_lpc_weighting(enum lc3_dt dt, int nbytes)
* a, b, n The 2 vectors of size `n`
* return sum( a[i] * b[i] ), i = [0..n-1]
*/
static inline float dot(const float *a, const float *b, int n)
LC3_HOT static inline float dot(const float *a, const float *b, int n)
{
float v = 0;
@@ -55,7 +55,8 @@ static inline float dot(const float *a, const float *b, int n)
* x Spectral coefficients
* gain, a Output the prediction gains and LPC coefficients
*/
static void compute_lpc_coeffs(enum lc3_dt dt, enum lc3_bandwidth bw,
LC3_HOT static void compute_lpc_coeffs(
enum lc3_dt dt, enum lc3_bandwidth bw,
const float *x, float *gain, float (*a)[9])
{
static const int sub_7m5_nb[] = { 9, 26, 43, 60 };
@@ -148,7 +149,7 @@ static void compute_lpc_coeffs(enum lc3_dt dt, enum lc3_bandwidth bw,
* LPC Weighting
* gain, a Prediction gain and LPC coefficients, weighted as output
*/
static void lpc_weighting(float pred_gain, float *a)
LC3_HOT static void lpc_weighting(float pred_gain, float *a)
{
float gamma = 1.f - (1.f - 0.85f) * (2.f - pred_gain) / (2.f - 1.5f);
float g = 1.f;
@@ -162,7 +163,7 @@ static void lpc_weighting(float pred_gain, float *a)
* a LPC coefficients
* rc Output refelection coefficients
*/
static void lpc_reflection(const float *a, float *rc)
LC3_HOT static void lpc_reflection(const float *a, float *rc)
{
float e, b[2][7], *b0, *b1;
@@ -251,7 +252,7 @@ static void unquantize_rc(const int *rc_q, int rc_order, float rc[8])
* rc_order, rc Order of coefficients, and coefficients
* x Spectral coefficients, filtered as output
*/
static void forward_filtering(
LC3_HOT static void forward_filtering(
enum lc3_dt dt, enum lc3_bandwidth bw,
const int rc_order[2], const float rc[2][8], float *x)
{
@@ -292,7 +293,7 @@ static void forward_filtering(
* rc_order, rc Order of coefficients, and unquantized coefficients
* x Spectral coefficients, filtered as output
*/
static void inverse_filtering(
LC3_HOT static void inverse_filtering(
enum lc3_dt dt, enum lc3_bandwidth bw,
const int rc_order[2], const float rc[2][8], float *x)
{