Commit 660f4443 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[cleanup] accept NONBE_1293_CRASH_FIRST_FRAME_LOST

parent 2977d4d7
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -992,9 +992,7 @@ int main(

    while ( 1 )
    {
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        int16_t bfi = 0;
#endif
        int16_t num_in_channels;
        num_in_channels = inBuffer.config.numChannels;

@@ -1003,11 +1001,7 @@ int main(
        {
            ivas_error error_tmp;
            numSamplesRead = (int16_t) inBufferSize;
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi );
#else
            error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten );
#endif
            if ( error_tmp != IVAS_ERR_OK )
            {
                if ( error_tmp == IVAS_ERR_END_OF_FILE )
@@ -1074,24 +1068,13 @@ int main(
        /* Read from split renderer bfi file if specified */
        if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame )
        {
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            int16_t bfi;
#endif
            if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) );
                goto cleanup;
            }
#endif
        }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( splitBinNeedsNewFrame )
        {
            if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK )
@@ -1100,7 +1083,6 @@ int main(
                goto cleanup;
            }
        }
#endif

        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
+0 −1
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@
#define FIX_1385_INIT_IGF_STOP_FREQ                     /* FhG: Initialize infoIGFStopFreq in init_igf_dec() */
#define FIX_1387_INIT_PRM_SQQ                           /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
#define FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define NONBE_1293_CRASH_FIRST_FRAME_LOST               /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */
#define FIX_1384_MSAN_stereo_tcx_core_enc               /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */
#define NONBE_1303_REND_GRANULARITY                     /* VA: issue 1303: Renderer granularity revision */
#define NONBE_1300_TDREND_LARGE_ITD                     /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/
+0 −43
Original line number Diff line number Diff line
@@ -1201,26 +1201,10 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
        hIvasDec->hasBeenFedFrame = false;
        move16();
        set16_fx( pcmBuf, 0, imult1616( st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) );
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        nSamplesRendered = nSamplesAsked;
        move16();
#else
        hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesAsked );
        move16();
        *nOutSamples = nSamplesAsked;
        move16();
#endif
        hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesAsked );
        move16();
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
        IF( hIvasDec->nSamplesAvailableNext == 0 )
        {
            hIvasDec->needNewFrame = true;
            *needNewFrame = true;
            move16();
            move16();
        }
#endif
    }
    ELSE
    {
@@ -1246,24 +1230,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
            }

            nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            nSamplesToRender = sub( nSamplesToRender, nSamplesRendered_loop );
            IF( hIvasDec->nSamplesAvailableNext == 0 )
            {
                *needNewFrame = true;
                hIvasDec->needNewFrame = true;
                move16();
                move16();
            }
            ELSE
            {
                *needNewFrame = false;
                move16();
            }
#endif
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    IF( hIvasDec->nSamplesAvailableNext == 0 )
    {
        *needNewFrame = true;
@@ -1276,7 +1244,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
        *needNewFrame = false;
        move16();
    }
#endif

    *nOutSamples = nSamplesRendered;
    move16();
@@ -1405,12 +1372,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        return error;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    IF( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        return IVAS_ERR_OK;
    }
#endif

    FOR( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i )
    {
@@ -3444,13 +3409,11 @@ ivas_error IVAS_DEC_GetSamplesDecoder(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    test();
    IF( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */
    {
        return IVAS_ERR_OK;
    }
#endif

    st_ivas = hIvasDec->st_ivas;

@@ -3657,7 +3620,6 @@ ivas_error IVAS_DEC_GetEditableParameters(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    IF( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        hIvasEditableParameters->num_obj = 0;
@@ -3665,7 +3627,6 @@ ivas_error IVAS_DEC_GetEditableParameters(

        return IVAS_ERR_OK;
    }
#endif

    st_ivas = hIvasDec->st_ivas;
    ism_mode = st_ivas->ism_mode;
@@ -3849,12 +3810,10 @@ ivas_error IVAS_DEC_SetEditableParameters(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    IF( !hIvasDec->hasBeenFedFirstGoodFrame )
    {
        return IVAS_ERR_OK;
    }
#endif

    st_ivas = hIvasDec->st_ivas;
    ism_mode = st_ivas->ism_mode;
@@ -4138,10 +4097,8 @@ ivas_error IVAS_DEC_PrepareRenderer(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    test();
    IF( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */
#endif
    {
        ivas_dec_prepare_renderer_fx( hIvasDec->st_ivas );
    }
+0 −2
Original line number Diff line number Diff line
@@ -1575,7 +1575,6 @@ static ivas_error renderSplitBinauralWithPostRot(
    ELSE
    {

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        IF( splitBinInput->numCachedSamples == 0 )
        {
            numSamplesPerChannelCacheSize = (Word16) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel;
@@ -1586,7 +1585,6 @@ static ivas_error renderSplitBinauralWithPostRot(
        {
            splitBinInput->numCachedSamples = sub( splitBinInput->numCachedSamples, outAudio.config.numSamplesPerChannel );
        }
#endif

        IF( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED )
        {
+0 −10
Original line number Diff line number Diff line
@@ -323,20 +323,12 @@ ivas_error split_rend_write_bitstream_to_file(
 *
 *-----------------------------------------------------------------------------------------*/

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
ivas_error split_rend_read_bits_from_file(
    SplitFileReadWrite *hSplitRendFileReadWrite,
    uint8_t *bits,
    int32_t *bits_read,
    int32_t *bits_written,
    int16_t *bfi )
#else
ivas_error split_rend_read_bits_from_file(
    SplitFileReadWrite *hSplitRendFileReadWrite,
    uint8_t *bits,
    int32_t *bits_read,
    int32_t *bits_written )
#endif
{
    char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME";
    char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN];
@@ -399,13 +391,11 @@ ivas_error split_rend_read_bits_from_file(

    *bits_read = 0;
    *bits_written = bit_len;
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    *bfi = 0;
    if ( bit_len == 0 )
    {
        *bfi = 1;
    }
#endif

    return IVAS_ERR_OK;
}
Loading