genesys: Use more robust gain calibration on gl841

release-1.1.x
Povilas Kanapickas 2021-12-27 22:21:06 +02:00
rodzic cc3bf08055
commit 4fce71b55b
1 zmienionych plików z 2 dodań i 13 usunięć

Wyświetl plik

@ -1885,7 +1885,8 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor&
float curr_output = 0;
float target_value = 0;
if (dev.model->asic_type == AsicType::GL842 ||
if (dev.model->asic_type == AsicType::GL841 ||
dev.model->asic_type == AsicType::GL842 ||
dev.model->asic_type == AsicType::GL843)
{
std::vector<uint16_t> values;
@ -1901,18 +1902,6 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor&
curr_output = static_cast<float>(values[unsigned((values.size() - 1) * 0.95)]);
target_value = calib_sensor->gain_white_ref * coeff;
} else if (dev.model->asic_type == AsicType::GL841) {
// FIXME: use the GL843 approach
unsigned max = 0;
for (std::size_t x = 0; x < image.get_width(); x++) {
auto value = image.get_raw_channel(x, 0, ch);
if (value > max) {
max = value;
}
}
curr_output = max;
target_value = 65535.0f;
} else {
// FIXME: use the GL843 approach
auto width = image.get_width();