Commit 93f9a311 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[cleanup] accept NONBE_1293_CRASH_FIRST_FRAME_LOST

parent cca64c75
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -953,9 +953,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;

@@ -964,11 +962,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 )
@@ -1035,23 +1029,12 @@ 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 )
@@ -1060,7 +1043,6 @@ int main(
                goto cleanup;
            }
        }
#endif

        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
+0 −1
Original line number Diff line number Diff line
@@ -179,7 +179,6 @@
#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_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.*/
#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 FIX_1384_MSAN_ivas_spar_dec_open                /* VA: issue 1386: fix use-of-uninitialized value in ivas_spar_dec_open() */
+0 −36
Original line number Diff line number Diff line
@@ -1166,12 +1166,10 @@ ivas_error IVAS_DEC_GetSamplesDecoder(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

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

    st_ivas = hIvasDec->st_ivas;
    isInitialized_voip = hIvasDec->apaExecBuffer != NULL;
@@ -1337,14 +1335,12 @@ 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;

        return IVAS_ERR_OK;
    }
#endif

    st_ivas = hIvasDec->st_ivas;
    ism_mode = st_ivas->ism_mode;
@@ -1485,12 +1481,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;
@@ -1731,9 +1725,7 @@ ivas_error IVAS_DEC_PrepareRenderer(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */
#endif
    {
        ivas_dec_prepare_renderer( hIvasDec->st_ivas );
    }
@@ -1818,20 +1810,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
    {
        hIvasDec->hasBeenFedFrame = false;
        set_s( pcmBuf, 0, hIvasDec->st_ivas->hDecoderConfig->nchan_out * nSamplesAsked );
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        nSamplesRendered = nSamplesAsked;
#else
        hIvasDec->nSamplesRendered += nSamplesAsked;
        *nOutSamples = nSamplesAsked;
#endif
        hIvasDec->nSamplesAvailableNext -= nSamplesAsked;
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( hIvasDec->nSamplesAvailableNext == 0 )
        {
            hIvasDec->needNewFrame = true;
            *needNewFrame = true;
        }
#endif
    }
    else
    {
@@ -1870,21 +1850,8 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
            }

            nSamplesRendered += nSamplesRendered_loop;
#ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST
            nSamplesToRender -= nSamplesRendered_loop;
            if ( hIvasDec->nSamplesAvailableNext == 0 )
            {
                *needNewFrame = true;
                hIvasDec->needNewFrame = true;
            }
            else
            {
                *needNewFrame = false;
            }
#endif
    }

#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
    if ( hIvasDec->nSamplesAvailableNext == 0 )
    {
        *needNewFrame = true;
@@ -1894,7 +1861,6 @@ ivas_error IVAS_DEC_GetSamplesRenderer(
    {
        *needNewFrame = false;
    }
#endif

    *nOutSamples = nSamplesRendered;

@@ -1996,12 +1962,10 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream(
        return error;
    }

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

    /* change buffer layout */
    for ( i = 0; i < numSamplesPerChannelToDecode; ++i )
+0 −2
Original line number Diff line number Diff line
@@ -1541,7 +1541,6 @@ static ivas_error renderSplitBinauralWithPostRot(
    }
    else
    {
#ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST
        if ( splitBinInput->numCachedSamples == 0 )
        {
            numSamplesPerChannelCacheSize = (int16_t) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel;
@@ -1551,7 +1550,6 @@ static ivas_error renderSplitBinauralWithPostRot(
        {
            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];
@@ -400,13 +392,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