Commit 822202b5 authored by Jan Kiene's avatar Jan Kiene
Browse files

fix compilation

warnings still todo
parent 88f16007
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1859,11 +1859,7 @@ static void isar_rend_CldfbSplitPostRendProcessTdIn(
        Q_cldfb = add( scaleFactor, Q_in );
#endif
        Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) );
#ifdef OPT_AVOID_STATE_BUF_RESCALE
        cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1
#else
        cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1
#endif
        Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) );
        Q_out[ch_idx] = sub( Q_cldfb, 1 );
    }
@@ -1927,11 +1923,7 @@ void isar_rend_CldfbSplitPostRendProcess(
        }
        Q_cldfb = scaleFactor + Q_cldfb_in;
        Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) );
#ifdef OPT_AVOID_STATE_BUF_RESCALE
        cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1
#else
        cldfbSynthesis_ivas_fx( RealBuffer_fx, ImagBuffer_fx, &( output_fx[ch_idx][0] ), num_cldfb_bands * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, 0, hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1
#endif
        Scale_sig32( hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) );
        Q_out[ch_idx] = sub( Q_cldfb, 1 );
    }
+0 −9
Original line number Diff line number Diff line
@@ -1513,7 +1513,6 @@ static ivas_error renderSplitBinauralWithPostRot(
                    }
                    Q_cldfb = scaleFactor + Q_cldfb_final[sf_idx];
                    Scale_sig32( hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( sub( Q_cldfb, 1 ), Q11 ) );
#ifdef OPT_AVOID_STATE_BUF_RESCALE
                    cldfbSynthesis_ivas_fx( RealBuffer_fx,
                                            ImagBuffer_fx,
                                            &( tmpCrendBuffer_fx[ch_idx][sf_idx * outBufNumSamplesPerChannel] ),
@@ -1521,14 +1520,6 @@ static ivas_error renderSplitBinauralWithPostRot(
                                            0,
                                            0,
                                            hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1
#else
                    cldfbSynthesis_ivas_fx( RealBuffer_fx,
                                            ImagBuffer_fx,
                                            &( tmpCrendBuffer_fx[ch_idx][sf_idx * outBufNumSamplesPerChannel] ),
                                            hSplitBin->hBinHrSplitPostRend->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES,
                                            0,
                                            hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx] ); // Q_cldfb - 1
#endif
                    Scale_sig32( hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->cldfb_state_fx, hSplitBin->hBinHrSplitPostRend->cldfbSyn[ch_idx]->p_filter_length, sub( Q11, sub( Q_cldfb, 1 ) ) );
                    Q_out[sf_idx][ch_idx] = sub( Q_cldfb, 1 );
                }
+0 −8
Original line number Diff line number Diff line
@@ -474,11 +474,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural(
                Q_cldfb = q_final;
                move16();
                Scale_sig32( hSplitBin->hCldfbHandles->cldfbSyn[ch]->cldfb_state_fx, hSplitBin->hCldfbHandles->cldfbSyn[ch]->p_filter_length, sub( sub( Q_cldfb, 1 ), hSplitBin->hCldfbHandles->cldfbSyn[ch]->Q_cldfb_state ) );
#ifdef OPT_AVOID_STATE_BUF_RESCALE
                cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, 0, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1
#else
                cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * num_slots, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] );    // Q_cldfb - 1
#endif
                Q_out[ch] = sub( Q_cldfb, 1 );
                move16();
                hSplitBin->hCldfbHandles->cldfbSyn[ch]->Q_cldfb_state = Q_out[ch];
