Commit 3c20b44b authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

remove casting to int16 in python scripts + adjust thresholds for tests

parent 80dcf2d9
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -65,10 +65,9 @@ def get_hoa_mtx(
        mtx_hoa_dec[1, 0] = 0.5
        mtx_hoa_dec[1, 1] = -0.5
    elif spkrlayout.isloudspeaker:
        # TODO getRSH in IVAS casts to int16_t , decide on final behaviour for scripts
        Y_td = getRSH(
            T_DESIGN_11_AZI.astype(np.int16),
            T_DESIGN_11_ELE.astype(np.int16),
            T_DESIGN_11_AZI,
            T_DESIGN_11_ELE,
            ambi_order,
            norm="ortho",
        )
+1 −3
Original line number Diff line number Diff line
@@ -331,9 +331,7 @@ def rotateMC(x: np.ndarray, trajectory: str, layout: spatialaudioformat) -> np.n
                rotateAziEle(a, e, Quat2RotMat(q))
                for a, e in zip(layout.ls_azi, layout.ls_ele)
            ]
        ).astype(
            np.int16
        )  # TODO tmu for alignment with IVAS
        )
        R = panner.pan(rotated_pos[:, 0], rotated_pos[:, 1])
        R[:, layout.lfe_index] = np.zeros([layout.nchannels, 1])
        R[layout.lfe_index, layout.lfe_index] = 1
