Commit a644681f authored by multrus's avatar multrus
Browse files

Merge branch '20250817_cleanup_float' into 'ivas-float-update'

[non-be] Clean-up of ivas-float-update

See merge request !2097
parents b1ebb9d3 375ec4f8
Loading
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -3513,14 +3513,10 @@ static ivas_error decodeVoIP(
        }
        vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len;
        frame++;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        if ( vec_pos_update == 0 )
        {
            systemTime_ms += vec_pos_len * systemTimeInc_ms;
        }
#else
        systemTime_ms += systemTimeInc_ms;
#endif

#ifdef WMOPS
        update_mem();
@@ -3529,7 +3525,6 @@ static ivas_error decodeVoIP(
    }


#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t nSamplesFlushed = 0;

    /* decode and get samples */
@@ -3609,7 +3604,6 @@ static ivas_error decodeVoIP(
            }
        }
    }
#endif


    /*------------------------------------------------------------------------------------------*
+2 −26
Original line number Diff line number Diff line
@@ -147,30 +147,8 @@

/* ################### Start FIXES switches ########################### */

#define NON_BE_FIX_807_MASA_DTX_BRSW                     /* Nokia: adds fix to check existence of DTX encoder for secondary channel in TD mode */
#define NON_BE_FIX_BASOP_819_THRESHOLD_MASA2TOTAL        /* Nokia: add fix for precision limitation in comparison with masa2total energy ratio threshold */
#define FIX_828_PORT_1152_FROM_FLT_REPO                  /* FhG: fix for issue 828 - fix uninitialized value used in BASOP */
#define NONE_BE_FIX_816_LFE_PLC_FLOAT                   /* DLB: issue 816: reduce required precision to float for LFE-PLC*/
#define FIX_835_PARAMMC_BUFFER_VALUES                   /* FhG: issue 835: wide range of buffer values for cx in ParamMC */
#define NONBE_FIX_943_PORT_1208_DFT_STEREO_PLC_BURST    /* Ericsson: BASOP Issue 943, Float Issue 1208, fix for overflow of sample offset counter for burst error in DFT Stereo PLC. */
#define FIX_903_ZERO_OUT_IMDCT_BUFFERS_FOR_MCT_IGNORE   /* FhG: zero out all relevant imdct buffers in MCT decoding of channels with mct_chan_mode == MCT_CHAN_MODE_IGNORE */
#define FIX_853_DECODE_MASA_ISM_AZIMUTH_PREC_FP        /* Nokia: Fixes ivas_decode_masaism_metadata decision logic change due to precision difference; this is the fix in floating point */
#define NONBE_FIX_1205_TD_STEREO_MOD_CT                 /* VA: fix mismatch of coder_type (mod_ct) btw. TD stereo encoder and decoder */
#define NONBE_FIX_1213_SBA_DET_MAT_INV_3BY3             /*Dolby: issue 1213: fix for inverse of det < 0*/
#define NONBE_FIX_1204_MDCT_STEREO_NOISE_EST_SCALING    /* FhG: fixes for decoder-side noise level estimation in MDCT-Stereo to prevent noise bursts in stereo switching */
#define NONBE_1233_HQ_CLASSIFIER_DIV_BY_ZERO            /* Eri: issue 1233: Address possible division by zero in hf_spectrum_sparseness() */

#define NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS /* DLB: adjust prerendering and mixing gain in OSBA encoder. This is fix to float codes*/
#define NONBE_1211_DTX_BR_SWITCHING                     /* VA: port float issue 1211: fix crash in MASA DTX bitrate switching */
#define NONBE_FIX_1189_GSC_IVAS_OMASA                   /* VA: Fix for issue 1189: Bitstream desynchornization due to reading/writing of the GSC_IVAS_mode parameter */
#define NONBE_FIX_1087_OOB_SBA_DTX_RS                   /* VA: issue 1087: Extend the length of the buffer for MCT decoding to avoid out-of-bound writing in SBA SID bitrate switching decoding */
#define NONBE_1273_ISM_METADATA_COUNTER                 /* VA: FLP issue 1273: fix counter overflow in ISM metadata encoder */
#define NONBE_FIX_GSC_BSTR                              /* VA: issue 1264 FLP (1189 BASOP): Fix bitstream synchronization between encoder and decoder in ACELP GSC in OMASA */
#define NONBE_FIX_1277_EVS_DTX_HIGH_RATE_THRESHOLD      /* VA/Eri: FLP issue 1277: Fix Mismatch in DTX high-rate threshold between EVS float and BASOP */

