Commit 8d73b36a authored by bayers's avatar bayers
Browse files

fix compiling, re-add all 5ms API stuff that got lost in the latest merge from main

parent 61245536
Loading
Loading
Loading
Loading
+36 −10
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ int main(
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/
#ifdef API_5MS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.tsmEnabled, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.tsmEnabled, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
@@ -1635,8 +1635,9 @@ static ivas_error initOnFirstGoodFrame(
static ivas_error decodeG192(
    DecArguments arg,
    BS_READER_HANDLE hBsReader,
    HeadRotFileReader *headRotReader,
    HeadRotFileReader *refRotReader,
    RotFileReader *headRotReader,
    RotFileReader *externalOrientationFileReader,
    RotFileReader *refRotReader,
    Vector3PairFileReader *referenceVectorReader,
    IVAS_DEC_HANDLE hIvasDec,
    int16_t *pcmBuf )
@@ -1770,7 +1771,7 @@ static ivas_error decodeG192(
            IVAS_QUATERNION quaternion;
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) );
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
            }

@@ -1781,6 +1782,30 @@ static ivas_error decodeG192(
            }
        }

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternion;
            int8_t enableHeadRotation;
            int8_t enableExternalOrientation;
            int8_t enableRotationInterpolation;
            int16_t numFramesToTargetOrientation;


            if ( ( error = ExternalOrientationFileReading( externalOrientationFileReader, &Quaternion, &enableHeadRotation, &enableExternalOrientation, &enableRotationInterpolation, &numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading external orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                         RotationFileReader_getFilePath( externalOrientationFileReader ) );
                goto cleanup;
            }


            if ( ( error = IVAS_DEC_FeedExternalOrientationData( hIvasDec, Quaternion, enableHeadRotation, enableExternalOrientation, enableRotationInterpolation, numFramesToTargetOrientation ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedExternalOrientationData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        {
@@ -1788,7 +1813,7 @@ static ivas_error decodeG192(

            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) );
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                goto cleanup;
            }

@@ -2024,7 +2049,7 @@ static ivas_error decodeG192(
            IVAS_QUATERNION quaternion;
            if ( ( error = HeadRotationFileReading( refRotReader, &quaternion, NULL ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( refRotReader ) );
                fprintf( stderr, "\nError %s while reading reference rotation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( refRotReader ) );
                goto cleanup;
            }

@@ -2042,7 +2067,7 @@ static ivas_error decodeG192(

            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), HeadRotationFileReader_getFilePath( headRotReader ) );
                fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                goto cleanup;
            }

@@ -2055,7 +2080,7 @@ static ivas_error decodeG192(
        }

        /* decode and get samples */
        if ( ( error = IVAS_DEC_VoIP_Flush( hIvasDec, nOutSamples, pcmBuf, &nSamplesAvailableNext, &nSamplesFlushed ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_Flush( hIvasDec, nOutSamples, pcmBuf,  &nSamplesFlushed ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_DEC_VoIP_Flush: %s\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
@@ -2833,7 +2858,8 @@ static ivas_error decodeVoIP(
        int16_t nOutSamples = 0;
#ifndef API_5MS
        uint16_t nSamplesAvailableNext = 0;
#endif#ifdef DEBUG_JBM_CMD_OPTION
#endif 
#ifdef DEBUG_JBM_CMD_OPTION
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs );
#else
        nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS );
+2 −0
Original line number Diff line number Diff line
@@ -5148,7 +5148,9 @@ void ivas_binaural_cldfb_sf(
void ivas_binRenderer(
    BINAURAL_RENDERER_HANDLE hBinRenderer,                      /* i/o: fastconv binaural renderer handle                       */
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData,       /* i  : combined head and external orientation handle           */
#ifndef API_5MS
    int16_t subframe_idx,                                       /* i  : subframe index                                          */
#endif
    const int16_t numTimeSlots,                                 /* i: : number of time slots to process                         */
    float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : Binaural signals             */
    float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : Binaural signals             */
+29 −6
Original line number Diff line number Diff line
@@ -994,7 +994,11 @@ void ivas_binaural_cldfb(
        }

        /* Implement binaural rendering */
#ifdef API_5MS
        ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );
#else
        ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, subframeIdx, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );
#endif

        /* Implement CLDFB synthesis */
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
@@ -1086,8 +1090,11 @@ void ivas_binaural_cldfb_sf(
        }

        /* Implement binaural rendering */
#ifdef API_5MS
        ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );
#else
        ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hCombinedOrientationData, subframeIdx, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer );

#endif
        /* Implement CLDFB synthesis */
        for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
@@ -1122,7 +1129,9 @@ void ivas_binaural_cldfb_sf(
void ivas_binRenderer(
    BINAURAL_RENDERER_HANDLE hBinRenderer,                /* i/o: binaural renderer handle    */
    COMBINED_ORIENTATION_HANDLE hCombinedOrientationData, /* i  : combined head and external orientation handle           */
#ifndef API_5MS
    int16_t subframe_idx, /* i  : subframe index   */
#endif
    const int16_t numTimeSlots,                                                            /* i  : number of time slots to render*/
    float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : Binaural signals */
    float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o  : Binaural signals */
@@ -1146,8 +1155,10 @@ void ivas_binRenderer(
    }

    /* Head rotation in HOA3 or CICPx */
    if (
        hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && hBinRenderer->rotInCldfb )
#ifdef API_5MS
    if ( hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation && hBinRenderer->rotInCldfb )
#else
    if ( hCombinedOrientationData != NULL && hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && hBinRenderer->rotInCldfb )
#endif
    {
        if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 )
@@ -1155,17 +1166,29 @@ void ivas_binRenderer(
            /* Rotation in SHD (HOA3) */
            if ( hCombinedOrientationData->shd_rot_max_order == -1 )
            {
#ifdef API_5MS
                rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 );
#else
                rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 );
#endif
            }
            else if ( hCombinedOrientationData->shd_rot_max_order > 0 )
            {
#ifdef API_5MS
                rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order );
#else
                rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hCombinedOrientationData->Rmat[subframe_idx], hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hCombinedOrientationData->shd_rot_max_order );
#endif
            }
        }
        else
        {
            /* Rotation in SD (CICPx) */
#ifdef API_5MS
            rotateFrame_sd_cldfb( hCombinedOrientationData->Rmat, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band );
#else
            rotateFrame_sd_cldfb( hCombinedOrientationData->Rmat[subframe_idx], RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band );
#endif
        }
    }

+23 −1
Original line number Diff line number Diff line
@@ -2456,9 +2456,17 @@ void ivas_dirac_dec_render_sf(
        set_zero( onset_filter_subframe, hDirAC->num_freq_bands );
    }

#ifdef API_5MS
    if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation )
#else
    if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] )
