Commit 30fce659 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'main' into kiene/test-ubuntu-24_04-runner

parents b273301d f9ca9221
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2026 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+1 −1
Original line number Diff line number Diff line
@@ -210,6 +210,7 @@
    <ClCompile Include="..\lib_dec\ivas_cpe_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_decision_matrix_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_dec_render.c" />
    <ClCompile Include="..\lib_dec\ivas_dirac_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_dirac_output_synthesis_cov.c" />
    <ClCompile Include="..\lib_dec\ivas_entropy_decoder.c" />
@@ -219,7 +220,6 @@
    <ClCompile Include="..\lib_dec\ivas_ism_metadata_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_ism_param_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_ism_renderer.c" />
    <ClCompile Include="..\lib_dec\ivas_jbm_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_lfe_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_lfe_plc.c" />
    <ClCompile Include="..\lib_dec\ivas_ls_custom_dec.c" />
+3 −6
Original line number Diff line number Diff line
@@ -4,9 +4,6 @@
    <ClCompile Include="..\lib_dec\ivas_agc_dec.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_binRenderer_internal.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_core_dec.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
@@ -49,9 +46,6 @@
    <ClCompile Include="..\lib_dec\ivas_ism_renderer.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_jbm_dec.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\ivas_lfe_dec.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
@@ -515,6 +509,9 @@
      <Filter>decoder_all_c</Filter>
    </ClCompile>
    <ClCompile Include="..\lib_dec\lib_dec.c" />
    <ClCompile Include="..\lib_dec\ivas_dec_render.c">
      <Filter>decoder_ivas_c</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="..\lib_dec\ivas_stat_dec.h">
+1 −1
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2026 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
+57 −109
Original line number Diff line number Diff line
/******************************************************************************************************

   (C) 2022-2025 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   (C) 2022-2026 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
   Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
   Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
   Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
@@ -159,11 +159,6 @@ typedef struct
    hrtfFileReader *hrtfReader;
    char *hrtfFileName;

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD;

    IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics;
#endif
    IVAS_BIN_RENDERER_TYPE binaural_renderer;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_old;
    IVAS_BIN_RENDERER_TYPE binaural_renderer_sec;
@@ -243,10 +238,6 @@ int main(
    enable_float_exception_trap( FLE_MASK_DENORM | FLE_MASK_UNDERFLOW );
#endif

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    hHrtfBinary.hHrtfTD = NULL;         /* just to avoid compilation warning */
    hHrtfBinary.hHrtfStatistics = NULL; /* just to avoid compilation warning */
#endif
    splitRendBits.bits_buf = splitRendBitsBuf;

    /*------------------------------------------------------------------------------------------*
@@ -450,7 +441,6 @@ int main(

    asked_num_subframes = arg.render_num_subframes;
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
    arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM;

    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.render_num_subframes, arg.customLsOutputEnabled, arg.hrtfReaderEnabled,
                                       arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.roomSize, arg.non_diegetic_pan_enabled,
@@ -460,17 +450,6 @@ int main(
        goto cleanup;
    }

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }

    if ( arg.render_num_subframes != asked_num_subframes )
    {
        fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for decoding to EXT!\n" );
    }

    /*------------------------------------------------------------------------------------------*
     * Configure Split rendering
     *------------------------------------------------------------------------------------------*/
