Commit 20f87457 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] IVAS_crend_unit_test tests and pipeline

- Bug in delay compensation for binauralrenderer.py when zero delay
- Modify -lfe_lpf flag to affect only whether the LFE is filtered;
  always add it by default.
- Update SNR thresholds
- Update usage printout for IVAS_crend_unit_test
- Apply clang-format
parent 9f8be23a
Loading
Loading
Loading
Loading
Loading
+47 −52
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@
#include "render_config_reader.h"



static ivas_result_t ivas_dec_default_io_params( ivas_dec_io_params_t *pIO_params )
{
    memset( pIO_params, 0, sizeof( ivas_dec_io_params_t ) );
@@ -285,9 +284,9 @@ static void ivas_crend_unit_test_usage( void )
    fprintf( stdout, "\nOptional arguments:\n" );
    fprintf( stdout, "---------------------\n" );
    fprintf( stdout, "-ifmt <Input_Format>     : Input format index\n" );
    fprintf( stdout, "                     (0 - MONO, 1 - STEREO, 2 - BINAURAL, 3 - FOA, 4 - 5.1, 5 - 7.1, 6 - 5.1.2, 7 - 7.1.4, 8 - HOA2, 9 - HOA3)\n" );
    fprintf( stdout, "                     (0 - MONO, 1 - STEREO, 2 - BINAURAL, 3 - FOA, 4 - 5.1, 5 - 7.1, 6 - 5.1.2, 7 - 5.1.4, 8 - 7.1.4, 9 - HOA2, 10 - HOA3)\n" );
    fprintf( stdout, "-ofmt <Output_Format>    : Output format index\n" );
    fprintf( stdout, "                     (0 - MONO, 1 - STEREO, 2 - BINAURAL, 3 - FOA, 4 - 5.1, 5 - 7.1, 6 - 5.1.2, 7 - 7.1.4, 8 - HOA2, 9 - HOA3)\n" );
    fprintf( stdout, "                     (0 - MONO, 1 - STEREO, 2 - BINAURAL, 3 - FOA, 4 - 5.1, 5 - 7.1, 6 - 5.1.2, 7 - 5.1.4, 8 - 7.1.4, 9 - HOA2, 10 - HOA3)\n" );
    fprintf( stdout, "-i <Input_Path/File>     : Input path/file\n" );
    fprintf( stdout, "-o <Output_File>         : Output file\n" );
    fprintf( stdout, "-r <Reference_Path/File> : Reference path/file\n" );
@@ -1216,7 +1215,6 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl
        {
            return error;
        }

    }

    st_ivas.nchan_transport = audioCfg2channels( st_ivas.transport_config );
@@ -1477,7 +1475,6 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl
                    cldfbSynthesis( &outSlotRePr, &outSlotImPr, &( ppPcm_in[ch][slot_idx * maxBand] ), maxBand, st_ivas.cldfbSynDec[ch] );
                }
            }

        }
        else
        {
@@ -1499,9 +1496,10 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl
                {
                    delay_signal( ppPcm_in[i], frame_len, ppDelay_lines[i], delay_lp );
                }
            }

            ivas_binaural_add_LFE( &st_ivas, frame_len, ppPcm_in );
            }

            for ( i = 0; i < out_ch; i++ )
            {
                mvr2r( ppPcm_in[i], ppPcm_out[i], frame_len );
@@ -1537,8 +1535,6 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl
                                                                                                        : ppPcm_out[i][j];
                pcm[i] = (short) roundf( temp );
                clip = max( clip, fabsf( ppPcm_out[i][j] ) );


            }
            if ( write_flag == 1 )
            {
@@ -1558,7 +1554,6 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl

        fprintf( stdout, "Processed frame: %ld\r", (long) frame_count );
        frame_count++;

    }

    int16_t pcm[MAX_OUTPUT_CHANNELS] = { 0 };
