Commit f16bb087 authored by vaclav's avatar vaclav
Browse files

- Merge remote-tracking branch 'remotes/origin/main' into 1956-basop-PortFlpMr2109

parents 56be5876 a751273d
Loading
Loading
Loading
Loading
Loading
+0 −167
Original line number Diff line number Diff line
@@ -80,7 +80,6 @@ static
 * Local structure for storing cmdln arguments
 *------------------------------------------------------------------------------------------*/

#ifdef FIX_1053_REVERB_RECONFIGURATION
typedef struct
{
    uint16_t *pID;
@@ -89,7 +88,6 @@ typedef struct
    uint16_t selected;
    uint16_t frameCounter;
} AcousticEnvironmentSequence;
#endif


typedef struct
@@ -122,11 +120,7 @@ typedef struct
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
    int16_t orientation_tracking;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    bool non_diegetic_pan_enabled;
#else
    int16_t Opt_non_diegetic_pan;
#endif
    float non_diegetic_pan_gain;
    Word16 non_diegetic_pan_gain_fx; /* Q15 */
    bool renderConfigEnabled;
@@ -135,16 +129,8 @@ typedef struct
    IVAS_DEC_COMPLEXITY_LEVEL complexityLevel;
    bool tsmEnabled;
    IVAS_RENDER_FRAMESIZE renderFramesize;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    AcousticEnvironmentSequence aeSequence;
#else
    uint16_t acousticEnvironmentId;
#endif
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    bool dpidEnabled;
#else
    int16_t Opt_dpid_on;
#endif
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];

} DecArguments;
@@ -266,11 +252,7 @@ int main(
    if ( arg.hrtfReaderEnabled )
    {
        /* sanity check */
#ifdef NONBE_1293_SR_HRTF
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#else
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
        {
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
@@ -385,51 +367,15 @@ int main(
        }
    }

#ifndef FIX_1158_FASTCONV_REVERB_HRTF
    /*------------------------------------------------------------------------------------------*
     * Open renderer configuration reader file
     *------------------------------------------------------------------------------------------*/

    if ( arg.renderConfigEnabled )
    {
        /* sanity check */
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.non_diegetic_pan_enabled == false )
#else
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
             arg.Opt_non_diegetic_pan == 0 )
#endif
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
            goto cleanup;
        }

        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

    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

    asked_frame_size = arg.renderFramesize;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    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 )
#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.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx,
                                       arg.Opt_dpid_on, 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.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx,
                                       arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
@@ -480,7 +426,6 @@ int main(
        }
    }

#ifdef FIX_VOIP_FUNCTIONS
    /*-----------------------------------------------------------------*
     * Print config information
     *-----------------------------------------------------------------*/
@@ -490,9 +435,6 @@ int main(
        fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
    }
#else
    IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode );
#endif

    /*-------------------------------------------------------------------*
     * Load renderer configuration from file
@@ -505,11 +447,7 @@ int main(
        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
             arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
             arg.non_diegetic_pan_enabled == false )
#else
             arg.Opt_non_diegetic_pan == 0 )
#endif
        {
            fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" );
            goto cleanup;
@@ -521,13 +459,11 @@ 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 )
        {
@@ -535,30 +471,16 @@ int main(
            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 ) );
        }
#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 &&
@@ -586,11 +508,7 @@ int main(

        if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
#ifdef FIX_1053_REVERB_RECONFIGURATION
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.acousticEnvironmentId, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
#endif
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
                {
@@ -600,16 +518,9 @@ int main(
            }
            else
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID );
#else
                fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", arg.acousticEnvironmentId );
#endif
                goto cleanup;
            }
#ifndef FIX_587_DEFAULT_REVERB
            renderConfig.roomAcoustics.override = true;
#endif
        }

        /* ISAR frame size is set from command line, not renderer config file.
@@ -805,13 +716,11 @@ cleanup:

    free( pcmBuf );

#ifdef FIX_1053_REVERB_RECONFIGURATION
    if ( arg.aeSequence.count > 0 )
    {
        free( arg.aeSequence.pID );
        free( arg.aeSequence.pValidity );
    }
#endif

    if ( arg.hrtfReaderEnabled )
    {
@@ -993,32 +902,20 @@ static bool parseCmdlIVAS_dec(

    arg->renderConfigEnabled = false;
    arg->renderConfigFilename = NULL;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    arg->dpidEnabled = false;
#else
    arg->Opt_dpid_on = 0;
#endif

    arg->outputMdFilename = NULL;

    arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    arg->non_diegetic_pan_enabled = false;
#else
    arg->Opt_non_diegetic_pan = 0;
#endif
    arg->non_diegetic_pan_gain = 0.f;
    arg->tsmEnabled = false;
    arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    arg->aeSequence.count = 0;
    arg->aeSequence.pID = NULL;
    arg->aeSequence.pValidity = NULL;
    arg->aeSequence.selected = 0;
    arg->aeSequence.frameCounter = 0;
#else
    arg->acousticEnvironmentId = 65535;
#endif
    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
        arg->directivityPatternId[i] = 65535;
@@ -1273,11 +1170,7 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
        {
            i++;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
            arg->non_diegetic_pan_enabled = true;
#else
            arg->Opt_non_diegetic_pan = 1;
#endif
            strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            to_upper( argv_to_upper );
@@ -1344,7 +1237,6 @@ static bool parseCmdlIVAS_dec(

            if ( !is_digits_only( argv[i] ) )
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                uint16_t k;
                char *s = argv[i];
                char *token = argv[i];
@@ -1404,13 +1296,7 @@ static bool parseCmdlIVAS_dec(
                    usage_dec();
                    return false;
                }
#else
                fprintf( stdout, "Error: Invalid acoustic environment ID specified: %s\n\n", argv[i] );
                usage_dec();
                return false;
#endif
            }
#ifdef FIX_1053_REVERB_RECONFIGURATION
            else
            {
                /* A single acoustic environment */
