summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/data/uncalibrated.json
blob: 16a01e940b42236f13dc0ee7f6e05f18832859da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
    "rpi.black_level":
    {
        "black_level": 4096
    },
    "rpi.awb":
    {
        "use_derivatives": 0,
        "bayes": 0
    },
    "rpi.agc":
    {
        "metering_modes":
        {
            "centre-weighted": {
                "weights": [4, 4, 4, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0]
            }
        },
        "exposure_modes":
        {
            "normal":
            {
                "shutter": [ 100, 15000, 30000, 60000, 120000 ],
                "gain":    [ 1.0, 2.0,   3.0,   4.0,   6.0    ]
            }
        },
        "constraint_modes":
        {
            "normal":
            [
                { "bound": "LOWER", "q_lo": 0.98, "q_hi": 1.0, "y_target": [ 0, 0.4, 1000, 0.4 ] }
            ]
        },
        "y_target": [ 0, 0.16, 1000, 0.165, 10000, 0.17 ]
    },
    "rpi.ccm":
    {
        "ccms":
        [
            { "ct": 4000, "ccm": [ 2.0, -1.0, 0.0,   -0.5, 2.0, -0.5,   0, -1.0, 2.0 ] }
        ]
    },
    "rpi.contrast":
    {
        "ce_enable": 0,
        "gamma_curve": [
            0,     0,
            1024,  5040,
            2048,  9338,
            3072,  12356,
            4096,  15312,
            5120,  18051,
            6144,  20790,
            7168,  23193,
            8192,  25744,
            9216,  27942,
            10240, 30035,
            11264, 32005,
            12288, 33975,
            13312, 35815,
            14336, 37600,
            15360, 39168,
            16384, 40642,
            18432, 43379,
            20480, 45749,
            22528, 47753,
            24576, 49621,
            26624, 51253,
            28672, 52698,
            30720, 53796,
            32768, 54876,
            36864, 57012,
            40960, 58656,
            45056, 59954,
            49152, 61183,
            53248, 62355,
            57344, 63419,
            61440, 64476,
            65535, 65535
        ]
    }
}
an> DRM_FORMAT_BGRA8888: formatFamily_ = RGB; r_pos_ = 1; g_pos_ = 2; b_pos_ = 3; bpp_ = 4; break; case DRM_FORMAT_VYUY: formatFamily_ = YUV; y_pos_ = 1; cb_pos_ = 2; break; case DRM_FORMAT_YVYU: formatFamily_ = YUV; y_pos_ = 0; cb_pos_ = 3; break; case DRM_FORMAT_UYVY: formatFamily_ = YUV; y_pos_ = 1; cb_pos_ = 0; break; case DRM_FORMAT_YUYV: formatFamily_ = YUV; y_pos_ = 0; cb_pos_ = 1; break; case DRM_FORMAT_MJPEG: formatFamily_ = MJPEG; break; default: return -EINVAL; }; format_ = format; width_ = width; height_ = height; return 0; } void FormatConverter::convert(const unsigned char *src, size_t size, QImage *dst) { switch (formatFamily_) { case MJPEG: dst->loadFromData(src, size, "JPEG"); break; case YUV: convertYUV(src, dst->bits()); break; case RGB: convertRGB(src, dst->bits()); break; case NV: convertNV(src, dst->bits()); break; }; } static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b) { int c = y - 16; int d = u - 128; int e = v - 128; *r = CLIP(( 298 * c + 409 * e + 128) >> RGBSHIFT); *g = CLIP(( 298 * c - 100 * d - 208 * e + 128) >> RGBSHIFT); *b = CLIP(( 298 * c + 516 * d + 128) >> RGBSHIFT); } void FormatConverter::convertNV(const unsigned char *src, unsigned char *dst) { unsigned int c_stride = width_ * (2 / horzSubSample_); unsigned int c_inc = horzSubSample_ == 1 ? 2 : 0; unsigned int cb_pos = nvSwap_ ? 1 : 0; unsigned int cr_pos = nvSwap_ ? 0 : 1; const unsigned char *src_c = src + width_ * height_; int r, g, b; for (unsigned int y = 0; y < height_; y++) { const unsigned char *src_y = src + y * width_; const unsigned char *src_cb = src_c + (y / vertSubSample_) * c_stride + cb_pos; const unsigned char *src_cr = src_c + (y / vertSubSample_) * c_stride + cr_pos; for (unsigned int x = 0; x < width_; x += 2) { yuv_to_rgb(*src_y, *src_cb, *src_cr, &r, &g, &b); dst[0] = b; dst[1] = g; dst[2] = r; dst[3] = 0xff; src_y++; src_cb += c_inc; src_cr += c_inc; dst += 4; yuv_to_rgb(*src_y, *src_cb, *src_cr, &r, &g, &b); dst[0] = b; dst[1] = g; dst[2] = r; dst[3] = 0xff; src_y++; src_cb += 2; src_cr += 2; dst += 4; } } } void FormatConverter::convertRGB(const unsigned char *src, unsigned char *dst)