Commit 0f5960de authored by emerit's avatar emerit
Browse files

Merge branch '744-fix-sofa-to-rom-tables-and-binaural-binary-files' of...

Merge branch '744-fix-sofa-to-rom-tables-and-binaural-binary-files' of https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec into 744-fix-sofa-to-rom-tables-and-binaural-binary-files
parents 1fa8eb8c 9236da2a
Loading
Loading
Loading
Loading
+38 −33
Original line number Diff line number Diff line
@@ -229,6 +229,17 @@ typedef struct
    MASA_PREREND_HANDLE hMasaPrerend;
} input_masa;


#ifdef FIX_BINARY_BINAURAL_READING
struct hrtf_handles
{
    IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF;
    IVAS_DEC_HRTF_FASTCONV_HANDLE hHrtfFastConv;
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hHrtfParambin;
    IVAS_DEC_HRTF_HANDLE hHrtfTD;
} hrtf_handles;
#endif

struct IVAS_REND
{
    int32_t sampleRateOut;
@@ -1359,10 +1370,7 @@ static ivas_error setRendInputActiveIsm(
    RENDER_CONFIG_DATA *hRendCfg
#ifdef FIX_BINARY_BINAURAL_READING
    ,
    IVAS_DEC_HRTF_CREND_HANDLE hMixConv,
    IVAS_DEC_HRTF_HANDLE hTD,
    IVAS_DEC_HRTF_FASTCONV_HANDLE hFastConv,
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hParam
    struct hrtf_handles hrtfs
#endif
)
{
@@ -1417,7 +1425,7 @@ static ivas_error setRendInputActiveIsm(

    error = IVAS_ERR_OK;
#ifdef FIX_BINARY_BINAURAL_READING
    inputIsm->tdRendWrapper.hHrtfTD = hTD;
    inputIsm->tdRendWrapper.hHrtfTD = hrtfs.hHrtfTD;
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -1428,7 +1436,7 @@ static ivas_error setRendInputActiveIsm(
    {
#ifndef SPLIT_REND_WITH_HEAD_ROT
#ifdef FIX_BINARY_BINAURAL_READING
        if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixConv, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtf_handles.hSetOfHRTF, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
@@ -1492,9 +1500,9 @@ static ivas_error setRendInputActiveIsm(
        {
#ifdef FIX_BINARY_BINAURAL_READING
#ifdef SPLIT_REND_WITH_HEAD_ROT
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixConv, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs.hSetOfHRTF, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
#else
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixConv, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
            if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs.hSetOfHRTF, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef SPLIT_REND_WITH_HEAD_ROT
@@ -2442,10 +2450,7 @@ static ivas_error setRendInputActiveMc(
    RENDER_CONFIG_DATA *hRendCfg
#ifdef FIX_BINARY_BINAURAL_READING
    ,
    IVAS_DEC_HRTF_CREND_HANDLE hMixConv,
    IVAS_DEC_HRTF_HANDLE hTD,
    IVAS_DEC_HRTF_FASTCONV_HANDLE hFastConv,
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hParam
    struct hrtf_handles hrtfs
#endif
)
{
@@ -2484,11 +2489,11 @@ static ivas_error setRendInputActiveMc(
    inputMc->customLsInput = defaultCustomLs();
    inputMc->tdRendWrapper = defaultTdRendWrapper();
#ifdef FIX_BINARY_BINAURAL_READING
    if ( hTD )
    if ( hrtfs.hHrtfTD )
    {
        inputMc->tdRendWrapper.binaural_latency_ns = (int32_t) ( hTD->latency_s * 1000000000.f );
        inputMc->tdRendWrapper.binaural_latency_ns = (int32_t) ( hrtfs.hHrtfTD->latency_s * 1000000000.f );
    }
    inputMc->tdRendWrapper.hHrtfTD = hTD;
    inputMc->tdRendWrapper.hHrtfTD = hrtfs.hHrtfTD;
#endif
    inputMc->crendWrapper = NULL;
    inputMc->hReverb = NULL;
@@ -2517,7 +2522,7 @@ static ivas_error setRendInputActiveMc(
#endif
    {
#ifdef FIX_BINARY_BINAURAL_READING
        if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, hMixConv ) ) != IVAS_ERR_OK )
        if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg, hrtfs.hSetOfHRTF ) ) != IVAS_ERR_OK )
#else
        if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK )
#endif
@@ -2851,11 +2856,9 @@ static ivas_error setRendInputActiveSplitPostRend(
    RENDER_CONFIG_DATA *hRendCfg
#ifdef FIX_BINARY_BINAURAL_READING
    ,
    IVAS_DEC_HRTF_CREND_HANDLE *,
    IVAS_DEC_HRTF_HANDLE hTD,
    IVAS_DEC_HRTF_FASTCONV_HANDLE hFastConv,
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hParam
    struct hrtf_handles hrtfs
#endif

)
{
    ivas_error error;
@@ -2913,11 +2916,9 @@ static ivas_error setRendInputActiveSba(
    RENDER_CONFIG_DATA *hRendCfg
#ifdef FIX_BINARY_BINAURAL_READING
    ,
    IVAS_DEC_HRTF_CREND_HANDLE hMixConv,
    IVAS_DEC_HRTF_HANDLE hTD,
    IVAS_DEC_HRTF_FASTCONV_HANDLE hFastConv,
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hParam
    struct hrtf_handles hrtfs
#endif

)
{
    ivas_error error;
@@ -2978,7 +2979,7 @@ static ivas_error setRendInputActiveSba(
    }

#ifdef FIX_BINARY_BINAURAL_READING
    if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg, hMixConv ) ) != IVAS_ERR_OK )
    if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg, hrtfs.hSetOfHRTF ) ) != IVAS_ERR_OK )
#else
    if ( ( error = updateSbaPanGains( inputSba, outConfig, hRendCfg ) ) != IVAS_ERR_OK )
#endif
@@ -3441,11 +3442,9 @@ static ivas_error setRendInputActiveMasa(
    RENDER_CONFIG_DATA *hRendCfg
#ifdef FIX_BINARY_BINAURAL_READING
    ,
    IVAS_DEC_HRTF_CREND_HANDLE hMixConv,
    IVAS_DEC_HRTF_HANDLE hTD,
    IVAS_DEC_HRTF_FASTCONV_HANDLE hFastConv,
    IVAS_DEC_HRTF_PARAMBIN_HANDLE hParam
    struct hrtf_handles hrtfs
#endif

    ) /* Todo: This is not used at all within MASA. Support might be better to do after refactoring. */
{
    ivas_error error;
@@ -3491,7 +3490,7 @@ static ivas_error setRendInputActiveMasa(
        inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 );
#endif
#ifdef FIX_BINARY_BINAURAL_READING
        inputMasa->decDummy->hHrtfParambin = hParam;
        inputMasa->decDummy->hHrtfParambin = hrtfs.hHrtfParambin;
#endif

        inputMasa->metadataHasBeenFed = false;
@@ -4369,11 +4368,12 @@ ivas_error IVAS_REND_AddInput(
    void *inputsArray;
    int32_t inputStructSize;
#ifdef FIX_BINARY_BINAURAL_READING
    ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, IVAS_DEC_HRTF_CREND_HANDLE, IVAS_DEC_HRTF_HANDLE, IVAS_DEC_HRTF_FASTCONV_HANDLE, IVAS_DEC_HRTF_PARAMBIN_HANDLE );
    ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, struct hrtf_handles hrtfs );
#else
    ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA * );
#endif
    int32_t inputIndex;
    struct hrtf_handles hrtfs;

    /* Validate function arguments */
    if ( hIvasRend == NULL || inputId == NULL )
@@ -4401,6 +4401,11 @@ ivas_error IVAS_REND_AddInput(
    }
#endif

    hrtfs.hSetOfHRTF = hIvasRend->hSetOfHRTF;
    hrtfs.hHrtfFastConv = hIvasRend->hHrtfFastConv;
    hrtfs.hHrtfParambin = hIvasRend->hHrtfParambin;
    hrtfs.hHrtfTD = hIvasRend->hHrtfTD;

    switch ( getAudioConfigType( inConfig ) )
    {
        case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED:
@@ -4447,7 +4452,7 @@ ivas_error IVAS_REND_AddInput(

    *inputId = makeInputId( inConfig, inputIndex );
#ifdef FIX_BINARY_BINAURAL_READING
    if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, hIvasRend->hSetOfHRTF, hIvasRend->hHrtfTD, hIvasRend->hHrtfFastConv, hIvasRend->hHrtfParambin ) ) != IVAS_ERR_OK )
    if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, hrtfs ) ) != IVAS_ERR_OK )
#else
    if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK )
#endif
+11 −7
Original line number Diff line number Diff line
@@ -241,24 +241,28 @@ def compare_renderer_vs_mergetarget(test_info, in_fmt, out_fmt, keep_files = Fal
        os.remove(out_ref)
        os.remove(out_cut)

def compare_renderer_vs_pyscripts(test_info, in_fmt, out_fmt, **kwargs):
def compare_renderer_vs_pyscripts(test_info, in_fmt, out_fmt, keep_files = False, **kwargs):
    ref, ref_fs= run_pyscripts(in_fmt, out_fmt, **kwargs)
    cut, cut_fs = run_renderer(
    [[cut, cut_fs], outfile_cut] = run_renderer(
        in_fmt, out_fmt, test_case_name=test_info.node.name, **kwargs
    )
    check_BE(test_info, ref, ref_fs, cut, cut_fs)

    if keep_files == False :
        os.remove(outfile_cut)

def compare_renderer_args(
    test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict
    test_info, in_fmt, out_fmt, ref_kwargs: Dict, cut_kwargs: Dict, keep_files = False
):
    ref, ref_fs = run_renderer(
    [[ref, ref_fs], outfile_ref] = run_renderer(
        in_fmt, out_fmt, test_case_name=test_info.node.name, **ref_kwargs
    )
    cut, cut_fs = run_renderer(
    [[cut, cut_fs], outfile_cut] = run_renderer(
        in_fmt, out_fmt, test_case_name=test_info.node.name, **cut_kwargs
    )
    check_BE(test_info, ref, ref_fs, cut, cut_fs)
    if keep_files == False :
        os.remove(outfile_ref)
        os.remove(outfile_cut)

def compare_renderer_vs_renderer_with_binary_hrir(test_info, in_fmt, out_fmt, keep_files = False, **kwargs):