+2 −6
Original line number Diff line number Diff line
@@ -372,8 +372,7 @@ def convert_mc(
        # SH response for loudspeaker positions
        MC2HOA = np.hstack(
            [
                # TODO getRSH in IVAS casts to int16_t , decide on final behaviour for scripts
                hoadecoder.getRSH([int(a)], [int(e)], out_spfmt.ambi_order)
                hoadecoder.getRSH([a], [e], out_spfmt.ambi_order)
                for a, e in zip(in_spfmt.ls_azi, in_spfmt.ls_ele)
            ]
        ).T
@@ -435,10 +434,7 @@ def convert_ism(
            gains = gains[:, np.newaxis]
        # ISM -> HOA
        elif out_spfmt.ambi_order > 0:
            # TODO getRSH in IVAS casts to int16_t , decide on final behaviour for scripts
            gains = hoadecoder.getRSH(
                [int(pos[0])], [int(pos[1])], out_spfmt.ambi_order
            )
            gains = hoadecoder.getRSH([pos[0]], [pos[1]], out_spfmt.ambi_order)
        else:
            raise NotImplementedError(
                f"{in_spfmt.name} -> {out_spfmt.name}: format conversion not implemented"
+124 −90
Original line number Diff line number Diff line
@@ -241,7 +241,9 @@ FORMAT_TO_CREND_FORMAT = {
INPUT_FORMATS_AMBI = ["FOA", "HOA2", "HOA3"]
INPUT_FORMATS_MC = ["MONO", "STEREO", "5_1", "5_1_2", "5_1_4", "7_1", "7_1_4"]
INPUT_FORMATS_ISM = ["ISM1", "ISM2", "ISM3", "ISM4"]
INPUT_FORMATS_MASA = ["MASA2"] #["MASA1", "MASA2"] # Disable MASA1 tests until MASA1 can be implemented properly
INPUT_FORMATS_MASA = [
    "MASA2"
]  # ["MASA1", "MASA2"] # Disable MASA1 tests until MASA1 can be implemented properly

""" Non binaural / parametric output formats """
OUTPUT_FORMATS = [
@@ -283,6 +285,22 @@ pass_snr = {
    # External Renderer vs Standalone and pyaudio3dtools renderers tests
    #
    ####################################################################
    # Failure reason: Renderer uses getRSH() with int16_t vs float in python
    "test_ambisonics[FOA-5_1]": 39,
    "test_ambisonics[FOA-5_1_2]": 40,
    "test_ambisonics[FOA-5_1_4]": 41,
    "test_ambisonics[FOA-7_1]": 39,
    "test_ambisonics[FOA-7_1_4]": 41,
    "test_ambisonics[HOA2-5_1]": 26,
    "test_ambisonics[HOA2-5_1_2]": 29,
    "test_ambisonics[HOA2-5_1_4]": 31,
    "test_ambisonics[HOA2-7_1]": 27,
    "test_ambisonics[HOA2-7_1_4]": 32,
    "test_ambisonics[HOA3-5_1]": 25,
    "test_ambisonics[HOA3-5_1_2]": 27,
    "test_ambisonics[HOA3-5_1_4]": 29,
    "test_ambisonics[HOA3-7_1]": 25,
    "test_ambisonics[HOA3-7_1_4]": 30,
    # TODO needs debugging
    "test_ambisonics_binaural_headrotation[HOA2-BINAURAL-full_circle_in_15s]": 18,
    "test_ambisonics_binaural_headrotation[HOA3-BINAURAL-full_circle_in_15s]": 15,
@@ -299,88 +317,102 @@ pass_snr = {
    "test_ambisonics_binaural_static[FOA-BINAURAL_ROOM]": 0,
    "test_ambisonics_binaural_static[HOA2-BINAURAL_ROOM]": 0,
    "test_ambisonics_binaural_static[HOA3-BINAURAL_ROOM]": 0,
    # Failure reason: Renderer uses getRSH() with int16_t vs float in python
    "test_custom_ls_input[t_design_4-FOA]": 43,
    "test_custom_ls_input[t_design_4-HOA2]": 39,
    "test_custom_ls_input[t_design_4-HOA3]": 36,
    "test_custom_ls_output[FOA-16ch_8+4+4]": 40,
    "test_custom_ls_output[FOA-4d4]": 40,
    "test_custom_ls_output[FOA-itu_4+5+1]": 41,
    "test_custom_ls_output[FOA-t_design_4]": 40,
    "test_custom_ls_output[HOA2-16ch_8+4+4]": 32,
    "test_custom_ls_output[HOA2-4d4]": 31,
    "test_custom_ls_output[HOA2-itu_4+5+1]": 31,
    "test_custom_ls_output[HOA2-t_design_4]": 34,
    "test_custom_ls_output[HOA3-16ch_8+4+4]": 30,
    "test_custom_ls_output[HOA3-4d4]": 29,
    "test_custom_ls_output[HOA3-itu_4+5+1]": 30,
    "test_custom_ls_output[HOA3-t_design_4]": 32,
    # Failure reason: TD Object Renderer standalone does not support custom LS input
    # Comparison with pyaudio3dtools results in bad SNR
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL]": 0,
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL]": 8,
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural[4d4-BINAURAL]": 0,
    "test_custom_ls_input_binaural[4d4-BINAURAL]": 6,
    "test_custom_ls_input_binaural[4d4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL]": 1,
    "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL_ROOM]": 3,
    "test_custom_ls_input_binaural[t_design_4-BINAURAL]": 5,
    "test_custom_ls_input_binaural[t_design_4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-full_circle_in_15s]": 7,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-rotate_yaw_pitch_roll1]": 6,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-full_circle_in_15s]": 7,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-rotate_yaw_pitch_roll1]": 5,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-full_circle_in_15s]": 1,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-rotate_yaw_pitch_roll1]": 1,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL_ROOM-full_circle_in_15s]": 3,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-full_circle_in_15s]": 4,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-rotate_yaw_pitch_roll1]": 4,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL]": 0,
    "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL_ROOM]": 3,
    "test_custom_ls_input_binaural[t_design_4-BINAURAL]": 0,
    "test_custom_ls_input_binaural[t_design_4-BINAURAL_ROOM]": 0,
    # TODO need to verify 5ms rendering in external renderer
    # Crend unit test does not support intermediate conversion to 7_1_4
    # Comparison with pyaudio3dtools results in bad SNR
    "test_ism_binaural_headrotation[ISM1-BINAURAL_ROOM-full_circle_in_15s]": 9,
    # TODO needs debugging
    "test_ism_binaural_headrotation[ISM2-BINAURAL-rotate_yaw_pitch_roll1]": 34,
    "test_ism_binaural_headrotation[ISM3-BINAURAL-rotate_yaw_pitch_roll1]": 34,
    "test_ism_binaural_headrotation[ISM4-BINAURAL-rotate_yaw_pitch_roll1]": 33,
    # Failure reason: Crend unit test does not support intermediate conversion to 7_1_4
    "test_ism_binaural_headrotation[ISM1-BINAURAL_ROOM-full_circle_in_15s]": 10,
    "test_ism_binaural_headrotation[ISM1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4,
    "test_ism_binaural_headrotation[ISM2-BINAURAL_ROOM-full_circle_in_15s]": 10,
    "test_ism_binaural_headrotation[ISM2-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3,
    "test_ism_binaural_headrotation[ISM2-BINAURAL-rotate_yaw_pitch_roll1]": 24,
    "test_ism_binaural_headrotation[ISM3-BINAURAL_ROOM-full_circle_in_15s]": 10,
    "test_ism_binaural_headrotation[ISM3-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4,
    "test_ism_binaural_headrotation[ISM3-BINAURAL-rotate_yaw_pitch_roll1]": 24,
    "test_ism_binaural_headrotation[ISM4-BINAURAL_ROOM-full_circle_in_15s]": 10,
    "test_ism_binaural_headrotation[ISM4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4,
    "test_ism_binaural_headrotation[ISM4-BINAURAL-rotate_yaw_pitch_roll1]": 24,
    "test_ism_binaural_static[ISM1-BINAURAL_ROOM]": 23,
    "test_ism_binaural_static[ISM2-BINAURAL_ROOM]": 21,
    "test_ism_binaural_static[ISM3-BINAURAL_ROOM]": 21,
    "test_ism_binaural_static[ISM4-BINAURAL_ROOM]": 21,
    # TODO needs debugging
    # Failure reason: minor differences could be due to crossfades or metadata position rounding
    "test_ism[ISM1-5_1_2]": 48,
    "test_ism[ISM1-5_1_4]": 48,
    "test_ism[ISM1-5_1]": 48,
    "test_ism[ISM1-7_1_4]": 46,
    "test_ism[ISM1-7_1]": 45,
    "test_ism[ISM1-FOA]": 44,
    "test_ism[ISM1-HOA2]": 40,
    "test_ism[ISM1-HOA3]": 37,
    "test_ism[ISM1-STEREO]": 54,
    "test_ism[ISM2-5_1_2]": 46,
    "test_ism[ISM2-5_1_4]": 45,
    # Failure Reason: Casting of positions in renderer to int16_t vs. float in python
    "test_ism[ISM1-STEREO]": 50,
    "test_ism[ISM2-STEREO]": 54,
    "test_ism[ISM4-STEREO]": 55,
    "test_ism[ISM3-STEREO]": 51,
    "test_ism[ISM1-5_1]": 43,
    "test_ism[ISM1-5_1_2]": 43,
    "test_ism[ISM1-5_1_4]": 43,
    "test_ism[ISM1-7_1]": 40,
    "test_ism[ISM1-7_1_4]": 41,
    "test_ism[ISM1-FOA]": 49,
    "test_ism[ISM1-HOA2]": 45,
    "test_ism[ISM1-HOA3]": 42,
    "test_ism[ISM2-5_1]": 47,
    "test_ism[ISM2-7_1_4]": 43,
    "test_ism[ISM2-7_1]": 45,
    "test_ism[ISM2-FOA]": 41,
    "test_ism[ISM2-HOA2]": 37,
    "test_ism[ISM2-HOA3]": 34,
    "test_ism[ISM2-STEREO]": 55,
    "test_ism[ISM3-5_1_2]": 44,
    "test_ism[ISM3-5_1_4]": 43,
    "test_ism[ISM2-5_1_2]": 44,
    "test_ism[ISM2-5_1_4]": 43,
    "test_ism[ISM2-7_1]": 44,
    "test_ism[ISM2-7_1_4]": 41,
    "test_ism[ISM2-FOA]": 47,
    "test_ism[ISM2-HOA2]": 43,
    "test_ism[ISM2-HOA3]": 40,
    "test_ism[ISM3-5_1]": 45,
    "test_ism[ISM3-7_1_4]": 42,
    "test_ism[ISM3-7_1]": 44,
    "test_ism[ISM3-FOA]": 39,
    "test_ism[ISM3-HOA2]": 36,
    "test_ism[ISM3-HOA3]": 33,
    "test_ism[ISM3-STEREO]": 54,
    "test_ism[ISM4-5_1_2]": 44,
    "test_ism[ISM4-5_1_4]": 44,
    "test_ism[ISM3-5_1_2]": 43,
    "test_ism[ISM3-5_1_4]": 42,
    "test_ism[ISM3-7_1]": 43,
    "test_ism[ISM3-7_1_4]": 41,
    "test_ism[ISM3-FOA]": 47,
    "test_ism[ISM3-HOA2]": 43,
    "test_ism[ISM3-HOA3]": 40,
    "test_ism[ISM4-5_1]": 46,
    "test_ism[ISM4-7_1_4]": 43,
    "test_ism[ISM4-7_1]": 44,
    "test_ism[ISM4-FOA]": 40,
    "test_ism[ISM4-HOA2]": 36,
    "test_ism[ISM4-HOA3]": 33,
    "test_ism[ISM4-STEREO]": 57,
    "test_ism[ISM4-5_1_2]": 43,
    "test_ism[ISM4-5_1_4]": 43,
    "test_ism[ISM4-7_1]": 45,
    "test_ism[ISM4-7_1_4]": 41,
    "test_ism[ISM4-FOA]": 47,
    "test_ism[ISM4-HOA2]": 43,
    "test_ism[ISM4-HOA3]": 40,
    # TODO delay alignment of LFE in binaural output
    # Failure reason: bitexact except for delay alignment of LFE signal (Issue 59)
    "test_multichannel_binaural_headrotation[5_1-BINAURAL-full_circle_in_15s]": 7,
