Commit 36f0a8dc authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

Merge branch '1890_basop_mr2052' into 'main'

[non-BE] BASOP porting of MR 2052 (#1890)

See merge request !2037
parents 4368d1c4 f9285fc4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@
#define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH               /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */
#define NONBE_1293_CRASH_FIRST_FRAME_LOST               /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */
#define FIX_1384_MSAN_stereo_tcx_core_enc               /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */
#define NONBE_FIX_1297_SPAR_JBM_MEM_SAN                 /* Dolby: issue 1297, SPAR + JBM + BR switch memory sanitizer */

// object-editing feature porting
#define OBJ_EDITING_API                                 /* object editing changes related to the API */
+99 −72
Original line number Diff line number Diff line
@@ -2979,14 +2979,29 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
#endif
            }
        }
        ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
        {
        ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) ){
#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
            IF( EQ_32( ism_mode_old, ISM_SBA_MODE_DISC ) ){
#endif
                Word32 * tc_local_fx[MAX_TRANSPORT_CHANNELS];
        Word16 last_spar_md_idx;
        Word16 last_dirac_md_idx;
        UWord16 nSamplesAvailableNext;
#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
        ISM_MODE ism_mode_orig;
        RENDERER_TYPE renderer_type_orig;
        Word32 ivas_total_brate;

        ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
        renderer_type_orig = st_ivas->renderer_type;
        ism_mode_orig = st_ivas->ism_mode;

        /* to render flushed samples, use configuration from the last received frame */
        move32();
        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;
#endif

        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];
@@ -2996,7 +3011,11 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
        /* copy from ISM delay buffer to the correct place in TCs */
        FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
        {
#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
            tc_local_fx[ch_idx] = &st_ivas->hTcBuffer->tc_fx[ch_idx][hTcBuffer->n_samples_rendered];
#else
            tc_local_fx[ch_idx] = &st_ivas->hTcBuffer->tc_fx[ch_idx + 2][hTcBuffer->n_samples_rendered];
#endif
            Copy32( st_ivas->hSbaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hSbaIsmData->delayBuffer_size );
        }

@@ -3032,12 +3051,19 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
            return error;
        }

#ifdef NONBE_FIX_1297_SPAR_JBM_MEM_SAN
        /* 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;
    }
#endif
}
ELSE
{
    return IVAS_ERROR( IVAS_ERR_WRONG_MODE, "Wrong IVAS format in VoIP renderer flushing!" );
}

hTcBuffer->n_samples_rendered = hTcBuffer->n_samples_granularity;
}

@@ -3065,6 +3091,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
}

ivas_syn_output_fx( p_output_fx, Q11, *nSamplesRendered, st_ivas->hDecoderConfig->nchan_out, data );

return IVAS_ERR_OK;
}