Commit 134ce55e authored by vaclav's avatar vaclav
Browse files

call ivas_jbm_dec_set_discard_samples() at one common place

parent c582f308
Loading
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
        mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
    }

#ifndef NONBE_1303_REND_GRANULARITY
    /* JBM: when granularity goes down (e.g. Discrete ISM with TD Obj Renderer -> ParamISM with binaural fastconv
            render what still fits in the new granularity */
#ifdef NONBE_1303_REND_GRANULARITY
@@ -142,7 +143,7 @@ static ivas_error ivas_ism_bitrate_switching_dec(
            return error;
        }
    }

#endif
    if ( st_ivas->ism_mode != last_ism_mode )
    {
        /* EFAP handle */
@@ -310,7 +311,9 @@ static ivas_error ivas_ism_bitrate_switching_dec(
    tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas );
    tc_nchan_allocate_new = tc_nchan_tc_new;
    tc_nchan_full_new = tc_nchan_tc_new;

#ifdef NONBE_1303_REND_GRANULARITY
    tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
#endif

    if ( st_ivas->ism_mode == ISM_MODE_PARAM && ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM ) )
    {
+2 −0
Original line number Diff line number Diff line
@@ -1502,6 +1502,7 @@ ivas_error ivas_masa_dec_reconfigure(
            {
                tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS;
            }
#ifndef NONBE_1303_REND_GRANULARITY
            if ( st_ivas->ivas_format == MASA_ISM_FORMAT && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode == ISM_MASA_MODE_DISC )
            {
#ifndef NONBE_1303_REND_GRANULARITY
@@ -1522,6 +1523,7 @@ ivas_error ivas_masa_dec_reconfigure(
                    /* flush already done in IVAS_DEC_ReadFormat() */
                }
            }
#endif
        }
        else if ( st_ivas->nchan_transport == 1 && ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirACRend->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) )
        {
+5 −1
Original line number Diff line number Diff line
@@ -793,6 +793,7 @@ static ivas_error ivas_mc_dec_reconfig(
        }
    }

#ifndef NONBE_1303_REND_GRANULARITY
    /* JBM: when granularity goes down (e.g. MCT with CREND -> ParamMC with binaural fastconv
            render what still fits in the new granularity */
#ifdef NONBE_1303_REND_GRANULARITY
@@ -813,7 +814,7 @@ static ivas_error ivas_mc_dec_reconfig(
            return error;
        }
    }

#endif
    if ( st_ivas->mc_mode == MC_MODE_MCT )
    {
        st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) );
@@ -1300,6 +1301,9 @@ static ivas_error ivas_mc_dec_reconfig(
        tc_nchan_tc_new = ivas_jbm_dec_get_num_tc_channels( st_ivas );
        tc_nchan_allocate_new = tc_nchan_tc_new;
        tc_nchan_full_new = tc_nchan_tc_new;
#ifdef NONBE_1303_REND_GRANULARITY
        tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
#endif

        if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
        {
+12 −0
Original line number Diff line number Diff line
@@ -208,6 +208,17 @@ ivas_error ivas_sba_dec_reconfigure(
        }
#endif

#ifdef NONBE_1303_REND_GRANULARITY
        if ( granularity_new > st_ivas->hTcBuffer->n_samples_granularity )
        {
            /* make sure the changed number of slots in the last subframe is not lost in the following steps */
            if ( st_ivas->hSpatParamRendCom != NULL )
            {
                st_ivas->hSpatParamRendCom->subframe_nbslots[st_ivas->hSpatParamRendCom->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1];
            }
            st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1];
        }
#else
        /* flush renderer on granularity change form 5ms to 1.25ms, again only possible for binaural rendering */
        if ( granularity_new < st_ivas->hTcBuffer->n_samples_granularity )
        {
@@ -227,6 +238,7 @@ ivas_error ivas_sba_dec_reconfigure(
            }
            st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->nb_subframes - 1] = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->nb_subframes - 1];
        }
#endif
    }

    /* save old */
+11 −1
Original line number Diff line number Diff line
@@ -1053,7 +1053,7 @@ ivas_error IVAS_DEC_ReadFormat(

#ifdef NONBE_1303_REND_GRANULARITY
        if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) ||
             ( renderer_type_sec_old != renderer_type_sec_new && renderer_type_sec_old != RENDERER_DISABLE ) )
             ( renderer_type_sec_old != renderer_type_sec_new ) )
#else
        if ( ( renderer_type_old != st_ivas->renderer_type && renderer_type_old != RENDERER_DISABLE ) ||
             ( st_ivas->ini_active_frame > 0 && ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == MASA_ISM_FORMAT ) && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC && st_ivas->ism_mode != ISM_MASA_MODE_DISC ) )
@@ -1075,6 +1075,16 @@ ivas_error IVAS_DEC_ReadFormat(
                    return error;
                }
            }
#ifdef NONBE_1303_REND_GRANULARITY
            /* JBM: when granularity goes up set samples to discard at the beginning of the frame */
            else if ( tc_granularity_new > st_ivas->hTcBuffer->n_samples_granularity )
            {
                if ( ( error = ivas_jbm_dec_set_discard_samples( st_ivas ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
            }
#endif
        }
    }