Commit 42f1abb6 authored by emerit's avatar emerit
Browse files

initialize q factor

parent bd973b2b
Loading
Loading
Loading
Loading
Loading
+103 −3
Original line number Diff line number Diff line
@@ -1481,6 +1481,16 @@ static ivas_error setRendInputActiveIsm(
#endif
    Word16 SrcInd[MAX_NUM_TDREND_CHANNELS];
    Word16 num_src;
    Word16 ivas_format;
    IF( EQ_32( getAudioConfigType( inConfig ), IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) )
    {
        ivas_format = MC_FORMAT;
    }
    ELSE
    {
        ivas_format = ISM_FORMAT;
    }


    inputIsm = (input_ism *) input;
    rendCtx = inputIsm->base.ctx;
@@ -1554,6 +1564,31 @@ static ivas_error setRendInputActiveIsm(
            return error;
        }

        Word16 nchan_rend = num_src;
        move16();

        test();
        IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
        {
            nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */
        }

        FOR( Word16 nS = 0; nS < nchan_rend; nS++ )
        {
            TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]];
            IF( Src_p != NULL )
            {
                IF( Src_p->SrcSpatial_p != NULL )
                {
                    Src_p->SrcSpatial_p->q_Pos_p = Q31;
                    move16();
                }
                TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p;
                SrcSpatial_p->q_Pos_p = Q31;
                move16();
            }
        }

        /* Open TD renderer wrappers */
        FOR( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
        {
@@ -1564,6 +1599,22 @@ static ivas_error setRendInputActiveIsm(

            /* Assert same delay as main TD renderer */
            assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns );

            FOR( Word16 nS = 0; nS < nchan_rend; nS++ )
            {
                TDREND_SRC_t *Src_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[SrcInd[nS]];
                IF( Src_p != NULL )
                {
                    IF( Src_p->SrcSpatial_p != NULL )
                    {
                        Src_p->SrcSpatial_p->q_Pos_p = Q31;
                        move16();
                    }
                    TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->splitTdRendWrappers[i].hBinRendererTd->Sources[nS]->SrcSpatial_p;
                    SrcSpatial_p->q_Pos_p = Q31;
                    move16();
                }
            }
        }
#endif
    }
@@ -1577,14 +1628,38 @@ static ivas_error setRendInputActiveIsm(
    ELSE
    {
#ifndef SPLIT_REND_WITH_HEAD_ROT
        if ( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ) != IVAS_ERR_OK )
        IF( NE_32( ( error = ivas_td_binaural_open_ext_fx( &inputIsm->tdRendWrapper, inConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, SrcInd, &num_src ) ), IVAS_ERR_OK ) )
        {
            return error;
        }
        Word16 nchan_rend = num_src;
        move16();

        test();
        IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
        {
            nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */
        }

        FOR( Word16 nS = 0; nS < nchan_rend; nS++ )
        {
            TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]];
            IF( Src_p != NULL )
            {
                IF( Src_p->SrcSpatial_p != NULL )
                {
                    Src_p->SrcSpatial_p->q_Pos_p = Q31;
                    move16();
                }
                TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p;
                SrcSpatial_p->q_Pos_p = Q31;
                move16();
            }
        }

        if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
        {
            if ( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
            IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) )
            {
                return error;
            }
@@ -1595,6 +1670,31 @@ static ivas_error setRendInputActiveIsm(
            return error;
        }

        Word16 nchan_rend = num_src;
        move16();

        test();
        IF( EQ_16( ivas_format, MC_FORMAT ) && NE_32( inConfig, IVAS_AUDIO_CONFIG_LS_CUSTOM ) )
        {
            nchan_rend = sub( nchan_rend, 1 ); /* Skip LFE channel -- added to the others */
        }

        FOR( Word16 nS = 0; nS < nchan_rend; nS++ )
        {
            TDREND_SRC_t *Src_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[SrcInd[nS]];
            IF( Src_p != NULL )
            {
                IF( Src_p->SrcSpatial_p != NULL )
                {
                    Src_p->SrcSpatial_p->q_Pos_p = Q31;
                    move16();
                }
                TDREND_SRC_SPATIAL_t *SrcSpatial_p = inputIsm->tdRendWrapper.hBinRendererTd->Sources[nS]->SrcSpatial_p;
                SrcSpatial_p->q_Pos_p = Q31;
                move16();
            }
        }

        IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
        {
            IF( NE_32( ( error = ivas_reverb_open_fx( &( inputIsm->hReverb ), outConfig, NULL, inputIsm->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac_fx, hRendCfg, *rendCtx.pOutSampleRate ) ), IVAS_ERR_OK ) )