@@ -483,6 +462,7 @@ int main(
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg.render_num_subframes ) ) != IVAS_ERR_OK )
    {
@@ -490,12 +470,9 @@ int main(
        goto cleanup;
    }

#ifdef FIX_1449_RENDERER_FRAME_SIZE_UNCLEAR_IN_ISAR
    if ( !arg.renderConfigEnabled && ( arg.render_num_subframes != asked_num_subframes ) )
    {
            fprintf( stderr, "\nChanged render framesize, only 20ms are allowed for non-0dof split rendering!\n" );
        }
#endif
        fprintf( stderr, "\nChanged render framesize, only 20ms allowed!\n" );
    }

    /*------------------------------------------------------------------------------------------*
@@ -859,13 +836,6 @@ cleanup:
#ifdef DEBUG_SBA_AUDIO_DUMP
    IVAS_DEC_GetSbaDebugParams( hIvasDec, &numOutChannels, &numTransportChannels, &pca_ingest_channels );

#endif
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    if ( arg.hrtfReaderEnabled )
    {
        destroy_td_hrtf( hHrtfBinary.hHrtfTD );
        destroy_hrtf_statistics( hHrtfBinary.hHrtfStatistics );
    }
#endif

    IVAS_DEC_Close( &hIvasDec );
@@ -2248,6 +2218,7 @@ static ivas_error decodeG192(
#endif
#endif
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 } };
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    SplitFileReadWrite *splitRendWriter = NULL;
@@ -2435,10 +2406,8 @@ static ivas_error decodeG192(
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableHeadRotation || isSplitRend )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            if ( headRotReader == NULL )
            {
                for ( i = 0; i < (int16_t) num_subframes; i++ )
@@ -2476,7 +2445,6 @@ static ivas_error decodeG192(

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -2864,16 +2832,28 @@ static ivas_error decodeG192(
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableHeadRotation || isSplitRend )
        {
            IVAS_QUATERNION Quaternion;
            if ( ( error = HeadRotationFileReading( headRotReader, &Quaternion, &Pos[0] ) ) != IVAS_ERR_OK )
            if ( headRotReader == NULL )
            {
                Quaternions[0].w = -3.0f;
                Quaternions[0].x = 0.0f;
                Quaternions[0].y = 0.0f;
                Quaternions[0].z = 0.0f;
                Pos[0].x = 0.0f;
                Pos[0].y = 0.0f;
                Pos[0].z = 0.0f;
            }
            else
            {
                if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[0], &Pos[0] ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                    goto cleanup;
                }
            }

            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternion, Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[0], Pos[0], 0, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
@@ -3196,6 +3176,7 @@ static ivas_error decodeVoIP(

    IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN;
    IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS];
    IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 }, { -3, 0, 0, 0 } };
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    int16_t nOutSamples = 0;
@@ -3398,10 +3379,8 @@ static ivas_error decodeVoIP(
        }

        /* Head-tracking input simulation */
        if ( arg.enableHeadRotation )
        if ( arg.enableHeadRotation || isSplitRend )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];

            if ( headRotReader == NULL )
            {
                for ( i = 0; i < (int16_t) num_subframes; i++ )
@@ -3440,7 +3419,6 @@ static ivas_error decodeVoIP(

        if ( arg.enableExternalOrientation )
        {
            IVAS_QUATERNION Quaternions[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableHeadRotation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableExternalOrientation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
            int8_t enableRotationInterpolation[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -4162,12 +4140,6 @@ static ivas_error load_hrtf_from_file(
         * Release HRTF binary data
         *------------------------------------------------------------------------------------------*/

#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( !( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT ) && binaural_renderer_sec != IVAS_BIN_RENDERER_TYPE_TDREND && hHrtfBinary->hHrtfTD != NULL )
        {
            destroy_td_hrtf( hHrtfBinary->hHrtfTD );
        }
#endif
        if ( ( error = IVAS_DEC_HRTF_binary_close( hIvasDec, hHrtfBinary->binaural_renderer_old ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -4190,22 +4162,14 @@ static ivas_error load_hrtf_from_file(
        if ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer_sec == IVAS_BIN_RENDERER_TYPE_TDREND || binaural_renderer == IVAS_BIN_RENDERER_TYPE_DEFAULT )
        {

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            IVAS_DEC_HRTF_TD_HANDLE *hHrtfTD = NULL;
            if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfTD ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_GetHrtfTDrendHandle( hIvasDec, &hHrtfBinary->hHrtfTD ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfTDrendHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            if ( ( error = load_TDrend_HRTF_binary( *hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_TDrend_HRTF_binary( *hHrtfBinary->hHrtfTD, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
@@ -4214,11 +4178,7 @@ static ivas_error load_hrtf_from_file(
                }
                else
                {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
                    destroy_td_hrtf( hHrtfTD );
#else
                    destroy_td_hrtf( hHrtfBinary->hHrtfTD );
#endif
                }
            }
        }
@@ -4291,32 +4251,17 @@ static ivas_error load_hrtf_from_file(
                }
            }
        }
#ifndef FIX_2249_MEMORY_LEAK_IN_SBA
    }
#endif

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
        if ( ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#else
        if ( hHrtfBinary->hHrtfStatistics == NULL && ( binaural_renderer == IVAS_BIN_RENDERER_TYPE_FASTCONV || binaural_renderer == IVAS_BIN_RENDERER_TYPE_CREND ) && OutputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
        {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            IVAS_DEC_HRTF_STATISTICS_HANDLE *hHrtfStatistics = NULL;
            if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfStatistics ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_GetHrtfStatisticsHandle( hIvasDec, &hHrtfBinary->hHrtfStatistics ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nIVAS_DEC_GetHrtfStatisticsHandle failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
                return error;
            }

#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
            if ( ( error = load_HrtfStatistics_from_binary( *hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#else
            if ( ( error = load_reverb_binary( *hHrtfBinary->hHrtfStatistics, output_Fs, hHrtfBinary->hrtfReader ) ) != IVAS_ERR_OK )
#endif
            {
                if ( error != IVAS_ERR_BINARY_FILE_WITHOUT_BINAURAL_RENDERER_DATA )
                {
@@ -4325,17 +4270,11 @@ static ivas_error load_hrtf_from_file(
                }
                else
                {
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
                    destroy_hrtf_statistics( hHrtfStatistics );
#else
                    destroy_hrtf_statistics( hHrtfBinary->hHrtfStatistics );
#endif
                }
            }
        }
#ifdef FIX_2249_MEMORY_LEAK_IN_SBA
    }
#endif

    return IVAS_ERR_OK;
}
@@ -4389,6 +4328,15 @@ static ivas_error restartDecoder(
        goto cleanup;
    }

    if ( arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }
    }

    if ( ( error = IVAS_DEC_GetRenderNumSubfr( hIvasDec, &arg->render_num_subframes ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_GetRenderNumSubfr failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
Loading