Commit 07cf4836 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] 5ms flag set incorrectly for LCLD codec on decoder (split-pre) side

parent c939706c
Loading
Loading
Loading
Loading
Loading
+77 −7
Original line number Diff line number Diff line
@@ -1736,7 +1736,12 @@ static ivas_error initOnFirstGoodFrame(
    IVAS_DEC_HANDLE hIvasDec,          /* i/o: */
    const DecArguments arg,            /* i  : */
    const int16_t numInitialBadFrames, /* i  : */
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
    uint16_t *numOutSamples, /* i/o: */
    int16_t *vec_pos_len,    /* i/o: */
#else
    const uint16_t numOutSamples, /* i  : */
#endif
    int16_t *pFullDelayNumSamples,                   /* o  : */
    int16_t *pRemainingDelayNumSamples,              /* o  : */
    int32_t *delayTimeScale,                         /* o  : */
@@ -1863,9 +1868,22 @@ static ivas_error initOnFirstGoodFrame(
        else
        {
#endif
            if ( *pRemainingDelayNumSamples < numOutSamples )
            if ( *pRemainingDelayNumSamples <
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
                 *numOutSamples
#else
             numOutSamples
#endif
            )
            {
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
                if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf,
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
                                                      *numOutSamples
#else
                                                  numOutSamples
#endif
                                                              * *pNumOutChannels -
                                                          ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "\nOutput audio file writer error\n" );
                    return error;
@@ -1874,7 +1892,13 @@ static ivas_error initOnFirstGoodFrame(
            }
            else
            {
                *pRemainingDelayNumSamples -= numOutSamples;
                *pRemainingDelayNumSamples -=
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
                    *numOutSamples
#else
                numOutSamples
#endif
                    ;
            }
#ifdef SPLIT_REND_WITH_HEAD_ROT
        }
@@ -1979,6 +2003,22 @@ static ivas_error initOnFirstGoodFrame(
        }
    }

#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
    int16_t enable5ms;
    IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
    if ( enable5ms )
    {
        *numOutSamples = (int16_t) ( arg.output_Fs / 1000 * HEADROTATION_FETCH_FRAMESIZE_MS );
        *vec_pos_len = IVAS_MAX_PARAM_SPATIAL_SUBFRAMES;
    }
    else
    {
        *numOutSamples = (int16_t) ( arg.output_Fs / 1000 * DEFAULT_FETCH_FRAMESIZE_MS );
        *vec_pos_len = 1;
    }

#endif

    return IVAS_ERR_OK;
}

