Commit f51fba73 authored by norvell's avatar norvell
Browse files

Merge branch 'main' into add-combined-formats-extrend-tests

parents e8ffa243 0bd4a32e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
variables:
  # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this
  # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information
  IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF 44cb5638949b874ce0f5c3bf4359f9db860d88bc
  IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF a31272de16bd1b556269a50bc179321a60f2a500

include:
  - local: .gitlab-ci/variables.yml
@@ -484,7 +484,7 @@ pytest-compare-20ms-and-5ms-rendering:
  needs: ["build-codec-linux-cmake", "build-codec-linux-make", "build-codec-instrumented-linux", "build-codec-sanitizers-linux"]
  script:
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/print-common-info.sh
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/float/disable-limiter.sh
    - bash "${CI_PROJECT_DIR}"/ivas-codec-ci/snippets/disable-limiter.sh
    - make clean
    - make -j
    ### prepare pytest
+12 −1
Original line number Diff line number Diff line
@@ -1083,7 +1083,18 @@ int main(
            fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath );
            goto cleanup;
        }

#ifdef NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND
        if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] );
            goto cleanup;
        }
        if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "Failed to get Distance Attenuation \n\n" );
            goto cleanup;
        }
#endif
        if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
        {
            aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535;
+3 −1
Original line number Diff line number Diff line
@@ -174,7 +174,9 @@
#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ 
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define NONBE_1250_MCMASA_LS_OUTPUT                     /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */

#define NONBE_1302_FIX_OMASA_JBM_FLUSH                  /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */
#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP               /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */

/* ##################### End NON-BE switches ########################### */

+74 −3
Original line number Diff line number Diff line
@@ -1504,17 +1504,54 @@ ivas_error ivas_jbm_dec_flush_renderer(
            if ( ism_mode_old == ISM_MASA_MODE_DISC )
            {
                float *tc_local[MAX_NUM_OBJECTS];
#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH
                int16_t last_dirac_md_idx;
                uint16_t nSamplesAvailableNext;
                ISM_MODE ism_mode_orig;
                RENDERER_TYPE renderer_type_orig;
                int32_t ivas_total_brate;
#endif

                /* 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[ch_idx] = &st_ivas->hTcBuffer->tc[ch_idx + 2][hTcBuffer->n_samples_rendered];
                    mvr2r( st_ivas->hMasaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size );
                }

#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;
                set_s( st_ivas->hSpatParamRendCom->render_to_md_map, last_dirac_md_idx, n_slots_still_available );

                if ( ( error = ivas_omasa_dirac_td_binaural_jbm( st_ivas, (uint16_t) hTcBuffer->n_samples_granularity, nSamplesRendered, &nSamplesAvailableNext, CPE_CHANNELS, p_output ) ) != 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
                if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK )
                {
                    return error;
                }
#endif
            }
        }
        else if ( st_ivas->ivas_format == SBA_ISM_FORMAT )
@@ -1529,20 +1566,20 @@ ivas_error ivas_jbm_dec_flush_renderer(
                RENDERER_TYPE renderer_type_orig;
                int32_t ivas_total_brate;

                /* 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_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];
#ifdef DEBUGGING
                assert( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV );
#endif

                /* 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[ch_idx] = &st_ivas->hTcBuffer->tc[ch_idx][hTcBuffer->n_samples_rendered];
@@ -1571,6 +1608,7 @@ ivas_error ivas_jbm_dec_flush_renderer(
                    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;
@@ -2224,11 +2262,35 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    const int16_t n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{
#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    int16_t ch_idx, num_tc_buffer_mem, n_samples_still_available;
    float tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1];
#endif
    ivas_error error;
    DECODER_TC_BUFFER_HANDLE hTcBuffer;

    hTcBuffer = st_ivas->hTcBuffer;

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    num_tc_buffer_mem = 0;
    n_samples_still_available = 0;

    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
        /* save samples of the TC buffer from the previous frame */
        num_tc_buffer_mem = min( hTcBuffer->nchan_transport_internal, nchan_transport_internal );
        n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered;

        /* what is remaining from last frame needs always be smaller than the new granularity */
        assert( n_samples_still_available < n_samples_granularity );

        for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
        {
            mvr2r( hTcBuffer->tc_buffer_old[ch_idx] + hTcBuffer->n_samples_flushed, tc_buffer_mem[ch_idx], n_samples_still_available );
        }
    }

#endif
    /* if granularity changes, adapt subframe_nb_slots */
    if ( n_samples_granularity != hTcBuffer->n_samples_granularity )
    {
@@ -2268,11 +2330,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    hTcBuffer->nchan_buffer_full = nchan_full;
    hTcBuffer->n_samples_granularity = n_samples_granularity;

#ifndef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
#ifdef DEBUGGING
    /* what is remaining from last frames needs always be smaller than n_samples_granularity */
    assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity );
#endif

#endif
    /* reallocate TC audio buffers */

    ivas_jbm_dec_tc_audio_deallocate( hTcBuffer );
@@ -2282,6 +2345,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
        return error;
    }

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    /* propagate samples of the TC buffer from the previous frame */
    for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
    {
        mvr2r( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old[ch_idx], n_samples_still_available );
    }

#endif
    return IVAS_ERR_OK;
}