import json


def load_params(filename):
    """Loads rendering parameters from json file."""
    with open(filename, 'r', encoding='utf-8') as jsonfile:
        result = json.load(jsonfile)

    assert 'width' in result and isinstance(result['width'], int)
    assert 'height' in result and isinstance(result['height'], int)
    assert 'samples_per_pixel' in result and isinstance(result['samples_per_pixel'], int)
    assert 'max_cpus' in result and isinstance(result['max_cpus'], int)
    assert 'max_depth' in result and isinstance(result['max_depth'], int)
    assert 'first_bounce_u_samples' in result and isinstance(result['first_bounce_u_samples'], int)
    assert 'first_bounce_v_samples' in result and isinstance(result['first_bounce_v_samples'], int)
    assert 'preview' in result and isinstance(result['preview'], bool)

    return result