Skip to content
Snippets Groups Projects
Commit ca12761b authored by Ulysse Darmet's avatar Ulysse Darmet
Browse files

Add analysis script

parent a0ac3494
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
filename = 'out.txt'
PredMode = {1:'inter', 2:'intra', 5:'skip'}
CUData = {
'addr' :int,
'depth' :int,
'f_intra' :int,
'f_inter' :int,
'f_MVD' :int,
'isLeaf' :lambda x: bool(int(x)),
'predMode':lambda x: PredMode[int(x[0])]}
# Parse data
data = []
import os
with open(os.path.join(os.path.dirname(__file__), filename)) as f:
for line in f.readlines():
tokens = line.replace(':',' ').split()
cu = {k:CUData[k](v) for k, v in zip(tokens[0::2], tokens[1::2])}
data.append(cu)
# Analyse
count = dict(zip(PredMode.values(), [0]*len(PredMode)))
errors = 0
for cu in data:
addr = cu['addr']
depth = cu['depth']
isLeaf = cu['isLeaf']
predMode = cu['predMode']
count[predMode] += 1
if isLeaf and depth > 0 and predMode != 'skip':
f_intra = cu['f_intra']
f_inter = cu['f_inter']
f_MVD = cu['f_MVD']
df_ratio = (f_intra - f_inter) / max(f_intra, f_inter)
if (predMode == 'intra' and df_ratio > 0) or (predMode == 'inter' and df_ratio < 0):
print('df_ratio: {:6.2f}\tf_MVD: {:6}\tpredMode: {}'.format(df_ratio, f_MVD, predMode))
errors += 1
print('errors: {} ({:.0f})%'.format(errors, 100*errors/(count['intra'] + count['inter'])))
print(count)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment