Commit 180b2ad1 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Merge remote-tracking branch 'origin/main' into...

Merge remote-tracking branch 'origin/main' into 2137_basop_port_mr_1822_omasa_rateswitch_invalid_data
parents 69feaf6a 92dda2de
Loading
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+86 −0
Original line number Diff line number Diff line
# .gitignore for IVAS public collaboration Git repository

# Compiler output Unix
IVAS_cod
IVAS_dec
IVAS_rend
ISAR_post_rend
ambi_converter
obj/
*.a
*.o
*.P

# default CMake
build*/**/*

# Compiler output VS2017
IVAS_cod.exe
IVAS_dec.exe
IVAS_rend.exe
ISAR_post_rend.exe
ambi_converter.exe
*.user
.vs/
Debug_*/
Release_*/
*.obj
*.pdb

# Standalone TD object renderer
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone
scripts/td_object_renderer/object_renderer_standalone/renderer_standalone.exe

# General/scripts
.DS_Store
.vscode
.cache
.idea
*.log
*.bak
.\#*
scripts/c-code_instrument/
scripts/ifdef_instrument.list
scripts/ref/
scripts/test/
scripts/out/
scripts/self_test_summary.txt
scripts/cppp/
binary/
tests/**/[c|d]ut
tests/**/ref
tests/*/testv
tests/hrtf_binary_loading/bitstream/*
tests/hrtf_binary_loading/dec_out_*/*
scripts/testv/*_cut*.pcm
scripts/testv/*_cut*.wav
scripts/testv/stvOMASA_*.met
scripts/testv/stvOMASA_*.csv
scripts/testv/stvOMASA_2ISM_1MASA1TC48c.wav
scripts/testv/stvOMASA_3ISM_1MASA1TC48c.wav
scripts/testv/stvO*
# default reference binary name
IVAS_cod_ref*
IVAS_dec_ref*
IVAS_rend_ref*
ISAR_post_rend_ref*

# Python files that pop up when running scripts
__pycache__/
*.py[cod]
*$py.class

# history
.history/

#externals
Externals/

# coan output files that are created when cleaning out switches
coan_out_*

# Additional ignored locations for the BASOP repo
/ci
/scripts
/tests
/pytest.ini
+4 −0
Original line number Diff line number Diff line
@@ -160,6 +160,10 @@
      <Project>{2FA8F384-0775-F3B7-F8C3-85209222FC70}</Project>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>
    <ProjectReference Include="lib_debug.vcxproj">
      <Project>{54509728-928B-44D9-A118-A6F92F08B34F}</Project>
      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
+6 −77
Original line number Diff line number Diff line
@@ -129,9 +129,7 @@ typedef struct
    AcousticEnvironmentSequence aeSequence;
    bool dpidEnabled;
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];
#ifdef OBJ_EDITING_COMMANDLINE
    bool objEditEnabled;
#endif
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    char *objEditFileName;
#endif
@@ -171,13 +169,11 @@ static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS
static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf );
#endif
static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs );
#ifdef OBJ_EDITING_EXAMPLE
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader );
#else
static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters );
#endif
#endif


/*------------------------------------------------------------------------------------------*
@@ -428,15 +424,9 @@ int main(
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;

#ifdef LIB_DEC_REVISION
#ifdef OBJ_EDITING_COMMANDLINE
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled,
                                       arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled,
                                       arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx, arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
@@ -615,7 +605,7 @@ int main(
            fprintf( stderr, "\nError in reading Custom loudspeaker file %s: %s\n\n", arg.customLsSetupFilename, CustomLoudspeakerLayout_getError( lsCustomError ) );
            goto cleanup;
        }
        for ( int i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ )
        for ( int16_t i = 0; i < IVAS_MAX_LS_CHANNELS; i++ )
        {
            hLsCustomData.azimuth_fx[i] = (Word32) ( hLsCustomData.azimuth[i] * ( 1u << 22 ) );
            hLsCustomData.elevation_fx[i] = (Word32) ( hLsCustomData.elevation[i] * ( 1u << 22 ) );
@@ -917,9 +907,7 @@ static bool parseCmdlIVAS_dec(
    {
        arg->directivityPatternId[i] = 65535;
    }
#ifdef OBJ_EDITING_COMMANDLINE
    arg->objEditEnabled = false;
#endif
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    arg->objEditFileName = NULL;
#endif
@@ -1391,7 +1379,6 @@ static bool parseCmdlIVAS_dec(

            i += tmp;
        }
#ifdef OBJ_EDITING_COMMANDLINE
        else if ( strcmp( argv_to_upper, "-OBJ_EDIT" ) == 0 )
        {
            arg->objEditEnabled = true;
@@ -1415,7 +1402,6 @@ static bool parseCmdlIVAS_dec(
            i++;
#endif
        }
#endif

        /*-----------------------------------------------------------------*
         * Option not recognized
@@ -1604,12 +1590,10 @@ static void usage_dec( void )
    fprintf( stdout, "                      without braces and spaces, with ':' character separating ID from duration and ',' separating\n" );
    fprintf( stdout, "                      ID and duration pairs, where duration is specified in frames\n" );
    fprintf( stdout, "                      for BINAURAL_ROOM_REVERB output configuration.\n" );
#ifdef OBJ_EDITING_COMMANDLINE
#ifndef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
    fprintf( stdout, "-obj_edit           : Enable objects editing\n" );
#else
    fprintf( stdout, "-obj_edit File      : Object editing instructions file or NULL for built-in example\n" );
#endif
#endif

    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
@@ -2266,7 +2250,6 @@ static ivas_error decodeG192(
                    return error;
                }

#ifdef OBJ_EDITING_API
                /* Object metadata editing */
                if ( arg.objEditEnabled )
                {
@@ -2289,53 +2272,12 @@ static ivas_error decodeG192(
                    }
#endif

#ifdef OBJ_EDITING_EXAMPLE
                    /* Do object metadata editing here ... */
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                    do_object_editing_fx( &editableParameters, objectEditFileReader );
#else
                    do_object_editing_fx( &editableParameters );
#endif
#else
                    /* edit object parameters...*/

                    /* put the objects equally spaced at the horizontal plane */
                    /* and play a little bit with the gains... */
                    Word16 obj_idx, non_diegetic_obj_idx;
                    Word16 num_nondiegetic_objects;

                    num_nondiegetic_objects = 0;
                    for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ )
                    {
                        if ( !editableParameters.ism_metadata[obj_idx].non_diegetic_flag )
                        {
                            num_nondiegetic_objects++;
                        }
                    }
                    if ( num_nondiegetic_objects )
                    {
                        float start_angle, angle_inc;
                        angle_inc = 360.0f / (float) num_nondiegetic_objects;
                        start_angle = angle_inc / 2.0f;
                        for ( obj_idx = 0, non_diegetic_obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ )
                        {
                            if ( !editableParameters.ism_metadata[obj_idx].non_diegetic_flag )
                            {
                                editableParameters.ism_metadata[obj_idx].elevation_fx = 0;
                                editableParameters.ism_metadata[obj_idx].azimuth_fx = (Word32) ( ( start_angle + (float) non_diegetic_obj_idx * angle_inc ) * powf( 2.0f, 22.0f ) );
                                non_diegetic_obj_idx++;
                            }
                        }
                    }

                    /* breakover object gains */
                    for ( obj_idx = 0; obj_idx < editableParameters.num_obj; obj_idx++ )
                    {
                        editableParameters.ism_metadata[obj_idx].gain_fx = (Word32) ( ( 0.5f + (float) ( ( frame + obj_idx * 50 ) % 250 ) / 250.0f ) * powf( 2.0f, 29.0f ) );
                    }

                    editableParameters.gain_bed_fx = ( 1 << 28 ); // 0.5 in Q29
