Merge pull request #146 from krakow10/vmaf-transform

define and use transform_vmaf function
This commit is contained in:
Zen 2020-09-04 23:55:55 +03:00 committed by GitHub
commit 0ce4dab652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -198,6 +198,12 @@ def get_closest(q_list, q, positive=True):
return min(q_list, key=lambda x: abs(x - q))
def transform_vmaf(vmaf):
if vmaf<99.99:
return -ln(1-vmaf/100)
else:
#return -ln(1-99.99/100)
return 9.210340371976184
def weighted_search(num1, vmaf1, num2, vmaf2, target):
"""
@ -211,8 +217,8 @@ def weighted_search(num1, vmaf1, num2, vmaf2, target):
:return: Q for new probe
"""
dif1 = abs(-ln(1-target/100) - (-ln(1-vmaf2/100)))
dif2 = abs(-ln(1-target/100) - (-ln(1-vmaf1/100)))
dif1 = abs(transform_vmaf(target) - transform_vmaf(vmaf2))
dif2 = abs(transform_vmaf(target) - transform_vmaf(vmaf1))
tot = dif1 + dif2