Commit e05675af authored by norvell's avatar norvell
Browse files

Fix SBA gain scaling for input signal

parent ddea277e
Loading
Loading
Loading
Loading
+31 −31
Original line number Diff line number Diff line
@@ -439,6 +439,37 @@ def test_param_file_tests(
        dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}"
        ref_output_file = f"{reference_path}/param_file/dec/{output_file}"

        # Check if we need to render to stereo or binaural for PEAQ comparison
        if peaq_binaural:

            allow_differing_lengths = True
            # Disable tracefile supported comparison -- no tracefile available for input
            tracefile_dec = ""

            # Find input format
            in_fmt = [
                (a, b)
                for (a, b) in INPUT_FMT
                if re.search(a, enc_opts)
            ][0][1]

            record_property = dut_decoder_frontend.record_property if dut_decoder_frontend else ref_decoder_frontend.record_property

            (ref_output_file, dut_output_file) = rend.binauralize_input_and_output(
                    record_property,
                    props_to_record,
                    test_info,
                    testv_file,
                    dut_output_file,
                    ref_output_file,
                    in_fmt,
                    output_config,
                    enc_opts,
                    dec_opts,
                    in_sr,
                    out_sr,
            )

        # set to false per default even if this is no JBM case - makes later check for failure easier
        tracefile_last_rtp_numbers_differ = False

@@ -471,37 +502,6 @@ def test_param_file_tests(
        else:
            ref_file = ref_output_file

        # Check if we need to render to stereo or binaural for PEAQ comparison
        if peaq_binaural:

            allow_differing_lengths = True
            # Disable tracefile supported comparison -- no tracefile available for input
            tracefile_dec = ""

            # Find input format
            in_fmt = [
                (a, b)
                for (a, b) in INPUT_FMT
                if re.search(a, enc_opts)
            ][0][1]

            record_property = dut_decoder_frontend.record_property if dut_decoder_frontend else ref_decoder_frontend.record_property

            (ref_file, dut_output_file) = rend.binauralize_input_and_output(
                    record_property,
                    props_to_record,
                    test_info,
                    testv_file,
                    dut_output_file,
                    ref_output_file,
                    in_fmt,
                    output_config,
                    enc_opts,
                    dec_opts,
                    in_sr,
                    out_sr,
            )

        fs = int(sampling_rate) * 1000
        output_differs, reason = cmp_pcm(
            ref_file,
+31 −16
Original line number Diff line number Diff line
@@ -188,6 +188,8 @@ def test_pca_enc(
            gain_flag,
            keep_files,
            decoder_only,
            cut_gain=cut_gain,
            cut_testv=cut_testv,
            plc_pattern=plc_pattern,
            get_mld=get_mld,
            get_mld_lim=get_mld_lim,
@@ -364,6 +366,8 @@ def test_sba_enc_system(
            gain_flag,
            keep_files,
            decoder_only,
            cut_gain=cut_gain,
            cut_testv=cut_testv,
            plc_pattern=plc_pattern,
            get_mld=get_mld,
            get_mld_lim=get_mld_lim,
@@ -506,6 +510,8 @@ def test_spar_hoa2_enc_system(
            gain_flag,
            keep_files,
            decoder_only,
            cut_gain=cut_gain,
            cut_testv=cut_testv,
            plc_pattern=plc_pattern,
            get_mld=get_mld,
            get_mld_lim=get_mld_lim,
@@ -642,6 +648,8 @@ def test_spar_hoa3_enc_system(
            gain_flag,
            keep_files,
            decoder_only,
            cut_gain=cut_gain,
            cut_testv=cut_testv,
            plc_pattern=plc_pattern,
            get_mld=get_mld,
            get_mld_lim=get_mld_lim,
@@ -798,6 +806,8 @@ def test_sba_enc_BWforce_system(
            gain_flag,
            keep_files,
            decoder_only,
            cut_gain=cut_gain,
            cut_testv=cut_testv,
            plc_pattern=plc_pattern,
            get_mld=get_mld,
            get_mld_lim=get_mld_lim,
@@ -935,6 +945,8 @@ def test_sba_plc_system(
            gain_flag,
            keep_files,
            decoder_only,
            cut_gain=cut_gain,
            cut_testv=cut_testv,
            plc_pattern=plc_pattern,
            get_mld=get_mld,
            get_mld_lim=get_mld_lim,
@@ -1093,6 +1105,8 @@ def sba_dec(
    gain_flag,
    keep_files,
    decoder_only,
    cut_gain="1.0",
    cut_testv=False,
    plc_pattern=None,
    get_mld=False,
    get_mld_lim=0,
@@ -1169,26 +1183,16 @@ def sba_dec(
            plc_file=plc_file,
        )

        allow_differing_lengths = False
        if compare_to_input:
            # If comparing to input, set input as reference and allow different length
            ref_out_file = f"{test_vector_path}/{tag}.wav"
            if gain_flag != -1:
                ref_out_file = f"{test_vector_path}/{tag}_Gain{gain_flag}.wav"
            else:
                ref_out_file = f"{test_vector_path}/{tag}.wav"

            allow_differing_lengths = True


        if peaq_binaural:
            allow_differing_lengths = True
            enc_opts = ""
            dec_opts = ""
            if gain_flag != -1:
                input_file = f"{test_vector_path}/{tag}_Gain{gain_flag}.wav"
            else:
            input_file = f"{test_vector_path}/{tag}.wav"
            if cut_testv:
                if cut_gain == "1.0":
                    input_file = f"{test_vector_path}/{tag}_cut.wav"
                else:
                    input_file = f"{test_vector_path}/{tag}_cut_{cut_gain}.wav"
            in_fmt = input_config
            in_sr = sampling_rate
            out_sr = sampling_rate
@@ -1207,6 +1211,17 @@ def sba_dec(
                in_sr,
                out_sr,
            )
        else:
            allow_differing_lengths = False
            if compare_to_input:
                # If comparing to input, set input as reference and allow different length
                ref_out_file = f"{test_vector_path}/{tag}.wav"
                if gain_flag != -1:
                    ref_out_file = f"{test_vector_path}/{tag}_Gain{gain_flag}.wav"
                else:
                    ref_out_file = f"{test_vector_path}/{tag}.wav"

                allow_differing_lengths = True

        sampling_rate_Hz = int(sampling_rate) * 1000
        cmp_result, reason = cmp_pcm(