Commit a3990a1b authored by vaclav's avatar vaclav
Browse files

updates

parent f5694d88
Loading
Loading
Loading
Loading
Loading
+33 −22
Original line number Diff line number Diff line
@@ -2691,6 +2691,7 @@ static ivas_error decodeVoIP(
    int16_t nOutSamples = 0;
#ifdef FIX_CREND_SIMPLIFY_CODE
    bool bitstreamReadDone = false;
    uint16_t nSamplesRendered;
#endif

    vec_pos_update = 0;
@@ -2809,6 +2810,9 @@ static ivas_error decodeVoIP(

    while ( 1 )
    {
#ifdef FIX_CREND_SIMPLIFY_CODE
        nSamplesRendered = 0;
#endif

        /* reference vector */
        if ( arg.enableReferenceVectorTracking && vec_pos_update == 0 )
@@ -2972,9 +2976,13 @@ static ivas_error decodeVoIP(


        /* decode and get samples */
#ifdef FIX_HRTF_LOAD
        while ( nSamplesRendered < nOutSamples )
        {
#endif
#ifdef SUPPORT_JBM_TRACEFILE
#ifdef FIX_CREND_SIMPLIFY_CODE
        if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, (void *) pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter, &bitstreamReadDone, &nSamplesRendered ) ) != IVAS_ERR_OK )
#else
            if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, writeJbmTraceFileFrameWrapper, jbmTraceWriter ) ) != IVAS_ERR_OK )
#endif
@@ -3015,6 +3023,9 @@ static ivas_error decodeVoIP(
                }
            }
#endif
#ifdef FIX_HRTF_LOAD
        }
#endif

        /* write JBM Offset file entry */
        if ( jbmOffsetWriter != NULL )
+2 −1
Original line number Diff line number Diff line
@@ -1031,7 +1031,8 @@ static ivas_error ivas_mc_dec_reconfig_fx(
#endif
    }
    /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
    ELSE IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
    ELSE
    IF( GT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) )
    {
        IF( NE_32( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ), IVAS_ERR_OK ) )
        {
+5 −5
Original line number Diff line number Diff line
@@ -273,14 +273,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    IVAS_DEC_HANDLE hIvasDec,                               /* i/o: IVAS decoder handle                                                     */
    UWord16 nSamplesPerChannel,                             /* i  : number of samples per channel requested to be written to output buffer  */
    Word16 *pcmBuf,                                         /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0  */
    const UWord32 systemTimestamp_ms                        /* i  : current system timestamp                                                */
    const UWord32 systemTimestamp_ms,                       /* i  : current system timestamp                                                */
#ifdef SUPPORT_JBM_TRACEFILE
    , JbmTraceFileWriterFn jbmWriterFn,
    void* jbmWriter
    JbmTraceFileWriterFn jbmWriterFn,
    void* jbmWriter,
#endif
#ifdef FIX_CREND_SIMPLIFY_CODE
,
   bool *bitstreamReadDone             /* o  : flag indicating that bitstream was read                                 */
   bool *bitstreamReadDone,                                 /* o  : flag indicating that bitstream was read                                 */
   UWord16 *nSamplesRendered                                /* o  : number of samples rendered                                              */
#endif
);

+36 −9
Original line number Diff line number Diff line
@@ -3713,15 +3713,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    IVAS_DEC_HANDLE hIvasDec,         /* i/o: IVAS decoder handle                         */
    UWord16 nSamplesPerChannel,       /* i  : number of samples per channel requested to be written to output buffer                  */
    Word16 *pcmBuf,                   /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels Q0 */
    const UWord32 systemTimestamp_ms /* i  : current system timestamp                    */
    const UWord32 systemTimestamp_ms, /* i  : current system timestamp                    */
#ifdef SUPPORT_JBM_TRACEFILE
    ,
    JbmTraceFileWriterFn jbmWriterFn,
    void *jbmWriter
    void *jbmWriter,
#endif
#ifdef FIX_CREND_SIMPLIFY_CODE
    ,
    bool *bitstreamReadDone /* o  : flag indicating that bitstream was read                                 */
    bool *bitstreamReadDone,  /* o  : that bitstream was read                                 */
    UWord16 *nSamplesRendered /* o  : number of samples rendered                              */
#endif
)
{
@@ -3733,7 +3732,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    UWord16 extBufferedSamples;
    Word16 result;
    ivas_error error;
#ifndef FIX_CREND_SIMPLIFY_CODE
    Word16 nSamplesRendered;
#endif
    UWord8 nOutChannels;

    test();
@@ -3747,7 +3748,9 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    hDecoderConfig = st_ivas->hDecoderConfig;
    hVoIP = hIvasDec->hVoIP;
    nOutChannels = (UWord8) st_ivas->hDecoderConfig->nchan_out;
#ifndef FIX_CREND_SIMPLIFY_CODE
    nSamplesRendered = 0;
#endif
    move16();
    move16();
    move16();
@@ -3758,7 +3761,11 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    }

/* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */
#ifdef FIX_CREND_SIMPLIFY_CODE
    WHILE( LT_16( *nSamplesRendered, nSamplesPerChannel ) )
#else
    WHILE( LT_16( nSamplesRendered, nSamplesPerChannel ) )
#endif
    {
        IF( hIvasDec->nSamplesAvailableNext == 0 )
        {
@@ -3911,8 +3918,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            /* codec mode to use not known yet - simply output silence */
            /* directly set output zero */
            Word16 nSamplesToZero = s_min( nSamplesPerChannel, hIvasDec->nSamplesAvailableNext );
#ifdef FIX_CREND_SIMPLIFY_CODE
            set16_fx( pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), 0, imult1616( nSamplesToZero, nOutChannels ) );
            *nSamplesRendered = add( *nSamplesRendered, nSamplesToZero );
#else
            set16_fx( pcmBuf + imult1616( nSamplesRendered, nOutChannels ), 0, imult1616( nSamplesToZero, nOutChannels ) );
            nSamplesRendered = add( nSamplesRendered, nSamplesToZero );
#endif
            hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesToZero );
            hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesToZero );
            move16();
@@ -3923,15 +3935,30 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
        {
            Word16 nSamplesToRender, nSamplesRendered_loop;
            bool tmp;
#ifdef FIX_CREND_SIMPLIFY_CODE
            nSamplesToRender = sub( nSamplesPerChannel, *nSamplesRendered );
#else
            nSamplesToRender = sub( nSamplesPerChannel, nSamplesRendered );
#endif

            /* render IVAS frames  directly to the output buffer */
#ifdef FIX_CREND_SIMPLIFY_CODE
            IF( NE_32( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + imult1616( *nSamplesRendered, nOutChannels ), &nSamplesRendered_loop, &tmp ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = IVAS_DEC_GetSamples( hIvasDec, nSamplesToRender, pcmBuf + imult1616( nSamplesRendered, nOutChannels ), &nSamplesRendered_loop, &tmp ) ), IVAS_ERR_OK ) )
#endif
            {
                return error;
            }

#ifdef FIX_HRTF_LOAD
            *bitstreamReadDone = false; // temp hack until JBM API is reworked
#endif
#ifdef FIX_CREND_SIMPLIFY_CODE
            *nSamplesRendered = add( *nSamplesRendered, nSamplesRendered_loop );
#else
            nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop );
#endif
            update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop );
        }
    }
+1 −1

File changed.

Contains only whitespace changes.

+1 −1

File changed.

Contains only whitespace changes.

Loading