Commit c2aeea67 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Wrong render framesize printout

parent 95a776dd
Loading
Loading
Loading
Loading
Loading
+109 −32
Original line number Diff line number Diff line
@@ -498,6 +498,7 @@ int main(
        }
    }

#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT
#ifdef DEBUGGING
    /*-----------------------------------------------------------------*
     * Preview bitstream and print config information
@@ -587,6 +588,7 @@ int main(
        fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
#endif
#endif

    /*-------------------------------------------------------------------*
@@ -621,14 +623,6 @@ int main(
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif

        aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader );
        if ( aeCount > 0 )
        {
@@ -708,13 +702,6 @@ int main(

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef FIX_2500_RENDCONF_REFACTOR
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#else
            if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -728,7 +715,6 @@ int main(
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#endif
        }

        /* ISAR frame size is set from command line, not renderer config file.
@@ -777,6 +763,99 @@ int main(
        hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID;
    }

#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT
#ifdef DEBUGGING
    /*-----------------------------------------------------------------*
     * Preview bitstream and print config information
     *-----------------------------------------------------------------*/

    if ( arg.voipMode )
    {
        if ( ( error = printBitstreamInfoVoip( arg, hBsReader, hIvasDec ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Error while previewing VoIP bitstream: %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
    }
    else
    {
        uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8];
        int16_t num_bits;
        int16_t bfi = 0;
        do
        {
            if ( BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError: input bitstream file %s couldn't be read\n\n", arg.inputBitstreamFilename );
                goto cleanup;
            }
        } while ( bfi || num_bits < MIN_NUM_BITS_ACTIVE_FRAME || num_bits == NUM_BITS_SID_IVAS_5K2 );

        BS_Reader_Rewind( hBsReader );

        IVAS_DEC_PrintConfigWithBitstream( hIvasDec, arg.quietModeEnabled, bit_stream, num_bits );

#ifdef VARIABLE_SPEED_DECODING
        if ( arg.tsmEnabled )
        {
            if ( arg.tsmScaleFileEnabled )
            {
                fprintf( stdout, "Variable speed file:    %s\n", arg.tsmScaleFileName );
            }
            else
            {
                fprintf( stdout, "Variable speed factor:  %i\n", arg.tsmScale );
            }
        }
#endif
    }

    /*-----------------------------------------------------------------*
     * Open Error pattern file for simulation
     *-----------------------------------------------------------------*/

    if ( arg.FEPatternFileName != NULL )
    {
        if ( ( FEC_pattern = fopen( arg.FEPatternFileName, "rb" ) ) == NULL )
        {
            fprintf( stderr, "Error: Missing or incorrect FEC filename specification\n\n" );
            usage_dec();
            goto cleanup;
        }
    }

#ifdef DEBUG_SBA_AUDIO_DUMP
    ivas_open_sba_decoder_debug_files( arg.output_Fs, 1, 1 );
#endif

    /*-----------------------------------------------------------------*
     * Print information about FEC
     *-----------------------------------------------------------------*/

    if ( !arg.voipMode && ( arg.FEPatternFileName != NULL || arg.FER > 0 ) )
    {
        if ( arg.FEPatternFileName != NULL )
        {
            fprintf( stdout, "FEC:                    %s\n", arg.FEPatternFileName );
        }
        else
        {
            fprintf( stdout, "FEC:                    %.2f %%\n", arg.FER );
        }
    }
#else
    /*-----------------------------------------------------------------*
     * Print config information
     *-----------------------------------------------------------------*/

    if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ) ) != IVAS_ERR_OK )
    {
        fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
#endif
#endif

    /*------------------------------------------------------------------------------------------*
     * Allocate output data buffer
     *------------------------------------------------------------------------------------------*/
@@ -1991,7 +2070,9 @@ static ivas_error initOnFirstGoodFrame(
        uint16_t rtpDecSeed = RANDOM_INITSEED_DEC;
        uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 );
        uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

        if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK )
        {
@@ -2028,7 +2109,11 @@ static ivas_error initOnFirstGoodFrame(


            /* Split Rendering RTPDump Output file */
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
            if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
            {
                fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename );
                return error;
@@ -2360,14 +2445,6 @@ static ivas_error decodeG192(
            fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename );
            goto cleanup;
        }

#ifdef FIX_2500_RENDCONF_REFACTOR
        if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Invalid renderer configuration parameters\n\n" );
            goto cleanup;
        }
#endif
    }

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
@@ -2567,13 +2644,6 @@ static ivas_error decodeG192(
                            arg.aeSequence.selected = 0;
                        }
                        arg.aeSequence.frameCounter = 0;
#ifdef FIX_2500_RENDCONF_REFACTOR
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }
#else
                        if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                        {
                            if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -2587,7 +2657,6 @@ static ivas_error decodeG192(
                            fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] );
                            goto cleanup;
                        }
#endif
                        if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK )
                        {
                            fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
@@ -3923,9 +3992,17 @@ static ivas_error decodeVoIP(
        }
        else if ( decodedGoodFrame )
        {
#ifdef FIX_1515_ISAR_FRAME_SIZES_IN_RTP
            srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->isar_frame_size_ms;
#else
            srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms;
#endif
            srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD;
#ifdef FIX_1515_ISAR_FRAME_SIZES_IN_RTP
            srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->isar_frame_size_ms;
#else
            srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms;
#endif

            if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK )
            {
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@
#define FIX_2095_REMOVE_UNUSED_ISAR_TABLES              /* Dolby: remove unused ISAR */
#define FIX_FLOAT_1582_STEREO_DFT_QUANTIZE_ITD          /* FhG: float issue 1582: Remove unncessary statement from stereo_dft_quantize_itd() */
#define FIX_1585_ASAN_FORMAT_SW_ALT                     /* VA: float issue 1585: alternative fix memory leaks with format switching */
#define FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT        /* Dolby: float issue 1550: Wrong render framesize printout */

/* #################### End BE switches ################################## */