Commit b054e79a authored by vaclav's avatar vaclav
Browse files

port float MR 2075

parent 6b75151f
Loading
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -98,22 +98,17 @@
#define FIX_1113_EXTREND_ISAR                           /* FhG: issue 1113: fix external renderer asserts for FOA/HOA2 and CLDFB config */
#define FIX_1166_TDREND_DIV0                            /* FhG,Eri: issue 1166: potential divide by zero in TD Renderer */
#define NONBE_1203_MDCT2DFT_SWITCHING                   /* VA: issue 1203: fix severe artifacts during MDCT to DFT stereo switching when MDCT ITD is not used */
#define NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX         /* FhG: Avoid JBM ignoring safety margin and setting playout delay to 0 during DTX */
#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 FIX_938_COMPILER_WARNING                        /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */
#define FIX_1376_MISSING_ISM_METADATA                   /* FhG: IVAS_rend: throw error if there exists an ISM input without a corresponding metadata file path */
#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 FIX_1349_TNS_CRASH                              /* FhG: Fix crash in TNS entropy coding, in case order of joint TNS coding is reduced to 0 */
#define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING           /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms  in PhECU-PLC  */
#define FIX_1179_USAN_PHASEECU                          /* Eri: issue 1179:  better handling of 16 bit wrap around for very long(>200ms) FER-bursts   */
#define NONBE_1199_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1199: fix bug in renderer flush in OMASA JBM bitrate switching */
#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 */
#define NONBE_1303_GRANULARITY_OSBA_REND                /* VA: issue 1303: Correctly set the granularity in OSBA, Disc mode, and BINAURAL_ROOM_REVERB output */
#define NONBE_1303_REND_GRANULARITY                     /* VA: issue 1303: Renderer granularity revision */

// object-editing feature porting
+10 −39
Original line number Diff line number Diff line
@@ -63,11 +63,7 @@ static Word16 sqrt2ndOrder( const Word16 );
static void windowing( const Word16 *, Word16 *, const Word16 *, const Word16, const Word16 );
static void windowing_ROM_optimized( const Word16 *, Word16 *, const Word16, const Word16, const Word16 );
static void fft_spec2_fx( const Word16[], Word32[], const Word16 );
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * );
#else
static void trans_ana_fx( const Word16 *, Word16 *, Word16 *, Word16 *, const Word16, const Word16, const Word16, const Word16, Word16 *, Word16 *, Word16 *, Word16 * );
#endif
static void peakfinder_fx( const Word16 *, const Word16, Word16 *, Word16 *, const Word16 );
static Word16 imax_fx( const Word16 *, const Word16 );
static void spec_ana_fx( const Word16 *prevsynth, Word16 *plocs, Word32 *plocsi, Word16 *num_plocs, Word16 *X_sav, const Word16 output_frame, const Word16 bwidth_fx, Word16 *Q );
@@ -234,9 +230,7 @@ static void trans_ana_fx(
    const Word16 time_offs,       /* i  : Time offset (integral multiple of output_frame)        */
    const Word16 est_mus_content, /* i  : 0.0=speech_like ... 1.0=Music    (==st->env_stab )     */
    const Word16 last_fec,        /* i  : signal that previous frame was concealed with fec_alg  */
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
    const Word16 element_mode,    /* i :  element_mode req to handle EVS_MONO specific BE path   */
#endif
    Word16 *alpha,                /* o  : Magnitude modification factors for fade to average     */
    Word16 *beta,                 /* o  : Magnitude modification factors for fade to average     */
    Word16 *beta_mute,            /* o  : Factor for long-term mute Q15                          */
@@ -562,7 +556,6 @@ static void trans_ana_fx(
            mag_chg[k] = mult_r( mag_chg_1st[k], att_val ); /* Q15 */
            move16();

#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING
            IF( NE_16( element_mode, EVS_MONO ) )
            {
                IF( EQ_16( k, 0 ) && GT_16( burst_len, BETA_MUTE_THR ) ) /* beta_mute final long term attenuation adjusted only once per frame in the first sub-band, Ref   Eq(184) in 26.447 */
@@ -579,13 +572,7 @@ static void trans_ana_fx(
                    move16();
                }
            }
#else
            IF( GT_16( burst_len, BETA_MUTE_THR ) )
            {
                *beta_mute = shr( *beta_mute, 1 );
                move16();
            }
#endif

            alpha[k] = mag_chg[k];
            move16();
            /*beta[k] = sqrt(1.0f - SQR(alpha[k])) * *beta_mute;*/
@@ -4545,13 +4532,9 @@ static void ivas_hq_phase_ecu_fx(
#endif

        offset = add( sub( sub( shl( output_frame, 1 ), lprot ), *time_offs ), ph_ecu_lookahead );
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING

        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      *last_fec, element_mode, alpha, beta, beta_mute, Xavg );
#else
        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      *last_fec, alpha, beta, beta_mute, Xavg );
#endif

        ivas_spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec, element_mode, &noise_fac, pcorr );

