Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7c28ecc authored by Antoine SOULIER's avatar Antoine SOULIER Committed by Jakub Pawlowski
Browse files

fix: unused parameters, and sanitizer quirk checks

Change-Id: I5a5d9eca60c6076ce9d51dc42376fbe51c53c5c7
parent 30f93c98
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ enum lc3_bandwidth lc3_bwdet_run(
    struct region { int is : 8; int ie : 8; };

    static const struct region bws_table[LC3_NUM_DT]
            [LC3_NUM_SRATE-1][LC3_NUM_BANDWIDTH-1] = {
            [LC3_NUM_BANDWIDTH-1][LC3_NUM_BANDWIDTH-1] = {

        [LC3_DT_7M5] = {
            { { 51, 63+1 } },
@@ -55,10 +55,14 @@ enum lc3_bandwidth lc3_bwdet_run(
    /* --- Stage 1 ---
     * Determine bw0 candidate */

    const struct region *bwr = bws_table[dt][sr-1];
    enum lc3_bandwidth bw0 = LC3_BANDWIDTH_NB;
    enum lc3_bandwidth bwn = (enum lc3_bandwidth)sr;

    if (bwn <= bw0)
        return bwn;

    const struct region *bwr = bws_table[dt][bwn-1];

    for (enum lc3_bandwidth bw = bw0; bw < bwn; bw++) {
        int i = bwr[bw].is, ie = bwr[bw].ie;
        int n = ie - i;
@@ -71,7 +75,6 @@ enum lc3_bandwidth lc3_bwdet_run(
            bw0 = bw + 1;
    }


    /* --- Stage 2 ---
     * Detect drop above cut-off frequency.
     * The Tc condition (13) is precalculated, as
+2 −5
Original line number Diff line number Diff line
@@ -303,14 +303,12 @@ static bool detect_pitch(

/**
 * Pitch-lag parameter (3.3.9.7)
 * state           State of the LTPF
 * x, n            [-232..-28] Previous, [0..n-1] Current 12.8KHz samples
 * tc              Pitch-lag estimation
 * pitch           The pitch value, in fixed .4
 * return          The bitstream pitch index value
 */
static int refine_pitch(struct lc3_ltpf_state *state,
    const float *x, int n, int tc, int *pitch)
static int refine_pitch(const float *x, int n, int tc, int *pitch)
{
    float r[17], rm;
    int e, f;
@@ -385,8 +383,7 @@ bool lc3_ltpf_analyse(enum lc3_dt dt, enum lc3_srate sr,
    if (pitch_present) {
        float u[n_12k8], v[n_12k8];

        data->pitch_index =
            refine_pitch(state, x_12k8, n_12k8, tc, &pitch);
        data->pitch_index = refine_pitch(x_12k8, n_12k8, tc, &pitch);

        interpolate(x_12k8, n_12k8, 0, u);
        interpolate(x_12k8 - (pitch >> 2), n_12k8, pitch & 3, v);
+7 −7
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ static int get_gain_offset(enum lc3_srate sr, unsigned nbytes)

/**
 * Global Gain Estimation (cf. 3.3.10.2)
 * dt, sr, nbytes  Duration, samplerate and size of the frame
 * dt, sr          Duration and samplerate
 * x               Spectral coefficients
 * nbits_budget    Number of bits available coding the spectrum
 * nbits_off       Offset on the available bits, temporarily smoothed
@@ -62,7 +62,7 @@ static int get_gain_offset(enum lc3_srate sr, unsigned nbytes)
 * return          The quantized gain value
 */
static int estimate_gain(
    enum lc3_dt dt, enum lc3_srate sr, unsigned nbytes, const float *x,
    enum lc3_dt dt, enum lc3_srate sr, const float *x,
    int nbits_budget, float nbits_off, int g_off, bool *reset_off)
{
    int ne = LC3_NE(dt, sr) >> 2;
@@ -175,13 +175,13 @@ static int adjust_gain(enum lc3_srate sr,

/**
 * Spectral quantization (cf. 3.3.10.3)
 * dt, sr, nbytes  Duration, samplerate and size of the frame
 * dt, sr          Duration and samplerate
 * g_int           Quantization gain value
 * x               Spectral coefficients, scaled as output
 * xq, nq          Output spectral quantized coefficients, and count
 */
static void perform_quantization(enum lc3_dt dt, enum lc3_srate sr,
    unsigned nbytes, int g_int, float *x, int16_t *xq, int *nq)
    int g_int, float *x, int16_t *xq, int *nq)
{
    int ne = LC3_NE(dt, sr);

@@ -489,12 +489,12 @@ void lc3_quant_perform(enum lc3_dt dt, enum lc3_srate sr,

    int g_off = get_gain_offset(sr, nbytes);

    int g_int = estimate_gain(dt, sr, nbytes,
    int g_int = estimate_gain(dt, sr,
        x, nbits_budget, nbits_off, g_off, &reset_off);

    /* --- Quantization --- */

    perform_quantization(dt, sr, nbytes, g_int, x, data->x, &data->n);
    perform_quantization(dt, sr, g_int, x, data->x, &data->n);

    int nbits = compute_nbits(dt, sr, nbytes,
        data->x, &data->n, 0, NULL, NULL);
@@ -507,7 +507,7 @@ void lc3_quant_perform(enum lc3_dt dt, enum lc3_srate sr,
    int g_adj = adjust_gain(sr, g_int + g_off, nbits, nbits_budget);

    if (g_adj)
        perform_quantization(dt, sr, nbytes, g_adj, x, data->x, &data->n);
        perform_quantization(dt, sr, g_adj, x, data->x, &data->n);

    data->g_idx = g_int + g_adj + g_off;
    nbits = compute_nbits(dt, sr, nbytes,