Commit 84874664 authored by TYAGIRIS's avatar TYAGIRIS
Browse files

MC split rendering IVAS decoder fixes

parent 62974bf0
Loading
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -124,8 +124,8 @@ ivas_error ivas_dec(
         ( output_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
    {
        assert( ( st_ivas->ivas_format == SBA_FORMAT ||
                  ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC ) ||
                  ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCT ) ) &&
                  ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode != ISM_MODE_PARAM ) ||
                  ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode != MC_MODE_MCMASA ) ) &&
                ( output_Fs == 48000 ) && "split binaural mode is currently supported with SBA, discrete ISM, or MCT-MC formats and 48 kHz sampling rate only" );
        ivas_set_split_rend_setup( &st_ivas->splitBinRend, &st_ivas->hRenderConfig->split_rend_config, st_ivas->hCombinedOrientationData, hSplitRendBits );
    }
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ void ivas_renderer_select(
                            *renderer_type = RENDERER_BINAURAL_FASTCONV;
                        }

#ifdef DEBUGGING
#if 0 // def DEBUGGING  /*temp disabling this as paramMC crashes with CREND*/
                        if ( st_ivas->hRenderConfig->renderer_type_override == RENDER_TYPE_OVERRIDE_CREND )
                        {
                            *renderer_type = RENDERER_BINAURAL_MIXER_CONV;
+33 −10
Original line number Diff line number Diff line
@@ -1771,7 +1771,7 @@ ivas_error ivas_rend_crendProcessSplitBin(
    pMultiBinPoseData = &st_ivas->splitBinRend.splitrend.multiBinPoseData;

    /* copy input */
    for ( i = 0; i < st_ivas->nchan_transport; ++i )
    for ( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE; ++i )
    {
        mvr2r( output[i], tmpInputBuffer[i], output_frame );
    }
@@ -1784,6 +1784,8 @@ ivas_error ivas_rend_crendProcessSplitBin(
    /* save current head positions */
    pCombinedOrientationDataLocal = st_ivas->hCombinedOrientationData;
    combinedOrientationDataLocal = *pCombinedOrientationDataLocal;
    if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
    {
        for ( sf = 1; sf < RENDERER_HEAD_POSITIONS_PER_FRAME; ++sf )
        {
            combinedOrientationDataLocal.Quaternions[sf] = combinedOrientationDataLocal.Quaternions[0];
@@ -1795,11 +1797,19 @@ ivas_error ivas_rend_crendProcessSplitBin(
                }
            }
        }
    }

    /* copy LFE to tmpLfeBuffer and apply gain only once */
    mvr2r( output[st_ivas->hTransSetup.index_lfe[0]], tmpLfeBuffer, output_frame );
    if ( st_ivas->hIntSetup.num_lfe > 0 && st_ivas->hIntSetup.index_lfe[0] != -1 )
    {
        mvr2r( output[st_ivas->hIntSetup.index_lfe[0]], tmpLfeBuffer, output_frame );
        gain_lfe = ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hHrtfCrend != NULL ) ) ? st_ivas->hCrendWrapper->hHrtfCrend->gain_lfe : GAIN_LFE;
        v_multc( tmpLfeBuffer, gain_lfe, tmpLfeBuffer, output_frame );
    }
    else
    {
        set_zero( tmpLfeBuffer, output_frame );
    }

    for ( pos_idx = 0; pos_idx < pMultiBinPoseData->num_poses; ++pos_idx )
    {
@@ -1820,6 +1830,11 @@ ivas_error ivas_rend_crendProcessSplitBin(

        /* render inplace to first two channels of tmpInputBuffer */
        pCombinedOrientationDataLocal = &combinedOrientationDataLocal;

        for ( i = 0; i < 3; i++ )
        {
            mvr2r( st_ivas->hCombinedOrientationData->Rmat_prev[pos_idx][i], pCombinedOrientationDataLocal->Rmat_prev[0][i], 3 );
        }
        if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper,
                                               st_ivas->intern_config,
                                               st_ivas->hOutSetup.output_config,
@@ -1833,6 +1848,10 @@ ivas_error ivas_rend_crendProcessSplitBin(
        {
            return error;
        }
        for ( i = 0; i < 3; i++ )
        {
            mvr2r( pCombinedOrientationDataLocal->Rmat_prev[0][i], st_ivas->hCombinedOrientationData->Rmat_prev[pos_idx][i], 3 );
        }

        for ( i = 0; i < BINAURAL_CHANNELS; ++i )
        {
@@ -1841,8 +1860,11 @@ ivas_error ivas_rend_crendProcessSplitBin(

            /* move to split bin output buffer */
            mvr2r( tmpInputBuffer[i], tmpSplitBinBuffer[pos_idx * BINAURAL_CHANNELS + i], output_frame );
        }

        /* overwrite rendered channels with input again for next iteration */
        for ( i = 0; i < st_ivas->hIntSetup.nchan_out_woLFE; ++i )
        {
            mvr2r( output[i], tmpInputBuffer[i], output_frame );
        }

@@ -1853,6 +1875,7 @@ ivas_error ivas_rend_crendProcessSplitBin(
        }
    }


    /* copy split binaural rendered signals to final output */
    for ( i = 0; i < BINAURAL_CHANNELS * pMultiBinPoseData->num_poses; ++i )
    {
+32 −1
Original line number Diff line number Diff line
@@ -363,7 +363,12 @@ void rotateFrame_shd(


    /* calculate ambisonics rotation matrices for the previous and current frames */
#ifdef SPLIT_REND_WITH_HEAD_ROT
    SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev[0], shd_rot_max_order );
#else
    SHrotmatgen( SHrotmat_prev, hCombinedOrientationData->Rmat_prev, shd_rot_max_order );
#endif

    SHrotmatgen( SHrotmat, hCombinedOrientationData->Rmat[subframe_idx], shd_rot_max_order );

    for ( i = 0; i < subframe_len; i++ )
@@ -416,7 +421,11 @@ void rotateFrame_shd(
    /* move Rmat to Rmat_prev */
    for ( i = 0; i < 3; i++ )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[0][i], 3 );
#else
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[i], 3 );
#endif
    }

    return;
@@ -483,7 +492,12 @@ void rotateFrame_sd(
        ch_in_woLFE = ( ch_in >= index_lfe ) ? ch_in - 1 : ch_in;

        /* gains for previous subframe rotation */
#ifdef SPLIT_REND_WITH_HEAD_ROT
        rotateAziEle( hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev[0], hTransSetup.is_planar_setup );
#else
        rotateAziEle( hTransSetup.ls_azimuth[ch_in_woLFE], hTransSetup.ls_elevation[ch_in_woLFE], &azimuth, &elevation, hCombinedOrientationData->Rmat_prev, hTransSetup.is_planar_setup );
#endif

        if ( hEFAPdata != NULL && ( hTransSetup.ls_azimuth[ch_in_woLFE] != azimuth || hTransSetup.ls_elevation[ch_in_woLFE] != elevation ) )
        {
            efap_determine_gains( hEFAPdata, tmp_gains, azimuth, elevation, EFAP_MODE_EFAP );
@@ -541,7 +555,11 @@ void rotateFrame_sd(
    /* move Rmat to Rmat_prev */
    for ( i = 0; i < 3; i++ )
    {
#ifdef SPLIT_REND_WITH_HEAD_ROT
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[0][i], 3 );
#else
        mvr2r( hCombinedOrientationData->Rmat[subframe_idx][i], hCombinedOrientationData->Rmat_prev[i], 3 );
#endif
    }

    /* copy to output */
@@ -830,6 +848,9 @@ ivas_error ivas_combined_orientation_open(
    int16_t i, j;
    IVAS_QUATERNION identity;
    IVAS_VECTOR3 origo;
#ifdef SPLIT_REND_WITH_HEAD_ROT
    int16_t pos_idx;
#endif

    identity.w = 1.0f;
    identity.x = identity.y = identity.z = 0.0f;
@@ -867,12 +888,22 @@ ivas_error ivas_combined_orientation_open(
            ( *hCombinedOrientationData )->Rmat[i][j][j] = 1.0f;
        }
    }

#ifdef SPLIT_REND_WITH_HEAD_ROT
    for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ )
    {
        for ( j = 0; j < 3; j++ )
        {
            set_zero( ( *hCombinedOrientationData )->Rmat_prev[pos_idx][j], 3 );
            ( *hCombinedOrientationData )->Rmat_prev[pos_idx][j][j] = 1.0f;
        }
    }
#else
    for ( j = 0; j < 3; j++ )
    {
        set_zero( ( *hCombinedOrientationData )->Rmat_prev[j], 3 );
        ( *hCombinedOrientationData )->Rmat_prev[j][j] = 1.0f;
    }
#endif

    set_zero( ( *hCombinedOrientationData )->chEneIIR[0], MASA_FREQUENCY_BANDS );
    set_zero( ( *hCombinedOrientationData )->chEneIIR[1], MASA_FREQUENCY_BANDS );
+4 −0
Original line number Diff line number Diff line
@@ -501,7 +501,11 @@ typedef struct ivas_combined_orientation_struct
    IVAS_QUATERNION Quaternions_ext_interpolation_start;
    IVAS_QUATERNION Quaternions_ext_interpolation_target;
    float Rmat[MAX_PARAM_SPATIAL_SUBFRAMES][3][3];
#ifdef SPLIT_REND_WITH_HEAD_ROT
    float Rmat_prev[MAX_HEAD_ROT_POSES][3][3];
#else
    float Rmat_prev[3][3];
#endif
    float chEneIIR[2][MASA_FREQUENCY_BANDS]; /* independent of the format. MASA bands are suitable for the task and readily available in ROM. */
    float procChEneIIR[2][MASA_FREQUENCY_BANDS];
    int16_t shd_rot_max_order;