Commit 0fd20a73 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_891_PARAMUPMIX_CLEANUP

parent 83c76789
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -1335,49 +1335,27 @@ typedef struct {
    unsigned short length[81];
} HUFF_ELEMENTS;

#ifdef FIX_891_PARAMUPMIX_CLEANUP
typedef struct {
    HUFF_ELEMENTS df0;
    HUFF_ELEMENTS df;
} HUFF_TABLE;
#else
typedef struct {
    HUFF_ELEMENTS df0;
    HUFF_ELEMENTS df;
    HUFF_ELEMENTS dt;
} HUFF_TABLE;
#endif

typedef enum {
    ALPHA,
    BETA
} PAR_TYPE;

#ifndef FIX_891_PARAMUPMIX_CLEANUP
typedef enum {
    FINE,
    COARSE
} QUANT_TYPE;

#endif
typedef struct {
    int16_t nquant;
    int16_t offset;
    float data[35];
} ACPL_QUANT_TABLE;  
#ifdef FIX_891_PARAMUPMIX_CLEANUP

typedef struct
{
    const int16_t (*alpha)[2];
    const int16_t (*beta)[2];
} HUFF_NODE_TABLE;
#else
typedef struct
{
    const int16_t (*alpha[2])[2];
    const int16_t (*beta[2])[2];
} HUFF_NODE_TABLE;
#endif

/*----------------------------------------------------------------------------------*
 * Parametric MC Constants
+0 −112
Original line number Diff line number Diff line
@@ -2518,17 +2518,6 @@ const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_
    1, 1, 1, 2, 24, 69, 122, 194, 285, 487, 690, 1173, 2255, 4709, 10599, 24635, 10862, 4709, 2204, 1059, 566, 330, 221, 150, 95, 59, 28, 2, 1, 1, 1
};
#ifndef FIX_891_PARAMUPMIX_CLEANUP
/*----------------------------------------------------------------------------------*
 * Parametric Upmix MC ROM tables
 *----------------------------------------------------------------------------------*/
const int16_t ivas_param_upmx_mx_qmap[2][33] =
{ 
    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0 },
                              { 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0 } 
};
#endif
/*----------------------------------------------------------------------------------*
 * MASA ROM tables
@@ -6439,7 +6428,6 @@ const int16_t sns_1st_means_32k[2][16] =
 * MC ParamUpmix ROM tables
 *-----------------------------------------------------------------------*/
