AV1-vs-HEVC/workflows/visualize_metrics_hevc.py
2024-01-12 20:33:08 +01:00

63 lines
2.2 KiB
Python

import os
from . import res
def start_workflow():
res.bootstrap_folder_structure()
aggregated_metrics = res.read_dict_from_json_file(
os.path.join(
res.get_path_results_aggregations(),
res.get_filename_results_aggregations_hevc()
)
)
for preset in aggregated_metrics.keys():
for crf in aggregated_metrics[preset].keys():
# encoding time
res.save_diagram_normal_distribution(
res.generate_diagram_normal_distribution(
res.get_all_values_encoding_time(
aggregated_metrics[preset][crf]
),
f"Encoding times HEVC (Preset:{preset}, CRF: {crf})",
"sec",
"Time (seconds)"
),
os.path.join(
res.get_path_results_diagrams(),
f'hevc_preset_{preset}_crf_{crf}_encoding_time.png'
)
)
# filesize
res.save_diagram_normal_distribution(
res.generate_diagram_normal_distribution(
res.get_all_values_filesize_percentage(
aggregated_metrics[preset][crf]
),
f"Filesize Percentage HEVC (Preset:{preset}, CRF: {crf})",
"pct",
"Percentage file size of the encode from the sample"
),
os.path.join(
res.get_path_results_diagrams(),
f'hevc_preset_{preset}_crf_{crf}_filesize_percentage.png'
)
)
# vmaf score
res.save_diagram_normal_distribution(
res.generate_diagram_normal_distribution(
res.get_all_values_vmaf_score(
aggregated_metrics[preset][crf]
),
f"VMAF Score HEVC (Preset:{preset}, CRF: {crf})",
"pct",
"Score (percent)"
),
os.path.join(
res.get_path_results_diagrams(),
f'hevc_preset_{preset}_crf_{crf}_vmaf_score.png'
)
)