Commit 923553f9 authored by multrus's avatar multrus
Browse files

[cleanup] accept NONBE_FIX_991_PARAMBIN_BINARY_HRTF

parent c2409ea9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@

/* #################### Start BASOP porting switches ############################ */

#define NONBE_FIX_991_PARAMBIN_BINARY_HRTF              /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */
#define FIX_1050_EFAP_ALLOC                             /* FhG: issue 1050: reduction of memory allocated to EFAP handle */
#define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS            /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */
#define NONBE_FIX_1070_USAN_SEGFAULT_MC_TO_BIN_BTSW_HEADROT   /* fix 1070 USAN: nullptr-with-offset and Segfaults in 7_1_4 to BINAURAL and BINAURAL_ROOM_REVERB decoding with bitrate switching and head rotation*/
+0 −4
Original line number Diff line number Diff line
@@ -1142,11 +1142,7 @@ ivas_error ivas_dirac_dec_config_fx(

            IF( st_ivas->hDiracDecBin[0] == NULL )
            {
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
                IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
#else
                IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
#endif
                {
                    return error;
                }
+0 −4
Original line number Diff line number Diff line
@@ -2676,11 +2676,7 @@ ivas_error ivas_init_decoder_fx(
            }
        }

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
        IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
#else
        IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
#endif
        {
            return error;
        }
+0 −8
Original line number Diff line number Diff line
@@ -261,11 +261,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
                return error;
            }

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
#endif
            {
                return error;
            }
@@ -292,11 +288,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(
                return error;
            }

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, &( st_ivas->hHrtfParambin ) ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = ivas_dirac_dec_init_binaural_data_fx( st_ivas, st_ivas->hHrtfParambin ) ), IVAS_ERR_OK ) )
#endif
            {
                return error;
            }
+0 −72
Original line number Diff line number Diff line
@@ -120,17 +120,9 @@ static void adaptTransportSignalsHeadtracked_fx( COMBINED_ORIENTATION_HANDLE hHe

static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked_fx( COMBINED_ORIENTATION_HANDLE hHeadTrackData, Word32 inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], Word32 inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const Word16 nBins, const Word16 nSlots, Word32 Rmat[3][3] /*Q30*/ );

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, const Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 useCachedValue, HRTFS_PARAMBIN_HANDLE hHrtfParambin );
#else
static void hrtfShGetHrtf_fx( const Word16 bin, const Word16 aziDeg, const Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 useCachedValue );
#endif

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
static void getDirectPartGains_fx( const Word16 bin, Word16 aziDeg, Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3] /*Q30*/, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 isHeadtracked, HRTFS_PARAMBIN_HANDLE hHrtfParambin );
#else
static void getDirectPartGains_fx( const Word16 bin, Word16 aziDeg, Word16 eleDeg, Word32 *lRealp, Word32 *lImagp, Word32 *rRealp, Word32 *rImagp, const UWord8 renderStereoOutputInsteadOfBinaural, Word32 Rmat[3][3] /*Q30*/, PARAMBIN_HRTF_GAIN_CACHE *gainCache, const Word16 isHeadtracked );
#endif

static void ivas_masa_ext_rend_parambin_internal_fx( MASA_EXT_REND_HANDLE hMasaExtRend, COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, Word32 *output_fx[] /*Q11*/, const Word16 subframe, const SPLIT_REND_WRAPPER *hSplitRendWrapper, Word32 Cldfb_Out_Real[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], Word32 Cldfb_Out_Imag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX] );