@@ -531,11 +527,7 @@ ivas_error ISAR_PRE_REND_MultiBinToSplitBinaural(
            Q_cldfb = q_final;
            move16();
            Scale_sig32( hSplitBin->hCldfbHandles->cldfbSyn[ch]->cldfb_state_fx, hSplitBin->hCldfbHandles->cldfbSyn[ch]->p_filter_length, sub( sub( Q_cldfb, 1 ), hSplitBin->hCldfbHandles->cldfbSyn[ch]->Q_cldfb_state ) );
#ifdef OPT_AVOID_STATE_BUF_RESCALE
            cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, 0, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1
#else
            cldfbSynthesis_ivas_fx( Cldfb_In_BinReal_p_fx, Cldfb_In_BinImag_p_fx, pOutput_fx[ch], hSplitBin->hCldfbHandles->cldfbSyn[0]->no_channels * CLDFB_NO_COL_MAX, 0, hSplitBin->hCldfbHandles->cldfbSyn[ch] ); // Q_cldfb - 1
#endif
            Q_out[ch] = sub( Q_cldfb, 1 );
            move16();
            hSplitBin->hCldfbHandles->cldfbSyn[ch]->Q_cldfb_state = Q_out[ch];
+2508 −2513
Original line number Diff line number Diff line
@@ -2748,8 +2748,6 @@ static void ivas_dirac_dec_binaural_process_output_fx(

    // scaling input and reverb to same q//
    // input scaling is to maintain precision in ivas_dirac_dec_decorrelate_slot fn//
    Word16 shift = s_min( L_norm_arr( cldfbSynDec[0]->cldfb_state_fx, cldfbSynDec[0]->p_filter_length ), L_norm_arr( cldfbSynDec[1]->cldfb_state_fx, cldfbSynDec[1]->p_filter_length ) );
    q_inp_mix = 31;
    move16();
    FOR( Word16 i = 0; i < ch_len; i++ )
    {
@@ -2984,11 +2982,7 @@ static void ivas_dirac_dec_binaural_process_output_fx(
                if ( recompute == 1 )
                {
                    /* Inverse filter bank */
#ifdef OPT_AVOID_STATE_BUF_RESCALE
                    cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, 0, cldfbSynDec[chA] );
#else
                    cldfbSynthesis_ivas_fx( &outSlotRePr_fx, &outSlotImPr_fx, &( output_fx[chA][nBins * slot + offsetSamples] ), nBins, 0, cldfbSynDec[chA] );
#endif
                    cldfbSynDec[chA]->Q_cldfb_state = sub( q_result, 1 );
                    move16();
                }
@@ -3002,6 +2996,7 @@ static void ivas_dirac_dec_binaural_process_output_fx(

        return;
    }
}


static void adaptTransportSignalsHeadtracked_fx(
+409 −704
Original line number Diff line number Diff line
@@ -3057,289 +3057,6 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx(
}


/*-------------------------------------------------------------------------
 * ivas_dirac_dec_get_response_split_order()
 *
 * calculate reponse, 1 degree resolution
 *------------------------------------------------------------------------*/

static void ivas_dirac_dec_get_response_split_order_fx(
    const Word16 azimuth,   /*q0*/
    const Word16 elevation, /*q0*/
    Word32 *response,       /*q_response*/
    const Word16 shd_rot_max_order,
    const Word32 *p_Rmat /* Q30 */,
    Word16 *q_response )
{
    Word16 index_azimuth, index_elevation;
    Word16 el, e, az;
    Word32 cos_1, cos_2, sin_1, cos_az[3];
    Word32 sin_az[3];
    Word32 f, c;
    Word16 l, m;
    Word16 b, b1, b_2, b1_2, a;
    Word32 dv_0, dv_1, dv_2, dv_r_0, dv_r_1, dv_r_2;
    Word32 w;
    Word16 tmp;
    Word32 temp;
    Word16 exp;

    push_wmops( "ivas_dirac_dec_get_response_split_order" );

    /* Corner case for handling crash in idiv1616 when numerator is 0 */
    IF( EQ_16( azimuth, -180 ) )
    {
        tmp = 0;
        move16();
    }
    ELSE
    {
        tmp = mult( add( azimuth, 180 ), ONE_BY_360_Q15 ); /* idiv1616( add( azimuth, 180 ), 360 ) */
    }
    index_azimuth = sub( add( azimuth, 180 ), i_mult( tmp, 360 ) ); // index_azimuth = (azimuth + 180) % 360
    index_elevation = add( elevation, 90 );

    IF( GT_16( index_elevation, 90 ) )
    {
        e = -ONE_IN_Q14; /*-1 in Q14*/
        move16();
        el = sub( 180, index_elevation );
    }
    ELSE
    {
        e = ONE_IN_Q14; /*1 in Q14*/
        move16();
        el = index_elevation;
        move16();
    }

    IF( GT_16( index_azimuth, 180 ) )
    {
        az = sub( 360, index_azimuth );
        f = -ONE_IN_Q30; /*-1 Q30*/
        move32();
    }
    ELSE
    {
        az = index_azimuth;
        move16();
        f = ONE_IN_Q30; /*1 Q30*/
        move32();
    }

    // dirac_gains_trg_term_int Q30
    cos_1 = L_shr( dirac_gains_trg_term_int[az][0], 1 );     // Q29
    cos_2 = L_shl( Mpy_32_32( cos_1, cos_1 ), 2 );           // Q29
    sin_1 = Mpy_32_32( f, dirac_gains_trg_term_int[az][1] ); // Q29

    cos_az[0] = cos_1; // Q29
    move32();
    cos_az[1] = L_shl( L_sub( Mpy_32_32( TWO_IN_Q29, cos_2 ), ONE_IN_Q27 ), 2 ); // Q29
    move32();
    cos_az[2] = L_sub( L_shl( Mpy_32_32( Mpy_32_32( TWO_IN_Q29, cos_1 ), cos_az[1] ), 4 ), cos_az[0] ); // Q29
    move32();

    sin_az[0] = sin_1; // Q29
    move32();
    sin_az[1] = L_shl( Mpy_32_32( Mpy_32_32( sin_1, TWO_IN_Q29 ), cos_1 ), 4 ); // Q29
    move32();
    sin_az[2] = L_shl( Mpy_32_32( sin_1, L_sub( Mpy_32_32( FOUR_IN_Q28, cos_2 ), ONE_IN_Q26 ) ), 5 ); // Q29
    move32();

    response[0] = ONE_IN_Q29;
    move32();

    FOR( l = 1; l <= shd_rot_max_order; l++ )
    {
        b_2 = i_mult( l, l );
        b1_2 = add( b_2, i_mult( 2, l ) );
        FOR( m = 0; m < l; m += 2 )
        {
            b = add( b_2, m );
            a = dirac_gains_P_idx[b];
            move16();

            c = Mpy_32_32( Mpy_32_32( SQRT2_FIXED, dirac_gains_norm_term_int[a] ), dirac_gains_Pnm_int[el][a] ); // Q25

            response[b] = L_shl( Mpy_32_32( c, sin_az[l - m - 1] ), 6 ); // Q29
            move32();

            b1 = sub( b1_2, m );
            response[b1] = L_shl( Mpy_32_32( c, cos_az[l - m - 1] ), 6 ); // Q29
            move32();
        }

        FOR( m = 1; m < l; m += 2 )
        {
            b = add( b_2, m );
            a = dirac_gains_P_idx[b];
            move16();

            c = Mpy_32_32( Mpy_32_32( SQRT2_FIXED, dirac_gains_norm_term_int[a] ), dirac_gains_Pnm_int[el][a] ); // Q25
            c = Mpy_32_16_1( c, e );                                                                             // Q24

            response[b] = L_shl( Mpy_32_32( c, sin_az[l - m - 1] ), 7 ); // Q29
            move32();

            b1 = sub( b1_2, m );
            response[b1] = L_shl( Mpy_32_32( c, cos_az[l - m - 1] ), 7 ); // Q29
            move32();
        }

        b = add( b_2, l );
        a = dirac_gains_P_idx[b];
        move16();

        c = L_shl( Mpy_32_32( dirac_gains_norm_term_int[a], dirac_gains_Pnm_int[el][a] ), 3 ); // Q29
        IF( EQ_16( l % 2, 1 ) )
        {
            c = L_shl( Mpy_32_16_1( c, e ), 1 ); // Q29
        }

        response[b] = c; // Q29
        move32();
    }

    /*Conversion spherical to cartesian coordinates*/
    w = L_negate( dirac_gains_trg_term_int[el][1] );                      // Q30
    dv_0 = Mpy_32_32( w, cos_1 );                                         // Q28
    dv_1 = Mpy_32_32( w, sin_1 );                                         // Q28
    dv_2 = L_shr( Mpy_32_16_1( dirac_gains_trg_term_int[el][0], e ), 1 ); // Q28

    /*Rotation mtx multiplication*/
    dv_r_0 = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr( p_Rmat[0], Q1 ), dv_0 ), L_shr( p_Rmat[1], Q1 ), dv_1 ), L_shr( p_Rmat[2], Q1 ), dv_2 ); // Q26
    dv_r_1 = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr( p_Rmat[3], Q1 ), dv_0 ), L_shr( p_Rmat[4], Q1 ), dv_1 ), L_shr( p_Rmat[5], Q1 ), dv_2 ); // Q26
    dv_r_2 = Madd_32_32( Madd_32_32( Mpy_32_32( L_shr( p_Rmat[6], Q1 ), dv_0 ), L_shr( p_Rmat[7], Q1 ), dv_1 ), L_shr( p_Rmat[8], Q1 ), dv_2 ); // Q26

    tmp = BASOP_util_atan2( dv_r_1, dv_r_0, 0 );            // Q13
    index_azimuth = shr( mult( tmp, _180_OVER_PI_Q9 ), 7 ); // Q0;
    IF( EQ_16( index_azimuth, -180 ) )
    {
        tmp = 0;
        move16();
    }
    ELSE
    {
        tmp = mult( add( index_azimuth, 180 ), ONE_BY_360_Q15 );
    }
    index_azimuth = sub( add( index_azimuth, 180 ), i_mult( tmp, 360 ) ); // index_azimuth = (index_azimuth + 180) % 360

    temp = L_add( Mpy_32_32( dv_r_0, dv_r_0 ), Mpy_32_32( dv_r_1, dv_r_1 ) ); // Q21
    exp = sub( 31, Q21 );
    temp = Sqrt32( temp, &exp );

    tmp = BASOP_util_atan2( dv_r_2, temp, sub( sub( 31, Q26 ), exp ) ); // Q13
    index_elevation = shr( mult( tmp, _180_OVER_PI_Q9 ), Q7 );          // Q0
    index_elevation = add( index_elevation, 90 );

    IF( GT_16( index_elevation, 90 ) )
    {
        e = -ONE_IN_Q14; /*-1 Q14*/
        move16();
        el = sub( 180, index_elevation );
    }
    ELSE
    {
        e = ONE_IN_Q14; /*1 Q14*/
        move16();
        el = index_elevation;
        move16();
    }

    IF( GT_16( index_azimuth, 180 ) )
    {
        az = sub( 360, index_azimuth );
        f = -ONE_IN_Q30; /*-1 Q30*/
        move32();
    }
    ELSE
    {
        az = index_azimuth;
        move16();
        f = ONE_IN_Q30; /*1 Q30*/
        move32();
    }

    // dirac_gains_trg_term_int Q30
    cos_1 = L_shr( dirac_gains_trg_term_int[az][0], 1 );     // Q29
    cos_2 = L_shl( Mpy_32_32( cos_1, cos_1 ), 2 );           // Q29
    sin_1 = Mpy_32_32( f, dirac_gains_trg_term_int[az][1] ); // Q29

    cos_az[0] = cos_1; // Q29
    move32();
    cos_az[1] = L_shl( L_sub( Mpy_32_32( TWO_IN_Q29, cos_2 ), ONE_IN_Q27 ), 2 ); // Q29
    move32();
    cos_az[2] = L_sub( L_shl( Mpy_32_32( Mpy_32_32( TWO_IN_Q29, cos_1 ), cos_az[1] ), 4 ), cos_az[0] ); // Q29
    move32();

    sin_az[0] = sin_1; // Q29
    move32();
    sin_az[1] = L_shl( Mpy_32_32( Mpy_32_32( sin_1, TWO_IN_Q29 ), cos_1 ), 4 ); // Q29
    move32();
    sin_az[2] = L_shl( Mpy_32_32( sin_1, L_sub( Mpy_32_32( FOUR_IN_Q28, cos_2 ), ONE_IN_Q26 ) ), 5 ); // Q29
    move32();

    FOR( l = shd_rot_max_order + 1; l <= 3; l++ )
    {
        b_2 = i_mult( l, l );
        b1_2 = add( b_2, i_mult( 2, l ) );

        FOR( m = 0; m < l; m += 2 )
        {
            b = add( b_2, m );
            a = dirac_gains_P_idx[b];
            move16();

            c = Mpy_32_32( Mpy_32_32( SQRT2_FIXED, dirac_gains_norm_term_int[a] ), dirac_gains_Pnm_int[el][a] ); // Q25

            response[b] = L_shl( Mpy_32_32( c, sin_az[l - m - 1] ), 6 ); // Q29
            move32();

            b1 = sub( b1_2, m );
            response[b1] = L_shl( Mpy_32_32( c, cos_az[l - m - 1] ), 6 ); // Q29
            move32();
        }

        FOR( m = 1; m < l; m += 2 )
        {
            b = add( b_2, m );
            a = dirac_gains_P_idx[b];
            move16();

            c = Mpy_32_32( Mpy_32_32( SQRT2_FIXED, dirac_gains_norm_term_int[a] ), dirac_gains_Pnm_int[el][a] ); // Q25
            c = Mpy_32_16_1( c, e );                                                                             // Q24

            response[b] = L_shl( Mpy_32_32( c, sin_az[l - m - 1] ), 7 ); // Q29
            move32();

            b1 = sub( b1_2, m );
            response[b1] = L_shl( Mpy_32_32( c, cos_az[l - m - 1] ), 7 ); // Q29
            move32();
        }

        b = add( b_2, l );
        a = dirac_gains_P_idx[b];
        move16();

        c = L_shl( Mpy_32_32( dirac_gains_norm_term_int[a], dirac_gains_Pnm_int[el][a] ), 3 ); // Q29

        IF( EQ_16( l % 2, 1 ) )
        {
            c = L_shl( Mpy_32_16_1( c, e ), 1 ); // Q29
        }

        response[b] = c; // Q29
        move32();
    }

    *q_response = Q29;
    move16();

    pop_wmops();

    return;
}

