Commit 4cbac086 authored by norvell's avatar norvell
Browse files

Add --diff option to create_histogram_summary.py for comparison to input

parent 1b6ac194
Loading
Loading
Loading
Loading
Loading
+23 −9
Original line number Diff line number Diff line
@@ -50,6 +50,13 @@ if __name__ == "__main__":
        "--evs",
        action="store_true",
        help="Parse using EVS 26.444 formats",
        default=False,
    )
    parser.add_argument(
        "--diff",
        action="store_true",
        help="Use limits for diff scores",
        default=False,
    )
    args = parser.parse_args()
    csv_report = args.csv_report
@@ -62,7 +69,14 @@ if __name__ == "__main__":
    else:
        FORMATS = IVAS_FORMATS
        CATEGORIES = IVAS_CATEGORIES

    if args.diff:
        limits_per_measure = {
            "MLD": ("MLD", [-math.inf, 0, 0.1, 0.2, 0.3, 0.4, math.inf]),
            "DIFF": ("MAXIMUM ABS DIFF", [-32768, 0, 128, 256, 512, 32767]),
            "SSNR": ("MIN_SSNR", [-math.inf, -0.4, -0.3, -0.2, -0.1, 0, math.inf]),
            "ODG": ("MIN_ODG", [-5.0, -0.3, -0.2, -0.1, 0, math.inf]),
        }
    else:
        limits_per_measure = {
            "MLD": ("MLD", [0, 5, 10, math.inf]),
            "DIFF": ("MAXIMUM ABS DIFF", [0, 1024, 16384, 32769]),
@@ -89,7 +103,7 @@ if __name__ == "__main__":
            f"{str(a)} -- {str(b)}" for (a, b) in zip(limits[0:-1], limits[1:])
        ] + ["None"]
        # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF
        if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF":
        if (measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF") and not args.diff:
            limits_labels = ["0"] + limits_labels
        headerline = f"Format;Category;" + ";".join(limits_labels) + "\n"
        fp.write(headerline)
@@ -107,7 +121,7 @@ if __name__ == "__main__":
                    ]
                ]
                # Zero difference is treated as a special category for MLD and MAXIMUM ABS DIFF
                if measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF":
                if (measure_label == "MLD" or measure_label == "MAXIMUM ABS DIFF") and not args.diff:
                    val = [
                        float(x) for x in values if x != "None" and x != "0" and x != ""
                    ]