+2 −1
Original line number Diff line number Diff line
@@ -773,6 +773,7 @@ def binaural_rendering(
    # delay compensation
    delay_total_smp = NS2SA(fs, delay_total_ns)
    y = np.roll(y, -delay_total_smp, axis=0)
    if delay_total_smp > 0:
        y[-delay_total_smp:, :] = 0

    # resample back to original rate
+3 −3
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ TDRENDERER_CMD = [

""" CREND commandline template """
RENDERER_CREND_CMD = [
    str(TESTS_DIR.parent.parent.joinpath("IVAS_crend_unit_test")),
    str(TESTS_DIR.parent.parent.joinpath("build/IVAS_crend_unit_test")),
    "-test",
    "1",
    "-sr",
@@ -83,8 +83,8 @@ RENDERER_CREND_CMD = [
    "",  # 2 -> input file
    "-o",
    "/dev/null",  # 6 -> output file
    "-lp_lfe",
    "-limiter"
    # "-lp_lfe",
    # "-limiter"
    # "-no_delay_cmp"
]

+34 −24
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ def check_BE(
    if not np.allclose(ref, cut, rtol=0, atol=2) and max_diff > 2:
        if snr >= snr_min:
            pytest.xfail(
                f"xfailed with minimum SNR {snr_min} vs {snr:3.2f}dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}"
                f"Expected failure with minimum SNR {snr_min} vs {snr:3.2f}dB, Gain CuT: {gain_b:1.3f}, Max Diff = {int(max_diff)}"
            )
        else:
            pytest.fail(
@@ -204,8 +204,8 @@ def run_crend_unittest(
    )

    cmd = RENDERER_CREND_CMD[:]
    cmd[6] = FORMAT_TO_CREND_FORMAT(str(in_fmt))
    cmd[8] = FORMAT_TO_CREND_FORMAT(str(out_fmt))
    cmd[6] = FORMAT_TO_CREND_FORMAT[str(in_fmt)]
    cmd[8] = FORMAT_TO_CREND_FORMAT[str(out_fmt)]
    cmd[10] = str(in_file)
    cmd[12] = str(out_file)
    if str(out_fmt) == "BINAURAL_ROOM":
@@ -469,7 +469,7 @@ def test_multichannel_binaural_static(test_info, in_fmt, out_fmt):

@pytest.mark.parametrize("out_fmt", OUTPUT_FORMATS_BINAURAL)
@pytest.mark.parametrize("in_fmt", INPUT_FORMATS_MC[2:])
def test_multichannel_binaural_static_vs_crend_unitest(test_info, in_fmt, out_fmt):
def test_multichannel_binaural_static_vs_crend_unittest(test_info, in_fmt, out_fmt):

    cut, cut_fs = run_renderer(in_fmt, out_fmt)

@@ -618,36 +618,36 @@ pass_snr = {
    "test_ambisonics_binaural_static[FOA-BINAURAL_ROOM]": 0.6,
    "test_ambisonics_binaural_static[HOA2-BINAURAL_ROOM]": 0.5,
    "test_ambisonics_binaural_static[HOA3-BINAURAL_ROOM]": 0.1,
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL]": 0,
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural[4d4-BINAURAL]": 0.2,
    "test_custom_ls_input_binaural[4d4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural[custom1-BINAURAL]": 0.2,
    "test_custom_ls_input_binaural[custom1-BINAURAL_ROOM]": 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,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "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[4d4-BINAURAL-full_circle_in_15s]": 0.1,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-full_circle_in_15s]": 0.1,
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL]": 0,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "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[custom1-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[custom1-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural[4d4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural[custom1-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural[t_design_4-BINAURAL_ROOM]": 0,
    "test_custom_ls_input_binaural[itu_4+5+1-BINAURAL_ROOM]": 3.9,
    "test_custom_ls_input_binaural_headrotation[custom1-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[custom1-BINAURAL_ROOM-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-rotate_yaw_pitch_roll1]": 0,
    "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[t_design_4-BINAURAL-full_circle_in_15s]": 0.1,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[4d4-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-BINAURAL-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural_headrotation[16ch_8+4+4-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[custom1-BINAURAL_ROOM-full_circle_in_15s]": 0,
    "test_custom_ls_input_binaural[16ch_8+4+4-BINAURAL_ROOM]": 0.2,
    "test_custom_ls_input_binaural_headrotation[t_design_4-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL_ROOM-full_circle_in_15s]": 4,
    "test_custom_ls_input_binaural_headrotation[itu_4+5+1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 4,
    "test_custom_ls_input_binaural_headrotation[custom1-BINAURAL_ROOM-rotate_yaw_pitch_roll1]": 0,
    "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_ism[ISM1-FOA]": 45,
    "test_ism[ISM1-HOA2]": 41,
    "test_ism[ISM1-HOA3]": 38,
@@ -717,4 +717,14 @@ pass_snr = {
    "test_multichannel_binaural_static[7_1-BINAURAL_ROOM]": 1,
    "test_multichannel_binaural_static[7_1_4-BINAURAL]": 7,
    "test_multichannel_binaural_static[7_1_4-BINAURAL_ROOM]": 1,
    "test_multichannel_binaural_static_vs_crend_unittest[5_1-BINAURAL]": 23,
    "test_multichannel_binaural_static_vs_crend_unittest[5_1-BINAURAL_ROOM]": 38,
    "test_multichannel_binaural_static_vs_crend_unittest[5_1_2-BINAURAL]": 24,
    "test_multichannel_binaural_static_vs_crend_unittest[5_1_2-BINAURAL_ROOM]": 37,
    "test_multichannel_binaural_static_vs_crend_unittest[5_1_4-BINAURAL]": 23,
    "test_multichannel_binaural_static_vs_crend_unittest[5_1_4-BINAURAL_ROOM]": 36,
    "test_multichannel_binaural_static_vs_crend_unittest[7_1-BINAURAL]": 24,
    "test_multichannel_binaural_static_vs_crend_unittest[7_1-BINAURAL_ROOM]": 37,
    "test_multichannel_binaural_static_vs_crend_unittest[7_1_4-BINAURAL]": 23,
    "test_multichannel_binaural_static_vs_crend_unittest[7_1_4-BINAURAL_ROOM]": 36,
}