Commit 1d91fca8 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into basop-2553-harmonize-tonalconcealment
parents e2b25741 a0a3fc64
Loading
Loading
Loading
Loading
Loading
+32 −6
Original line number Diff line number Diff line
@@ -507,6 +507,14 @@ 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 )
        {
@@ -585,6 +593,13 @@ 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 )
@@ -598,6 +613,7 @@ 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.
@@ -1750,9 +1766,7 @@ 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 )
        {
@@ -1789,11 +1803,7 @@ 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;
@@ -2114,6 +2124,14 @@ 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 )
@@ -2276,6 +2294,13 @@ 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 )
@@ -2289,6 +2314,7 @@ 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 ) );
+0 −6
Original line number Diff line number Diff line
@@ -230,9 +230,7 @@ int main(
    uint16_t rtpEncSeed = RANDOM_INITSEED_ENC;
    uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) << 16 );
    uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpEncSeed );
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
    uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */
#endif

    /*------------------------------------------------------------------------------------------*
     * Parse command-line arguments
@@ -647,11 +645,7 @@ int main(

    if ( arg.rtpdumpOutput )
    {
#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API
        if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#else
        if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK )
#endif
        {
            fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename );
            goto cleanup;
+23 −0
Original line number Diff line number Diff line
@@ -1246,6 +1246,13 @@ int main(
            fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath );
            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
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] );
@@ -1259,6 +1266,13 @@ int main(
        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID;
#ifdef FIX_2500_RENDCONF_REFACTOR
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nFailed to get acoustic environment with ID: %d\n\n", aeID );
                goto cleanup;
            }
#else
            if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
            {
                if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -1272,6 +1286,7 @@ 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.
@@ -1716,6 +1731,13 @@ int main(
                    args.aeSequence.selected = 0;
                }
                args.aeSequence.frameCounter = 0;
#ifdef FIX_2500_RENDCONF_REFACTOR
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nFailed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }
#else
                if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, args.aeSequence.pID[args.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK )
                {
                    if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK )
@@ -1729,6 +1751,7 @@ int main(
                    fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", args.aeSequence.pID[args.aeSequence.selected] );
                    goto cleanup;
                }
#endif
                if ( ( error = IVAS_REND_FeedRenderConfig( hIvasRend, renderConfig ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nIVAS_REND_FeedRenderConfig failed: %s\n\n", ivas_error_to_string( error ) );
+33 −14
Original line number Diff line number Diff line
@@ -1216,7 +1216,13 @@ void analysisCldfbEncoder_fx(
        &enerScale.lb_scale16 );

    /* get the energy */
    GetEnergyCldfb( &st_fx->energyCoreLookahead_Fx,
#ifdef HARMONIZE_2564_GetEnergyCldfb
    GetEnergyCldfb(
        EVS_MONO,
#else
    GetEnergyCldfb(
#endif
        &st_fx->energyCoreLookahead_Fx,
        &st_fx->sf_energyCoreLookahead_Fx,
        num_slots,
        ppBuf_Real16,
@@ -1234,7 +1240,12 @@ void analysisCldfbEncoder_fx(
}


#ifdef HARMONIZE_2564_GetEnergyCldfb
void GetEnergyCldfb(
    Word16 element_mode, /*!< i:     |   Is IVAS or EVS?  */
#else
void GetEnergyCldfb(
#endif
    Word32 *energyLookahead,     /*!< o: Q(*sf_energyLookahead) |   pointer to the result in the core look-ahead slot */
    Word16 *sf_energyLookahead,  /*!< o:         pointer to the scalefactor of the result in the core look-ahead slot  */
    const Word16 numLookahead,   /*!< i: Q0      the number of look-ahead time-slots */
@@ -1309,7 +1320,15 @@ void GetEnergyCldfb(
                move16();
                energyValuesSum[j] = L_shr_r( energyValuesSum[j], 1 );
                move32();
#ifdef HARMONIZE_2564_GetEnergyCldfb
                nrg = L_shr_r( nrg, 1 );
                if ( EQ_16( element_mode, EVS_MONO ) )
                {
#endif
                    nrg = L_shr_r( energyValues[k][j], 1 );
#ifdef HARMONIZE_2564_GetEnergyCldfb
                }
#endif
            }
            energyValuesSum[j] = L_add( energyValuesSum[j], nrg );
            move32();
+8 −3
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@

static void cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs );

#ifndef HARMONIZE_2564_GetEnergyCldfb
static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead,     /*!< o: Q(*sf_energyLookahead) |   pointer to the result in the core look-ahead slot */
                                    Word16 *sf_energyLookahead,  /*!< o:         pointer to the scalefactor of the result in the core look-ahead slot  */
                                    const Word16 numLookahead,   /*!< i: Q0      the number of look-ahead time-slots */
@@ -68,7 +69,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
                                    Word32 *energyValuesSum,     /*!< o: Q(2*sf_Values-4) |   pointer to sum array of energy values, not initialized*/
                                    Word16 *energyValuesSum_Exp, /*!< o:         pointer to exponents of energyValuesSum, not initialized */
                                    TEC_ENC_HANDLE hTecEnc );

#endif

/*-------------------------------------------------------------------*
 * cldfbAnalysis_ivas()
@@ -1455,7 +1456,7 @@ void resampleCldfb_ivas_fx(
    return;
}


#ifndef HARMONIZE_2564_GetEnergyCldfb
static void GetEnergyCldfb_ivas_fx(
    Word32 *energyLookahead,     /*!< o: Q(*sf_energyLookahead) |   pointer to the result in the core look-ahead slot */
    Word16 *sf_energyLookahead,  /*!< o:         pointer to the scalefactor of the result in the core look-ahead slot  */
@@ -1614,6 +1615,7 @@ static void GetEnergyCldfb_ivas_fx(
    *energyHF_Exp = 17;
    move16();
}
#endif


void analysisCldfbEncoder_ivas_fx(
@@ -1675,8 +1677,11 @@ void analysisCldfbEncoder_ivas_fx(
    move16();

    AnalysisPostSpectrumScaling_Fx( st->cldfbAnaEnc, ppBuf_Real, ppBuf_Imag, ppBuf_Real16, ppBuf_Imag16, &enerScale.lb_scale16 );

#ifdef HARMONIZE_2564_GetEnergyCldfb
    GetEnergyCldfb( st->element_mode, &st->energyCoreLookahead_Fx, &st->sf_energyCoreLookahead_Fx, 1, ppBuf_Real16, ppBuf_Imag16, enerScale.lb_scale16, st->cldfbAnaEnc->no_channels, st->cldfbAnaEnc->no_col, &st->currEnergyHF_fx, &st->currEnergyHF_e_fx, ppBuf_Ener, enerBuffSum_exp, st->hTECEnc );
#else
    GetEnergyCldfb_ivas_fx( &st->energyCoreLookahead_Fx, &st->sf_energyCoreLookahead_Fx, 1, ppBuf_Real16, ppBuf_Imag16, enerScale.lb_scale16, st->cldfbAnaEnc->no_channels, st->cldfbAnaEnc->no_col, &st->currEnergyHF_fx, &st->currEnergyHF_e_fx, ppBuf_Ener, enerBuffSum_exp, st->hTECEnc );
#endif

    return;
}
Loading