Commit d2b95b64 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'opt_binaural_rend' into 'main'

Binaural renderer optimization - non bit exact changes

See merge request !1913
parents 9773847c 6b8a3beb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@
/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V3_NBE
#define OPT_MCT_ENC_V2_BE
#define OPT_BIN_REND_V2_NBE
#define OPT_MCH_DEC_V1_NBE
#define OPT_MASA_DEC_V1_NBE
#define OPT_MASA_DEC_V2_NBE
+384 −338
Original line number Diff line number Diff line
@@ -72,12 +72,17 @@ static void ivas_binRenderer_filterModule_fx(
    Q_filterStates = hBinRenderer->hBinRenConvModule->Q_filterStatesLeft;
    move16();

    // to be checked: feasibility with 32 bit buffers
#ifdef OPT_BIN_REND_V2_NBE
    shift_q = add( sub( Q_filterStates, Q_curr ), 1 );
    hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr;
#else  /* OPT_BIN_REND_V2_NBE */
    Word64 Cldfb_RealBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES];
    Word64 Cldfb_ImagBuffer_64fx[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES];
#endif /* OPT_BIN_REND_V2_NBE */

    FOR( bandIdx = 0; bandIdx < hBinRenderer->conv_band; bandIdx++ )
    {
#ifndef OPT_BIN_REND_V2_NBE
        set64_fx( &Cldfb_RealBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES );
        set64_fx( &Cldfb_ImagBuffer_64fx[0][0], 0, BINAURAL_CHANNELS * MAX_PARAM_SPATIAL_SUBFRAMES );

@@ -91,6 +96,7 @@ static void ivas_binRenderer_filterModule_fx(
            filterTapsRightRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx]; // Q29
            filterTapsRightImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx]; // Q29

#endif /* OPT_BIN_REND_V2_NBE */
            FOR( k = 0; k < numTimeSlots; k++ )
            {
                Word64 outRealLeft_fx = 0, outRealRight_fx = 0, outImagLeft_fx = 0, outImagRight_fx = 0;
@@ -98,6 +104,23 @@ static void ivas_binRenderer_filterModule_fx(
                move64();
                move64();
                move64();
#ifdef OPT_BIN_REND_V2_NBE
                Word64 outRealLeft = 0, outRealRight = 0, outImagLeft = 0, outImagRight = 0;
                move64();
                move64();
                move64();
                move64();

                FOR( chIdx = 0; chIdx < hBinRenderer->nInChannels; chIdx++ )
                {
                    filterStatesLeftRealPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftReal_fx[bandIdx][chIdx][0] );
                    filterStatesLeftImagPtr_fx = (Word32 *) &( hBinRenderer->hBinRenConvModule->filterStatesLeftImag_fx[bandIdx][chIdx][0] );

                    filterTapsLeftRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftReal_fx[bandIdx][chIdx];   // Q29
                    filterTapsLeftImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsLeftImag_fx[bandIdx][chIdx];   // Q29
                    filterTapsRightRealPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightReal_fx[bandIdx][chIdx]; // Q29
                    filterTapsRightImagPtr_fx = hBinRenderer->hBinRenConvModule->filterTapsRightImag_fx[bandIdx][chIdx]; // Q29
#endif                                                                                                                   /* OPT_BIN_REND_V2_NBE */

                    FOR( tapIdx = hBinRenderer->hBinRenConvModule->numTapsArray[bandIdx] - 1; tapIdx > 0; tapIdx-- )
                    {
@@ -121,6 +144,7 @@ static void ivas_binRenderer_filterModule_fx(
                        outImagRight_fx = W_mac_32_32( outImagRight_fx, filterStatesLeftImagPtr_fx[tapIdx], filterTapsRightRealPtr_fx[tapIdx] ); // Q30 + Q_filterStates
                    }

#ifndef OPT_BIN_REND_V2_NBE
                    shift_q = add( sub( Q_filterStates, Q_curr ), 1 );

                    IF( shift_q != 0 )
@@ -132,13 +156,34 @@ static void ivas_binRenderer_filterModule_fx(
                        hBinRenderer->hBinRenConvModule->Q_filterStatesLeft = Q_curr;
                        move16();
                    }

#endif /* OPT_BIN_REND_V2_NBE */
                    filterStatesLeftRealPtr_fx[0] = CLDFB_real[chIdx][k][bandIdx];
                    move32();
                    filterStatesLeftImagPtr_fx[0] = CLDFB_imag[chIdx][k][bandIdx];
                    move32();


#ifdef OPT_BIN_REND_V2_NBE
                    /* Left Real and Imag */
                    Word32 neg_temp2 = L_negate( filterStatesLeftImagPtr_fx[0] ); // Q_curr -1

                    outRealLeft = W_mac_32_32( W_mac_32_32( outRealLeft, filterStatesLeftRealPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), neg_temp2, filterTapsLeftImagPtr_fx[0] );
                    outImagLeft = W_mac_32_32( W_mac_32_32( outImagLeft, filterStatesLeftImagPtr_fx[0], filterTapsLeftRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsLeftImagPtr_fx[0] );

                    /* Right Real and Imag */
                    outRealRight = W_mac_32_32( W_mac_32_32( outRealRight, neg_temp2, filterTapsRightImagPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsRightRealPtr_fx[0] );
                    outImagRight = W_mac_32_32( W_mac_32_32( outImagRight, filterStatesLeftImagPtr_fx[0], filterTapsRightRealPtr_fx[0] ), filterStatesLeftRealPtr_fx[0], filterTapsRightImagPtr_fx[0] );
                }
                out_Conv_CLDFB_real[0][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outRealLeft_fx, shift_q ), W_shr( outRealLeft, 1 ) ), shift_q6 );
                out_Conv_CLDFB_real[1][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outRealRight_fx, shift_q ), W_shr( outRealRight, 1 ) ), shift_q6 );
                out_Conv_CLDFB_imag[0][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outImagLeft_fx, shift_q ), W_shr( outImagLeft, 1 ) ), shift_q6 );
                out_Conv_CLDFB_imag[1][k][bandIdx] = W_shl_sat_l( W_add( W_shr( outImagRight_fx, shift_q ), W_shr( outImagRight, 1 ) ), shift_q6 );
                move32();
                move32();
                move32();
                move32();
            }
#else  /* OPT_BIN_REND_V2_NBE */
            /* Left Real and Imag */

            Word32 temp1 = L_shr( filterStatesLeftRealPtr_fx[0], 1 ); // Q_curr -1
@@ -178,6 +223,7 @@ static void ivas_binRenderer_filterModule_fx(
            move32();
        }
    }
#endif /* OPT_BIN_REND_V2_NBE */
        }