Commit d1648520 authored by vaclav's avatar vaclav
Browse files

VARIABLE_SPEED_DECODING: formal improvements

parent 5fae92c8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1010,7 +1010,7 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-VS" ) == 0 )
        {
            i++;
            int tmp = 100;
            int32_t tmp = 100;
            arg->variableSpeedMode = true;
            if ( i < argc - 3 )
            {
@@ -1037,7 +1037,7 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 )
        {
            i++;
            int tmp;
            int32_t tmp;
            if ( i < argc - 3 )
            {
                if ( !is_digits_only( argv[i] ) )
+2 −2
Original line number Diff line number Diff line
@@ -5715,10 +5715,10 @@ ivas_error ivas_td_binaural_renderer(
);

#ifdef JBM_TSM_ON_TCS
void ObjRenderIVASSubframe(
ivas_error ivas_td_binaural_renderer_sf(
    Decoder_Struct *st_ivas,   /* i/o: IVAS decoder structure            */
    float *output[],           /* i/o: SCE channels / Binaural synthesis */
    const int16_t output_frame /* i  : output frame length               */
    const int16_t n_samples_granularity                         /* i  : granularity of the renderer/buffer      */
);
#endif

+17 −4
Original line number Diff line number Diff line
@@ -716,6 +716,7 @@ ivas_error ivas_jbm_dec_render(
        else /* ISM_MODE_DISC */
        {
            *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal );

            /* Loudspeaker or Ambisonics rendering */
            if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
            {
@@ -731,7 +732,9 @@ ivas_error ivas_jbm_dec_render(
            /* Binaural rendering */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
                ObjRenderIVASSubframe( st_ivas, p_output, *nSamplesRendered );
                if ( ( ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK )
                {
                    return error;
            }
            else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM )
            {
@@ -834,7 +837,11 @@ ivas_error ivas_jbm_dec_render(
            }
            else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
                ObjRenderIVASSubframe( st_ivas, p_output, *nSamplesRendered );
                if ( ( ivas_td_binaural_renderer_sf( st_ivas, p_output, *nSamplesRendered ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                ivas_binaural_add_LFE( st_ivas, *nSamplesRendered, st_ivas->hTcBuffer->tc, p_output );
            }
        }
@@ -995,7 +1002,9 @@ ivas_error ivas_jbm_dec_flush_renderer(
                /* Binaural rendering */
                if ( renderer_type_old == RENDERER_BINAURAL_OBJECTS_TD )
                {
                    ObjRenderIVASSubframe( st_ivas, p_output, hTcBuffer->n_samples_granularity );
                    if ( ( ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK )
                    {
                        return error;
                }
                else if ( renderer_type_old == RENDERER_BINAURAL_MIXER_CONV_ROOM )
                {
@@ -1050,7 +1059,11 @@ ivas_error ivas_jbm_dec_flush_renderer(
                }
                else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
                {
                    ObjRenderIVASSubframe( st_ivas, p_output, hTcBuffer->n_samples_granularity );
                    if ( ( ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK )
                    {
                        return error;
                    }

                    ivas_binaural_add_LFE( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc, p_output );
                }
            }
+5 −4
Original line number Diff line number Diff line
@@ -85,16 +85,17 @@ ivas_error ivas_td_binaural_renderer(

#ifdef JBM_TSM_ON_TCS
/*---------------------------------------------------------------------*
 * ObjRenderIVASFrame()
 * ivas_td_binaural_renderer_sf()
 *
 * Receives the current frames for the object streams, updates metadata
 * and renders the current frame.
 *---------------------------------------------------------------------*/

void ObjRenderIVASSubframe(
ivas_error ivas_td_binaural_renderer_sf(
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure            */
    float *output[],         /* i/o: SCE channels / Binaural synthesis */
    const int16_t n_samples_asked )
    const int16_t n_samples_granularity /* i  : granularity of the renderer/buffer  */
)
{
    int16_t first_sf, last_sf, subframe_idx;
    float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES];
@@ -116,7 +117,7 @@ void ObjRenderIVASSubframe(
    }
    slot_size = st_ivas->hTcBuffer->n_samples_granularity;
    /* loop for synthesis, assume we always have to render in multiples of 5ms subframes with spills */
    slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_asked / slot_size );
    slots_to_render = min( st_ivas->hTcBuffer->num_slots - st_ivas->hTcBuffer->slots_rendered, n_samples_granularity / slot_size );
    first_sf = st_ivas->hTcBuffer->subframes_rendered;
    last_sf = first_sf;
    st_ivas->hTcBuffer->slots_rendered += slots_to_render;
+34 −3
Original line number Diff line number Diff line
@@ -1889,6 +1889,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            return IVAS_ERR_VS_FRAME_NEEDED;
        }
#endif

#ifdef JBM_TSM_ON_TCS
        if ( hVoIP->nSamplesAvailableNext == 0 )
        {
@@ -1907,6 +1908,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs;

            dataUnit = NULL;

#ifdef VARIABLE_SPEED_DECODING
            if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VOIP )
            {
@@ -1966,6 +1968,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
#ifdef VARIABLE_SPEED_DECODING
            }
#endif

            /* decode */
            if ( !hIvasDec->hasBeenFedFirstGoodFrame )
            {
@@ -2060,6 +2063,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
                hVoIP->lastDecodedWasActive = 1;
            }
#endif

            /* limit scale to range supported by time scaler */
            if ( scale < APA_MIN_SCALE )
            {
@@ -3195,14 +3199,30 @@ static ivas_error input_format_API_to_internal(
    return IVAS_ERR_OK;
}


#ifdef JBM_TSM_ON_TCS
static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas )
/*---------------------------------------------------------------------*
 * IVAS_DEC_VoIP_GetRenderGranularity()
 *
 *
 *---------------------------------------------------------------------*/

static int16_t IVAS_DEC_VoIP_GetRenderGranularity(
    Decoder_Struct *st_ivas )
{

    return st_ivas->hTcBuffer->n_samples_granularity;
}

static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec )

/*---------------------------------------------------------------------*
 * IVAS_DEC_VoIP_GetRendererConfig()
 *
 *
 *---------------------------------------------------------------------*/

static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig(
    IVAS_DEC_HANDLE hIvasDec )
{
    JBM_RENDERER_TYPE rendererType;
    rendererType = JBM_RENDERER_NONE;
@@ -3219,7 +3239,17 @@ static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasD
    return rendererType;
}

ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts )

/*---------------------------------------------------------------------*
 * IVAS_DEC_VoIP_reconfigure()
 *
 *
 *---------------------------------------------------------------------*/

ivas_error IVAS_DEC_VoIP_reconfigure(
    IVAS_DEC_HANDLE hIvasDec,
    const uint16_t nTransportChannels,
    const uint16_t l_ts )
{

    IVAS_DEC_VOIP *hVoIP;
@@ -3240,6 +3270,7 @@ ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t n
#else
        startQuality = 1.0f;
#endif

        /* get current renderer type*/
        hVoIP->rendererType = IVAS_DEC_VoIP_GetRendererConfig( hIvasDec );
        hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig;
Loading