Commit 1c3b4f06 authored by bayers's avatar bayers
Browse files

fix EVS JBM BE, fix JBM bit rate switching for SBA, clang-format

parent 665014b2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ static
#define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20
#endif
#ifdef JBM_TSM_ON_TCS
#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 5
#define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20
#define FRAME_SIZE_NS                   20000000L
#endif

+6 −1
Original line number Diff line number Diff line
@@ -1026,16 +1026,21 @@ ivas_error ivas_dirac_dec_config(
    /* allocate transport channels*/
    if ( flag_config == DIRAC_OPEN )
    {
        if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC )
        if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL )
        {
            if ( st_ivas->sba_mode == SBA_MODE_DIRAC )
            {
                int16_t nchan_to_allocate;

                nchan_to_allocate = nchan_transport;
                if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) )
                {
                    nchan_to_allocate++; /* we need a channel for the CNG in this case*/
                }
                if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
                {
                    nchan_to_allocate = 2 * BINAURAL_CHANNELS;
                }
                if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_to_allocate, nchan_to_allocate, hDirAC->slot_size ) ) != IVAS_ERR_OK )
                {
                    return error;
+5 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ ivas_error ivas_spar_dec_open(
        }
    }
    /* allocate transport channels*/
    if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC )
    if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL )
    {
        int16_t nchan_to_allocate;
        int16_t nchan_tc;
@@ -205,6 +205,10 @@ ivas_error ivas_spar_dec_open(
            nchan_tc = st_ivas->hDecoderConfig->nchan_out;
            nchan_to_allocate = nchan_tc;
        }
        else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
            nchan_to_allocate = 2 * BINAURAL_CHANNELS;
        }
        if ( ( error = ivas_jbm_dec_tc_buffer_open( st_ivas, buffer_mode, nchan_tc, nchan_to_allocate, nchan_to_allocate, NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ) != IVAS_ERR_OK )
        {
            return error;
+42 −2
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct apa_state_t
{
    /* output buffer */
#ifdef JBM_TSM_ON_TCS
    bool evs_compat_mode;
    float *buf_out;
#else
    int16_t *buf_out;
@@ -187,6 +188,10 @@ ivas_error apa_init(
        return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) );
    }

#ifdef JBM_TSM_ON_TCS
    ps->evs_compat_mode = false;
#endif

    apa_reset( ps );
    *pps = ps;

@@ -406,6 +411,19 @@ bool apa_set_renderer_residual_samples(
    ps->l_r_buf = l_r_buf * ps->num_channels;
    return 0;
}

bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode )
{
    /* make sure pointer is valid */
    if ( ps == NULL )
    {
        return 1;
    }

    ps->evs_compat_mode = mode;

    return 0;
}
#endif

/*
@@ -1291,7 +1309,18 @@ static bool shrink_frm(
        {
            return 1;
        }
#ifdef JBM_TSM_ON_TCS
        if ( ps->evs_compat_mode == true )
        {
            overlapAddEvs( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win );
        }
        else
        {
#endif
            overlapAdd( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win );
#ifdef JBM_TSM_ON_TCS
        }
#endif
    }
    else
    {
@@ -1517,7 +1546,18 @@ static bool extend_frm(
            fadeOut = frm_in + l_frm + xtract[n - 1] + l_seg;
            fadeIn = frm_in + l_frm + xtract[n];
            out = frm_out + ( n - 2 ) * l_seg;
#ifdef JBM_TSM_ON_TCS
            if ( ps->evs_compat_mode == true )
            {
                overlapAddEvs( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win );
            }
            else
            {
#endif
                overlapAdd( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win );
#ifdef JBM_TSM_ON_TCS
            }
#endif
        }
        else
        {
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts );

bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf );

bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode );

uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, uint16_t l_ts );
#endif

Loading