@@ -1425,19 +1311,12 @@ static bool parseCmdlIVAS_dec(
                arg->aeSequence.pID[0] = (int16_t) atoi( argv[i++] );
                arg->aeSequence.pValidity[0] = 0;
            }
#else
            arg->acousticEnvironmentId = (int16_t) atoi( argv[i++] );
#endif
        }
        else if ( strcmp( argv_to_upper, "-DPID" ) == 0 )
        {
            int16_t id, tmp;

#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
            arg->dpidEnabled = true;
#else
            arg->Opt_dpid_on = 1;
#endif
            ++i;
            tmp = 0;
            while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
@@ -1518,11 +1397,7 @@ static bool parseCmdlIVAS_dec(
        }
        i++;

#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
        if ( arg->non_diegetic_pan_enabled && arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO )
#else
        if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) )
#endif
        {
            fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" );
            usage_dec();
@@ -1540,11 +1415,7 @@ static bool parseCmdlIVAS_dec(
        arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
        arg->decMode = IVAS_DEC_MODE_EVS;

#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
        if ( arg->non_diegetic_pan_enabled )
#else
        if ( ( arg->Opt_non_diegetic_pan ) )
#endif
        {
            arg->outputConfig = IVAS_AUDIO_CONFIG_STEREO;
        }
@@ -1665,15 +1536,11 @@ static void usage_dec( void )
    fprintf( stdout, "                      output configuration. ID1, ID2, ID3, ID4 specify the directivity pattern IDs used for\n" );
    fprintf( stdout, "                      ISMs 1,2,3 and 4 respectively. This options needs to be accompanied by a render_config file,\n" );
    fprintf( stdout, "                      otherwise a default directivity pattern is used.\n" );
#ifdef FIX_1053_REVERB_RECONFIGURATION
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number > 0) or\n" );
    fprintf( stdout, "                      a sequence thereof in the format [ID1:duration1,ID2:duration2...]\n" );
    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" );
#else
    fprintf( stdout, "-aeid ID            : Acoustic environment ID (number >= 0) for BINAURAL_ROOM_REVERB output configuration\n" );
#endif
    fprintf( stdout, "-level level        : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" );
    fprintf( stdout, "                      Currently, all values default to level 3 (full functionality).\n" );
    fprintf( stdout, "-q                  : Quiet mode, no frame counter\n" );
@@ -1925,12 +1792,8 @@ static ivas_error initOnFirstGoodFrame(

                for ( int16_t j = 0; j < numInitialBadFrames; ++j )
                {
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                    float delayMs = (float) ( pFullDelayNumSamples[0] ) / (float) ( *delayTimeScale );
                    if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta, &delayMs ) ) != IVAS_ERR_OK )
