Commit e731929c authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fixes in external renderer

parent 2e7c1ae9
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@
#include "wmc_auto.h"

#include "prot_fx.h"
#include "debug.h"

#define WMC_TOOL_SKIP

+4 −3
Original line number Diff line number Diff line
@@ -1228,7 +1228,7 @@ ivas_error ivas_rend_openCldfbRend(
    }

    /* Allocate memories and buffers needed for convolutional module in CICP19 */
    IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, 1, inConfig, pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ), IVAS_ERR_OK ) )
    IF( NE_32( ( error = ivas_binRenderer_convModuleOpen( hBinRenderer, RENDERER_BINAURAL_FASTCONV, hBinRenderer->hInputSetup->is_loudspeaker_setup, inConfig, pCldfbRend->hHrtfFastConv, hBinRenderer->numPoses ) ), IVAS_ERR_OK ) )
    {
        return error;
    }
@@ -2127,11 +2127,12 @@ void ivas_rend_CldfbMultiBinRendProcess(
    Word32 Cldfb_ImagBuffer_sfIn[MAX_INPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_RealBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word32 Cldfb_ImagBuffer_Binaural[MAX_HEAD_ROT_POSES][BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
    Word16 Q_in_orig = Q_in;
    move16();
    Word16 Q_in_orig;

    FOR( sf_idx = 0; sf_idx < num_subframes; sf_idx++ )
    {
        Q_in_orig = Q_in;
        move16();
        FOR( slot_idx = 0; slot_idx < MAX_PARAM_SPATIAL_SUBFRAMES; slot_idx++ )
        {
            idx = sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES + slot_idx;
+3 −0
Original line number Diff line number Diff line
@@ -6796,9 +6796,12 @@ static void ivas_masa_ext_rend_parambin_internal_fx(
                FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
                {
                    Copy32( hMasaExtRend->hDiracDecBin[0]->ChEne_fx[ch], hDiracDecBin->ChEne_fx[ch], hSpatParamRendCom->num_freq_bands );
                    Copy( hMasaExtRend->hDiracDecBin[0]->ChEne_e[ch], hDiracDecBin->ChEne_e[ch], hSpatParamRendCom->num_freq_bands );
                }
                Copy32( hMasaExtRend->hDiracDecBin[0]->ChCrossRe_fx, hDiracDecBin->ChCrossRe_fx, hSpatParamRendCom->num_freq_bands );
                Copy32( hMasaExtRend->hDiracDecBin[0]->ChCrossIm_fx, hDiracDecBin->ChCrossIm_fx, hSpatParamRendCom->num_freq_bands );
                Copy( hMasaExtRend->hDiracDecBin[0]->ChCrossRe_e, hDiracDecBin->ChCrossRe_e, hSpatParamRendCom->num_freq_bands );
                Copy( hMasaExtRend->hDiracDecBin[0]->ChCrossIm_e, hDiracDecBin->ChCrossIm_e, hSpatParamRendCom->num_freq_bands );

                ivas_dirac_dec_binaural_formulate_target_covariance_matrices_fx( hDiracDecBin, hSpatParamRendCom, &config_data, Rmat_local, subframe,
                                                                                 hCombinedOrientationData && hCombinedOrientationData->enableCombinedOrientation[subframe] > 0,
+31 −9
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ static void copyBufferToCLDFBarray_fx(

    assert( ( buffer.config.is_cldfb == 1 ) && "for time domain input call copyBufferTo2dArray()" );
    readPtr = buffer.data_fx;
    numCldfbSamples = (UWord32) shl( buffer.config.numSamplesPerChannel, 1 );
    numCldfbSamples = (UWord32) shr( buffer.config.numSamplesPerChannel, 1 );
    num_bands = (UWord32) Mpy_32_32( numCldfbSamples, ONE_BY_CLDFB_NO_COL_MAX_Q31 );
    FOR( chnlIdx = 0; chnlIdx < (UWord32) buffer.config.numChannels; ++chnlIdx )
    {
@@ -430,7 +430,7 @@ static void accumulateCLDFBArrayToBuffer_fx(

    assert( ( buffer->config.is_cldfb == 1 ) && "for time domain input call copyBufferTo2dArray()" );
    writePtr = buffer->data_fx;
    numCldfbSamples = (UWord32) shl( buffer->config.numSamplesPerChannel, 1 );
    numCldfbSamples = (UWord32) shr( buffer->config.numSamplesPerChannel, 1 );
    num_bands = (UWord32) Mpy_32_32( numCldfbSamples, ONE_BY_CLDFB_NO_COL_MAX_Q31 );
    FOR( chnlIdx = 0; chnlIdx < (uint32_t) buffer->config.numChannels; ++chnlIdx )
    {
@@ -3924,6 +3924,9 @@ static ivas_error ivas_pre_rend_init(
        {
            return IVAS_ERR_FAILED_ALLOC;
        }

        pSplitRendEncBuffer->q_factor = 0;
        pSplitRendEncBuffer->pq_fact = &pSplitRendEncBuffer->q_factor;
    }
    ELSE
    {
@@ -3934,6 +3937,8 @@ static ivas_error ivas_pre_rend_init(
        bufConfig2.is_cldfb = 0;
        pSplitRendEncBuffer->config = bufConfig2;
        pSplitRendEncBuffer->data_fx = NULL;
        pSplitRendEncBuffer->pq_fact = NULL;
        pSplitRendEncBuffer->q_factor = 0;
        move16();
        move16();
        move16();
@@ -4937,11 +4942,20 @@ ivas_error IVAS_REND_SetHeadRotation(
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    /* check for Euler angle signaling */
    IF( EQ_32( headRot.w_fx, L_negate( 12582912 ) ) && EQ_16( headRot.q_fact, Q22 ) )
    {
        Euler2Quat_fx( deg2rad_fx( headRot.x_fx ), deg2rad_fx( headRot.y_fx ), deg2rad_fx( headRot.z_fx ), &rotQuat );
        modify_Quat_q_fx( &rotQuat, &rotQuat, Q29 );
    }
#else
    /* check for Euler angle signaling */
    IF( EQ_32( headRot.w_fx, -1610612736 /* -3.0f in Q29 */ ) )
    {
        Euler2Quat_fx( deg2rad_fx( headRot.x_fx ), deg2rad_fx( headRot.y_fx ), deg2rad_fx( headRot.z_fx ), &rotQuat );
    }
#endif
    ELSE
    {
        rotQuat = headRot;
@@ -6254,6 +6268,7 @@ static ivas_error renderIsmToSplitBinaural(
    const MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData;
    const SPLIT_REND_WRAPPER *pSplitRendWrapper;
    IVAS_QUATERNION originalHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES];
    IVAS_QUATERNION localHeadRot[MAX_PARAM_SPATIAL_SUBFRAMES];
    Word16 i;
    Word32 tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k];
    Word16 output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel;
@@ -6299,9 +6314,9 @@ static ivas_error renderIsmToSplitBinaural(
            {
                pCombinedOrientationData->Quaternions[i].w_fx = L_negate( 12582912 ); // Q22
                q_fact_orig = originalHeadRot[i].q_fact;
                modify_Quat_q_fx( &originalHeadRot[i], &originalHeadRot[i], Q22 );
                modify_Quat_q_fx( &originalHeadRot[i], &localHeadRot[i], Q22 );
                /*euler*/
                Quat2EulerDegree_fx( originalHeadRot[i],
                Quat2EulerDegree_fx( localHeadRot[i],
                                     &pCombinedOrientationData->Quaternions[i].z_fx,
                                     &pCombinedOrientationData->Quaternions[i].y_fx,
                                     &pCombinedOrientationData->Quaternions[i].x_fx );
@@ -7571,6 +7586,9 @@ static ivas_error renderSbaToMultiBinaural(
        IF( NE_32( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate,
                                                     getNumSubframesInBuffer( &tmpRotBuffer, *sbaInput->base.ctx.pOutSampleRate ), pos_idx ) ),
                   IVAS_ERR_OK ) )
        {
            return error;
        }

        FOR( i = 0; i < combinedOrientationDataLocal.num_subframes; i++ )
        {
@@ -8850,7 +8868,8 @@ static ivas_error getSamplesInternal(
        Word16 num_poses_orig;
        num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses;
        move16();
        outAudio = hIvasRend->splitRendEncBuffer;
        outAudio.config = hIvasRend->splitRendEncBuffer.config;
        outAudio.data_fx = hIvasRend->splitRendEncBuffer.data_fx;

        ISAR_PRE_REND_GetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper.multiBinPoseData, hIvasRend->headRotData.sr_pose_pred_axis );

@@ -8949,7 +8968,7 @@ static ivas_error getSamplesInternal(
        Q_out[0] = 31;
        Word16 num_poses = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses;

        for ( i = 0; i < 16; i++ )
        for ( i = 0; i < num_poses * BINAURAL_CHANNELS; i++ )
        {
            for ( j = 0; j < CLDFB_NO_COL_MAX; j++ )
            {
@@ -8958,7 +8977,7 @@ static ivas_error getSamplesInternal(
            }
        }
        Q_buff = s_min( q1, q2 );
        for ( i = 0; i < 16; i++ )
        for ( i = 0; i < num_poses * BINAURAL_CHANNELS; i++ )
        {
            for ( j = 0; j < CLDFB_NO_COL_MAX; j++ )
            {
@@ -8966,7 +8985,7 @@ static ivas_error getSamplesInternal(
                scale_sig32( Cldfb_ImagBuffer_Binaural[i][j], CLDFB_NO_CHANNELS_MAX, Q_buff );
            }
        }
        Q_buff = Q_buff + Q6;
        Q_buff = Q_buff + *outAudio.pq_fact;

        IF( EQ_16( cldfb_in_flag, 0 ) )
        {
@@ -9008,7 +9027,8 @@ static ivas_error getSamplesInternal(
        convertInternalBitsBuffToBitsBuffer( hBits, bits );

        /* reset to outAudioOrig in case of PCM output */
        outAudio = outAudioOrig;
        outAudio.config = outAudioOrig.config;
        outAudio.data_fx = outAudioOrig.data_fx;

        IF( NE_16( pcm_out_flag, 0 ) )
        {
@@ -9272,8 +9292,10 @@ void IVAS_REND_cldfbAnalysis_ts_wrapper(
{

    Word16 Q_cldfb = Q_in;
    assert( Q_in == h_cldfb->Q_cldfb_state );
    cldfbAnalysis_ts_fx_fixed_q( timeIn, realBuffer, imagBuffer, samplesToProcess, h_cldfb,
                                 &Q_cldfb );

    *Q_out = sub( Q_in, 5 );

    return;