Commit 94bbfb7d authored by multrus's avatar multrus
Browse files

[cleanup] accept BINAURALIZATION_DELAY_REPORT

parent 865a4b9f
Loading
Loading
Loading
Loading
+0 −50
Original line number Diff line number Diff line
@@ -1263,11 +1263,7 @@ static ivas_error initOnFirstGoodFrame(

    if ( !arg.delayCompensationEnabled )
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        pFullDelayNumSamples[0] = 0;
#else
        *pFullDelayNumSamples = 0;
#endif
    }
#else
    if ( arg.delayCompensationEnabled )
@@ -1280,18 +1276,10 @@ static ivas_error initOnFirstGoodFrame(
    }
    else
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        pFullDelayNumSamples[0] = 0;
#else
        *pFullDelayNumSamples = 0;
#endif
    }
#endif
#ifdef BINAURALIZATION_DELAY_REPORT
    *pRemainingDelayNumSamples = pFullDelayNumSamples[0];
#else
    *pRemainingDelayNumSamples = *pFullDelayNumSamples;
#endif

    if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, pNumOutChannels ) ) != IVAS_ERR_OK )
    {
@@ -1459,11 +1447,7 @@ static ivas_error decodeG192(
    int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */
    int16_t nOutChannels = 0;
    int16_t delayNumSamples = -1;
#ifdef BINAURALIZATION_DELAY_REPORT
    int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */
#else
    int16_t delayNumSamples_orig = 0;
#endif
    int16_t nOutSamples = 0;
    int32_t delayTimeScale = 0;
    ivas_error error = IVAS_ERR_UNKNOWN;
@@ -1489,9 +1473,7 @@ static ivas_error decodeG192(
        fprintf( stdout, "\n-- Start the decoder (quiet mode) --\n\n" );
    }

#ifdef BINAURALIZATION_DELAY_REPORT
    delayNumSamples_orig[0] = -1;
#endif

#ifdef WMOPS
    reset_stack();
@@ -1631,11 +1613,7 @@ static ivas_error decodeG192(
                    arg,
                    numInitialBadFrames,
                    nOutSamples,
#ifdef BINAURALIZATION_DELAY_REPORT
                    delayNumSamples_orig,
#else
                    &delayNumSamples_orig,
#endif
                    &delayNumSamples,
                    &delayTimeScale,
                    &bsFormat,
@@ -1749,13 +1727,8 @@ static ivas_error decodeG192(
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/

#ifdef BINAURALIZATION_DELAY_REPORT
    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
#else
    memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
@@ -1767,7 +1740,6 @@ static ivas_error decodeG192(

    if ( !arg.quietModeEnabled )
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        printf( "\n\nDecoder+renderer delay: %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale );

        if ( delayNumSamples_orig[2] > 0 )
@@ -1779,9 +1751,6 @@ static ivas_error decodeG192(
            printf( "Total delay:            %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale );
#endif
        }
#else
        fprintf( stdout, "\nDecoder delay:          %-5u [samples]  - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale );
#endif
    }

    /* Print output metadata file name(s) */
@@ -1970,11 +1939,7 @@ static ivas_error decodeVoIP(
#endif
    JbmOffsetFileWriter *jbmOffsetWriter = NULL;

#ifdef BINAURALIZATION_DELAY_REPORT
    int16_t delayNumSamples_orig[3]; /* stores: overall delay, dec+rend delay, and binauralization delay */
#else
    int16_t delayNumSamples_orig = -1;
#endif
    int16_t delayNumSamples = -1;
    int32_t delayTimeScale = -1;

@@ -1994,9 +1959,7 @@ static ivas_error decodeVoIP(
        ismWriters[i] = NULL;
    }

#ifdef BINAURALIZATION_DELAY_REPORT
    delayNumSamples_orig[0] = -1;
#endif

    rtpdumpDepacker.rtpdump = NULL;
    switch ( arg.inputFormat )
@@ -2193,11 +2156,7 @@ static ivas_error decodeVoIP(
                    arg,
                    numInitialBadFrames,
                    nOutSamples,
#ifdef BINAURALIZATION_DELAY_REPORT
                    delayNumSamples_orig,
#else
                    &delayNumSamples_orig,
#endif
                    &delayNumSamples,
                    &delayTimeScale,
                    &bsFormat,
@@ -2254,13 +2213,8 @@ static ivas_error decodeVoIP(
     * Add zeros at the end to have equal length of synthesized signals
     *------------------------------------------------------------------------------------------*/

#ifdef BINAURALIZATION_DELAY_REPORT
    memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK )
#else
    memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) );
    if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK )
#endif
    {
        fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
@@ -2272,7 +2226,6 @@ static ivas_error decodeVoIP(

    if ( !arg.quietModeEnabled )
    {
#ifdef BINAURALIZATION_DELAY_REPORT
        printf( "\n\nDecoder+renderer delay: %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[1] / (float) delayTimeScale, delayNumSamples_orig[1], delayTimeScale );

        if ( delayNumSamples_orig[2] > 0 )
@@ -2284,9 +2237,6 @@ static ivas_error decodeVoIP(
            printf( "Total delay:            %4.2f ms   (%3u samples at timescale %5u)\n", 1000.f * delayNumSamples_orig[0] / (float) delayTimeScale, delayNumSamples_orig[0], delayTimeScale );
#endif
        }
#else
        printf( "\nDecoder delay:       %5u [samples]  - Timescale: %5u\n", delayNumSamples_orig, delayTimeScale );
#endif
    }

    /*------------------------------------------------------------------------------------------*
+0 −8
Original line number Diff line number Diff line
@@ -55,10 +55,6 @@ 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            */
#ifndef BINAURALIZATION_DELAY_REPORT
    ,
    const int32_t binaural_latency_ns /* i  : binaural renderer HRTF delay in ns  */
#endif
)
{
    int32_t delay = 0;
@@ -110,10 +106,6 @@ int32_t get_delay(
                delay += IVAS_FB_DEC_DELAY_NS;
            }

#ifndef BINAURALIZATION_DELAY_REPORT
            /* compensate for binauralization delay */
            delay += binaural_latency_ns;
#endif

#ifdef FIX_350_MASA_DELAY_COMP
            if ( ivas_format == MASA_FORMAT )
+0 −1
Original line number Diff line number Diff line
@@ -143,7 +143,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define SBA_HPF_TUNING_DEC*/

#define BINAURALIZATION_DELAY_REPORT                    /* VA: Issue 255 - Changes the way the decoder delay is reported */
#define TUNE_360_OBJECT_WITH_NOISE                      /* VA: issue 360: consider objects being speech+noise for active speech coding */
#define FIX_350_MASA_DELAY_COMP                         /* Nokia: Issue 350: MASA audio/meta delay compensation */
#define FIX_372_LIB_REND_VALIDATE_IO                    /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */
+0 −4
Original line number Diff line number Diff line
@@ -681,10 +681,6 @@ 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              */
#ifndef BINAURALIZATION_DELAY_REPORT
    ,
    const int32_t binaural_latency_ns /* i  : binauralization delay in ns           */
#endif
);

void decision_matrix_enc(
+0 −4
Original line number Diff line number Diff line
@@ -1256,13 +1256,9 @@ ivas_error IVAS_DEC_GetDelay(
    st_ivas = hIvasDec->st_ivas;
    hDecoderConfig = st_ivas->hDecoderConfig;

#ifdef BINAURALIZATION_DELAY_REPORT
    nSamples[1] = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0] ) );
    nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f );
    nSamples[0] = nSamples[1] + nSamples[2];
#else
    *nSamples = (int16_t) roundf( (float) get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) * hDecoderConfig->output_Fs / 1000000000.f );
#endif

    *timeScale = hDecoderConfig->output_Fs;

Loading