Commit 7a985bd8 authored by Jan Kiene's avatar Jan Kiene
Browse files

use test offset in audioarray.compare for all steps

parent 090641c8
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -265,18 +265,25 @@ def compare(
        Set to True to only apply the threshold comparison for the reference signal
        for whether to include a segment in the ssnr computation. Use this to align
        behaviour with the MPEG-D conformance specification.
    test_start_offset_ms: int
    test_start_offset_ms: (non-negative) int
        offset in miliseconds for test signal. If > 0, the corresponding number of samples
        will be removed from the test array like so: test = test[sample_offset:, :], default 0
        will be removed from the test array like so: test = test[sample_offset:, :].

    Returns
    -------
    result: dict
        Comparison results
    """
    framesize = fs // 50

    if test_start_offset_ms < 0:
        raise ValueError(
            f"Test_start_offset_ms has to be non-negative, but {test_start_offset_ms} was given."
        )
    test_start_offset_samples = int(fs * test_start_offset_ms / 1000)
    diff = abs(test[test_start_offset_samples:, :] - ref)
    test = test[test_start_offset_samples:, :]

    framesize = fs // 50
    diff = abs(test - ref)
    max_diff = int(diff.max())
    result = {
        "bitexact": True,