Commit c27a5ae4 authored by vaclav's avatar vaclav
Browse files

Merge branch '223-return-data-type-in-get_delay' into 'main'

Resolve "return data type in get_delay()"

See merge request !290
parents e0c0842c 5b72826e
Loading
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -50,8 +50,12 @@
 *--------------------------------------------------------------------------*/

/*! r: delay value in ns */
#ifdef FIX_GET_DELAY_RETURN
int32_t get_delay(
#else
float get_delay(
    const int16_t what_delay,         /* i  : what delay? (ENC or DEC)            */
#endif
    const int16_t enc_dec,            /* i  : encoder/decoder flag                */
    const int32_t io_fs,              /* i  : input/output sampling frequency     */
    const IVAS_FORMAT ivas_format,    /* i  : IVAS format                         */
    HANDLE_CLDFB_FILTER_BANK hCldfb,  /* i  : Handle of Cldfb analysis            */
@@ -59,9 +63,13 @@ float get_delay(
    const int32_t binaural_latency_ns /* i  : binaural renderer HRTF delay in ns  */
)
{
#ifdef FIX_GET_DELAY_RETURN
    int32_t delay = 0;
#else
    float delay = 0;
#endif

    if ( what_delay == ENC )
    if ( enc_dec == ENC )
    {
        if ( ivas_format == MONO_FORMAT ) /* EVS mono */
        {
@@ -78,7 +86,7 @@ float get_delay(
            delay += IVAS_FB_ENC_DELAY_NS;
        }
    }
    else
    else /* DEC */
    {
        if ( ivas_format == MONO_FORMAT ) /* EVS mono */
        {
+1 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@
#define FIX_221_BR_SWITCH_STEREO                        /* Issue 221: Fix missing initialization when switchin from TD to MDCT stereo*/
#define FIX_DTX_RANGE                                   /* Issue 118: fix the DTX usage: default DTX up to 64 kbps, otherwise only in silence */
#define FIX_ISM_METADATA_READER                         /* Issue 211: make ISM metadata file reader robust against invalid files */
#define FIX_GET_DELAY_RETURN                            /* Issue 223: change return data type in function get_delay() */


/* ################## End DEVELOPMENT switches ######################### */
+10 −6
Original line number Diff line number Diff line
@@ -712,8 +712,12 @@ int16_t lev_dur(
);

/*! r: delay value in ns */
#ifdef FIX_GET_DELAY_RETURN
int32_t get_delay(
#else
float get_delay(
    const int16_t what_delay,         /* i  : what delay? (ENC or DEC)        */
#endif
    const int16_t enc_dec,            /* i  : encoder/decoder flag                  */
    const int32_t io_fs,              /* i  : input/output sampling frequency       */
    const IVAS_FORMAT ivas_format,    /* i  : IVAS format                           */
    HANDLE_CLDFB_FILTER_BANK hCldfb,  /* i  : Handle of Cldfb analysis              */
+4 −0
Original line number Diff line number Diff line
@@ -1055,7 +1055,11 @@ ivas_error IVAS_DEC_GetDelay(
    st_ivas = hIvasDec->st_ivas;
    hDecoderConfig = st_ivas->hDecoderConfig;

#ifdef FIX_GET_DELAY_RETURN
    *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns ) );
#else
    *nSamples = NS2SA( hDecoderConfig->output_Fs, (int32_t) ( get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->renderer_type, st_ivas->binaural_latency_ns ) + 0.5f ) );
#endif

    *timeScale = hDecoderConfig->output_Fs;

+4 −0
Original line number Diff line number Diff line
@@ -963,7 +963,11 @@ ivas_error IVAS_ENC_GetDelay(
        return IVAS_ERR_UNEXPECTED_NULL_POINTER;
    }

#ifdef FIX_GET_DELAY_RETURN
    *delay = NS2SA( hEncoderConfig->input_Fs, get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0 ) );
#else
    *delay = NS2SA( hEncoderConfig->input_Fs, (int32_t) ( get_delay( ENC, hEncoderConfig->input_Fs, hEncoderConfig->ivas_format, NULL, RENDERER_DISABLE, 0 ) + 0.5f ) );
#endif

    *delay *= hEncoderConfig->nchan_inp;