@@ -160,11 +152,7 @@ static void matrixTransp2Mul_fx(

ivas_error ivas_dirac_dec_init_binaural_data_fx(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure                  */
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
    HRTFS_PARAMBIN_HANDLE *phHrtfParambin /* i  : HRTF structure for rendering            */
#else
    HRTFS_PARAMBIN_HANDLE hHrtfParambin /* i  : HRTF structure for rendering            */
#endif
)
{
    DIRAC_DEC_BIN_HANDLE hDiracDecBin;
@@ -207,9 +195,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
            hDiracDecBin->hReverb = NULL;
            hDiracDecBin->h_freq_domain_decorr_ap_params = NULL;
            hDiracDecBin->h_freq_domain_decorr_ap_state = NULL;
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            hDiracDecBin->phHrtfParambin = NULL;
#endif
        }

        output_Fs = st_ivas->hDecoderConfig->output_Fs;
@@ -301,7 +287,6 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
        }
        ELSE IF( EQ_32( renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) /* Indication of binaural rendering with room effect */
        {
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
#ifdef NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART
            IF( EQ_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) )
            {
@@ -319,9 +304,6 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
            }
#else
            Copy32( ( *phHrtfParambin )->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins );
#endif
#else
            Copy32( hHrtfParambin->parametricEarlyPartEneCorrection_fx, hDiracDecBin->earlyPartEneCorrection_fx, nBins );
#endif
            hDiracDecBin->q_earlyPartEneCorrection = Q28;
            move16();
@@ -337,7 +319,6 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
            IF( hDiracDecBin->hReverb == NULL && EQ_16( pos_idx, 0 ) ) /* open reverb only for the main direction */
            {

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
#ifdef FIX_587_DEFAULT_REVERB
#ifdef FIX_1139_REV_COLORATION_SHORT_T60
                IF( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, pRoomAcoustics, output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx, hDiracDecBin->earlyPartEneCorrection_fx ) ), IVAS_ERR_OK ) )
@@ -346,9 +327,6 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
#endif
#else
                if ( NE_32( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, ( *phHrtfParambin )->parametricReverberationTimes_fx, ( *phHrtfParambin )->parametricReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) )
#endif
#else
                if ( ( error = ivas_binaural_reverb_init( &hDiracDecBin->hReverb, st_ivas->hHrtfStatistics, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, &( st_ivas->hRenderConfig->roomAcoustics ), output_Fs, st_ivas->hHrtfParambin->parametricReverberationTimes_fx, st_ivas->hHrtfParambin->parametricReverberationEneCorrections_fx ) ) != IVAS_ERR_OK )
#endif
                {
                    return error;
@@ -419,9 +397,7 @@ ivas_error ivas_dirac_dec_init_binaural_data_fx(
        hDiracDecBin->reqularizationFactor_fx = configure_reqularization_factor_fx( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate ); /* Q14 */
        move16();

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
        hDiracDecBin->phHrtfParambin = phHrtfParambin;
#endif

        st_ivas->hDiracDecBin[pos_idx] = hDiracDecBin;
    }
@@ -1796,11 +1772,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx(
                spreadCoh_fx = s_max( spreadCoh_fx, altSpreadCoh_fx );
            }

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex], isHeadtracked, *hDiracDecBin->phHrtfParambin );
#else
            getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex], isHeadtracked );
#endif

            Word16 q_lr = Q28;
            move16();
@@ -1851,11 +1823,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx(
                rImagp_fx = Mpy_32_32( rImagp_fx, centerMul_fx ); // Q25

                /* Apply the gain for the left source of the three coherent sources */
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
                getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked, *hDiracDecBin->phHrtfParambin );
#else
                getDirectPartGains_fx( bin, add( aziDeg, 30 ), eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 1], isHeadtracked );
#endif

                hrtfEneSides_fx = L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ),                     // Q25
                                         L_add( Mpy_32_32( lImagpTmp_fx, lImagpTmp_fx ),              // Q25
@@ -1869,11 +1837,7 @@ static void ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx(
                /* Apply the gain for the right source of the three coherent sources.
                 * -30 degrees to 330 wrapping due to internal functions. */

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
                getDirectPartGains_fx( bin, aziDeg + 330, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 2], isHeadtracked, *hDiracDecBin->phHrtfParambin );
#else
                getDirectPartGains_fx( bin, aziDeg + 330, eleDeg, &lRealpTmp_fx, &lImagpTmp_fx, &rRealpTmp_fx, &rImagpTmp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat_fx, &gainCache[gainCacheBaseIndex + 2], isHeadtracked );
#endif

                hrtfEneSides_fx = L_add( hrtfEneSides_fx,
                                         L_add( Mpy_32_32( lRealpTmp_fx, lRealpTmp_fx ),                       // Q25
@@ -2629,11 +2593,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices_fx(
                q_processMtxPrev_SCCR[bin] = q_processMtx_bin;
                move16();

#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
                getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked, *hDiracDecBin->phHrtfParambin );
#else
                getDirectPartGains_fx( bin, aziDeg, eleDeg, &lRealp_fx, &lImagp_fx, &rRealp_fx, &rImagp_fx, hDiracDecBin->renderStereoOutputInsteadOfBinaural, Rmat, &gainCache[chB], isHeadtracked );
#endif

                hDiracDecBin->processMtxRe_fx[0][chB + 2][bin] = extract_h( Mpy_32_32( lRealp_fx, gainFactor_fx ) );
                move16();
@@ -4875,12 +4835,8 @@ static void getDirectPartGains_fx(
    const UWord8 renderStereoOutputInsteadOfBinaural,
    Word32 Rmat[3][3], /*Q30*/
    PARAMBIN_HRTF_GAIN_CACHE *gainCache,
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
    const Word16 isHeadtracked,
    HRTFS_PARAMBIN_HANDLE hHrtfParambin
#else
    const Word16 isHeadtracked
#endif
)
{
    // float aziRad, eleRad;
@@ -5010,11 +4966,7 @@ static void getDirectPartGains_fx(
        test();
        IF( EQ_16( aziDeg, gainCache->azi ) && EQ_16( eleDeg, gainCache->ele ) )
        {
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE, hHrtfParambin );
#else
            hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, TRUE );
#endif
        }
        ELSE
        {
@@ -5029,11 +4981,7 @@ static void getDirectPartGains_fx(
                                                                              // eleDeg = L_shr(eleDeg_32, 22);
                                                                              // aziDeg = L_shr(aziDeg_32, 22);
            }
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE, hHrtfParambin );
#else
            hrtfShGetHrtf_fx( bin, aziDeg, eleDeg, lRealp, lImagp, rRealp, rImagp, gainCache, FALSE );
#endif
        }
    }

@@ -5049,21 +4997,15 @@ static void hrtfShGetHrtf_fx(
    Word32 *rRealp,
    Word32 *rImagp,
    PARAMBIN_HRTF_GAIN_CACHE *gainCache,
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
    const Word16 useCachedValue,
    HRTFS_PARAMBIN_HANDLE hHrtfParambin
#else
    const Word16 useCachedValue
#endif
)
{
    Word16 k;
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
    Word16( *hrtfShCoeffsReInt_fx )[16][60];
    Word16( *hrtfShCoeffsImInt_fx )[16][60];
    hrtfShCoeffsReInt_fx = hHrtfParambin->hrtfShCoeffsRe_fx;
    hrtfShCoeffsImInt_fx = hHrtfParambin->hrtfShCoeffsIm_fx;
#endif

    *lRealp = 0;
    *lImagp = 0;
@@ -5081,17 +5023,10 @@ static void hrtfShGetHrtf_fx(

        FOR( k = 0; k < HRTF_SH_CHANNELS; k++ )
        {
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsReInt_fx[0][k][bin] ); // Q28
            *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsImInt_fx[0][k][bin] ); // Q28
            *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsReInt_fx[1][k][bin] ); // Q28
            *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsImInt_fx[1][k][bin] ); // Q28
#else
            *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28
            *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28
            *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28
            *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28
#endif
            move32();
            move32();
            move32();
@@ -5110,17 +5045,10 @@ static void hrtfShGetHrtf_fx(

        FOR( k = 0; k < HRTF_SH_CHANNELS; k++ )
        {
#ifdef NONBE_FIX_991_PARAMBIN_BINARY_HRTF
            *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsReInt_fx[0][k][bin] ); // Q28
            *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsImInt_fx[0][k][bin] ); // Q28
            *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsReInt_fx[1][k][bin] ); // Q28
            *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsImInt_fx[1][k][bin] ); // Q28
#else
            *lRealp = Madd_32_16( *lRealp, shVec[k], hrtfShCoeffsRe_fx[0][k][bin] ); // Q28
            *lImagp = Madd_32_16( *lImagp, shVec[k], hrtfShCoeffsIm_fx[0][k][bin] ); // Q28
            *rRealp = Madd_32_16( *rRealp, shVec[k], hrtfShCoeffsRe_fx[1][k][bin] ); // Q28
            *rImagp = Madd_32_16( *rImagp, shVec[k], hrtfShCoeffsIm_fx[1][k][bin] ); // Q28
#endif
            gainCache->shVec_fx[k] = shVec[k]; // Q29
            move32();
            move32();
Loading