Commit 705e81ae authored by PLAINSI's avatar PLAINSI
Browse files

Merge branch 'main' into 652-mc-paramupmix-binaural-updates

parents 3f7a4f57 640e85a7
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -217,7 +217,8 @@
#define FIX_613_DIRAC_NULL_PTR_USAN                     /* Nokia: Issue #613: USAN in DirAC decoder setup */

#define MASA_AND_OBJECTS                                /* Nokia: Combination of MASA and objects */

#define FIX_653_BUG_IN_SKIP_MATRIX                      /* Dlb: fix for issue #653, bug in the ivas_spar_get_skip_mat function*/
#define FIX_663_PARAM_ISM_EXT                           /* FhG: Issue 663: ParamISM EXT output improvement */
#define PARAMUPMIX_BINAURAL_UPDATES                     /* Dlb : issue 652, MC ParamUpmix Binaural Updates */ 


+1 −0
Original line number Diff line number Diff line
@@ -1085,6 +1085,7 @@ ivas_error ivas_rend_openCldfbRend(
        hBinRenderer->conv_band = convBand;
    }
    hBinRenderer->hInputSetup->is_loudspeaker_setup = 0;
    hBinRenderer->hInputSetup->output_config = in_config;
    getAudioConfigNumChannels( inConfig, &hBinRenderer->hInputSetup->nchan_out_woLFE );

    if ( ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || ( out_config == AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
+48 −0
Original line number Diff line number Diff line
@@ -839,6 +839,7 @@ void ivas_param_ism_dec(
            }
        }

#ifndef FIX_663_PARAM_ISM_EXT
        for ( i = 0; i < nchan_transport; i++ )
        {
            for ( j = 0; j < nchan_out_woLFE; j++ )
@@ -853,6 +854,29 @@ void ivas_param_ism_dec(
                }
            }
        }
#else
        for ( j = 0; j < nchan_out_woLFE; j++ )
        {
            if ( hDirAC->azimuth_values[j] > 0.0f )
            {
                hDirAC->hParamIsmRendering->proto_matrix[j] = 1.0f;
                hDirAC->hParamIsmRendering->proto_matrix[nchan_out_woLFE + j] = 0.0f;
            }
            else
            {
                if ( hDirAC->azimuth_values[j] < 0.0f )
                {
                    hDirAC->hParamIsmRendering->proto_matrix[j] = 0.0f;
                    hDirAC->hParamIsmRendering->proto_matrix[nchan_out_woLFE + j] = 1.0f;
                }
                else /* == 0.0f */
                {
                    hDirAC->hParamIsmRendering->proto_matrix[j] = 0.5f;
                    hDirAC->hParamIsmRendering->proto_matrix[nchan_out_woLFE + j] = 0.5f;
                }
            }
        }
#endif
    }

    /* Energy Compensation */
@@ -1193,6 +1217,7 @@ void ivas_param_ism_dec_digest_tc(
            }
        }

#ifndef FIX_663_PARAM_ISM_EXT
        for ( i = 0; i < nchan_transport; i++ )
        {
            for ( j = 0; j < nchan_out_woLFE; j++ )
@@ -1207,6 +1232,29 @@ void ivas_param_ism_dec_digest_tc(
                }
            }
        }
#else
        for ( j = 0; j < nchan_out_woLFE; j++ )
        {
            if ( hDirAC->azimuth_values[j] > 0.0f )
            {
                hDirAC->hParamIsmRendering->proto_matrix[j] = 1.0f;
                hDirAC->hParamIsmRendering->proto_matrix[nchan_out_woLFE + j] = 0.0f;
            }
            else
            {
                if ( hDirAC->azimuth_values[j] < 0.0f )
                {
                    hDirAC->hParamIsmRendering->proto_matrix[j] = 0.0f;
                    hDirAC->hParamIsmRendering->proto_matrix[nchan_out_woLFE + j] = 1.0f;
                }
                else /* == 0.0f */
                {
                    hDirAC->hParamIsmRendering->proto_matrix[j] = 0.5f;
                    hDirAC->hParamIsmRendering->proto_matrix[nchan_out_woLFE + j] = 0.5f;
                }
            }
        }
#endif
    }

    /* Energy Compensation */
