Commit dfecf010 authored by vaclav's avatar vaclav
Browse files

port MR

parent 5d9d739f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */

#define FIX_1959_assert_in_gain_enc_mless_fx            /* VA: Fix saturation introduced by the usage of the non-EVS basop operators =, the saturation was expected */
#define NONBE_1302_FIX_OMASA_JBM_FLUSH                  /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */
#define NONBE_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328  */

/* #################### End BASOP porting switches ############################ */
+44 −1
Original line number Diff line number Diff line
@@ -2712,6 +2712,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
    DECODER_TC_BUFFER_HANDLE hTcBuffer;
    Word32 *p_output_fx[MAX_CICP_CHANNELS + MAX_NUM_OBJECTS];
    Word16 nchan_in, nchan_out;

    IF( !st_ivas->hDecoderConfig->Opt_tsm )
    {
        return IVAS_ERR_OK;
@@ -2892,7 +2893,15 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
#else
                Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS];
#endif
#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH
                Word16 last_dirac_md_idx;
                UWord16 nSamplesAvailableNext;
                ISM_MODE ism_mode_orig;
                RENDERER_TYPE renderer_type_orig;
                Word32 ivas_total_brate;
#endif

                /* copy from ISM delay buffer to the correct place in TCs */
                move16();
                FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
                {
@@ -2900,6 +2909,34 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    Copy32( st_ivas->hMasaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size ); /*Q11*/
                }

#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH
                /* to render flushed samples, use configuration from the last received frame */
                ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
                renderer_type_orig = st_ivas->renderer_type;
                ism_mode_orig = st_ivas->ism_mode;
                st_ivas->ism_mode = ism_mode_old;
                st_ivas->renderer_type = renderer_type_old;
                st_ivas->hDecoderConfig->ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;
                last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1];

                /* transfer adapted sf info from hTcBuffer to DirAC */
                st_ivas->hSpatParamRendCom->nb_subframes = 1;
                st_ivas->hSpatParamRendCom->subframes_rendered = 0;
                st_ivas->hSpatParamRendCom->subframe_nbslots[0] = JBM_CLDFB_SLOTS_IN_SUBFRAME;
                st_ivas->hSpatParamRendCom->slots_rendered = 0;
                st_ivas->hSpatParamRendCom->num_slots = JBM_CLDFB_SLOTS_IN_SUBFRAME;
                set16_fx( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available );

                IF( ( error = ivas_omasa_dirac_td_binaural_jbm_fx( st_ivas, (UWord16) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, CPE_CHANNELS, p_output_fx ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

                /* restore original configuration */
                st_ivas->ism_mode = ism_mode_orig;
                st_ivas->renderer_type = renderer_type_orig;
                st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate;
#else
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
                IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) )
                {
@@ -2924,6 +2961,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    move16();
                    move16();
                }
#endif
#endif
            }
        }
@@ -2934,11 +2972,14 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
            Word16 last_dirac_md_idx;
            UWord16 nSamplesAvailableNext;

            /* to render flushed samples, use configuration from the last received frame */

            last_spar_md_idx = st_ivas->hSpar->render_to_md_map[st_ivas->hSpar->slots_rendered - 1];
            last_dirac_md_idx = st_ivas->hSpatParamRendCom->render_to_md_map[st_ivas->hSpatParamRendCom->slots_rendered - 1];
            move16();
            move16();
            /* copy from ISM delay buffer to the correct place in tcs */

            /* copy from ISM delay buffer to the correct place in TCs */
            FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
            {
                tc_local_fx[ch_idx] = &st_ivas->hTcBuffer->tc_fx[ch_idx + 2][hTcBuffer->n_samples_rendered];
@@ -2976,6 +3017,8 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
            {
                return error;
            }

            /* restore original configuration */
        }
        ELSE
        {