#define NONBE_1319_M2R_PRECISION_ALIGN                  /* Nokia: bring updates from PC code related to OMASA masa2total ratios */
#define NONBE_FIX_864_JBM_RENDER_FRAMESIZE                    /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */
#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT  /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */



/* #################### End FIXES switches ############################ */

@@ -209,13 +187,11 @@
#define NONBE_FIX_1052_SBA_EXT_FIX                      /* VA: SBA external output support fix - do not overwrite "output_config" parameter */
#define FIX_1113_CLDFB_REND_IN_ISAR                     /* issue 1113: fix the use of CLDFB renderer in split-rendering at the external renderer */
#define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING       /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */

#define NONBE_1894_OSBA_SCALING                         /* FhG: port OSBA scaling MRs (298,355,360) jointly */
#define NONBE_FIX_1141_OSBA_ROOM_RENDERING              /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect  */
#define NONBE_1360_LFE_DELAY                            /* Dlb: LFE delay alignment when rendering in CLDFB domain*/
#define NONBE_1229_FIX_ISM1_DPID                        /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */
#define NONBE_SVD_OPTIMIZATION

#define FIX_1158_FASTCONV_REVERB_HRTF                   /* Philips: issue 1158: Rendering with FastConv to BINAURAL_ROOM_REVERB uses BRIR convolution instead of HRTF */

/* #################### End BASOP porting switches ############################ */
+0 −8
Original line number Diff line number Diff line
@@ -1505,11 +1505,7 @@ void decoder_tcx_tns(
            hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode;
        }

#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT
        if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 && whitenedDomain ) || ( L_spec > L_frameTCX ) )
#else
        if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 ) || ( L_spec > L_frameTCX ) )
#endif
        {
            L = L_spec;
        }