#ifdef FIX_891_PARAMUPMIX_CLEANUP
const int16_t ivas_param_upmx_mx_qmap[33] =
{ 
    0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0
@@ -6503,105 +6491,5 @@ const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9] =
            { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */
        }
};
#else
const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table[] =
{
    /* Alfa Fine */
    {
        33, /* nquant */
        16, /* offset */
        { -2.000000e+000f, -1.809375e+000f, -1.637500e+000f, -1.484375e+000f, -1.350000e+000f, -1.234375e+000f, -1.137500e+000f, -1.059375e+000f, -1.000000e+000f, -9.406250e-001f, 
          -8.625000e-001f, -7.656250e-001f, -6.500000e-001f, -5.156250e-001f, -3.625000e-001f, -1.906250e-001f, +0.000000e+000f, +1.906250e-001f, +3.625000e-001f, +5.156250e-001f, 
          +6.500000e-001f, +7.656250e-001f, +8.625000e-001f, +9.406250e-001f, +1.000000e+000f, +1.059375e+000f, +1.137500e+000f, +1.234375e+000f, +1.350000e+000f, +1.484375e+000f, 
          +1.637500e+000f, +1.809375e+000f, +2.000000e+000f } /* data */
    },
    {  /* Alfa Coarse */
        17, /* nquant */
        8, /* offset */
        { -2.000000e+000f, -1.637500e+000f, -1.350000e+000f, -1.137500e+000f, -1.000000e+000f, -8.625000e-001f, -6.500000e-001f, -3.625000e-001f, +0.000000e+000f, +3.625000e-001f, 
          +6.500000e-001f, +8.625000e-001f, +1.000000e+000f, +1.137500e+000f, +1.350000e+000f, +1.637500e+000f, +2.000000e+000f } /* data */
    }
};
const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[2][9] =
{
    {
        /* Beta Fine #1 */
        {
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +2.375000e-001f, +5.500000e-001f, +9.375000e-001f, +1.400000e+000f, +1.937500e+000f, +2.550000e+000f, +3.237500e+000f, +4.000000e+000f } /* data */
        },
        {   /* Beta Fine #2 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +2.035449e-001f, +4.713672e-001f, +8.034668e-001f, +1.199844e+000f, +1.660498e+000f, +2.185430e+000f, +2.774639e+000f, +3.428125e+000f } /* data */
        },
        {   /* Beta Fine #3 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +1.729297e-001f, +4.004688e-001f, +6.826172e-001f, +1.019375e+000f, +1.410742e+000f, +1.856719e+000f, +2.357305e+000f, +2.912500e+000f } /* data */
        },
        {   /* Beta Fine #4 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +1.456543e-001f, +3.373047e-001f, +5.749512e-001f, +8.585938e-001f, +1.188232e+000f, +1.563867e+000f, +1.985498e+000f, +2.453125e+000f } /* data */
        },
        {   /* Beta Fine #5 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +1.217188e-001f, +2.818750e-001f, +4.804688e-001f, +7.175000e-001f, +9.929688e-001f, +1.306875e+000f, +1.659219e+000f, +2.050000e+000f } /* data */
        },
        {   /* Beta Fine #6 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +1.011230e-001f, +2.341797e-001f, +3.991699e-001f, +5.960938e-001f, +8.249512e-001f, +1.085742e+000f, +1.378467e+000f, +1.703125e+000f } /* data */
        },
        {   /* Beta Fine #7 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +8.386719e-002f, +1.942188e-001f, +3.310547e-001f, +4.943750e-001f, +6.841797e-001f, +9.004688e-001f, +1.143242e+000f, +1.412500e+000f } /* data */
        },
        {   /* Beta Fine #8 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +6.995117e-002f, +1.619922e-001f, +2.761230e-001f, +4.123438e-001f, +5.706543e-001f, +7.510547e-001f, +9.535449e-001f, +1.178125e+000f } /* data */
        },
        {   /* Beta Fine #9 */
            9, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +5.937500e-002f, +1.375000e-001f, +2.343750e-001f, +3.500000e-001f, +4.843750e-001f, +6.375000e-001f, +8.093750e-001f, +1.000000e+000f } /* data */
        }
    },
    {
        /* Beta Coarse #1 */
        {
            5, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +5.500000e-001f, +1.400000e+000f, +2.550000e+000f, +4.000000e+000f } /* data */
        },
        {  /* Beta Coarse #2 */
            5, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +4.004688e-001f, +1.019375e+000f, +1.856719e+000f, +2.912500e+000f } /* data */
        },
        {   /* Beta Coarse #3 */
            5, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +2.818750e-001f, +7.175000e-001f, +1.306875e+000f, +2.050000e+000f } /* data */
        },
        {  /* Beta Coarse #4 */
            5, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +1.942188e-001f, +4.943750e-001f, +9.004688e-001f, +1.412500e+000f } /* data */
        },
        {  /* Beta Coarse #5 */
            5, /* nquant */
            0, /* offset */
            { +0.000000e+000f, +1.375000e-001f, +3.500000e-001f, +6.375000e-001f, +1.000000e+000f } /* data */
        }
    }
};
#endif
/* clang-format on */
+0 −11
Original line number Diff line number Diff line
@@ -259,12 +259,6 @@ extern const uint16_t ivas_param_mc_sym_freq_icc_combined_48_16bits[PARAM_MC_SZ_
extern const uint16_t ivas_param_mc_cum_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER];
extern const uint16_t ivas_param_mc_sym_freq_icc_delta_combined_48_16bits[2 * PARAM_MC_SZ_ICC_QUANTIZER - 1];