@@ -4571,13 +4554,9 @@ static void ivas_hq_phase_ecu_fx(
        *time_offs = add_sat( *time_offs, output_frame );
        move16();
        offset = sub( shl( output_frame, 1 ), lprot );
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING

        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      0, element_mode, alpha, beta, beta_mute, Xavg );
#else
        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      0, alpha, beta, beta_mute, Xavg );
#endif
    }

    Copy( X_sav, X, lprot );
@@ -4666,13 +4645,9 @@ static void hq_phase_ecu_fx(
        }

        offset = sub( sub( shl( output_frame, 1 ), lprot ), *time_offs );
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING

        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      *last_fec, EVS_MONO, alpha, beta, beta_mute, Xavg );
#else
        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      *last_fec, alpha, beta, beta_mute, Xavg );
#endif

        spec_ana_fx( prevsynth + offset, plocs, plocsi, num_p, X_sav, output_frame, bwidth_fx, Q_spec );

@@ -4697,13 +4672,9 @@ static void hq_phase_ecu_fx(
        move16();

        offset = sub( shl( output_frame, 1 ), lprot );
#ifdef NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING

        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      0, EVS_MONO, alpha, beta, beta_mute, Xavg );
#else
        trans_ana_fx( prevsynth + offset, mag_chg, &ph_dith, mag_chg_1st, output_frame, *time_offs, env_stab,
                      0, alpha, beta, beta_mute, Xavg );
#endif
    }

    Copy( X_sav, X, lprot );
+91 −99
Original line number Diff line number Diff line
@@ -2947,15 +2947,14 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
#endif
            }
        }
        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
        ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
        {
            IF( EQ_32( ism_mode_old, ISM_SBA_MODE_DISC ) )
            {
                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;
@@ -2969,7 +2968,6 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                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];
@@ -2979,11 +2977,7 @@ 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 );
                }

@@ -3019,13 +3013,11 @@ 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
        {
+0 −4
Original line number Diff line number Diff line
@@ -207,13 +207,9 @@ ivas_error ivas_sba_dec_reconfigure_fx(
        ELSE
        {
            test();
#ifdef NONBE_1303_GRANULARITY_OSBA_REND
            test();
            test();
            IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
#else
            IF( EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) || EQ_16( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
#endif
            {
                renderer_type_new = RENDERER_BINAURAL_FASTCONV;
                move16();
+0 −8
Original line number Diff line number Diff line
@@ -774,7 +774,6 @@ static void JB4_targetPlayoutDelay(
    move32();
    move32();

#ifdef NONBE_1122_JBM_FIX_PLAYOUT_DELAY_IN_DTX
#ifdef NONBE_1122_KEEP_EVS_MODE_UNCHANGED
    IF( !h->evsMode )
    {
@@ -786,13 +785,6 @@ static void JB4_targetPlayoutDelay(
#endif
    *targetStartUp = JB4_MAX( *targetStartUp, (UWord32) h->safetyMargin );
    move32();
#else
    if ( LT_64( *targetStartUp, 60 ) )
    {
        *targetStartUp = 60;
        move32();
    }
#endif

    return;
}
Loading