genesys: Add option to fill dark calibration with constant

merge-requests/244/head
Povilas Kanapickas 2020-06-27 00:47:16 +03:00
rodzic 6fdc5e6e1f
commit 86c15ff4a0
2 zmienionych plików z 16 dodań i 12 usunięć

Wyświetl plik

@ -510,6 +510,9 @@ enum class ModelFlag : unsigned
// whether scanner must wait for the head while parking
MUST_WAIT = 1 << 10,
// use zeroes for dark calibration
USE_CONSTANT_FOR_DARK_CALIBRATION = 1 << 11,
// do dark and white calibration in one run
DARK_WHITE_CALIBRATION = 1 << 12,

Wyświetl plik

@ -2456,7 +2456,7 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
* can be computed from previous calibration data (when doing offset
* calibration ?)
*/
static void genesys_dummy_dark_shading(Genesys_Device* dev, const Genesys_Sensor& sensor)
static void genesys_dark_shading_by_dummy_pixel(Genesys_Device* dev, const Genesys_Sensor& sensor)
{
DBG_HELPER(dbg);
uint32_t pixels_per_line;
@ -2535,6 +2535,11 @@ static void genesys_dummy_dark_shading(Genesys_Device* dev, const Genesys_Sensor
}
}
static void genesys_dark_shading_by_constant(Genesys_Device& dev)
{
dev.dark_average_data.clear();
dev.dark_average_data.resize(dev.average_size, 0x0101);
}
static void genesys_repark_sensor_before_shading(Genesys_Device* dev)
{
@ -3786,7 +3791,11 @@ static void genesys_flatbed_calibration(Genesys_Device* dev, Genesys_Sensor& sen
genesys_repark_sensor_after_white_shading(dev);
if (!has_flag(dev->model->flags, ModelFlag::DARK_CALIBRATION)) {
genesys_dummy_dark_shading(dev, sensor);
if (has_flag(dev->model->flags, ModelFlag::USE_CONSTANT_FOR_DARK_CALIBRATION)) {
genesys_dark_shading_by_constant(*dev);
} else {
genesys_dark_shading_by_dummy_pixel(dev, sensor);
}
}
}
}
@ -3894,17 +3903,9 @@ static void genesys_sheetfed_calibration(Genesys_Device* dev, Genesys_Sensor& se
}
// in case we haven't black shading data, build it from black pixels of white calibration
// FIXME: shouldn't we use genesys_dummy_dark_shading() ?
// FIXME: shouldn't we use genesys_dark_shading_by_dummy_pixel() ?
if (!has_flag(dev->model->flags, ModelFlag::DARK_CALIBRATION)) {
dev->dark_average_data.clear();
dev->dark_average_data.resize(dev->average_size, 0x0f0f);
/* XXX STEF XXX
* with black point in white shading, build an average black
* pixel and use it to fill the dark_average
* dev->calib_pixels
(sensor.x_size_calib_mm * dev->settings.xres) / MM_PER_INCH,
dev->calib_lines,
*/
genesys_dark_shading_by_constant(*dev);
}
/* send the shading coefficient when doing whole line shading