Commit 44b91a11 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Fix the float issue 1528 by adding a rendering time resolution independent counter.

parent 7d03a381
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@

#define FIX_2448_RENDERER_MSAN_ERROR                    /* FhG: basop issue 2448: fix MSAN error with MSA rendering */
#define FIX_2283_ISM_MD_DELAY                           /* Dolby: Fix ISM metadata delay round-off */
#define FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION  /* Nokia: float issue 1528: Fixes incorrect compensation for ISM metadata delay in 5ms TD rendering */

/* ##################### End NON-BE switches ########################### */

+22 −0
Original line number Diff line number Diff line
@@ -351,6 +351,10 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx(
    Word32 *output_fx[],                                  /* i/o: SCE channels / Binaural synthesis   Q11                      */
    const Word16 output_frame,                            /* i  : output frame length                                          */
    const Word16 num_subframes                            /* i  : number of subframes to render                                */
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    ,
    Word16 *metaSfCounter                                 /* i/o: subframe counter for metadata update                         */
#endif
)
{
    Word16 subframe_length;
@@ -400,7 +404,11 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx(

    FOR( subframe_idx = 0; subframe_idx < num_subframes; subframe_idx++ )
    {
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
        IF( EQ_16( *metaSfCounter, ism_md_subframe_update ) )
#else
        IF( EQ_16( subframe_idx, ism_md_subframe_update ) )
#endif
        {
            /* Update object position(s) */
            IF( NE_32( ( error = TDREND_Update_object_positions_fx( hBinRendererTd, num_src, ivas_format, hIsmMetaData ) ), IVAS_ERR_OK ) )
@@ -409,6 +417,10 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx(
            }
        }

#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
        *metaSfCounter = ( *metaSfCounter + 1 ) % 4;

#endif
        /* Update the listener's location/orientation */
        Word16 tmp_headRotEnabled;
        tmp_headRotEnabled = 0;
@@ -884,7 +896,11 @@ ivas_error ivas_td_binaural_open_ext_fx(
 *---------------------------------------------------------------------*/

ivas_error ivas_td_binaural_renderer_ext_fx(
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    TDREND_WRAPPER *pTDRend,                                     /* i/o: TD Renderer wrapper structure           */
#else
    const TDREND_WRAPPER *pTDRend,                               /* i  : TD Renderer wrapper structure           */
#endif
    const AUDIO_CONFIG inConfig,                                 /* i  : Input audio configuration               */
    const LSSETUP_CUSTOM_HANDLE customLsInput,                   /* i  : Input custom loudspeaker layout         */
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i  : Combined head and external orientations */
@@ -1005,9 +1021,15 @@ ivas_error ivas_td_binaural_renderer_ext_fx(
        }
    }

#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    IF( NE_32( ( error = ivas_td_binaural_renderer_unwrap_fx( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData,
                                                              ism_md_subframe_update_ext, p_output_fx, output_frame, num_subframes, &pTDRend->metaSfCounter ) ),
               IVAS_ERR_OK ) )
#else
    IF( NE_32( ( error = ivas_td_binaural_renderer_unwrap_fx( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, *hCombinedOrientationData,
                                                              ism_md_subframe_update_ext, p_output_fx, output_frame, num_subframes ) ),
               IVAS_ERR_OK ) )
#endif
    {
        return error;
    }
+8 −0
Original line number Diff line number Diff line
@@ -671,10 +671,18 @@ ivas_error ivas_td_binaural_renderer_unwrap_fx(
    Word32 *output_fx[],                                        /* i/o: SCE channels / Binaural synthesis  Q11  */
    const Word16 output_frame,                                  /* i  : output frame length                     */
    const Word16 num_subframes                                  /* i  : number of subframes to render           */
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    ,
    Word16 *metaSfCounter                                       /* i/o: subframe counter for metadata update    */
#endif
);

ivas_error ivas_td_binaural_renderer_ext_fx(
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    TDREND_WRAPPER *pTDRend,                                    /* i/o: TD Renderer wrapper structure           */
#else
    const TDREND_WRAPPER *pTDRend,                              /* i  : TD Renderer wrapper structure           */
#endif
    const AUDIO_CONFIG inConfig,                                /* i  : Input audio configuration               */
    const LSSETUP_CUSTOM_HANDLE customLsInput,                  /* i  : Input custom loudspeaker layout         */
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData,/* i  : Combined head and external orientations */
+3 −0
Original line number Diff line number Diff line
@@ -1278,6 +1278,9 @@ typedef struct
    Word32 binaural_latency_ns;
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd;
    TDREND_HRFILT_FiltSet_t **hHrtfTD;
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    Word16 metaSfCounter;
#endif

} TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE;

+8 −0
Original line number Diff line number Diff line
@@ -1425,6 +1425,10 @@ static TDREND_WRAPPER defaultTdRendWrapper(
    move32();
    w.hBinRendererTd = NULL;
    w.hHrtfTD = NULL;
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    w.metaSfCounter = 0;
    move16();
#endif

    return w;
}
@@ -6523,7 +6527,11 @@ static ivas_error rotateFrameSba_fx(


static ivas_error renderIsmToBinaural(
#ifdef FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION
    input_ism *ismInput,
#else
    const input_ism *ismInput,
#endif
    IVAS_REND_AudioBuffer outAudio )
{
    Word32 tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];