Commit 269979ba authored by Brown, Stefanie's avatar Brown, Stefanie
Browse files

Merge branch 'main' into dlb/cont-47-low-bitrate-SBA-update2

parents 0545f2fa 65ef6ef7
Loading
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -321,7 +321,6 @@ codec-smoke-test:
    - *print-common-info
    - bash ci/smoke_test.sh
    ### analyze for failures
    - cat out/logs/stv1MASA2TC48c_MASA_2TC_1DIR_b96_fb_cbr.enc.txt
    - if cat smoke_test_output.txt | grep -c "failed"; then echo "Smoke test without PLC failed"; exit 1; fi
    - if cat smoke_test_output_plc.txt | grep -c "failed"; then echo "Smoke test with PLC failed"; exit 1; fi
    - if cat smoke_test_output_jbm_noEXT.txt | grep -c "failed"; then echo "Smoke test JBM part failed"; exit 1; fi
+5 −0
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@ typedef struct
    float last_true_azimuth;   /* MD smoothing in DTX- last true Q azimuth value */
    float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */

#ifdef FIX_387_ISM_MD_FEC
    int16_t ism_md_fec_cnt_enc;  /* counter of continuous frames where MD are not transmitted */
    int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */
#endif

} ISM_METADATA_FRAME, *ISM_METADATA_HANDLE;


+2 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@
/*#define DEBUG_MODE_TCX*/                      /* output most important TCX core parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_DFT*/                      /* output most important DFT stereo parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_TD*/                       /* output most important TD stereo parameters to the subdirectory "res/ */
//#define DEBUG_MODE_DIRAC                   /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_DIRAC*/                    /* output most important DIRAC parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_MDCT*/                     /* output most important MDCT parameters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_MC */                /* output Parametric MC paramters to the subdirectory "res/" */
/*#define DEBUG_MODE_PARAM_ISM*/                /* output Parametric ISM paramters to the subdirectory "res/" */
@@ -150,6 +150,7 @@
#define SNS_MSVQ                                        /* FhG: contribution 33 - MSVQ for SNS parameters at stereo mid bitrates */

#define FIX_379_GAININTP                                /* Eri: Adds a gain interpolation for directional/distance gain to handle abrupt changes in metadata (Non BE) */
#define FIX_387_ISM_MD_FEC                              /* VA: Issue 387: fix MD discontinuity in ISM FEC */

#define FIX_418_SID_BITRATE                             /* Eri: Issue 418: Using the correct bitrate for unified stereo SID */
#define PARAMMC_SHORT_ENC_MDFT                          /* FhG: Issue 410: complexity optimization for parametric Multichannel modes */
+5 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static ivas_error ivas_ism_bitrate_switching(
    int32_t element_brate_tmp[MAX_NUM_OBJECTS];
    int16_t nSCE_old, nCPE_old;
#ifdef FIX_416_ISM_BR_SWITCHING
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old;
    int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode;
#endif

    error = IVAS_ERR_OK;
@@ -65,7 +65,11 @@ static ivas_error ivas_ism_bitrate_switching(
    nSCE_old = st_ivas->nSCE;

#ifdef FIX_416_ISM_BR_SWITCHING
    /* we have to temporarily set the ism mode back to the old one, otherwise this can give wrong results*/
    ism_mode = st_ivas->ism_mode;
    st_ivas->ism_mode = last_ism_mode;
    ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old );
    st_ivas->ism_mode = ism_mode;
#endif

    if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK )
+77 −8
Original line number Diff line number Diff line
@@ -56,6 +56,11 @@
#define ISM_MAX_RADIUS_DIFF_IDX    ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ )

#define ISM_FEC_MAX 10
#ifdef FIX_387_ISM_MD_FEC
#define ISM_MD_FEC_DIFF         10
#define ISM_MD_INC_DIFF_CNT_MAX 6
#define ISM_MD_FEC_CNT_MAX      25
#endif

#define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters)  */

@@ -195,7 +200,6 @@ ivas_error ivas_ism_metadata_enc(

    push_wmops( "ism_meta_enc" );


    /* initialization */
    ism_metadata_flag_global = 0;
    set_s( nb_bits_metadata, 0, nchan_transport );
@@ -218,6 +222,37 @@ ivas_error ivas_ism_metadata_enc(
        else if ( ism_mode == ISM_MODE_DISC )
        {
            hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10;

#ifdef FIX_387_ISM_MD_FEC
            /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */
            if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
            {
                if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) ||
                     ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) )
                {
                    hIsmMeta[ch]->ism_metadata_flag = 1;
                    hIsmMeta[ch]->ism_md_inc_diff_cnt = 0;
                }
                else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX )
                {
                    hIsmMeta[ch]->ism_metadata_flag = 1;

                    if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 )
                    {
                        hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX;
                    }
                    else
                    {
                        hIsmMeta[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX;
                    }
                }
                else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX )
                {
                    hIsmMeta[ch]->ism_metadata_flag = 1;
                    hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX;
                }
            }
#endif
        }
    }

@@ -307,7 +342,9 @@ ivas_error ivas_ism_metadata_enc(
                    idx_angle1_abs = hParamIsm->azi_index[ch];
                    idx_angle2_abs = hParamIsm->ele_index[ch];
                }

                encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] );

                /*----------------------------------------------------------------*
                 * Quantize and encode radius, yaw, and pitch
                 *----------------------------------------------------------------*/
@@ -317,6 +354,7 @@ ivas_error ivas_ism_metadata_enc(
                    idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS );
                    idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS );
                    idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS );

                    encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] );
                    encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] );
                }
@@ -326,6 +364,12 @@ ivas_error ivas_ism_metadata_enc(
                {
                    nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start;
                }

#ifdef FIX_387_ISM_MD_FEC
                /* Updates */
                hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth;
                hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation;
#endif
            }
        }

@@ -462,6 +506,19 @@ ivas_error ivas_ism_metadata_enc(
    for ( ch = 0; ch < nchan_ism; ch++ )
    {
        hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag;

#ifdef FIX_387_ISM_MD_FEC
        if ( hIsmMeta[ch]->ism_metadata_flag == 0 )
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc++;
        }
        else
        {
            hIsmMeta[ch]->ism_md_fec_cnt_enc = 0;
        }
        hIsmMeta[ch]->ism_md_inc_diff_cnt++;
        hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX );
#endif
    }

    for ( ch = 0; ch < nchan_transport; ch++ )
@@ -547,6 +604,13 @@ ivas_error ivas_ism_metadata_enc_create(

        st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f;
        st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f;

#ifdef FIX_387_ISM_MD_FEC
        st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0.0f;
        st_ivas->hIsmMetaData[ch]->last_true_elevation = 0.0f;
        st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0;
        st_ivas->hIsmMetaData[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX;
#endif
    }

    if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK )
@@ -1032,6 +1096,11 @@ void ivas_ism_metadata_sid_enc(
                    hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth );
                    hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation );
                }

#ifdef FIX_387_ISM_MD_FEC
                hIsmMetaData->ism_md_fec_cnt_enc = 0;
                hIsmMeta[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX;
#endif
            }
        }

Loading