@@ -411,6 +443,12 @@ pass_snr = {
    "test_multichannel_binaural_headrotation[7_1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3,
    "test_multichannel_binaural_headrotation[7_1_4-BINAURAL_ROOM-full_circle_in_15s]": 10,
    "test_multichannel_binaural_headrotation[7_1_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 3,
    # Failure reason: combined format, reasons listed above
    "test_metadata[mixed_scene-5_1_2]": 47,
    "test_metadata[mixed_scene-7_1]": 48,
    "test_metadata[mixed_scene-7_1_4]": 47,
    "test_metadata[mixed_scene-5_1_4]": 47,
    "test_metadata[mixed_scene-5_1]": 47,
    #####################################
    #
    # External vs Internal Renderer tests
@@ -437,46 +475,42 @@ pass_snr = {
    "test_ism_binaural_static_vs_decoder[ISM4-BINAURAL_ROOM]": 12,
    # TODO harmonize panning to stereo
    # Failure reason ISM to stereo panning is done via EFAP in the renderer and tangent law in decoder, harmonize
    "test_ism_vs_decoder[ISM1-STEREO]": 8,
    "test_ism_vs_decoder[ISM2-STEREO]": 17,
    "test_ism_vs_decoder[ISM3-STEREO]": 14,
    "test_ism_vs_decoder[ISM4-STEREO]": 14,
    # TODO needs investigation
    # Failure reason: likely differences between metadata position rounding (decoder uses ceil()) and crossfades
    "test_ism_vs_decoder[ISM1-5_1_2]": 26,
    "test_ism_vs_decoder[ISM1-5_1]": 26,
    "test_ism_vs_decoder[ISM1-5_1_4]": 26,
    "test_ism_vs_decoder[ISM1-7_1]": 26,
    "test_ism_vs_decoder[ISM1-7_1_4]": 26,
    "test_ism_vs_decoder[ISM1-FOA]": 26,
    "test_ism_vs_decoder[ISM1-HOA2]": 26,
    "test_ism_vs_decoder[ISM1-HOA3]": 26,
    "test_ism_vs_decoder[ISM2-5_1_2]": 31,
    "test_ism_vs_decoder[ISM2-5_1_4]": 31,
    # "test_ism_vs_decoder[ISM1-STEREO]": 8,
    # "test_ism_vs_decoder[ISM2-STEREO]": 17,
    # "test_ism_vs_decoder[ISM3-STEREO]": 14,
    # "test_ism_vs_decoder[ISM4-STEREO]": 14,
    # Failure reason: Decoder sets elevation for non-planar output layouts to 0
    "test_ism_vs_decoder[ISM2-5_1]": 6,
    "test_ism_vs_decoder[ISM2-7_1_4]": 31,
    "test_ism_vs_decoder[ISM2-7_1]": 5,
    "test_ism_vs_decoder[ISM2-FOA]": 31,
    "test_ism_vs_decoder[ISM2-HOA2]": 30,
    "test_ism_vs_decoder[ISM2-HOA3]": 29,
    "test_ism_vs_decoder[ISM3-5_1_2]": 32,
    "test_ism_vs_decoder[ISM3-5_1_4]": 32,
    "test_ism_vs_decoder[ISM3-5_1]": 8,
    "test_ism_vs_decoder[ISM3-7_1_4]": 31,
    "test_ism_vs_decoder[ISM3-7_1]": 7,
    "test_ism_vs_decoder[ISM3-FOA]": 32,
    "test_ism_vs_decoder[ISM3-HOA2]": 31,
    "test_ism_vs_decoder[ISM3-HOA3]": 29,
    "test_ism_vs_decoder[ISM3-MONO]": 77,
    "test_ism_vs_decoder[ISM4-5_1_2]": 31,
    "test_ism_vs_decoder[ISM4-5_1_4]": 30,
    "test_ism_vs_decoder[ISM4-5_1]": 8,
    "test_ism_vs_decoder[ISM4-7_1_4]": 30,
    "test_ism_vs_decoder[ISM4-7_1]": 7,
    # Failure reason: Bit-exact except for first frame; renderer fades in from defaultObjectPosition(), decoder fades in from 0
    "test_ism_vs_decoder[ISM1-5_1_2]": 27,
    "test_ism_vs_decoder[ISM1-5_1_4]": 27,
    "test_ism_vs_decoder[ISM1-7_1_4]": 27,
    "test_ism_vs_decoder[ISM1-FOA]": 27,
    "test_ism_vs_decoder[ISM1-HOA2]": 27,
    "test_ism_vs_decoder[ISM1-HOA3]": 27,
    "test_ism_vs_decoder[ISM2-5_1_2]": 32,
    "test_ism_vs_decoder[ISM2-5_1_4]": 32,
    "test_ism_vs_decoder[ISM2-7_1_4]": 32,
    "test_ism_vs_decoder[ISM2-FOA]": 32,
    "test_ism_vs_decoder[ISM2-HOA2]": 32,
    "test_ism_vs_decoder[ISM2-HOA3]": 32,
    "test_ism_vs_decoder[ISM3-5_1_2]": 33,
    "test_ism_vs_decoder[ISM3-5_1_4]": 33,
    "test_ism_vs_decoder[ISM3-7_1_4]": 33,
    "test_ism_vs_decoder[ISM3-FOA]": 33,
    "test_ism_vs_decoder[ISM3-HOA2]": 33,
    "test_ism_vs_decoder[ISM3-HOA3]": 33,
    "test_ism_vs_decoder[ISM4-5_1_2]": 31,
    "test_ism_vs_decoder[ISM4-5_1_4]": 31,
    "test_ism_vs_decoder[ISM4-7_1_4]": 31,
    "test_ism_vs_decoder[ISM4-FOA]": 31,
    "test_ism_vs_decoder[ISM4-HOA2]": 30,
    "test_ism_vs_decoder[ISM4-HOA3]": 29,
    "test_ism_vs_decoder[ISM4-MONO]": 77,
    "test_ism_vs_decoder[ISM4-HOA2]": 32,
    "test_ism_vs_decoder[ISM4-HOA3]": 31,
    # TODO needs investigation
    # Failure reason: headrotation and crossfade could have differences
    "test_multichannel_binaural_headrotation_vs_decoder[5_1_2-BINAURAL-full_circle_in_15s]": 4,