#endif

                    /* set new object parameters*/
                    if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK )
@@ -2351,7 +2293,6 @@ static ivas_error decodeG192(
                    fprintf( stderr, "\nError: could not prepare the renderer: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }
#endif
            }

            if ( isSplitRend )
@@ -2806,9 +2747,7 @@ static ivas_error decodeVoIP(
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;
    bool bitstreamReadDone = false;
#ifdef OBJ_EDITING_API
    bool parametersAvailableForEditing = false;
#endif
    uint16_t nSamplesRendered;

    vec_pos_update = 0;
@@ -3109,17 +3048,9 @@ static ivas_error decodeVoIP(
        while ( nSamplesRendered < nOutSamples )
        {
#ifdef SUPPORT_JBM_TRACEFILE
#ifdef OBJ_EDITING_API
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef OBJ_EDITING_API
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, &bitstreamReadDone, &parametersAvailableForEditing, systemTime_ms ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, &bitstreamReadDone, systemTime_ms ) ) != IVAS_ERR_OK )
#endif
#endif
            {
                fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -3150,7 +3081,6 @@ static ivas_error decodeVoIP(
                }
            }

#ifdef OBJ_EDITING_API
            /* Object metadata editing */
            if ( arg.objEditEnabled && parametersAvailableForEditing == true )
            {
@@ -3164,14 +3094,12 @@ static ivas_error decodeVoIP(
                }

                /* Do object metadata editing here ... */
#ifdef OBJ_EDITING_EXAMPLE
#ifdef FIX_1217_OBJECT_EDIT_FILE_INTERFACE
                do_object_editing_fx( &editableParameters, objectEditFileReader );
#else
                do_object_editing_fx( &editableParameters );
#endif

#endif
                /* set new object parameters */
                if ( ( error = IVAS_DEC_SetEditableParameters( hIvasDec, editableParameters ) ) != IVAS_ERR_OK )
                {
@@ -3179,7 +3107,6 @@ static ivas_error decodeVoIP(
                    return error;
                }
            }
#endif
        } /* while ( nSamplesRendered < nOutSamples ) */

        /* write JBM Offset file entry */
@@ -3311,9 +3238,9 @@ static ivas_error decodeVoIP(
        {
            fprintf( stdout, "%-8d\b\b\b\b\b\b\b\b", frame );
        }
#endif
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        frame++;
#endif
        if ( vec_pos_update == 0 )
        {
            systemTime_ms += vec_pos_len * systemTimeInc_ms;
@@ -3483,7 +3410,6 @@ cleanup:
    return error;
}

#ifdef OBJ_EDITING_EXAMPLE

/*---------------------------------------------------------------------*
 * do_object_editing_fx()
@@ -3561,7 +3487,11 @@ static void do_object_editing_fx(
                if ( readInfo->obj_gain_relative[obj_idx] )
                {
                    /* gain: apply relative edit + saturation */
#ifdef FIX_2140_OBJECT_EDITING_SANITIZER_ISSUES
                    editableParameters->ism_metadata[obj_idx].gain_fx = L_max( L_min( L_shl_sat( Mpy_32_32( editableParameters->ism_metadata[obj_idx].gain_fx, (Word32) readInfo->obj_gain[obj_idx] * 536870912 ), 2 ), OBJ_EDIT_GAIN_MAX_FX ), OBJ_EDIT_GAIN_MIN_FX ); /* Q29*Q29 -> Q27 shift back to Q29 */
#else
                    editableParameters->ism_metadata[obj_idx].gain_fx = L_max( L_min( editableParameters->ism_metadata[obj_idx].gain_fx * (Word32) readInfo->obj_gain[obj_idx] * 536870912, OBJ_EDIT_GAIN_MAX_FX ), OBJ_EDIT_GAIN_MIN_FX ); /* Q29 */
#endif
                }
                else
                {
@@ -3603,7 +3533,6 @@ static void do_object_editing_fx(
    return;
}

#endif

/*---------------------------------------------------------------------*
 * load_hrtf_from_file()
+68 −20
Original line number Diff line number Diff line
@@ -760,8 +760,8 @@ int main(
    RotFileReader *headRotReader = NULL;
    RotFileReader *externalOrientationFileReader = NULL;
    RotFileReader *referenceRotReader = NULL;
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[IVAS_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[IVAS_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbAna[RENDERER_MAX_INPUT_CHANNELS];
    IVAS_CLDFB_FILTER_BANK_HANDLE cldfbSyn[RENDERER_MAX_INPUT_CHANNELS];
    int16_t cldfb_in_flag, CLDFBframeSize_smpls;
    SplitRendBFIFileReader *splitRendBFIReader = NULL;
    Vector3PairFileReader *referenceVectorReader = NULL;
@@ -1242,8 +1242,8 @@ int main(
    /* Set up output custom layout configuration */
    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM )
    {
        floatToFixed_arrL_app( args.outConfig.outSetupCustom.azimuth, args.outConfig.outSetupCustom.azimuth_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS );
        floatToFixed_arrL_app( args.outConfig.outSetupCustom.elevation, args.outConfig.outSetupCustom.elevation_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS );
        floatToFixed_arrL_app( args.outConfig.outSetupCustom.azimuth, args.outConfig.outSetupCustom.azimuth_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS );
        floatToFixed_arrL_app( args.outConfig.outSetupCustom.elevation, args.outConfig.outSetupCustom.elevation_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS );
        if ( ( error = IVAS_REND_ConfigureCustomOutputLoudspeakerLayout( hIvasRend, args.outConfig.outSetupCustom ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomOutputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) );
@@ -1341,8 +1341,8 @@ int main(

        if ( args.inConfig.multiChannelBuses[i].audioConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM )
        {
            floatToFixed_arrL_app( args.inConfig.inSetupCustom.azimuth, args.inConfig.inSetupCustom.azimuth_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS );
            floatToFixed_arrL_app( args.inConfig.inSetupCustom.elevation, args.inConfig.inSetupCustom.elevation_fx, Q22, IVAS_MAX_OUTPUT_CHANNELS );
            floatToFixed_arrL_app( args.inConfig.inSetupCustom.azimuth, args.inConfig.inSetupCustom.azimuth_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS );
            floatToFixed_arrL_app( args.inConfig.inSetupCustom.elevation, args.inConfig.inSetupCustom.elevation_fx, Q22, RENDERER_MAX_OUTPUT_CHANNELS );
            if ( ( error = IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend, mcIds[i], args.inConfig.inSetupCustom ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in IVAS_REND_ConfigureCustomInputLoudspeakerLayout(): %s\n", ivas_error_to_string( error ) );
@@ -1359,7 +1359,7 @@ int main(
                args.lfePanningEnabled = false;
            }

            FOR( Word16 k = 0; k < IVAS_MAX_OUTPUT_CHANNELS; k++ )
            FOR( Word16 k = 0; k < RENDERER_MAX_OUTPUT_CHANNELS; k++ )
            {
                ( *lfePanMatrix_fx )[k] = (Word32) ( ( *lfePanMatrix )[k] * ( 1u << 31 ) );
            }
@@ -1394,7 +1394,7 @@ int main(
                        goto cleanup;
                    }

                    FOR( Word16 k = 0; k < IVAS_MAX_OUTPUT_CHANNELS; k++ )
                    FOR( Word16 k = 0; k < RENDERER_MAX_OUTPUT_CHANNELS; k++ )
                    {
                        ( *lfePanMatrix_fx )[k] = (Word32) ( ( *lfePanMatrix )[k] * ( 1u << 31 ) );
                    }
@@ -3108,6 +3108,13 @@ void getMetadataFromFileReader(
        fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) );
        exit( -1 );
    }
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
    objectMetadataBuffer->positions[objIdx].azimuth_fx = ismMetadata.azimuth_fx;
    objectMetadataBuffer->positions[objIdx].elevation_fx = ismMetadata.elevation_fx;
    objectMetadataBuffer->positions[objIdx].radius_fx = ismMetadata.radius_fx;
    objectMetadataBuffer->positions[objIdx].yaw_fx = ismMetadata.yaw_fx;
    objectMetadataBuffer->positions[objIdx].pitch_fx = ismMetadata.pitch_fx;
#else
    objectMetadataBuffer->positions[objIdx].azimuth_fx = (Word32) ( ismMetadata.azimuth * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].elevation_fx = (Word32) ( ismMetadata.elevation * ( 1 << 22 ) );
    objectMetadataBuffer->positions[objIdx].radius_fx = (Word16) ( ismMetadata.radius * ( 1 << 9 ) );
@@ -3119,6 +3126,7 @@ void getMetadataFromFileReader(
    objectMetadataBuffer->positions[objIdx].radius = ismMetadata.radius;
    objectMetadataBuffer->positions[objIdx].yaw = ismMetadata.yaw;
    objectMetadataBuffer->positions[objIdx].pitch = ismMetadata.pitch;
#endif
    objectMetadataBuffer->positions[objIdx].non_diegetic_flag = ismMetadata.non_diegetic_flag;

    return;
@@ -3172,20 +3180,50 @@ static void IsmPositionProvider_getNextFrame(
        /* Otherwise fall back to default position */
        else
        {
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
            objectMetadataBuffer->positions[objIdx].azimuth_fx = 0;
            objectMetadataBuffer->positions[objIdx].elevation_fx = 0;
            objectMetadataBuffer->positions[objIdx].radius_fx = 512; // 1.f in Q9
            objectMetadataBuffer->positions[objIdx].yaw_fx = 0;
            objectMetadataBuffer->positions[objIdx].pitch_fx = 0;
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#else
            objectMetadataBuffer->positions[objIdx].azimuth = 0.0f;
            objectMetadataBuffer->positions[objIdx].elevation = 0.0f;
            objectMetadataBuffer->positions[objIdx].radius = 1.0f;
            objectMetadataBuffer->positions[objIdx].yaw = 0.0f;
            objectMetadataBuffer->positions[objIdx].pitch = 0.0f;
            objectMetadataBuffer->positions[objIdx].azimuth_fx = 0;
            objectMetadataBuffer->positions[objIdx].elevation_fx = 0;
            objectMetadataBuffer->positions[objIdx].radius_fx = 512;
            objectMetadataBuffer->positions[objIdx].yaw_fx = 0;
            objectMetadataBuffer->positions[objIdx].pitch_fx = 0;
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
#endif
        }

        /* Wrap azimuth to lie within (-180, 180] range */
#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
        while ( LT_32( objectMetadataBuffer->positions[objIdx].azimuth_fx, 0 ) )
        {
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_add( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
        }
        while ( GE_32( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 ) )
        {
            objectMetadataBuffer->positions[objIdx].azimuth_fx = L_sub( objectMetadataBuffer->positions[objIdx].azimuth_fx, DEG_360_IN_Q22 );
        }

        /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].elevation_fx = L_min( L_max( objectMetadataBuffer->positions[objIdx].elevation_fx, -DEG_90_IN_Q22 ), DEG_90_IN_Q22 );

        /* Wrap yaw to lie within (-180, 180] range */
        while ( LT_32( objectMetadataBuffer->positions[objIdx].yaw_fx, 0 ) )
        {
            objectMetadataBuffer->positions[objIdx].yaw_fx = L_add( objectMetadataBuffer->positions[objIdx].yaw_fx, DEG_360_IN_Q22 );
        }
        while ( GE_32( objectMetadataBuffer->positions[objIdx].yaw_fx, DEG_360_IN_Q22 ) )
        {
            objectMetadataBuffer->positions[objIdx].yaw_fx = L_sub( objectMetadataBuffer->positions[objIdx].yaw_fx, DEG_360_IN_Q22 );
        }

        /* Clamp pitch to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].pitch_fx = L_min( L_max( objectMetadataBuffer->positions[objIdx].pitch_fx, -DEG_90_IN_Q22 ), DEG_90_IN_Q22 );
#else
        while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f )
        {
            objectMetadataBuffer->positions[objIdx].azimuth += 360.0f;
@@ -3213,6 +3251,7 @@ static void IsmPositionProvider_getNextFrame(
        objectMetadataBuffer->positions[objIdx].pitch = min( max( objectMetadataBuffer->positions[objIdx].pitch, -90 ), 90 );
        objectMetadataBuffer->positions[objIdx].yaw_fx = (Word32) ( ( objectMetadataBuffer->positions[objIdx].yaw ) * ( 1 << Q22 ) );
        objectMetadataBuffer->positions[objIdx].pitch_fx = (Word32) ( ( objectMetadataBuffer->positions[objIdx].pitch ) * ( 1 << Q22 ) );
#endif
    }

    ++positionProvider->frameCounter;
@@ -3517,6 +3556,14 @@ static void parseObjectPosition(
        exit( -1 );
    }

#ifdef FIX_2084_FLOATING_POINT_LEFTOVERS
    position->azimuth_fx = (Word32) ( meta_prm[0] * ( 1 << Q22 ) );   /* Q22 */
    position->elevation_fx = (Word32) ( meta_prm[1] * ( 1 << Q22 ) ); /* Q22 */
    position->radius_fx = (Word16) ( meta_prm[2] * ( 1 << Q9 ) );     /* Q9 */
    position->yaw_fx = (Word32) ( meta_prm[5] * ( 1 << Q22 ) );       /* Q22 */
    position->pitch_fx = (Word32) ( meta_prm[6] * ( 1 << Q22 ) );     /* Q22 */
    position->non_diegetic_flag = (Word16) meta_prm[7];
#else
    position->azimuth = meta_prm[0];
    position->elevation = meta_prm[1];
    position->azimuth_fx = (Word32) ( meta_prm[0] * ( 1 << 22 ) );
@@ -3525,6 +3572,7 @@ static void parseObjectPosition(
    position->yaw = meta_prm[5];
    position->pitch = meta_prm[6];
    position->non_diegetic_flag = (int16_t) meta_prm[7];
#endif

    return;
}
@@ -4010,7 +4058,7 @@ static ivas_error parseLfePanMtxFile(
       any subsequent issue in file reading will gracefully exit the function */
    for ( lfe_in = 0; lfe_in < RENDERER_MAX_INPUT_LFE_CHANNELS; lfe_in++ )
    {
        for ( i = 0; i < IVAS_MAX_OUTPUT_CHANNELS; i++ )
        for ( i = 0; i < RENDERER_MAX_OUTPUT_CHANNELS; i++ )
        {
            ( *lfePanMtx )[lfe_in][i] = 0.0f;
        }
@@ -4038,7 +4086,7 @@ static ivas_error parseLfePanMtxFile(
            {
                continue;
            }
            if ( ch_out > IVAS_MAX_OUTPUT_CHANNELS )
            if ( ch_out > RENDERER_MAX_OUTPUT_CHANNELS )
            {
                break;
            }
@@ -4080,13 +4128,13 @@ static void convertInputBuffer_fx(
    IF( cldfb_in_flag )
    {
        Word16 slotIdx, numCldfbBands, numFloatPcmSamples;
        Word32 fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];
        Word32 fIn[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];

        numFloatPcmSamples = numFloatSamplesPerChannel >> 1;
        numCldfbBands = numFloatPcmSamples / IVAS_CLDFB_NO_COL_MAX;

        /* CLDFB Analysis*/
        assert( numIntSamplesPerChannel <= IVAS_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE );
        assert( numIntSamplesPerChannel <= RENDERER_MAX_OUTPUT_CHANNELS * IVAS_MAX_FRAME_SIZE );
        FOR( smpl = 0; smpl < numFloatPcmSamples; ++smpl )
        {
            FOR( chnl = 0; chnl < numChannels; ++chnl )
@@ -4164,9 +4212,9 @@ static void convertOutputBuffer_fx(
    IF( cldfb_in_flag )
    {
        Word16 slotIdx, numCldfbBands, numPcmSamples, b, temp_out_q = 0;
        Word32 fIn[IVAS_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];
        Word32 re[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];
        Word32 im[IVAS_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];
        Word32 fIn[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_MAX_FRAME_SIZE];
        Word32 re[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];
        Word32 im[RENDERER_MAX_OUTPUT_CHANNELS][IVAS_CLDFB_NO_COL_MAX][IVAS_CLDFB_NO_CHANNELS_MAX];

        numPcmSamples = numSamplesPerChannel >> 1;
        numCldfbBands = numPcmSamples / IVAS_CLDFB_NO_COL_MAX;
+8 −11

File changed.

Preview size limit exceeded, changes collapsed.

Loading