xref: /aosp_15_r20/external/libaom/tools/gop_bitrate/analyze_data.py (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1with open('experiment.txt', 'r') as file:
2    lines = file.readlines()
3    curr_filename = ''
4    keyframe = 0
5    actual_value = 0
6    estimate_value = 0
7    print('filename, estimated value (b), actual value (b)')
8    for line in lines:
9        if line.startswith('input:'):
10            curr_filename = line[13:].strip()
11        if line.startswith('estimated'):
12            estimate_value = float(line[19:].strip())
13        if line.startswith('frame:'):
14            actual_value += float(line[line.find('size')+6:line.find('total')-2])
15        if line.startswith('****'):
16            print(f'{curr_filename}, {estimate_value}, {actual_value}')
17            estimate_value = 0
18            actual_value = 0
19