Commit e7d8cde5 authored by Jan Kiene's avatar Jan Kiene
Browse files

return neg inf if ref outside of thresh everywhere

parent cf01bc18
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -569,6 +569,12 @@ def ssnr(

        ss.append(ss_seg)

    # round to 2 decimals. this is just to be in line with the meg conformance tool
    if np.all(segment_counter == 0):
        # the reference signal was outside of [thresh_lowm thresh_high] for all segments -> return -inf
        # note that this is not in line with the mpeg conf tool which gives +/-0.0 in this case
        ssnr = np.asarray([-np.inf] * len(segment_counter))
    else:
        # round to 2 decimals. this is just to be in line with the mpeg conformance tool
        ssnr = np.round(10 * np.log10(10 ** (np.sum(ss, axis=0) / segment_counter) - 1), 2)

    return ssnr