@@ -1552,11 +1548,7 @@ void decoder_tcx_tns(
        if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 )
        {

#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT
            if ( st->element_mode == EVS_MONO || ( L_spec < L_frameTCX && !whitenedDomain ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */
#else
            if ( st->element_mode == EVS_MONO || L_spec < L_frameTCX ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */
#endif
            {
                tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC );
            }
+1 −45
Original line number Diff line number Diff line
@@ -59,9 +59,7 @@ struct IVAS_DEC_VOIP
    uint16_t lastDecodedWasActive;
    JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */
    uint16_t *bs_conversion_buf;          /* Buffer for bitstream conversion from packed to serial */
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t nSamplesRendered20ms;         /* how many samples have been rendered since the last 20ms render border*/
#endif
#ifdef SUPPORT_JBM_TRACEFILE
    IVAS_JBM_TRACE_DATA JbmTraceData;
#endif
@@ -83,9 +81,7 @@ struct IVAS_DEC
    bool Opt_VOIP;           /* flag indicating VOIP mode with JBM */
    int16_t tsm_scale;       /* scale for TSM operation */
    int16_t tsm_max_scaling;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t timeScalingDone; /* have we done already one TSM in a 20ms frame? */
#endif
    float tsm_quality;
    float *apaExecBuffer; /* Buffer for APA scaling */
    PCMDSP_APA_HANDLE hTimeScaler;
@@ -128,9 +124,7 @@ static ivas_error ivas_dec_reconfig_split_rend( Decoder_Struct *st_ivas );
static ivas_error ivas_dec_init_split_rend( Decoder_Struct *st_ivas );
static void ivas_destroy_handle_isar( ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE *hSplitBinRend_out );
static int16_t get_render_frame_size_ms( IVAS_RENDER_FRAMESIZE render_framesize );
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
static void update_voip_rendered20ms( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesRendered );
#endif

/*---------------------------------------------------------------------*
 * IVAS_DEC_Open()
@@ -167,9 +161,7 @@ ivas_error IVAS_DEC_Open(
    hIvasDec->tsm_scale = 100;
    hIvasDec->tsm_max_scaling = 0;
    hIvasDec->tsm_quality = 1.0f;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    hIvasDec->timeScalingDone = 0;
#endif
    hIvasDec->needNewFrame = false;
    hIvasDec->nTransportChannelsOld = 0;
    hIvasDec->nSamplesAvailableNext = 0;
@@ -760,9 +752,7 @@ ivas_error IVAS_DEC_EnableVoIP(
    hIvasDec->hVoIP->lastDecodedWasActive = 0;
    hIvasDec->hVoIP->hCurrentDataUnit = NULL;
    hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC );
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    hIvasDec->hVoIP->nSamplesRendered20ms = 0;
#endif

#define WMC_TOOL_SKIP
    /* Bitstream conversion is not counted towards complexity and memory usage */
@@ -1008,9 +998,7 @@ ivas_error IVAS_DEC_GetSamples(

                    assert( nTimeScalerOutSamples <= APA_BUF );
                    nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
                    hIvasDec->timeScalingDone = 1;
#endif
                }
                else
                {
@@ -1475,9 +1463,7 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples(
    if ( hIvasDec->st_ivas->hTcBuffer != NULL )
    {
        *nSamplesBuffered = hIvasDec->st_ivas->hTcBuffer->n_samples_buffered - hIvasDec->st_ivas->hTcBuffer->n_samples_rendered;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
        *nSamplesBuffered += hIvasDec->hVoIP->nSamplesRendered20ms;
#endif
    }

    return IVAS_ERR_OK;
@@ -2598,9 +2584,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    uint32_t extBufferedTime_ms, scale, maxScaling;
    JB4_DATAUNIT_HANDLE dataUnit;
    uint16_t extBufferedSamples;
#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    int16_t timeScalingDone;
#endif
    int16_t result;
    ivas_error error;
    int16_t nSamplesRendered;
@@ -2609,9 +2592,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
    st_ivas = hIvasDec->st_ivas;
    hDecoderConfig = st_ivas->hDecoderConfig;
    hVoIP = hIvasDec->hVoIP;
#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    timeScalingDone = 0;
#endif
    nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out;
    nSamplesRendered = 0;

@@ -2635,11 +2615,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
                }
            }

#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
            extBufferedSamples = nSamplesBuffered;
#else
            extBufferedSamples = nSamplesRendered + nSamplesBuffered;
#endif
            extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs;
            dataUnit = NULL;

@@ -2662,20 +2638,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            /* avoid time scaling multiple times in one sound card slot */
            if ( scale != 100U )
            {
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
                if ( hIvasDec->timeScalingDone )
#else
                if ( timeScalingDone )
#endif
                {
                    scale = 100;
                }
#ifndef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
                else
                {
                    timeScalingDone = 1;
                }
#endif
            }

            /* limit scale to range supported by time scaler */
@@ -2760,9 +2726,7 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            nSamplesRendered += nSamplesToZero;
            hIvasDec->nSamplesRendered += nSamplesToZero;
            hIvasDec->nSamplesAvailableNext -= nSamplesToZero;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
            update_voip_rendered20ms( hIvasDec, nSamplesToZero );
#endif
        }
        else
        {
@@ -2777,16 +2741,13 @@ ivas_error IVAS_DEC_VoIP_GetSamples(
            }

            nSamplesRendered += nSamplesRendered_loop;
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
            update_voip_rendered20ms( hIvasDec, nSamplesRendered_loop );
#endif
        }
    }

    return IVAS_ERR_OK;
}

#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
/*---------------------------------------------------------------------*
 * update_voip_rendered20ms( )
 *
@@ -2807,7 +2768,6 @@ static void update_voip_rendered20ms(
    hIvasDec->hVoIP->nSamplesRendered20ms = nSamplesRenderedTotal % hIvasDec->hVoIP->nSamplesFrame;
}

#endif

/*---------------------------------------------------------------------*
 * IVAS_DEC_VoIP_Flush( )
@@ -2832,19 +2792,15 @@ ivas_error IVAS_DEC_Flush(
    nSamplesToRender = (uint16_t) *nSamplesFlushed;

    /* render IVAS frames  */
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    error = IVAS_ERR_OK;
    if ( nSamplesToRender > 0 && hIvasDec->st_ivas->ivas_format != MONO_FORMAT )
    {
#endif
        error = IVAS_DEC_GetRenderedSamples( hIvasDec, nSamplesToRender, &nSamplesFlushedLocal, &hIvasDec->nSamplesAvailableNext, pcmType, pcmBuf );
#ifdef NONBE_FIX_864_JBM_RENDER_FRAMESIZE
    }
    else
    {
        *nSamplesFlushed = 0;
    }
#endif
    return error;
}

+0 −3
Original line number Diff line number Diff line
@@ -473,9 +473,6 @@ static void ivas_osba_render_ism_to_sba(
    int16_t azimuth, elevation;
    float gains[MAX_INPUT_CHANNELS];
    float g1, g2;
#ifndef NONE_BE_FIX_BASOP_1044_OSBA_PRERENDER_MIX_GAINS
    float output_gain;
#endif

    int16_t nchan_sba;