+4 −0
Original line number Diff line number Diff line
@@ -984,7 +984,11 @@ static void ivas_spar_get_skip_mat(
                {
                    for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ )
                    {
#ifndef FIX_653_BUG_IN_SKIP_MATRIX
                        if ( hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band + i_ts * MAX_PARAM_SPATIAL_SUBFRAMES] != 0.0f )
#else
                        if ( hSpar->hMdDec->mixer_mat[out_ch][in_ch][spar_band + i_ts * IVAS_MAX_NUM_BANDS] != 0.0f )
#endif
                        {
                            skip_flag = 0;
                            break;
+60 −22
Original line number Diff line number Diff line
@@ -4117,6 +4117,47 @@ static ivas_error findFreeInputSlot(
}

#ifdef SPLIT_REND_WITH_HEAD_ROT
static int16_t getCldfbRendFlag(
    IVAS_REND_HANDLE hIvasRend, /* i: Renderer handle               */
    IVAS_REND_AudioConfigType new_config )
{
    int16_t i;
    int16_t numMasaInputs = 0, numSbaInputs = 0, numIsmInputs = 0, numMcInputs = 0;
    int16_t isCldfbRend;

    isCldfbRend = 0;
    if ( hIvasRend->hRendererConfig != NULL )
    {
        for ( i = 0; i < RENDERER_MAX_MASA_INPUTS; ++i )
        {
            numMasaInputs += ( hIvasRend->inputsMasa[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ? 0 : 1;
        }
        for ( i = 0; i < RENDERER_MAX_SBA_INPUTS; ++i )
        {
            numSbaInputs += ( hIvasRend->inputsSba[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ? 0 : 1;
        }
        for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
        {
            numIsmInputs += ( hIvasRend->inputsIsm[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) ? 0 : 1;
        }
        for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i )
        {
            numMcInputs += ( hIvasRend->inputsMc[i].base.inConfig == IVAS_REND_AUDIO_CONFIG_UNKNOWN && new_config != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ? 0 : 1;
        }

        if ( numIsmInputs > 0 || numMcInputs > 0 )
        {
            isCldfbRend = 0;
        }
        else if ( ( numMasaInputs > 0 ) ||
                  ( numSbaInputs > 0 && hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) )
        {
            isCldfbRend = 1;
        }
    }

    return isCldfbRend;
}
static void closeSplitRend( SPLIT_REND_WRAPPER *pSplitRendWrapper, IVAS_REND_AudioBuffer *pSplitRendEncBuffer )
{
    ivas_split_renderer_close( pSplitRendWrapper );
@@ -4159,12 +4200,8 @@ ivas_error IVAS_REND_AddInput(
    if ( hIvasRend->splitRendEncBuffer.data == NULL && hIvasRend->hRendererConfig != NULL )
    {
        int16_t cldfb_in;
        cldfb_in = 0;
        if ( ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_MASA ) ||
             ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS && hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_SPLIT_REND_RENDERER_SELECTION_FASTCONV ) )
        {
            cldfb_in = 1;
        }
        cldfb_in = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) );

#ifdef FIX_658_SPLIT_REND_MASA
        ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec,
                                              ( cldfb_in == 0 ),
@@ -5029,10 +5066,12 @@ int16_t IVAS_REND_FeedRenderConfig(
    if ( hIvasRend->splitRendEncBuffer.data != NULL && hIvasRend->hRendererConfig != NULL )
#endif
    {
        int16_t cldfb_in;
        cldfb_in = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN );
        closeSplitRend( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
        /* TODO : Do not hard code TDin to 1 here*/

        ivas_split_rend_choose_default_codec( &hIvasRend->hRendererConfig->split_rend_config.codec,
                                              1,
                                              ( cldfb_in == 0 ),
                                              hIvasRend->outputConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM );
        if ( ( error = initSplitRend( &hIvasRend->splitRendWrapper,
                                      &hIvasRend->splitRendEncBuffer,
@@ -5040,7 +5079,7 @@ int16_t IVAS_REND_FeedRenderConfig(
                                      hIvasRend->headRotData,
                                      hIvasRend->sampleRateOut,
                                      hIvasRend->outputConfig,
                                      0 ) ) != IVAS_ERR_OK )
                                      cldfb_in ) ) != IVAS_ERR_OK )
        {
            return error;
        }
@@ -7280,7 +7319,7 @@ static ivas_error renderSplitBinauralWithPostRot(
    {
        if ( bits.pose_correction == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
        {
            if ( !SplitRendBFI ) /* ToDo: this is always true */
            if ( !SplitRendBFI )
            {
                ivas_splitBinPostRendMdDec(
                    &bits,
@@ -8244,7 +8283,6 @@ static ivas_error renderInputMasa(
#ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_CODED:
                case IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM:
                    /* TODO: implement */
                    renderMasaToBinaural( masaInput, outAudio
#ifdef SPLIT_REND_WITH_HEAD_ROT
                                          ,
Loading