#endif
    {
#ifdef API_5MS
        p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[0][0];
#else
        p_Rmat = &st_ivas->hCombinedOrientationData->Rmat[subframe_idx][0][0];
#endif

        if ( st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 )
        {
@@ -2522,7 +2530,11 @@ void ivas_dirac_dec_render_sf(
                set_zero( surCohRatio, hDirAC->num_freq_bands );
            }
        }
#ifdef API_5MS
        if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 )
#else
        if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 1 )
#endif
        {
            ivas_dirac_dec_compute_directional_responses( hDirAC,
                                                          st_ivas->hVBAPdata,
@@ -2615,7 +2627,11 @@ void ivas_dirac_dec_render_sf(

        if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD )
        {
#ifdef API_5MS
            if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 )
#else
            if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order == 0 )
#endif
            {
                protoSignalComputation_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer,
                                            hDirAC->h_output_synthesis_psd_state.proto_direct_buffer_f,
@@ -2849,7 +2865,11 @@ void ivas_dirac_dec_render_sf(
        }

/*Compute PSDs*/
#ifdef API_5MS
        if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 )
#else
        if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[subframe_idx] && st_ivas->hCombinedOrientationData->shd_rot_max_order > 0 )
#endif
        {
            ivas_dirac_dec_output_synthesis_process_slot( reference_power,
                                                          p_onset_filter,
@@ -2942,7 +2962,9 @@ void ivas_dirac_dec_render_sf(
        /* Perform binaural rendering */
        ivas_binRenderer( st_ivas->hBinRenderer,
                          st_ivas->hCombinedOrientationData,
#ifndef API_5MS
                          subframe_idx,
#endif
                          hDirAC->subframe_nbslots[subframe_idx],
                          Cldfb_RealBuffer_Binaural,
                          Cldfb_ImagBuffer_Binaural,
+21 −0
Original line number Diff line number Diff line
@@ -159,10 +159,17 @@ void ivas_ism_render(
        else
        {
            /* Combined rotation: rotate the object positions depending the head and external orientations */
#ifdef API_5MS
            if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation == 1 )
#else
            if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
#endif
            {
#ifdef API_5MS
                rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat, st_ivas->hIntSetup.is_planar_setup );
#else
                rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup );
#endif
            }
            else
            {
@@ -243,6 +250,9 @@ void ivas_ism_render_sf(
        set_f( output_f[i], 0.0f, n_samples_to_render );
    }

#ifdef API_5MS
    if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation )
#else
    if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
#endif
    {
@@ -256,9 +266,17 @@ void ivas_ism_render_sf(
    {

        /* Combined rotation: rotate the object positions depending the head and external orientations */
#ifdef API_5MS
        if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation == 1 )
#else
        if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
#endif
        {
#ifdef API_5MS
            rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat, st_ivas->hIntSetup.is_planar_setup );
#else
            rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup );
#endif
            if ( st_ivas->hEFAPdata != NULL )
            {
                efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], azimuth, elevation, EFAP_MODE_EFAP );
@@ -287,6 +305,9 @@ void ivas_ism_render_sf(
            }

            /* update here only in case of head rotation */
#ifdef API_5MS
            if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation == 1 )
#else
            if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
#endif
            {
Loading