#ifndef FIX_891_PARAMUPMIX_CLEANUP
/*----------------------------------------------------------------------------------*
 * Parametric Upmix MC ROM tables
 *----------------------------------------------------------------------------------*/
extern const int16_t ivas_param_upmx_mx_qmap[2][33];
#endif

/*----------------------------------------------------------------------------------*
 * MASA ROM tables
@@ -453,15 +447,10 @@ extern const int16_t sns_1st_means_32k[2][16];
/*----------------------------------------------------------------------*
 * MC ParamUpmix ROM tables
 *-----------------------------------------------------------------------*/
#ifdef FIX_891_PARAMUPMIX_CLEANUP

extern const int16_t ivas_param_upmx_mx_qmap[33];
extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table;
extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[9];
#else
extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_alpha_quant_table[];
extern const ACPL_QUANT_TABLE ivas_mc_paramupmix_beta_quant_table[2][9];
#endif

/* IVAS_ROM_COM_H */
#endif
+0 −1
Original line number Diff line number Diff line
@@ -151,7 +151,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SPLIT_REND_WITH_HEAD_ROT  */                  /* Dlb,FhG: Split Rendering contributions 21 and 35 */

#define FIX_891_PARAMUPMIX_CLEANUP                      /* Dlb: issue 891: remove unneeded code from ParamUpmix */
#define FIX_917_LCLD_WARNINGS                           /* Dlb: issue 917 and 918: fix LCLD codec warnings*/
#define FIX_920_IGF_INIT_ERROR                          /* FhG: issue 920: fix bitrate mismatch in initial IGF config to avoid error message in same cases */
#define FIX_SPLITREND_WARNINGS                          /* FhG: fix warnings related to split rendering observed in build jobs */
+0 −166
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ static void paramupmix_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr[], f
#endif
static int16_t huff_read( Decoder_State *st, const int16_t ( *ht )[2] );

#ifdef FIX_891_PARAMUPMIX_CLEANUP
static void huffman_decode( Decoder_State *st, const PAR_TYPE parType, int32_t *vq );

static void dequant_alpha( int32_t *vq, float *v );
@@ -90,15 +89,6 @@ static void dequant_alpha( int32_t *vq, float *v );
static void dequant_beta( int32_t *aq, int32_t *bq, float *beta );

static void get_ec_data( Decoder_State *st, const PAR_TYPE parType, int32_t *parQ, int32_t *alphaQEnv, float ab[IVAS_MAX_NUM_BANDS] );
#else
static void huffman_decode( Decoder_State *st, const int16_t nv, const int16_t ivStart, PAR_TYPE parType, QUANT_TYPE quant_type, const int16_t bNoDt, int32_t *vq );

static void dequant_alpha( const int16_t nv, const int16_t ivStart, const QUANT_TYPE quant_type, int32_t *vq, float *v );

static void dequant_beta( const int16_t nv, const int16_t ivStart, const QUANT_TYPE quant_type, int32_t *aq, int32_t *bq, float *beta );

static void get_ec_data( Decoder_State *st, const PAR_TYPE parType, const QUANT_TYPE quant_type, const int16_t nParBand, const int16_t parBandStart, int32_t *parQ, int32_t *alphaQEnv, float ab[IVAS_MAX_NUM_BANDS] );
#endif


