Commit 080e731b authored by sagnowski's avatar sagnowski
Browse files

Use 5 ms framing in tests with binaural output

parent 6c57c8fd
Loading
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -3820,7 +3820,7 @@ ivas_error IVAS_REND_FeedInputAudio(

    if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel )
    {
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" );
    }

    if ( inputAudio.config.numChannels <= 0 || MAX_INPUT_CHANNELS < inputAudio.config.numChannels )
@@ -3831,8 +3831,7 @@ ivas_error IVAS_REND_FeedInputAudio(
    if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL &&
         inputAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut )
    {
        /* Binaural rendering requires specific frame size */
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" );
    }

    if ( ( error = getInputById( hIvasRend, inputId, (void **) &inputBase ) ) != IVAS_ERR_OK )
@@ -5298,8 +5297,7 @@ static ivas_error renderInputIsm(

    if ( ismInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel )
    {
        /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" );
    }
    ismInput->base.numNewSamplesPerChannel = 0;

@@ -5844,8 +5842,7 @@ static ivas_error renderInputMc(

    if ( mcInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel )
    {
        /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" );
    }
    mcInput->base.numNewSamplesPerChannel = 0;

@@ -6192,8 +6189,7 @@ static ivas_error renderInputSba(

    if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel )
    {
        /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" );
    }
    sbaInput->base.numNewSamplesPerChannel = 0;

@@ -6520,8 +6516,7 @@ static ivas_error renderInputMasa(

    if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel )
    {
        /* Mismatch between the number of input samples vs number of requested output samples - currently not allowed */
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" );
    }
    masaInput->base.numNewSamplesPerChannel = 0;

@@ -6794,8 +6789,7 @@ ivas_error IVAS_REND_GetSamples(
    if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL &&
         outAudio.config.numSamplesPerChannel * 1000 != BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->sampleRateOut )
    {
        /* Binaural rendering requires specific frame size */
        return IVAS_ERR_INVALID_BUFFER_SIZE;
        return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" );
    }

    /* Check that there is allowed configuration for MASA format output */
+40 −0
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ def test_ambisonics(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    run_renderer(in_fmt, out_fmt, framing_5ms=framing_5ms)


@@ -52,6 +55,9 @@ def test_ambisonics_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_AMBI)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ambisonics_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    run_renderer(
        in_fmt,
        out_fmt,
@@ -75,10 +81,12 @@ def test_ambisonics_binaural_headrotation_refrotzero(
        ref_kwargs={
            "name_extension": "refrotzero",
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "refrot_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "framing_5ms": True,
        },
    )

@@ -95,6 +103,7 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt
        out_fmt,
        ref_kwargs={
            "name_extension": "refrotequal",
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath(
@@ -103,6 +112,7 @@ def test_ambisonics_binaural_headrotation_refrotequal(test_info, in_fmt, out_fmt
            "refrot_file": HR_TRAJECTORY_DIR.joinpath(
                "azi_plus_2-ele_plus_2-every-25-rows.csv"
            ),
            "framing_5ms": True,
        },
    )

@@ -124,10 +134,12 @@ def test_ambisonics_binaural_headrotation_refveczero(
        ref_kwargs={
            "name_extension": "refveczero",
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath(f"{trj_file}.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath("const000-Vector3.csv"),
            "framing_5ms": True,
        },
    )

@@ -149,6 +161,7 @@ def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt
            out_fmt,
            ref_kwargs={
                "name_extension": "refvecequal",
                "framing_5ms": True,
            },
            cut_kwargs={
                "trj_file": HR_TRAJECTORY_DIR.joinpath(
@@ -157,6 +170,7 @@ def test_ambisonics_binaural_headrotation_refvecequal(test_info, in_fmt, out_fmt
                "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                    "full-circle-with-up-and-down-4s-Vector3.csv"
                ),
                "framing_5ms": True,
            },
        )

@@ -181,12 +195,14 @@ def test_ambisonics_binaural_headrotation_refvec_rotating(test_info, in_fmt, out
                "trj_file": HR_TRAJECTORY_DIR.joinpath(
                    "full-circle-with-up-and-down-4s.csv"
                ),
                "framing_5ms": True,
            },
            cut_kwargs={
                "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
                "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                    "full-circle-with-up-and-down-4s-ccw-Vector3.csv"
                ),
                "framing_5ms": True,
            },
        )

@@ -211,12 +227,14 @@ def test_ambisonics_binaural_headrotation_refvec_rotating_fixed_pos_offset(
            "trj_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-ccw.csv"
            ),
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-fixed-pos-offset-Vector3.csv"
            ),
            "framing_5ms": True,
        },
    )

@@ -241,10 +259,12 @@ def test_ambisonics_binaural_headrotation_refveclev_vs_refvec(
            "refveclev_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-Vector3.csv"
            ),
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath("full-circle-4s-Vector3.csv"),
            "framing_5ms": True,
        },
    )

@@ -265,6 +285,8 @@ def test_multichannel(test_info, in_fmt, out_fmt, framing_5ms):
def test_multichannel_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
    if in_fmt in ["MONO", "STEREO"]:
        pytest.skip("MONO or STEREO to Binaural rendering unsupported")
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    run_renderer(in_fmt, out_fmt, framing_5ms=framing_5ms)

@@ -276,6 +298,8 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
def test_multichannel_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
    if in_fmt in ["MONO", "STEREO"]:
        pytest.skip("MONO or STEREO to Binaural rendering unsupported")
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    if (in_fmt == "5_1" or in_fmt == "7_1") and out_fmt == "BINAURAL":
        run_renderer(
@@ -312,12 +336,14 @@ def test_multichannel_binaural_headrotation_refvec_rotating(test_info, in_fmt, o
            "trj_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s.csv"
            ),
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
            "refvec_file": HR_TRAJECTORY_DIR.joinpath(
                "full-circle-with-up-and-down-4s-ccw-Vector3.csv"
            ),
            "framing_5ms": True,
        },
    )

@@ -336,6 +362,9 @@ def test_ism(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    try:
        in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
    except:
@@ -352,6 +381,9 @@ def test_ism_binaural_static(test_info, in_fmt, out_fmt, framing_5ms):
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_ISM)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_ism_binaural_headrotation(test_info, in_fmt, out_fmt, trj_file, framing_5ms):
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    try:
        in_meta_files = FORMAT_TO_METADATA_FILES[in_fmt]
    except:
@@ -397,6 +429,7 @@ def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt):
                "full-circle-with-up-and-down-4s.csv"
            ),
            "in_meta_files": in_meta_files,
            "framing_5ms": True,
        },
        cut_kwargs={
            "trj_file": HR_TRAJECTORY_DIR.joinpath("const000.csv"),
@@ -404,6 +437,7 @@ def test_ism_binaural_headrotation_refvec_rotating(test_info, in_fmt, out_fmt):
                "full-circle-with-up-and-down-4s-ccw-Vector3.csv"
            ),
            "in_meta_files": in_meta_files,
            "framing_5ms": True,
        },
    )

@@ -450,6 +484,9 @@ def test_custom_ls_input_output(test_info, in_fmt, out_fmt):
@pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, framing_5ms):
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    run_renderer(
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,
@@ -462,6 +499,9 @@ def test_custom_ls_input_binaural(test_info, in_layout, out_fmt, framing_5ms):
@pytest.mark.parametrize("in_layout", CUSTOM_LS_TO_TEST)
@pytest.mark.parametrize("framing_5ms", FRAMING_5MS_TO_TEST)
def test_custom_ls_input_binaural_headrotation(test_info, in_layout, out_fmt, trj_file, framing_5ms):
    if not framing_5ms:
        pytest.xfail("Binaural output currently only supported with 5ms framing")

    run_renderer(
        CUSTOM_LAYOUT_DIR.joinpath(f"{in_layout}.txt"),
        out_fmt,