Commit 300f3262 authored by vaclav's avatar vaclav
Browse files

Merge branch '1850-ref-PortFloatMr1527' into 'ivas-float-update'

Port MR1527 from float to FLP-ref

See merge request !1978
parents 555a417a b4bb5e7e
Loading
Loading
Loading
Loading
+45 −38
Original line number Diff line number Diff line
@@ -465,7 +465,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;
        }

@@ -630,6 +630,7 @@ int main(
            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;
        }

#ifdef CONF_DISTATT
        if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt ) ) != IVAS_ERR_OK )
        {
@@ -637,8 +638,8 @@ int main(
            goto cleanup;
        }
#endif
        if ( ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ||
               arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )

        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 ||
@@ -688,6 +689,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;
@@ -1436,7 +1438,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;
            }
@@ -1887,6 +1889,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 */
@@ -1896,7 +1899,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;
    }
@@ -1921,7 +1936,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];
@@ -1938,29 +1953,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;
@@ -1974,16 +1975,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;
@@ -1991,7 +1983,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 )
@@ -2205,10 +2197,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 } };
    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 )
@@ -2230,6 +2235,7 @@ static ivas_error decodeG192(
        }
    }
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        ismWriters[i] = NULL;
@@ -2238,7 +2244,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" );
@@ -2516,7 +2521,7 @@ static ivas_error decodeG192(
                }
            }

            if ( IVAS_DEC_is_split_rendering_enabled( hIvasDec ) )
            if ( isSplitRend )
            {
                if ( ( error = IVAS_DEC_GetSplitBinauralBitstream( hIvasDec, (void *) ( pcmBuf + nOutChannels * nSamplesRendered ), splitRendBits, &nSamplesRendered_loop, &needNewFrame ) ) != IVAS_ERR_OK )
                {
@@ -2584,7 +2589,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 )
                {
@@ -2593,7 +2598,7 @@ static ivas_error decodeG192(
                }
            }

            if ( IVAS_DEC_is_split_rendering_coded_out( hIvasDec ) == 0 )
            if ( !isSplitCoded )
            {
                if ( delayNumSamples < nOutSamples )
                {
@@ -2654,11 +2659,13 @@ static ivas_error decodeG192(
                    fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                }
#endif

                if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 0 ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                    goto cleanup;
                }

#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                delayMs = (float) ( fullDelayNumSamples[0] ) / (float) ( delayTimeScale );
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ typedef struct _ISAR_SPLIT_REND_CONFIG
                                 2 - (2dof correction. By default YAW and PITCH correction)
                                 3 - (3dof correction. By default YAW, PITCH and ROLL correction)
                                 */
    int16_t codec_delay_ms;      /*PLACEHOLDER (currently being ignored) : look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
    int16_t codec_delay_ms;      /* look ahead delay of the codec that is used to code BIN signal output of pre-renderer*/
    int16_t isar_frame_size_ms;  /* ISAR bit stream frame size in milliseconds */
    int16_t codec_frame_size_ms; /* Codec frame size in milliseconds, only relevant with LC3plus */
    ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrectionMode;
+6 −6
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ int32_t get_delay(
    const int32_t io_fs,                    /* i  : input/output sampling frequency     */
    const IVAS_FORMAT ivas_format,          /* i  : IVAS format                         */
    HANDLE_CLDFB_FILTER_BANK hCldfb,        /* i  : Handle of Cldfb analysis            */
    const AUDIO_CONFIG output_config /* i  : decoder output config              */
    const int16_t flag_binaural_split_coded /* i  : split rendering on/off flag         */
)
{
    int32_t delay = 0;
@@ -98,7 +98,7 @@ int32_t get_delay(
        {
            delay = IVAS_DEC_DELAY_NS;

            if ( output_config != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
            if ( !flag_binaural_split_coded )
            {
                if ( hCldfb != NULL )
                {
+5 −0
Original line number Diff line number Diff line
@@ -312,6 +312,11 @@ ivas_error ivas_output_buff_dec(
    const int16_t nchan_out_buff                                /* i  : number of output channels               */
);

/*! r: flag to indicate if split rendering is enabled */
int16_t is_split_rendering_enabled(
    const DECODER_CONFIG_HANDLE hDecoderConfig,                 /* i  : configuration structure                         */
    const IVAS_RENDER_CONFIG_HANDLE hRenderConfig               /* i  : Render config data structure                    */
);

ivas_error get_channel_config(
    const AUDIO_CONFIG config,
+5 −6
Original line number Diff line number Diff line
@@ -691,9 +691,8 @@ int32_t get_delay(
    const int16_t enc_dec,                  /* i  : encoder/decoder flag                  */
    const int32_t io_fs,                    /* i  : input/output sampling frequency       */
    const IVAS_FORMAT ivas_format,          /* i  : IVAS format                           */
    HANDLE_CLDFB_FILTER_BANK hCldfb /* i  : Handle of Cldfb analysis              */
    ,
    const AUDIO_CONFIG output_config /* i  : decoder output config                 */
    HANDLE_CLDFB_FILTER_BANK hCldfb,        /* i  : Handle of Cldfb analysis              */
    const int16_t flag_binaural_split_coded /* i  : split rendering on/off flag           */
);

void decision_matrix_enc(
Loading