{
"version": 2.0,
"target": "bcm2835",
"algorithms": [
{
"rpi.black_level":
{
"black_level": 4096
}
},
{
"rpi.dpc": { }
},
{
"rpi.lux":
{
"reference_shutter_speed": 13841,
"reference_gain": 2.0,
"reference_aperture": 1.0,
"reference_lux": 900,
"reference_Y": 12064
}
},
{
"rpi.noise":
{
"reference_constant": 0,
"reference_slope": 2.776
}
},
{
"rpi.geq":
{
"offset": 189,
"slope": 0.01495
}
},
{
"rpi.sdn": { }
},
{
"rpi.awb":
{
"priors": [
{
"lux": 0,
"prior":
[
2000, 1.0,
3000, 0.0,
13000, 0.0
]
},
{
"lux": 800,
"prior":
[
2000, 0.0,
6000, 2.0,
13000, 2.0
]
},
{
"lux": 1500,
"prior":
[
2000, 0.0,
4000, 1.0,
6000, 6.0,
6500, 7.0,
7000, 1.0,
13000, 1.0
]
}
],
"modes":
{
"auto":
{
"lo": 2500,
"hi": 7900
},
"incandescent":
{
"lo": 2500,
"hi": 3000
},
"tungsten":
{
"lo": 3000,
"hi": 3500
},
"fluorescent":
{
"lo": 4000,
"hi": 4700
},
"indoor":
{
"lo": 3000,
"hi": 5000
},
"daylight":
{
"lo": 5500,
"hi": 6500
},
"cloudy":
{
"lo": 7000,
"hi": 8000
}
},
"bayes": 1,
"ct_curve":
[
2890.0, 0.7328, 0.3734,
3550.0, 0.6228, 0.4763,
4500.0, 0.5208, 0.5825,
5700.0, 0.4467, 0.6671,
7900.0, 0.3858, 0.7411
],
"sensitivity_r": 1.0,
"sensitivity_b": 1.0,
"transverse_pos": 0.02027,
"transverse_neg": 0.01935
}
},
{
"rpi.agc":
{
"metering_modes":
{
"centre-weighted":
{
"weights": [ 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0 ]
},
"spot":
{
"weights": [ 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
},
"matrix":
{
"weights": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
}
},
"exposure_modes":
{
"normal":
{
"shutter": [ 100, 10000, 30000, 60000, 120000 ],
"gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
},
"short":
{
"shutter": [ 100, 5000, 10000, 20000, 120000 ],
"gain": [ 1.0, 2.0, 4.0, 6.0, 8.0 ]
},
"long":
{
"shutter": [ 1000, 30000, 60000, 90000, 120000 ],
"gain": [ 1.0, 2.0, 4.0, 6.0, 12.0 ]
}
},
"constraint_modes":
{
"normal": [
{
"bound": "LOWER",
"q_lo": 0.98,
"q_hi": 1.0,
"y_target":
[
0, 0.5,
1000, 0.5
]
}
],
"highlight": [
{
"bound": "LOWER",
"q_lo": 0.98,
"q_hi": 1.0,
"y_target":
[
0, 0.5,
1000, 0.5
]
},
{
"bound": "UPPER",
"q_lo": 0.98,
"q_hi": 1.0,
"y_target":
[
0, 0.8,
1000, 0.8
]
}
]
},
"y_target":
[
0, 0.16,
1000, 0.165,
10000, 0.17
]
}
},
{
"rpi.alsc":
{
"omega": 1.3,
"n_iter": 100,
"luminance_strength": 0.5,
"calibrations_Cr": [
{
"ct": 3000,
"table":
[
1.527, 1.521, 1.508, 1.493, 1.476, 1.455, 1.442, 1.441, 1.441, 1.441, 1.448, 1.467, 1.483, 1.494, 1.503, 1.504,
1.525, 1.513, 1.496, 1.477, 1.461, 1.434, 1.418, 1.409, 1.409, 1.416, 1.429, 1.449, 1.469, 1.485, 1.495, 1.503,
1.517, 1.506, 1.485, 1.461, 1.434, 1.412, 1.388, 1.376, 1.376, 1.386, 1.405, 1.429, 1.449, 1.471, 1.488, 1.495,
1.512, 1.496, 1.471, 1.442, 1.412, 1.388, 1.361, 1.344, 1.344, 1.358, 1.384, 1.405, 1.431, 1.456, 1.479, 1.489,
1.508, 1.488, 1.458, 1.425, 1.393, 1.361, 1.343, 1.322, 1.321, 1.342, 1.358, 1.385, 1.416, 1.445, 1.471, 1.484,
1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322, 1.318, 1.318, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,
1.507, 1.482, 1.453, 1.418, 1.382, 1.349, 1.322, 1.313, 1.313, 1.321, 1.345, 1.373, 1.405, 1.437, 1.465, 1.483,
1.507, 1.485, 1.455, 1.422, 1.387, 1.355, 1.333, 1.319, 1.321, 1.333, 1.351, 1.381, 1.411, 1.441, 1.467, 1.483,
1.508, 1.489, 1.463, 1.432, 1.401, 1.372, 1.355, 1.333, 1.333, 1.351, 1.369, 1.393, 1.422, 1.448, 1.471, 1.484,
1.511, 1.494, 1.472, 1.444, 1.416, 1.398, 1.372, 1.361, 1.361, 1.369, 1.393, 1.411, 1.436, 1.458, 1.477, 1.487,
1.511, 1.496, 1.478, 1.455, 1.436, 1.416, 1.399, 1.391, 1.391, 1.397, 1.411, 1.429, 1.451, 1.466, 1.479, 1.487,
1.511, 1.495, 1.478, 1.462, 1.448, 1.432, 1.419, 1.419, 1.419, 1.419, 1.429, 1.445, 1.459, 1.471, 1.482, 1.487
]
},
{
"ct": 6000,
"table":
[
2.581, 2.573, 2.558, 2.539, 2.514, 2.487, 2.473, 2.471, 2.471, 2.471, 2.479, 2.499, 2.517, 2.532, 2.543, 2.544,
2.575, 2.559, 2.539, 2.521, 2.491, 2.458, 2.435, 2.421, 2.421, 2.429, 2.449, 2.477, 2.499, 2.519, 2.534, 2.543,
2.561, 2.549, 2.521, 2.491, 2.457, 2.423, 2.393, 2.375, 2.375, 2.387, 2.412, 2.444, 2.475, 2.499, 2.519, 2.532,
2.552, 2.531, 2.498, 2.459, 2.423, 2.391, 2.349, 2.325, 2.325, 2.344, 2.374, 2.412, 2.444, 2.476, 2.505, 2.519,
2.543, 2.518, 2.479, 2.435, 2.392, 2.349, 2.324, 2.285, 2.283, 2.313, 2.344, 2.374, 2.417, 2.457, 2.489, 2.506,
2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284, 2.277, 2.279, 2.283, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,
2.541, 2.511, 2.469, 2.421, 2.372, 2.326, 2.284, 2.267, 2.267, 2.281, 2.313, 2.357, 2.401, 2.443, 2.479, 2.504,
2.541, 2.512, 2.472, 2.425, 2.381, 2.338, 2.302, 2.278, 2.279, 2.301, 2.324, 2.364, 2.407, 2.447, 2.481, 2.504,
2.544, 2.519, 2.483, 2.441, 2.401, 2.363, 2.338, 2.302, 2.302, 2.324, 2.355, 2.385, 2.423, 2.459, 2.488, 2.506,
2.549, 2.527, 2.497, 2.463, 2.427, 2.401, 2.363, 2.345, 2.345, 2.355, 2.385, 2.412, 2.444, 2.473, 2.497, 2.509,
2.552, 2.532, 2.507, 2.481, 2.459, 2.427, 2.402, 2.389, 2.389, 2.394, 2.412, 2.444, 2.465, 2.481, 2.499, 2.511,
2.553, 2.533, 2.508, 2.489, 2.475, 2.454, 2.429, 2.429, 2.429, 2.429, 2.439, 2.463, 2.481, 2.492, 2.504, 2.511
]
}
],
"calibrations_Cb": [
{
"ct": 3000,
"table":
[
3.132, 3.126, 3.116, 3.103, 3.097, 3.091, 3.087, 3.086, 3.088, 3.091, 3.092, 3.102, 3.113, 3.121, 3.141, 3.144,
3.149, 3.132, 3.123, 3.108, 3.101, 3.096, 3.091, 3.089, 3.091, 3.092, 3.101, 3.107, 3.116, 3.129, 3.144, 3.153,
3.161, 3.149, 3.129, 3.121, 3.108, 3.103, 3.101, 3.101, 3.101, 3.103, 3.107, 3.116, 3.125, 3.134, 3.153, 3.159,
3.176, 3.161, 3.144, 3.129, 3.124, 3.121, 3.117, 3.118, 3.118, 3.119, 3.122, 3.125, 3.134, 3.146, 3.159, 3.171,
3.183, 3.176, 3.157, 3.144, 3.143, 3.143, 3.139, 3.141, 3.141, 3.141, 3.141, 3.141, 3.146, 3.161, 3.171, 3.179,
3.189, 3.183, 3.165, 3.157, 3.156, 3.157, 3.159, 3.163, 3.163, 3.163, 3.163, 3.161, 3.163, 3.169, 3.179, 3.187,
3.199, 3.189, 3.171, 3.165, 3.164, 3.167, 3.171, 3.173, 3.173, 3.172, 3.171, 3.169, 3.169, 3.175, 3.187, 3.189,
3.206, 3.196, 3.177, 3.171, 3.165, 3.167, 3.171, 3.173, 3.173, 3.172, 3.171, 3.171, 3.173, 3.177, 3.192, 3.194,
3.209, 3.197, 3.178, 3.171, 3.164, 3.161, 3.159, 3.161, 3.162, 3.164, 3.167, 3.171, 3.173, 3.181, 3.193, 3.198,
3.204, 3.194, 3.176, 3.165, 3.161, 3.156, 3.154, 3.154, 3.159, 3.161, 3.164, 3.168, 3.173, 3.182, 3.198, 3.199,
3.199, 3.191, 3.176, 3.169, 3.161, 3.157, 3.153, 3.153, 3.156, 3.161, 3.164, 3.168, 3.173, 3.186, 3.196, 3.199,
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Test the buffer cache different operation modes
*/
#include <iostream>
#include <random>
#include <vector>
#include <libcamera/formats.h>
#include <libcamera/stream.h>
#include "buffer_source.h"
#include "test.h"
using namespace libcamera;
namespace {
class BufferCacheTest : public Test
{
public:
/*
* Test that a cache with the same size as there are buffers results in
* a sequential run over; 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, ...
*
* The test is only valid when the cache size is as least as big as the
* number of buffers.
*/
int testSequential(V4L2BufferCache *cache,
const std::vector<std::unique_ptr<FrameBuffer>> &buffers)
{
for (unsigned int i = 0; i < buffers.size() * 100; i++) {
int nBuffer = i % buffers.size();
int index = cache->get(*buffers[nBuffer].get());
if (index != nBuffer) {
std::cout << "Expected index " << nBuffer
<< " got " << index << std::endl;
return TestFail;
}
cache->put(index);
}
return TestPass;
}
/*
* Test that randomly putting buffers to the cache always results in a
* valid index.
*/
int testRandom(V4L2BufferCache *cache,
const std::vector<std::unique_ptr<FrameBuffer>> &buffers)
{
std::uniform_int_distribution<> dist(0, buffers.size() - 1);
0.18306,
-0.32356, 1.44826, -0.12471,
-0.00412, -0.69936, 1.70348
]
},
{
"ct": 2920,
"ccm":
[
1.26704, 0.01624, -0.28328,
-0.28516, 1.38934, -0.10419,
-0.04854, -0.82211, 1.87066
]
},
{
"ct": 3550,
"ccm":
[
1.42836, -0.27235, -0.15601,
-0.28751, 1.41075, -0.12325,
-0.01812, -0.54849, 1.56661
]
},
{
"ct": 4500,
"ccm":
[
1.36328, -0.19569, -0.16759,
-0.25254, 1.52248, -0.26994,
-0.01575, -0.53155, 1.54729
]
},
{
"ct": 5700,
"ccm":
[
1.49207, -0.37245, -0.11963,
-0.21493, 1.40005, -0.18512,
-0.03781, -0.38779, 1.42561
]
},
{
"ct": 7900,
"ccm":
[
1.34849, -0.05425, -0.29424,
-0.22182, 1.77684, -0.55502,
-0.07403, -0.55336, 1.62739
]
}
]
}
},
{
"rpi.sharpen": { }
}
]
}