#else
                    if ( ( error = MasaFileWriter_writeFrame( *ppMasaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                    {
                        fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( *ppMasaWriter ) );
                        return error;
@@ -2006,7 +1869,6 @@ static ivas_error decodeG192(
    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;

@@ -2042,7 +1904,6 @@ static ivas_error decodeG192(
            goto cleanup;
        }
    }
#endif

    for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i )
    {
@@ -2209,7 +2070,6 @@ static ivas_error decodeG192(
        {
            if ( needNewFrame )
            {
#ifdef FIX_1053_REVERB_RECONFIGURATION
                if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && renderConfigReader != NULL &&
                     arg.aeSequence.count > 0 && arg.aeSequence.pValidity[arg.aeSequence.selected] != 0 )
                {
@@ -2240,7 +2100,6 @@ static ivas_error decodeG192(
                        }
                    }
                }
#endif
                if ( ( error = BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) ) != IVAS_ERR_OK )
                {
                    if ( error == IVAS_ERR_END_OF_FILE )
@@ -2383,7 +2242,6 @@ static ivas_error decodeG192(
            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
            {
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                int16_t fullDelayNumSamples[3];
                float delayMs;

@@ -2392,19 +2250,14 @@ 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 )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
@@ -2530,7 +2383,6 @@ static ivas_error decodeG192(
            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
            {
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                int16_t fullDelayNumSamples[3];
                float delayMs;

@@ -2538,19 +2390,14 @@ 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 )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
@@ -2628,9 +2475,7 @@ static ivas_error decodeG192(

cleanup:

#ifdef FIX_1053_REVERB_RECONFIGURATION
    RenderConfigReader_close( &renderConfigReader );
#endif

    split_rend_reader_writer_close( &splitRendWriter );
    AudioFileWriter_close( &afWriter );
@@ -3098,7 +2943,6 @@ static ivas_error decodeVoIP(
                if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
                {
                    IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                    int16_t fullDelayNumSamples[3];
                    float delayMs;

@@ -3107,19 +2951,14 @@ static ivas_error decodeVoIP(
                    {
                        fprintf( stderr, "\nUnable to get delay of decoder: %s\n", ivas_error_to_string( error ) );
                    }
#endif
                    if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &hMasaExtOutMeta, 1 ) ) != 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 )
#else
                    if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                    {
                        fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                        goto cleanup;
@@ -3197,7 +3036,6 @@ static ivas_error decodeVoIP(
            if ( bsFormat == IVAS_DEC_BS_MASA || bsFormat == IVAS_DEC_BS_MASA_ISM )
            {
                IVAS_MASA_DECODER_EXT_OUT_META_HANDLE hMasaExtOutMeta;
#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT
                int16_t fullDelayNumSamples[3];
                float delayMs;

@@ -3206,19 +3044,14 @@ static ivas_error decodeVoIP(
                {
                    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 )
#else
                if ( ( error = MasaFileWriter_writeFrame( masaWriter, hMasaExtOutMeta ) ) != IVAS_ERR_OK )
#endif
                {
                    fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) );
                    goto cleanup;
+0 −62

File changed.

Preview size limit exceeded, changes collapsed.

+0 −29
Original line number Diff line number Diff line
@@ -2123,35 +2123,6 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
    return L_sum;
}

#ifndef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
/* note: now available in basop_util.h */
Word32 w_norm_llQ31( Word64 L_sum, Word16 *exp );
Word32 w_norm_llQ31(               /* o : normalized result              Q31 */
                     Word64 L_sum, /* i : upper and lower bits of accu, unsigned   Q31 */
                     Word16 *exp   /* o : exponent of result in [-32,31]  Q0 */
)
{
    Word32 L_tmp;
    Word16 exp_val;
    Word64 L64_inp64 = L_sum;
    move64();

    L64_inp64 = W_shl( L64_inp64, 1 );
    exp_val = W_norm( L64_inp64 );
    L64_inp64 = W_shl( L64_inp64, exp_val );
    exp_val = sub( 31, exp_val );
    if ( EQ_64( L_sum, 0 ) )
    {
        exp_val = -32;
        move16();
    }
    *exp = exp_val;
    move16();

    L_tmp = W_extract_h( L64_inp64 );
    return L_tmp;
}
#endif

Word32 Dot_product16HQ(                     /* o : normalized result              Q31 */
                        const Word32 L_off, /* i : initial sum value               Qn */
+0 −2
Original line number Diff line number Diff line
@@ -641,7 +641,6 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
                   Word16 *exp   /* o : exponent of result in [-32,31]  Q0 */
);

#ifdef FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW
/*------------------------------------------------------------------*
 * w_norm_llQ31:
 *
@@ -656,7 +655,6 @@ static inline Word32 w_norm_llQ31( Word64 L64_var1, Word16 *S_var2 ) /*Q31 - L_t
    *S_var2 = ( L_result == 0 ) ? -32 : 32 - sh;
    return L_result;
}
#endif

/**
 * \brief Compute dot product of 1 32 bit vectors with itself
+3 −13
Original line number Diff line number Diff line
@@ -623,9 +623,6 @@ ivas_error config_acelp1_fx(
    const Word16 tdm_lp_reuse_flag,        /* i  : LPC reuse flag (can be 1 only with secondary channel */
    const Word16 tdm_low_rate_mode,        /* i  : secondary channel low rate mode flag */
    const Word16 idchan,                   /* i  : stereo channel ID               */
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
    const Word16 active_cnt, /* i  : Active frame counter            */
#endif
    const Word16 tdm_Pitch_reuse_flag,     /* i  : primary channel pitch reuse flag*/
    const Word16 tdm_LRTD_flag,            /* i  : LRTD stereo mode flag           */
    const Word16 GSC_IVAS_mode             /* i  : GSC IVAS mode                   */
@@ -808,9 +805,6 @@ ivas_error config_acelp1_fx(

        test();
        test();
#ifndef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        test();
#endif
        IF( !tdm_lp_reuse_flag || idchan == 0 )
        {
            /* LSF Q bit-budget */
@@ -887,11 +881,7 @@ ivas_error config_acelp1_fx(

            bits = sub( bits, acelp_cfg->mid_lsf_bits );
        }
#ifdef NONBE_1325_TD_STEREO_QUANT_LSF_SEC
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) )
#else
        ELSE IF( EQ_16( tdm_lp_reuse_flag, 1 ) && EQ_16( idchan, 1 ) && NE_16( active_cnt, 1 ) )
#endif
        {
            bits = sub( bits, TDM_IC_LSF_PRED_BITS );
        }
Loading