import math


def get_psnr(mse, max_value=255.0):
    """
    Calculates PSNR value from given MSE value.
    :param mse:
    :param max_value:
    :return:
    """
    if mse is None or mse == float('Inf') or mse == 0:
        psnr = 0
    else:
        psnr = 20 * math.log(max_value / math.sqrt(mse), 10)
    return psnr