Commit 0bac2e81 authored by vaclav's avatar vaclav
Browse files

fix FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES_VE

parent 94b76557
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1104,12 +1104,17 @@ enum
#define MAX_NO_VALS                         4
#define WB_LIMIT_LSF                        6350
#define CNG_LVQ_MODES                       16
#ifdef FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES_VE
#define MAX_NO_MODES                        169
#define START_CNG                           MAX_NO_MODES - CNG_LVQ_MODES
#else
#define MAX_NO_MODES_IVAS                   169
#define MAX_NO_MODES                        128
#define START_CNG_IVAS                      MAX_NO_MODES_IVAS - CNG_LVQ_MODES
#define START_CNG                           112
#define MAX_NO_MODES_p_IVAS                 237
#define MAX_NO_MODES_p                      145
#endif
#define NO_CODING_MODES                     6
#define LVQ_COD_MODES                       18

+7 −8
Original line number Diff line number Diff line
@@ -29,8 +29,7 @@ static void decode_leaders_fx( Word16 index, const Word16 idx_lead, Word16 *cv )
static void idx2c_fx( Word16 n, Word16 *p, const Word16 k, Word16 val );
static void divide_64_32_fx( Word16 *xs, Word32 y, Word32 *result, Word32 *rem );
#ifdef FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES
Word16 decode_indexes_fx( Word16 *index, Word16 no_bits, const Word16 *p_scales, Word16 *x_lvq, Word16 mode_glb, Word16 *scales_mslvq, Word16 prediction_flag );

