Commit c8ba1f8c authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into 1851-basop-PortFloatMr1586

parents 612a8cfb 81fd0d1d
Loading
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4,8 +4,8 @@ variables:
  IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF main

include:
  - local: .gitlab-ci/variables.yml
  - local: .gitlab-ci/rules-basis.yml
  - project: ivas-codec-pc/ivas-codec-ci
    ref: *IVAS_CODEC_CI_REF
    file: main-basop.yml
  - local: .gitlab-ci/variables.yml
  - local: .gitlab-ci/rules-basis.yml
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@
    <ClCompile Include="..\lib_com\basop_util.c" />
    <ClCompile Include="..\lib_com\bitallocsum_fx.c" />
    <ClCompile Include="..\lib_com\bitalloc_fx.c" />
    <ClCompile Include="..\lib_com\bitstream.c" />
    <ClCompile Include="..\lib_com\bitstream_fx.c" />
    <ClCompile Include="..\lib_com\bits_alloc_fx.c" />
    <ClCompile Include="..\lib_com\cb_shape_fx.c" />
@@ -212,6 +211,7 @@
    <ClCompile Include="..\lib_com\ivas_mdct_imdct_fx.c" />
    <ClCompile Include="..\lib_com\ivas_mdft_imdft_fx.c" />
    <ClCompile Include="..\lib_com\ivas_omasa_com_fx.c" />
    <ClCompile Include="..\lib_com\ivas_osba_com_fx.c" />
    <ClCompile Include="..\lib_com\ivas_pca_tools_fx.c" />
    <ClCompile Include="..\lib_com\ivas_qmetadata_com_fx.c" />
    <ClCompile Include="..\lib_com\ivas_qspherical_com_fx.c" />
+209 −637

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@
  <ItemGroup>
    <ClCompile Include="..\lib_isar\isar_lcld_decoder.c" />
    <ClCompile Include="..\lib_isar\isar_lcld_encoder.c" />
    <ClCompile Include="..\lib_isar\isar_lcld_rom_tables.c" />
    <ClCompile Include="..\lib_isar\isar_rom_lcld_tables.c" />
    <ClCompile Include="..\lib_isar\isar_splitRend_lcld_enc.c" />
    <ClCompile Include="..\lib_isar\isar_splitRend_lcld_dec.c" />
    <ClCompile Include="..\lib_isar\isar_lc3plus_common.c" />
@@ -150,7 +150,7 @@
    <ClInclude Include="..\lib_isar\isar_prot.h" />
    <ClInclude Include="..\lib_isar\isar_stat.h" />
    <ClInclude Include="..\lib_isar\isar_cnst.h" />
    <ClInclude Include="..\lib_isar\isar_lcld_rom_tables.h" />
    <ClInclude Include="..\lib_isar\isar_rom_lcld_tables.h" />
    <ClInclude Include="..\lib_isar\isar_lc3plus_common.h" />
    <ClInclude Include="..\lib_isar\isar_lc3plus_dec.h" />
    <ClInclude Include="..\lib_isar\isar_lc3plus_enc.h" />
+66 −46
Original line number Diff line number Diff line
@@ -373,6 +373,7 @@ int main(
        }
    }

#ifndef FIX_1158_FASTCONV_REVERB_HRTF
    /*------------------------------------------------------------------------------------------*
     * Open renderer configuration reader file
     *------------------------------------------------------------------------------------------*/
@@ -393,6 +394,7 @@ int main(
            goto cleanup;
        }
    }
#endif

    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
@@ -431,7 +433,7 @@ int main(
    {
        if ( ( error = IVAS_DEC_EnableSplitRendering( hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            fprintf( stderr, "\nSplit rendering configure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
            goto cleanup;
        }

@@ -482,26 +484,45 @@ int main(
            goto cleanup;
        }

#ifdef FIX_1158_FASTCONV_REVERB_HRTF
        if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError: Can't open Renderer configuration file %s \n\n", arg.renderConfigFilename );
            goto cleanup;
        }
#endif

        if ( RenderConfigReader_read( renderConfigReader, arg.renderConfigFilename, &renderConfig ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }

#ifdef CONF_DISTATT
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK )
#else
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] );
            goto cleanup;
        }
#ifndef CONF_DISTATT
        FOR( Word16 i = 0; i < 4; i++ )
        {
            renderConfig.directivity_fx[i * 3] = (Word16) ( renderConfig.directivity[i * 3] * ( 1u << 6 ) );
            renderConfig.directivity_fx[i * 3 + 1] = (Word16) ( renderConfig.directivity[i * 3 + 1] * ( 1u << 6 ) );
            renderConfig.directivity_fx[i * 3 + 2] = (Word16) ( renderConfig.directivity[i * 3 + 2] * ( ( 1u << 15 ) - 1 ) );
        }

        if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
               arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
#endif
#ifdef CONF_DISTATT
        if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt_fx ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get Distance Attenuation \n\n" );
            goto cleanup;
        }
