Commit 95170560 authored by janssontoftg's avatar janssontoftg
Browse files

Fix for non-binaural delay compensation. Adding filterbank delay when there is...

Fix for non-binaural delay compensation. Adding filterbank delay when there is not binaural rendering (and it is used). Using binaural_latency_ns > 0 as indicator.
parent ca2bd30c
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -54,8 +54,8 @@ float get_delay(
    const int16_t what_delay,         /* i  : what delay? (ENC or DEC)            */
    const int32_t io_fs,              /* i  : input/output sampling frequency     */
    const IVAS_FORMAT ivas_format,    /* i  : IVAS format                         */
#ifndef FIX_I59
    HANDLE_CLDFB_FILTER_BANK hCldfb,  /* i  : Handle of Cldfb analysis            */
#ifndef FIX_I59
    RENDERER_TYPE renderer_type,      /* i  : IVAS rendering type                 */
#endif
    const int32_t binaural_latency_ns /* i  : binaural renderer HRTF delay in ns  */
@@ -97,10 +97,16 @@ float get_delay(
        {
            delay = IVAS_DEC_DELAY_NS;
#ifdef FIX_I59
            /* compensate for binaural renderer delay */
            if ( binaural_latency_ns > 0 )
            {
                /* compensate for binaural renderer delay */
                delay += binaural_latency_ns;
            }
            else if ( hCldfb != NULL )
            {
                /* compensate for filterbank delay */
                delay += IVAS_FB_DEC_DELAY_NS;
            }
#else
            if ( hCldfb != NULL || renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
+1 −1
Original line number Diff line number Diff line
@@ -716,8 +716,8 @@ float get_delay(
    const int16_t what_delay,         /* i  : what delay? (ENC or DEC)        */
    const int32_t io_fs,              /* i  : input/output sampling frequency */
    const IVAS_FORMAT ivas_format,    /* i  : IVAS format                     */
#ifndef FIX_I59
    HANDLE_CLDFB_FILTER_BANK hCldfb,  /* i  : Handle of Cldfb analysis        */
#ifndef FIX_I59
    RENDERER_TYPE renderer_type,      /* i  : IVAS rendering type                 */
#endif
    const int32_t binaural_latency_ns /* i  : binaural renderer HRTF delay in ns  */
+1 −1
Original line number Diff line number Diff line
@@ -1061,7 +1061,7 @@ ivas_error IVAS_DEC_GetDelay(
    st_ivas = hIvasDec->st_ivas;
    hDecoderConfig = st_ivas->hDecoderConfig;
#ifdef FIX_I59
    *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->binaural_latency_ns ) + 0.5f );
    *nSamples = NS2SA( hDecoderConfig->output_Fs, get_delay( DEC, hDecoderConfig->output_Fs, st_ivas->ivas_format, st_ivas->cldfbAnaDec[0], st_ivas->binaural_latency_ns ) + 0.5f );
#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
+1 −1
Original line number Diff line number Diff line
@@ -941,7 +941,7 @@ ivas_error IVAS_ENC_GetDelay(
    }

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