Commit 9396799d authored by norvell's avatar norvell Committed by emerit
Browse files

Fix for PEAQ binaural, where the input and reference binauralization had the same name

parent 26290986
Loading
Loading
Loading
Loading
+1 −17
Original line number Diff line number Diff line
@@ -509,7 +509,7 @@ def run_test(
                else ref_decoder_frontend.record_property
            )

            (odg_input, odg_test) = binauralize_input_and_output(
            (odg_input, odg_test, odg_ref) = binauralize_input_and_output(
                record_property,
                props_to_record,
                test_info,
@@ -524,22 +524,6 @@ def run_test(
                out_sr,
            )

            (_ , odg_ref) = binauralize_input_and_output(
                record_property,
                props_to_record,
                test_info,
                testv_file,
                ref_output_file,
                ref_output_file,
                in_fmt,
                output_config,
                enc_opts,
                dec_opts,
                in_sr,
                out_sr,
                skip_input_rendering=True,
            )

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

+1 −18
Original line number Diff line number Diff line
@@ -1179,7 +1179,7 @@ def sba_dec(
            in_sr = sampling_rate
            out_sr = sampling_rate

            (odg_input, odg_test) = binauralize_input_and_output(
            (odg_input, odg_test, odg_ref) = binauralize_input_and_output(
                dut_decoder_frontend.record_property,
                props_to_record,
                test_info,
@@ -1194,23 +1194,6 @@ def sba_dec(
                out_sr,
            )

            (_, odg_ref) = binauralize_input_and_output(
                dut_decoder_frontend.record_property,
                props_to_record,
                test_info,
                input_file,
                ref_out_file,
                ref_out_file,
                in_fmt,
                output_config,
                enc_opts,
                dec_opts,
                in_sr,
                out_sr,
                skip_input_rendering=True,
            )


        allow_differing_lengths = False
        if compare_to_input:
            # If comparing to input, set input as reference and allow different length
+45 −10
Original line number Diff line number Diff line
@@ -393,16 +393,17 @@ def binauralize_input_and_output(
    dec_opts,
    in_sr,
    out_sr,
    skip_input_rendering=False,
):

    # Use current folder as location for temporary directory, since scene description does not handle spaces in path
    with tempfile.TemporaryDirectory(dir=".") as tmp_dir:
        tmp_dir = Path(tmp_dir)
        scene_out = str(tmp_dir.joinpath("scene_out.txt"))
        scene_dut = str(tmp_dir.joinpath("scene_dut.txt"))
        scene_ref = str(tmp_dir.joinpath("scene_ref.txt"))
        scene_in = str(tmp_dir.joinpath("scene_in.txt"))

        # File names for binauralized input, if needed
        # File names for binauralized signals, if needed
        ref_input_file_binaural  = ref_output_file[0:-4] + ".INPUT.BINAURAL.wav"
        dut_output_file_binaural = dut_output_file[0:-4] + ".BINAURAL.wav"
        ref_output_file_binaural = ref_output_file[0:-4] + ".BINAURAL.wav"

@@ -462,9 +463,13 @@ def binauralize_input_and_output(
            if "OSBA" in output_config:
                output_config = output_config[:-1] + '3' # Temporary fix to handle than IVAS_dec produces HOA3 for all OSBA configs. Needs to be removed when this fix is ported to BASOP.
            scene_description_file(
                output_config, scene_out, n_obj, dut_output_file, out_meta_files
                output_config, scene_dut, n_obj, dut_output_file, out_meta_files
            )
            dut_output_file = scene_out
            dut_output_file = scene_dut
            scene_description_file(
                output_config, scene_ref, n_obj, ref_output_file, out_meta_files
            )
            ref_output_file = scene_ref
            out_meta_files = None
            output_config = "META"

@@ -523,16 +528,46 @@ def binauralize_input_and_output(
                sr=out_sr,
                render_for_peaq=True,
            )

            check_and_makedir(str(Path(ref_output_file_binaural).parent))

            run_renderer(
                record_property,
                props_to_record,
                test_info,
                output_config,
                output_reformat,
                metadata_input,
                out_meta_files,
                trj_file,
                non_diegetic_pan,
                name_extension,
                refrot_file,
                refvec_file,
                refveclev_file,
                config_file,
                binary_suffix,
                frame_size,
                hrtf_file,
                aeid,
                in_file=ref_output_file,
                out_file=ref_output_file_binaural,
                sr=out_sr,
                render_for_peaq=True,
            )

            # Update output_config to rendered format
            output_config = output_reformat
        else:
            # Signal already mono, stereo or binaural
            dut_output_file_binaural = dut_output_file
            ref_output_file_binaural = ref_output_file

        if in_fmt.upper() != output_config.upper() and not skip_input_rendering:
        if in_fmt.upper() != output_config.upper():
            # Render input to match output_config
            out_fmt = output_config

            check_and_makedir(str(Path(ref_output_file_binaural).parent))
            check_and_makedir(str(Path(ref_input_file_binaural).parent))

            run_renderer(
                record_property,
@@ -554,13 +589,13 @@ def binauralize_input_and_output(
                hrtf_file,
                aeid,
                in_file=input_file,
                out_file=ref_output_file_binaural,
                out_file=ref_input_file_binaural,
                sr=in_sr,
                render_for_peaq=True,
            )
        else:
            ref_output_file_binaural = input_file
        return (ref_output_file_binaural, dut_output_file_binaural)
            ref_input_file_binaural = input_file
        return (ref_input_file_binaural, dut_output_file_binaural, ref_output_file_binaural)


def findstr(exp, s, one_element=True):