#endif
        if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
        {
            if ( asked_frame_size != IVAS_RENDER_FRAMESIZE_20MS &&
                 ( renderConfig.split_rend_config.poseCorrectionMode == ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE ||
@@ -551,6 +572,7 @@ int main(
            }
            renderConfig.roomAcoustics.override = true;
        }

        /* ISAR frame size is set from command line, not renderer config file.
         * This will be ignored if output format is not split rendering. */
        renderConfig.split_rend_config.isar_frame_size_ms = (int16_t) arg.renderFramesize /* given in number of 5ms subframes */ * 5;
@@ -1195,7 +1217,7 @@ static bool parseCmdlIVAS_dec(
            arg->outputMdFilename = argv[i + 1];
            if ( arg->outputMdFilename[0] == '\0' )
            {
                fprintf( stderr, "Error: output metadata file path not specified\n\n" );
                fprintf( stderr, "Error: Split rendering output metadata file path not specified\n\n" );
                usage_dec();
                return false;
            }
@@ -1620,6 +1642,7 @@ static ivas_error initOnFirstGoodFrame(
    uint16_t *pNumObj,                               /* o  : */
    SplitFileReadWrite **splitRendWriter )
{
    int16_t isSplitRend, isSplitCoded;
    ivas_error error = IVAS_ERR_UNKNOWN;

    /* Now delay, number of output channels and frame size are known */
@@ -1629,7 +1652,19 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

    if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
    if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_enabled, code: %d\n", error );
        return error;
    }

    if ( ( error = IVAS_DEC_is_split_rendering_coded_out( hIvasDec, &isSplitCoded ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_coded_out, code: %d\n", error );
        return error;
    }

    if ( isSplitRend )
    {
        pFullDelayNumSamples[0] = 0;
    }
@@ -1654,7 +1689,7 @@ static ivas_error initOnFirstGoodFrame(
        return error;
    }

    if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
    if ( isSplitRend )
    {
        /* Open split rendering metadata writer */
        int16_t delayNumSamples_temp[3];
@@ -1671,29 +1706,15 @@ static ivas_error initOnFirstGoodFrame(
            return error;
        }

        if ( ( error = IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec,
                                                             &splitRendCodec,
                                                             &poseCorrection,
                                                             &splitRendIsarFrameSizeMs,
                                                             &splitRendCodecFrameSizeMs,
                                                             &lc3plusHighRes ) ) != IVAS_ERR_OK )
        if ( ( error = IVAS_DEC_GetSplitRendBitstreamHeader( hIvasDec, &splitRendCodec, &poseCorrection, &splitRendIsarFrameSizeMs, &splitRendCodecFrameSizeMs, &lc3plusHighRes ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nUnable to get split renderer bitstream header: %s\n", ivas_error_to_string( error ) );
            return error;
        }

        if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) )
        if ( isSplitCoded )
        {
            if ( ( error = split_rend_writer_open( splitRendWriter,
                                                   arg.outputWavFilename,
                                                   delayNumSamples_temp[0],
                                                   delayTimeScale_temp,
                                                   splitRendCodec,
                                                   poseCorrection,
                                                   splitRendCodecFrameSizeMs,
                                                   splitRendIsarFrameSizeMs,
                                                   arg.output_Fs,
                                                   lc3plusHighRes ) ) != IVAS_ERR_OK )
            if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, lc3plusHighRes ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
                return error;
@@ -1707,16 +1728,7 @@ static ivas_error initOnFirstGoodFrame(
                return IVAS_ERR_INVALID_SPLIT_REND_CONFIG;
            }

            if ( ( error = split_rend_writer_open( splitRendWriter,
                                                   arg.outputMdFilename,
                                                   delayNumSamples_temp[0],
                                                   delayTimeScale_temp,
                                                   splitRendCodec,
                                                   poseCorrection,
                                                   splitRendCodecFrameSizeMs,
                                                   splitRendIsarFrameSizeMs,
                                                   arg.output_Fs,
                                                   lc3plusHighRes ) ) != IVAS_ERR_OK )
            if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputMdFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, lc3plusHighRes ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nUnable to open output split rendering metadata file %s\n", arg.outputWavFilename );
                return error;
@@ -1724,7 +1736,7 @@ static ivas_error initOnFirstGoodFrame(
        }
    }

    if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
    if ( !isSplitCoded )
    {
        /* Open audio writer and write all previously skipped bad frames now that frame size is known */
        if ( ( error = AudioFileWriter_open( ppAfWriter, arg.outputWavFilename, arg.output_Fs, *pNumOutChannels ) ) != IVAS_ERR_OK )
@@ -1759,7 +1771,6 @@ static ivas_error initOnFirstGoodFrame(
        }
        else
        {

            if ( *pRemainingDelayNumSamples < *numOutSamples )
            {
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
@@ -1929,11 +1940,23 @@ static ivas_error decodeG192(
    IVAS_VECTOR3 Pos[IVAS_MAX_PARAM_SPATIAL_SUBFRAMES] = { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } };
    int16_t vec_pos_update, vec_pos_len;
    SplitFileReadWrite *splitRendWriter = NULL;

    int16_t isSplitRend, isSplitCoded;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    IVAS_RENDER_CONFIG_DATA renderConfig;
    RenderConfigReader *renderConfigReader = NULL;

    if ( ( error = IVAS_DEC_is_split_rendering_enabled( hIvasDec, &isSplitRend ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_enabled, code: %d\n", error );
        return error;
    }

    if ( ( error = IVAS_DEC_is_split_rendering_coded_out( hIvasDec, &isSplitCoded ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nError in IVAS_DEC_is_split_rendering_coded_out, code: %d\n", error );
        return error;
    }

    if ( arg.renderConfigEnabled )
    {
        if ( ( error = RenderConfigReader_open( arg.renderConfigFilename, &renderConfigReader ) ) != IVAS_ERR_OK )
@@ -1964,7 +1987,6 @@ static ivas_error decodeG192(
    /* we always start with needing a new frame */
    needNewFrame = true;


    if ( !arg.quietModeEnabled )
    {
        fprintf( stdout, "\n------ Running the decoder ------\n\n" );
@@ -1996,13 +2018,13 @@ static ivas_error decodeG192(
        return error;
    }


    /*------------------------------------------------------------------------------------------*
     * Loop for every packet (frame) of bitstream data
     * - Read the bitstream packet
     * - Run the decoder
     * - Write the synthesized signal into output file
     *------------------------------------------------------------------------------------------*/

    while ( 1 )
    {
        /* Read next frame if not enough samples availble */
@@ -2172,7 +2194,7 @@ static ivas_error decodeG192(
                }
            }

            if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
            if ( isSplitRend )
            {
                if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (Word16 *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
                {
@@ -2237,7 +2259,7 @@ static ivas_error decodeG192(
        /* Write current frame */
        if ( decodedGoodFrame )
        {
            if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
            if ( isSplitRend )
            {
                if ( split_rend_write_bitstream_to_file( splitRendWriter, splitRendBits->bits_buf, &splitRendBits->bits_read, &splitRendBits->bits_written ) != IVAS_ERR_OK )
                {
@@ -2246,7 +2268,7 @@ static ivas_error decodeG192(
                }
            }

            if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
            if ( !isSplitCoded )
            {
                if ( delayNumSamples < nOutSamples )
                {
@@ -2813,8 +2835,7 @@ static ivas_error decodeVoIP(
                {
                    if ( ( error = HeadRotationFileReading( headRotReader, &Quaternions[i], &Pos[i] ) ) != IVAS_ERR_OK )
                    {
                        fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ),
                                 RotationFileReader_getFilePath( headRotReader ) );
                        fprintf( stderr, "\nError %s while reading head orientation from %s\n", IVAS_DEC_GetErrorMessage( error ), RotationFileReader_getFilePath( headRotReader ) );
                        goto cleanup;
                    }
                }
@@ -2822,8 +2843,7 @@ static ivas_error decodeVoIP(

            for ( i = 0; i < num_subframes; i++ )
            {
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i,
                                                           DEFAULT_AXIS ) ) != IVAS_ERR_OK )
                if ( ( error = IVAS_DEC_FeedHeadTrackData( hIvasDec, Quaternions[i], Pos[i], i, DEFAULT_AXIS ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
Loading