static Word16 decode_indexes_fx( Word16 *index, const Word16 no_bits, const Word16 *p_scales, Word16 *x_lvq, const Word16 mode_glb, Word16 *scales_mslvq, const Word16 prediction_flag );
#else
static Word16 decode_indexes_fx( Word16 *index, Word16 no_bits, const Word16 *p_scales, Word16 *p_no_scales, Word32 *p_offset_scale1, Word32 *p_offset_scale2, Word16 *x_lvq, Word16 mode_glb, Word16 *scales );
static Word16 decode_indexes_ivas_fx( Word16 *index, const Word16 no_bits, const Word16 *p_scales, const Word16 prediction_flag, Word16 *x_lvq, const Word16 mode_glb, Word16 *scales_mslvq );
@@ -284,14 +283,14 @@ void init_offset_fx(
 *
 *-----------------------------------------------------------------*/

Word16 decode_indexes_fx(
static Word16 decode_indexes_fx(
    Word16 *index,
    Word16 no_bits,
    const Word16 no_bits,
    const Word16 *p_scales,
    Word16 *x_lvq,
    Word16 mode_glb,
    const Word16 mode_glb,
    Word16 *scales_mslvq,
    Word16 prediction_flag )
    const Word16 prediction_flag )
{
    Word32 index1 = 0, index2 = 0;
    Word16 i, im1 = 0, idx_scale = 0;
@@ -329,12 +328,12 @@ Word16 decode_indexes_fx(
        }
    }

    create_offset_fx( (UWord32 *) offset_scale1, (UWord32 *) offset_scale2, mode_glb, prediction_flag );
    create_offset_fx( offset_scale1, offset_scale2, mode_glb, prediction_flag );
    
    /* Divide using second subvector's max scale index */
    IF( offset_scale2[MAX_NO_SCALES - 1] > 0 )
    {
        divide_64_32_fx( index, (Word32) offset_scale2[MAX_NO_SCALES], &index1, &index2 );
        divide_64_32_fx( index, offset_scale2[MAX_NO_SCALES], &index1, &index2 );
    }
    ELSE
    {
+1 −0
Original line number Diff line number Diff line
@@ -120,6 +120,7 @@
#define FIX_1576_LCLD_CRASH_DIFFERENT_CODEC_ISAR_FRAME_SIZE  /* Dolby: float issue 1576: fix for crash in LCLD mode when codec frame size is less than isar frame size */
#define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW     /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */
#define FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES   /* Nokia: basop issue 2492: remove duplicates for decode_indexes() unify the use of offset scales between IVAS and EVS, which also allows to remove some duplicated tables and parameters */
#define FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES_VE
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
#define NONBE_FIX_ISSUE_2206_MDCT_STEREO_FIX_2549       /* FhG: Correct scale inconsistency of old_inp_16k_fx buffer scale. */
#define FIX_BASOP_2548_ProcessIGF_fx_PREDICTIONGAIN     /* FhG: fixes obvious bug for IVAS path. For EVS path, issue is still not resolved */
+2 −0
Original line number Diff line number Diff line
@@ -74,9 +74,11 @@ void CNG_dec_fx(

    m = 0;
    move16();

    /*-----------------------------------------------------------------*
     * Decode CNG spectral envelope (only in SID frame)
     *-----------------------------------------------------------------*/

    test();
    IF( EQ_32( st_fx->core_brate, SID_1k75 ) || EQ_32( st_fx->core_brate, SID_2k40 ) )
    {
+14 −13
Original line number Diff line number Diff line
@@ -215,12 +215,11 @@ void lsf_dec_fx(
    }

    /* LSF de-quantization */
    lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc,
                    tdm_lsfQ_PCh );
    lsf_end_dec_fx( st_fx, 0, coder_type, st_fx->bwidth, nBits, lsf_new, param_lpc, LSF_Q_prediction, &no_param_lpc, tdm_lsfQ_PCh );

    /* convert quantized LSFs to LSPs */

    lsf2lsp_fx( lsf_new, lsp_new, M, st_fx->sr_core );

    /* set seed_acelp used in UC mode */
    test();
    IF( EQ_16( coder_type, UNVOICED ) && GT_16( st_fx->element_mode, EVS_MONO ) )
@@ -234,6 +233,7 @@ void lsf_dec_fx(
            move16();
        }
    }

    IF( EQ_32( st_fx->core_brate, SID_2k40 ) )
    {
        /* return if SID frame (conversion to A(z) done in the calling function) */
@@ -430,13 +430,12 @@ void lsf_end_dec_fx(
    const Word16 *Bit_alloc1 = NULL, *bits;
    Word16 num_bits;
    Word16 *p_lpc_param;

    Word16 nBits;

    Word16 coder_type;
    Word16 ber_flag;
    Word16 flag_1bit_gran;
    Word16 pred3[M];

    flag_1bit_gran = (Word16) ( st->element_mode > EVS_MONO ); /* Q0 */

    nBits = nBits_in; /* Q0 */
@@ -478,19 +477,19 @@ void lsf_end_dec_fx(
        return;
    }


    find_pred_mode( &predmode, coder_type, bwidth, st->sr_core, &mode_lvq, &mode_lvq_p, st->total_brate );

    /*----------------------------------------------------------------*
     * Calculate number of stages and levels for each stage based on the allowed bit allocation
     * (subtract one bit for LSF predictor selection)
     *----------------------------------------------------------------*/
    lsf_allocate_fx( sub( nBits, shr( predmode, 1 ) ), mode_lvq, mode_lvq_p, &stages0, &stages1, levels0, levels1,
                     bits0, bits1 );

    lsf_allocate_fx( sub( nBits, shr( predmode, 1 ) ), mode_lvq, mode_lvq_p, &stages0, &stages1, levels0, levels1, bits0, bits1 );

    /*--------------------------------------------------------------------------*
     * Select safety_net or predictive mode
     *--------------------------------------------------------------------------*/

    test();
    test();
    IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL )
@@ -499,10 +498,10 @@ void lsf_end_dec_fx(
        /*predmode += 3;*/
        predmode = add( predmode, 3 ); /* Q0 */
    }
    p_lpc_param = lpc_param; /* Q0 */


    p_lpc_param = lpc_param; /* Q0 */
    move16();

    IF( predmode == 0 )
    {
        safety_net = 1; /* Q0 */
@@ -537,8 +536,9 @@ void lsf_end_dec_fx(
    /*--------------------------------------------------------------------------*
     * Read indices from array
     *--------------------------------------------------------------------------*/
    test();

    /* Make sure there are the correct bit allocations */
    test();
    IF( EQ_16( st->idchan, 1 ) && GT_16( predmode, 2 ) )
    {
        /* use same AR prediction bit allocation  for intra and inter modes*/
@@ -711,20 +711,22 @@ void lsf_end_dec_fx(
    }
    ELSE
    {

        /* Safety-net */
        Copy( ModeMeans_fx[mode_lvq], pred0, M ); /* Q2.56 */
        
        /* for mem_MA update */
        FOR( i = 0; i < M; i++ )
        {
            pred1[i] = add( pred0[i], mult_r( MU_MA_FX, st->mem_MA_fx[i] ) ); /* Q2.56 */
            move16();
        }

        /* TD stereo SCh: perform intra-frame prediction with pulling-to-mean */
        IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL )
        {
            tdm_SCh_LSF_intra_pred_fx( st->element_brate, tdm_lsfQ_PCh, pred3 );
        }

        IF( safety_net )
        {
            /* LVQ */
@@ -732,7 +734,6 @@ void lsf_end_dec_fx(
            test();
            IF( st->tdm_LRTD_flag == 0 && EQ_16( st->idchan, 1 ) && tdm_lsfQ_PCh != NULL )
            {

                /* intra mode*/
#ifdef FIX_2492_REMOVE_DUPLICATES_FOR_DECODE_INDEXES
                st->BER_detect = s_or( st->BER_detect,
Loading