/*-------------------------------------------------------------------------
 * ivas_dirac_dec_compute_directional_responses()
 *
@@ -3470,24 +3187,11 @@ void ivas_dirac_dec_compute_directional_responses_fx(
                exp_direct_response_dir2 = 0;
                move16();

                IF( p_Rmat != 0 )
                {
                    ivas_dirac_dec_get_response_split_order_fx( azimuth[k], elevation[k], direct_response_hoa_fx, shd_rot_max_order, p_Rmat, &Q_direct_response_hoa );

                    IF( hodirac_flag )
                    {
                        ivas_dirac_dec_get_response_split_order_fx( azimuth2[k], elevation2[k], direct_response_dir2_fx, shd_rot_max_order, p_Rmat, &Q_direct_response_dir2 );
                    }
                }
                ELSE
                {
                ivas_dirac_dec_get_response_fx_29( azimuth[k], elevation[k], direct_response_hoa_fx, hDirACRend->hOutSetup.ambisonics_order );

                IF( hodirac_flag )
                {
                    ivas_dirac_dec_get_response_fx_29( azimuth2[k], elevation2[k], direct_response_dir2_fx, hDirACRend->hOutSetup.ambisonics_order );
                    }
                }

                    test();
                    test();
@@ -4025,6 +3729,7 @@ void ivas_dirac_dec_compute_directional_responses_fx(

        return;
    }
}


/*-------------------------------------------------------------------------
Loading