summaryrefslogtreecommitdiff
path: root/Documentation/guides/introduction.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/guides/introduction.rst')
0 files changed, 0 insertions, 0 deletions
1 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
#!/usr/bin/env python3
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Script to convert version 1.0 Raspberry Pi camera tuning files to version 2.0.
#
# Copyright 2022 Raspberry Pi Ltd

import argparse
import json
import numpy as np
import sys

from ctt_pretty_print_json import pretty_print
from ctt_pisp import grid_size as grid_size_pisp
from ctt_pisp import json_template as json_template_pisp
from ctt_vc4 import grid_size as grid_size_vc4
from ctt_vc4 import json_template as json_template_vc4


def interp_2d(in_ls, src_w, src_h, dst_w, dst_h):

    out_ls = np.zeros((dst_h, dst_w))
    for i in range(src_h):
        out_ls[i] = np.interp(np.linspace(0, dst_w - 1, dst_w),
                              np.linspace(0, dst_w - 1, src_w),
                              in_ls[i])
    for i in range(dst_w):
        out_ls[:,i] = np.interp(np.linspace(0, dst_h - 1, dst_h),
                                np.linspace(0, dst_h - 1, src_h),
                                out_ls[:src_h, i])
    return out_ls


def convert_target(in_json: dict, target: str):

    src_w, src_h = grid_size_pisp if target == 'vc4' else grid_size_vc4
    dst_w, dst_h = grid_size_vc4 if target == 'vc4' else grid_size_pisp