/*-------------------------------------------------------------------------
@@ -153,17 +143,9 @@ void ivas_mc_paramupmix_dec_read_BS(

        for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ )
        {
#ifdef FIX_891_PARAMUPMIX_CLEANUP
            get_ec_data( st0, ALPHA, hMCParamUpmix->alpha_quant[i], alpha_quant, hMCParamUpmix->alphas[i] );

            get_ec_data( st0, BETA, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas[i] );
#else
            get_ec_data( st0, ALPHA, FINE /*quant_type*/, IVAS_MAX_NUM_BANDS /*nParBand*/,
                         0 /*parBandStart*/, hMCParamUpmix->alpha_quant[i], alpha_quant, hMCParamUpmix->alphas[i] );

            get_ec_data( st0, BETA, FINE /*quant_type*/, IVAS_MAX_NUM_BANDS /*nParBand*/,
                         0 /*parBandStart*/, hMCParamUpmix->beta_quant[i], alpha_quant, hMCParamUpmix->betas[i] );
#endif
        }
        *nb_bits += st0->next_bit_pos;
        st0->bit_stream = bit_stream_orig;
@@ -1364,19 +1346,10 @@ static int16_t huff_read(

static void huffman_decode(
    Decoder_State *st,
#ifndef FIX_891_PARAMUPMIX_CLEANUP
    const int16_t nv,
    const int16_t ivStart,
    const PAR_TYPE parType,
    const QUANT_TYPE quant_type,
    const int16_t bNoDt,
#else
    const PAR_TYPE parType,
#endif
    int32_t *vq )
{
    const int16_t( *huff_node_table )[2];
#ifdef FIX_891_PARAMUPMIX_CLEANUP
    int16_t iv, nquant, offset;

    nquant = 0;
@@ -1393,38 +1366,8 @@ static void huffman_decode(
    }

    offset = nquant - 1; /* range of df [-(nquant - 1), nquant - 1] */
#else
    int16_t iv, bdt, nquant, offset;
    nquant = 0;
    switch ( parType )
    {
        case ALPHA:
            nquant = ivas_mc_paramupmix_alpha_quant_table[quant_type].nquant;
            break;
        case BETA:
            nquant = ivas_mc_paramupmix_beta_quant_table[quant_type][0].nquant;
            break;
        default:
            assert( 0 );
    }

    offset = nquant - 1; /* range of df/dt [-(nquant - 1), nquant - 1] */
#endif

#ifdef FIX_891_PARAMUPMIX_CLEANUP
    st->next_bit_pos++;
#else
    if ( bNoDt )
    {
        bdt = 0;
    }
    else
    {
        bdt = st->bit_stream[st->next_bit_pos];
    st->next_bit_pos++;
    }
#endif
#ifdef FIX_891_PARAMUPMIX_CLEANUP
    switch ( parType )
    {
        case ALPHA:
@@ -1455,76 +1398,16 @@ static void huffman_decode(
    {
        vq[iv] = huff_read( st, huff_node_table ) + vq[iv - 1] - offset;
    }
#else
    if ( bdt )
    { /* Get dt */
        switch ( parType )
        {
            case ALPHA:
                huff_node_table = ivas_mc_paramupmix_huff_nodes_dt.alpha[quant_type];
                break;
            case BETA:
                huff_node_table = ivas_mc_paramupmix_huff_nodes_dt.beta[quant_type];
                break;
            default:
                huff_node_table = NULL;
                assert( 0 );
        }
        for ( iv = ivStart; iv < nv; iv++ )
        {
            vq[iv] = huff_read( st, huff_node_table ) + vq[iv] - offset;
        }
    }
    else /* Get f0, df */
    {
        switch ( parType )
        {
            case ALPHA:
                huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.alpha[quant_type];
                break;
            case BETA:
                huff_node_table = ivas_mc_paramupmix_huff_nodes_df0.beta[quant_type];
                break;
            default:
                huff_node_table = NULL;
                assert( 0 );
        }
        vq[ivStart] = huff_read( st, huff_node_table );

        switch ( parType )
        {
            case ALPHA:
                huff_node_table = ivas_mc_paramupmix_huff_nodes_df.alpha[quant_type];
                break;
            case BETA:
                huff_node_table = ivas_mc_paramupmix_huff_nodes_df.beta[quant_type];
                break;
            default:
                assert( 0 );
        }

        for ( iv = ivStart + 1; iv < nv; iv++ )
        {
            vq[iv] = huff_read( st, huff_node_table ) + vq[iv - 1] - offset;
        }
    }
#endif

    return;
}


static void dequant_alpha(
#ifndef FIX_891_PARAMUPMIX_CLEANUP
    const int16_t nv,
    const int16_t ivStart,
    const QUANT_TYPE quant_type,
#endif
    int32_t *vq,
    float *v )
{
    int16_t iv;
#ifdef FIX_891_PARAMUPMIX_CLEANUP
    const ACPL_QUANT_TABLE *quant_table = &ivas_mc_paramupmix_alpha_quant_table;

    for ( iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++ )
@@ -1532,29 +1415,11 @@ static void dequant_alpha(
        v[iv] = quant_table->data[vq[iv]];
    }

#else
    const ACPL_QUANT_TABLE *quant_table = &ivas_mc_paramupmix_alpha_quant_table[quant_type];

    for ( iv = 0; iv < ivStart; iv++ )
    {
        v[iv] = 0;
    }

    for ( iv = ivStart; iv < nv; iv++ )
    {
        v[iv] = quant_table->data[vq[iv]];
    }
#endif
    return;
}


static void dequant_beta(
#ifndef FIX_891_PARAMUPMIX_CLEANUP
    const int16_t nv,
    const int16_t ivStart,
    const QUANT_TYPE quant_type,
#endif
    int32_t *aq,
    int32_t *bq,
    float *beta )
@@ -1562,25 +1427,12 @@ static void dequant_beta(
    int16_t iv;
    const ACPL_QUANT_TABLE *quant_table;

#ifdef FIX_891_PARAMUPMIX_CLEANUP
    for ( iv = 0; iv < IVAS_MAX_NUM_BANDS; iv++ )
    {
        quant_table = &ivas_mc_paramupmix_beta_quant_table[ivas_param_upmx_mx_qmap[aq[iv]]];
        beta[iv] = quant_table->data[bq[iv]];
    }

#else
    for ( iv = 0; iv < ivStart; iv++ )
    {
        beta[iv] = 0;
    }

    for ( iv = ivStart; iv < nv; iv++ )
    {
        quant_table = &ivas_mc_paramupmix_beta_quant_table[quant_type][ivas_param_upmx_mx_qmap[quant_type][aq[iv]]];
        beta[iv] = quant_table->data[bq[iv]];
    }
#endif
    return;
}

@@ -1588,38 +1440,20 @@ static void dequant_beta(
static void get_ec_data(
    Decoder_State *st,
    const PAR_TYPE parType,
#ifndef FIX_891_PARAMUPMIX_CLEANUP
    const QUANT_TYPE quant_type,
    const int16_t nParBand,
    const int16_t parBandStart,
#endif
    int32_t *parQ,
    int32_t *alphaQEnv,
    float ab[IVAS_MAX_NUM_BANDS] )
{
#ifdef FIX_891_PARAMUPMIX_CLEANUP
    huffman_decode( st, parType, parQ );
#else
    huffman_decode( st, nParBand, parBandStart, parType, quant_type, 0, parQ );
#endif

    if ( parType == ALPHA )
    {
#ifdef FIX_891_PARAMUPMIX_CLEANUP
        dequant_alpha( parQ, ab );
        mvl2l( parQ, alphaQEnv, (int16_t) IVAS_MAX_NUM_BANDS );
#else
        dequant_alpha( nParBand, parBandStart, quant_type, parQ, ab );
        mvl2l( parQ, alphaQEnv, (int16_t) nParBand );
#endif
    }
    else
    {
#ifdef FIX_891_PARAMUPMIX_CLEANUP
        dequant_beta( alphaQEnv, parQ, ab );
#else
        dequant_beta( nParBand, parBandStart, quant_type, alphaQEnv, parQ, ab );
#endif
    }

    return;
Loading