@@ -2016,7 +2056,11 @@ static ivas_error decodeG192(
    int16_t nOutChannels = 0;
    int16_t delayNumSamples = -1;
    int16_t delayNumSamples_orig[3];
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
    uint16_t nOutSamples = 0;
#else
    int16_t nOutSamples = 0;
#endif
    int32_t delayTimeScale = 0;
    ivas_error error = IVAS_ERR_UNKNOWN;
    uint16_t numObj = 0;
@@ -2203,7 +2247,13 @@ static ivas_error decodeG192(
                fprintf( stderr, "\nIVAS_DEC_FeedHeadTrackData failed: %s\n", IVAS_DEC_GetErrorMessage( error ) );
                goto cleanup;
            }
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
            int16_t enable5ms;
            IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
            arg.enable5ms = enable5ms;
#else
            if ( !arg.enable5ms )
#endif
            {
                /* Skip over 3 following head positions - they are given on 5ms grid */
                for ( i = 0; i < 3; ++i )
@@ -2240,7 +2290,13 @@ static ivas_error decodeG192(
                goto cleanup;
            }

#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
            int16_t enable5ms;
            IVAS_DEC_Get5msFlag( hIvasDec, &enable5ms );
            arg.enable5ms = enable5ms;
#else
            if ( !arg.enable5ms )
#endif
            {
                /* Skip over 3 following entries in file - they are given on 5ms grid */
                for ( i = 0; i < 3; ++i )
@@ -2367,7 +2423,12 @@ static ivas_error decodeG192(
                    hIvasDec,
                    arg,
                    numInitialBadFrames,
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
                    &nOutSamples,
                    &vec_pos_len,
#else
                    nOutSamples,
#endif
                    delayNumSamples_orig,
                    &delayNumSamples,
                    &delayTimeScale,
@@ -3495,7 +3556,11 @@ static ivas_error decodeVoIP(

    while ( 1 )
    {
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
        uint16_t nOutSamples = 0;
#else
        int16_t nOutSamples = 0;
#endif
#ifndef API_5MS
        uint16_t nSamplesAvailableNext = 0;
#endif
@@ -3616,7 +3681,12 @@ static ivas_error decodeVoIP(
                    hIvasDec,
                    arg,
                    numInitialBadFrames,
#if defined( SPLIT_REND_WITH_HEAD_ROT ) && defined( API_5MS )
                    &nOutSamples,
                    NULL,
#else
                    nOutSamples,
#endif
                    delayNumSamples_orig,
                    &delayNumSamples,
                    &delayTimeScale,
+7 −0
Original line number Diff line number Diff line
@@ -204,10 +204,17 @@ ivas_error ivas_dec_init_split_rend(
    {
        return error;
    }

    if ( st_ivas->hRenderConfig->split_rend_config.codec == IVAS_SPLIT_REND_CODEC_LC3PLUS &&
         ( st_ivas->hRenderConfig->split_rend_config.dof == 0 || st_ivas->hRenderConfig->split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) )
    {
        st_ivas->hDecoderConfig->Opt_5ms = true;
    }
#else
    ivas_split_rend_choose_default_codec( &st_ivas->hRenderConfig->split_rend_config.codec, ( cldfb_in == 0 ), pcm_out );
#endif


    error = ivas_split_renderer_open( &st_ivas->splitBinRend.splitrend,
                                      &st_ivas->hRenderConfig->split_rend_config,
                                      st_ivas->hDecoderConfig->output_Fs,
+21 −5
Original line number Diff line number Diff line
@@ -695,10 +695,6 @@ ivas_error IVAS_DEC_Configure(

ivas_error IVAS_DEC_EnableSplitRendering(
    IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle                             */
#ifdef API_5MS_BASELINE
    ,
    IVAS_RENDER_CONFIG_DATA renderConfig
#endif
)
{
    DECODER_CONFIG_HANDLE hDecoderConfig;
@@ -716,7 +712,7 @@ ivas_error IVAS_DEC_EnableSplitRendering(

    hDecoderConfig->Opt_Headrotation = 1;
#ifdef API_5MS_BASELINE
    hDecoderConfig->Opt_5ms = ( ( renderConfig.split_rend_config.poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_NONE ) || renderConfig.split_rend_config.dof == 0 );
    hDecoderConfig->Opt_5ms = false;
#endif


@@ -725,6 +721,26 @@ ivas_error IVAS_DEC_EnableSplitRendering(
    return error;
}
#endif
/*---------------------------------------------------------------------*
 * IVAS_DEC_Get5msFlag( )
 *
 * Get the 5ms flag
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_Get5msFlag(
    IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle                             */
    int16_t *enable5ms        /* o  : 5ms flag                                        */
)
{
    if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL || enable5ms == NULL )
    {
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

    *enable5ms = (int16_t) hIvasDec->st_ivas->hDecoderConfig->Opt_5ms;

    return IVAS_ERR_OK;
}
#endif

/*---------------------------------------------------------------------*
+5 −4
Original line number Diff line number Diff line
@@ -387,10 +387,11 @@ ivas_error IVAS_DEC_EnableVoIP(
/*! r: error code */
ivas_error IVAS_DEC_EnableSplitRendering(
    IVAS_DEC_HANDLE hIvasDec               /* i/o: IVAS decoder handle                             */
#ifdef API_5MS_BASELINE
    ,
    IVAS_RENDER_CONFIG_DATA renderConfig   /* i  : render configuration                            */
#endif
);

ivas_error IVAS_DEC_Get5msFlag(
    IVAS_DEC_HANDLE hIvasDec,              /* i/o: IVAS decoder handle                             */
    int16_t *enable5ms                     /* o  : 5ms flag                                        */
);
#endif
#endif