Commit 5970ca8d authored by vaclav's avatar vaclav
Browse files

port NONBE_1303_REND_GRANULARITY

parent c4f46c08
Loading
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -999,11 +999,18 @@ Word16 IGF_MapBitRateToIndex(
    const Word16 rf_mode       /* i  :  flag to signal the RF mode */
);

Word16 ivas_jbm_dec_get_render_granularity(
#ifdef NONBE_1303_REND_GRANULARITY
Word16 ivas_jbm_dec_get_render_granularity_fx(
    const RENDERER_TYPE renderer_type,                          /* i  : renderer type                                               */
    const RENDERER_TYPE renderer_type_sec,                      /* i  : secondary renderer type                                     */
    const int32_t output_Fs                                     /* i  : sampling rate                                               */
#else
Word16 ivas_jbm_dec_get_render_granularity
    const RENDERER_TYPE rendererType, /* i  : renderer type     */
    const IVAS_FORMAT ivas_format,    /* i  : ivas format */
    const MC_MODE mc_mode,            /* i  : MC mode */
    const Word32 output_Fs            /* i  : sampling rate     */
    #endif
);

// ivas_stereo_dft_com.c
@@ -6221,7 +6228,7 @@ void ivas_renderer_select(

#ifdef FIX_CREND_SIMPLIFY_CODE
/*! r: secondary binaural renderer type */
RENDERER_TYPE ivas_renderer_secondary_select(
RENDERER_TYPE ivas_renderer_secondary_select_fx(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif
+1 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@
#define FIX_1385_INIT_IGF_STOP_FREQ                     /* FhG: Initialize infoIGFStopFreq in init_igf_dec() */
#define FIX_1387_INIT_PRM_SQQ                           /* FhG: initialize pointer prm_sqQ, which might be uninitialized in case of bfi == 1 */
#define NONBE_1296_TDREND_ITD_OUT_OF_BOUNDS_ACCESS      /* Eri: issue 1296: ITD resampling can occasionally read out of bounds, especially when the requested subframes are short (1.25 ms). Seen for headtracking+JBM. */
#define NONBE_1303_REND_GRANULARITY                     /* VA: issue 1303: Renderer granularity revision */

/* #################### End BASOP porting switches ############################ */

+12 −3
Original line number Diff line number Diff line
@@ -2645,7 +2645,7 @@ ivas_error ivas_init_decoder_fx(
                return error;
            }
        }

#ifndef NONBE_1303_REND_GRANULARITY
        granularity = NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES );

        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );
@@ -2655,6 +2655,7 @@ ivas_error ivas_init_decoder_fx(
        {
            return error;
        }
#endif
    }
    ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_MC ) )
    {
@@ -2704,7 +2705,7 @@ ivas_error ivas_init_decoder_fx(

        st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns;
        move32();

#ifndef NONBE_1303_REND_GRANULARITY
        test();
        IF( ( EQ_32( st_ivas->ivas_format, MC_FORMAT ) ) && ( EQ_32( st_ivas->mc_mode, MC_MODE_PARAMUPMIX ) ) )
        {
@@ -2727,6 +2728,7 @@ ivas_error ivas_init_decoder_fx(
                return error;
            }
        }
#endif
    }

    IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
@@ -2765,7 +2767,7 @@ ivas_error ivas_init_decoder_fx(

            IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
            {
                IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) )
                IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, output_Fs ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
@@ -3013,9 +3015,16 @@ ivas_error ivas_init_decoder_fx(
    IF( st_ivas->hTcBuffer == NULL )
    {
        /* no module has yet open the TC buffer, open a default one */
#ifdef NONBE_1303_REND_GRANULARITY
        granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, ivas_renderer_secondary_select_fx( st_ivas ), output_Fs );
        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );

        IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, granularity ) ), IVAS_ERR_OK ) )
#else
        n_channels_transport_jbm = ivas_jbm_dec_get_num_tc_channels_fx( st_ivas );

        IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, ivas_jbm_dec_get_tc_buffer_mode( st_ivas ), n_channels_transport_jbm, n_channels_transport_jbm, n_channels_transport_jbm, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) )
#endif
        {
            return error;
        }
+5 −2
Original line number Diff line number Diff line
@@ -169,7 +169,11 @@ static ivas_error ivas_ism_bitrate_switching_dec_fx(

        /* 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
        tc_granularity_new = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, st_ivas->hDecoderConfig->output_Fs );
#else
        tc_granularity_new = ivas_jbm_dec_get_render_granularity( st_ivas->renderer_type, st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs );
#endif

        IF( LT_16( tc_granularity_new, st_ivas->hTcBuffer->n_samples_granularity ) ){
#ifdef FIX_HRTF_LOAD
@@ -181,8 +185,7 @@ static ivas_error ivas_ism_bitrate_switching_dec_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 ) )
            {
+15 −1
Original line number Diff line number Diff line
@@ -584,7 +584,11 @@ ivas_error ivas_param_ism_dec_open_fx(
    Decoder_Struct *st_ivas /* i/o: IVAS decoder structure      */
)
{
#ifdef NONBE_1303_REND_GRANULARITY
    Word16 i, granularity;
#else
    Word16 i;
#endif
    PARAM_ISM_DEC_HANDLE hParamIsmDec;
    IVAS_OUTPUT_SETUP hOutSetup;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
@@ -747,6 +751,9 @@ ivas_error ivas_param_ism_dec_open_fx(
    st_ivas->hParamIsmDec = hParamIsmDec;
    st_ivas->hSpatParamRendCom = hSpatParamRendCom;

#ifdef NONBE_1303_REND_GRANULARITY
    granularity = ivas_jbm_dec_get_render_granularity_fx( st_ivas->renderer_type, RENDERER_DISABLE, output_Fs );
#endif

    test();
    IF( NE_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) && NE_32( st_ivas->renderer_type, RENDERER_DISABLE ) )
@@ -793,8 +800,11 @@ ivas_error ivas_param_ism_dec_open_fx(

        IF( st_ivas->hTcBuffer == NULL )
        {
#ifdef NONBE_1303_REND_GRANULARITY
            IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, granularity ) ), IVAS_ERR_OK ) )
#else
            IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_RENDERER, nchan_transport, nchan_transport, nchan_full, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) )

#endif
            {
                return error;
            }
@@ -807,8 +817,12 @@ ivas_error ivas_param_ism_dec_open_fx(
        IF( st_ivas->hTcBuffer == NULL )
        {
            Word16 nchan_to_allocate = st_ivas->hDecoderConfig->nchan_out;
#ifdef NONBE_1303_REND_GRANULARITY
            IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, granularity ) ), IVAS_ERR_OK ) )
#else
            move16(); // NS2SA
            IF( NE_32( ( error = ivas_jbm_dec_tc_buffer_open_fx( st_ivas, TC_BUFFER_MODE_BUFFER, nchan_to_allocate, nchan_to_allocate, nchan_to_allocate, NS2SA_FX2( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ) ) ), IVAS_ERR_OK ) )
#endif
            {
                return error;
            }
Loading