Merge branch 'genesys-calibration-area-config' into 'master'

genesys: Improve calibration area configuration

See merge request sane-project/backends!337
merge-requests/340/head
Povilas Kanapickas 2020-02-16 22:21:05 +00:00
commit 494aa15141
14 zmienionych plików z 286 dodań i 630 usunięć

Wyświetl plik

@ -137,9 +137,19 @@ struct Genesys_Model
// Size of scan area in mm
float y_size = 0;
// Start of white strip in mm
// Start of white strip in mm for scanners that use separate dark and white shading calibration.
float y_offset_calib_white = 0;
// The size of the scan area that is used to acquire shading data in mm
float y_size_calib_mm = 0;
// Start of the black/white strip in mm for scanners that use unified dark and white shading
// calibration.
float y_offset_calib_dark_white_mm = 0;
// The size of the scan area that is used to acquire dark/white shading data in mm
float y_size_calib_dark_white_mm = 0;
// Start of black mark in mm
float x_offset_calib_black = 0;
@ -164,6 +174,9 @@ struct Genesys_Model
// Start of black strip in transparency mode in mm
float y_offset_calib_black_ta = 0;
// The size of the scan area that is used to acquire shading data in transparency mode in mm
float y_size_calib_ta_mm = 0;
// Size of scan area after paper sensor stop sensing document in mm
float post_scan = 0;
@ -199,10 +212,6 @@ struct Genesys_Model
// Button flags, described existing buttons for the model
SANE_Word buttons = 0;
// how many lines are used for shading calibration
SANE_Int shading_lines = 0;
// how many lines are used for shading calibration in TA mode
SANE_Int shading_ta_lines = 0;
// how many lines are used to search start position
SANE_Int search_lines = 0;

Wyświetl plik

@ -517,14 +517,22 @@ enum class ScanFlag : unsigned
DISABLE_SHADING = 1 << 1,
DISABLE_GAMMA = 1 << 2,
DISABLE_BUFFER_FULL_MOVE = 1 << 3,
IGNORE_LINE_DISTANCE = 1 << 4,
DISABLE_LAMP = 1 << 5,
CALIBRATION = 1 << 6,
FEEDING = 1 << 7,
USE_XPA = 1 << 8,
ENABLE_LEDADD = 1 << 9,
USE_XCORRECTION = 1 << 10,
REVERSE = 1 << 11,
// if this flag is set the sensor will always be handled ignoring staggering of multiple
// sensors to achieve high resolution.
IGNORE_STAGGER_OFFSET = 1 << 4,
// if this flag is set the sensor will always be handled as if the components that scan
// different colors are at the same position.
IGNORE_COLOR_OFFSET = 1 << 5,
DISABLE_LAMP = 1 << 6,
CALIBRATION = 1 << 7,
FEEDING = 1 << 8,
USE_XPA = 1 << 9,
ENABLE_LEDADD = 1 << 10,
USE_XCORRECTION = 1 << 11,
REVERSE = 1 << 12,
};
inline ScanFlag operator|(ScanFlag left, ScanFlag right)

Wyświetl plik

@ -709,6 +709,11 @@ namespace gl124 {
void scanner_clear_scan_and_feed_counts(Genesys_Device& dev)
{
switch (dev.model->asic_type) {
case AsicType::GL841: {
dev.interface->write_register(gl841::REG_0x0D,
gl841::REG_0x0D_CLRLNCNT);
break;
}
case AsicType::GL843: {
dev.interface->write_register(gl843::REG_0x0D,
gl843::REG_0x0D_CLRLNCNT | gl843::REG_0x0D_CLRMCNT);
@ -786,6 +791,7 @@ void scanner_stop_action(Genesys_Device& dev)
DBG_HELPER(dbg);
switch (dev.model->asic_type) {
case AsicType::GL841:
case AsicType::GL843:
case AsicType::GL845:
case AsicType::GL846:
@ -896,7 +902,8 @@ void scanner_move(Genesys_Device& dev, ScanMethod scan_method, unsigned steps, D
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::FEEDING |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
if (dev.model->asic_type == AsicType::GL124) {
session.params.flags |= ScanFlag::DISABLE_BUFFER_FULL_MOVE;
@ -1040,7 +1047,8 @@ void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home)
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE |
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET |
ScanFlag::REVERSE;
if (dev.model->asic_type == AsicType::GL843) {
@ -1180,7 +1188,8 @@ void scanner_move_back_home_ta(Genesys_Device& dev)
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE |
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET |
ScanFlag::REVERSE;
compute_session(&dev, session, sensor);

Wyświetl plik

@ -1095,7 +1095,6 @@ void CommandSetGl124::search_start_position(Genesys_Device* dev) const
session.params.color_filter = ColorFilter::GREEN;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE |
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
compute_session(dev, session, sensor);
@ -1159,7 +1158,8 @@ void CommandSetGl124::init_regs_for_coarse_calibration(Genesys_Device* dev,
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::FEEDING |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -1176,28 +1176,23 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
Genesys_Register_Set& regs) const
{
DBG_HELPER(dbg);
int move, resolution, dpihw, factor;
unsigned channels = 3;
unsigned calib_lines = dev->model->shading_lines;
dpihw = sensor.get_register_hwdpi(dev->settings.xres);
if(dpihw>=2400)
{
calib_lines *= 2;
}
resolution=dpihw;
unsigned dpihw = sensor.get_register_hwdpi(dev->settings.xres);
unsigned resolution = dpihw;
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres);
resolution /= ccd_size_divisor;
calib_lines /= ccd_size_divisor; // reducing just because we reduced the resolution
unsigned calib_lines =
static_cast<unsigned>(dev->model->y_size_calib_mm * resolution / MM_PER_INCH);
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
dev->settings.scan_method);
factor = calib_sensor.optical_res / resolution;
unsigned factor = calib_sensor.optical_res / resolution;
/* distance to move to reach white target at high resolution */
move=0;
unsigned move=0;
if (dev->settings.yres >= 1200) {
move = static_cast<int>(dev->model->y_offset_calib_white);
move = static_cast<int>((move * (dev->motor.base_ydpi/4)) / MM_PER_INCH);
@ -1218,8 +1213,7 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
session.params.color_filter = ColorFilter::RED;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::DISABLE_BUFFER_FULL_MOVE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
compute_session(dev, session, calib_sensor);
try {
@ -1446,7 +1440,8 @@ static void move_to_calibration_area(Genesys_Device* dev, const Genesys_Sensor&
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, move_sensor);
dev->cmd_set->init_regs_for_scan_session(dev, move_sensor, &regs, session);
@ -1522,7 +1517,8 @@ SensorExposure CommandSetGl124::led_calibration(Genesys_Device* dev, const Genes
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -1681,7 +1677,8 @@ void CommandSetGl124::offset_calibration(Genesys_Device* dev, const Genesys_Sens
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -1831,7 +1828,8 @@ void CommandSetGl124::coarse_gain_calibration(Genesys_Device* dev, const Genesys
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
try {
@ -1939,7 +1937,8 @@ void CommandSetGl124::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, reg, session);

Wyświetl plik

@ -1695,8 +1695,11 @@ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
settings.tl_y = 0;
settings.pixels = (calib_sensor.sensor_pixels * settings.xres) / calib_sensor.optical_res;
settings.requested_pixels = settings.pixels;
unsigned calib_lines = dev->model->shading_lines;
unsigned calib_lines =
static_cast<unsigned>(dev->model->y_size_calib_mm * settings.yres / MM_PER_INCH);
settings.lines = calib_lines;
settings.depth = 16;
settings.color_filter = dev->settings.color_filter;

Wyświetl plik

@ -2126,67 +2126,6 @@ void CommandSetGl841::end_scan(Genesys_Device* dev, Genesys_Register_Set __sane_
}
}
// Moves the slider to steps
static void gl841_feed(Genesys_Device* dev, int steps)
{
DBG_HELPER_ARGS(dbg, "steps = %d", steps);
Genesys_Register_Set local_reg;
int loop;
gl841_stop_action(dev);
// FIXME: we should pick sensor according to the resolution scanner is currently operating on
const auto& sensor = sanei_genesys_find_sensor_any(dev);
local_reg = dev->reg;
regs_set_optical_off(dev->model->asic_type, local_reg);
gl841_init_motor_regs(dev, sensor, &local_reg, steps, MOTOR_ACTION_FEED, MotorFlag::NONE);
dev->interface->write_registers(local_reg);
try {
scanner_start_action(*dev, true);
} catch (...) {
catch_all_exceptions(__func__, [&]() { gl841_stop_action (dev); });
// restore original registers
catch_all_exceptions(__func__, [&]()
{
dev->interface->write_registers(dev->reg);
});
throw;
}
if (is_testing_mode()) {
dev->interface->test_checkpoint("feed");
dev->advance_head_pos_by_steps(ScanHeadId::PRIMARY, Direction::FORWARD, steps);
gl841_stop_action(dev);
return;
}
loop = 0;
while (loop < 300) /* do not wait longer then 30 seconds */
{
auto status = scanner_read_status(*dev);
if (!status.is_motor_enabled) {
DBG(DBG_proc, "%s: finished\n", __func__);
dev->advance_head_pos_by_steps(ScanHeadId::PRIMARY, Direction::FORWARD, steps);
return;
}
dev->interface->sleep_ms(100);
++loop;
}
/* when we come here then the scanner needed too much time for this, so we better stop the motor */
gl841_stop_action (dev);
dev->set_head_pos_unknown(ScanHeadId::PRIMARY);
throw SaneException(SANE_STATUS_IO_ERROR, "timeout while waiting for scanhead to go home");
}
// Moves the slider to the home (top) position slowly
void CommandSetGl841::move_back_home(Genesys_Device* dev, bool wait_until_home) const
{
@ -2318,7 +2257,6 @@ void CommandSetGl841::search_start_position(Genesys_Device* dev) const
session.params.color_filter = ColorFilter::GREEN;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE |
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
compute_session(dev, session, sensor);
@ -2381,7 +2319,8 @@ void CommandSetGl841::init_regs_for_coarse_calibration(Genesys_Device* dev,
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -2396,28 +2335,6 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
Genesys_Register_Set& regs) const
{
DBG_HELPER(dbg);
SANE_Int ydpi;
unsigned starty = 0;
ydpi = dev->motor.base_ydpi;
if (dev->model->motor_id == MotorId::PLUSTEK_OPTICPRO_3600) /* TODO PLUSTEK_3600: 1200dpi not yet working, produces dark bar */
{
ydpi = 600;
}
if (dev->model->motor_id == MotorId::CANON_LIDE_80) {
ydpi = gl841_get_dpihw(dev);
/* get over extra dark area for this model.
It looks like different devices have dark areas of different width
due to manufacturing variability. The initial value of starty was 140,
but it moves the sensor almost past the dark area completely in places
on certain devices.
On a particular device the black area starts at roughly position
160 to 230 depending on location (the dark area is not completely
parallel to the frame).
*/
starty = 70;
}
unsigned channels = 3;
@ -2427,22 +2344,24 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
dev->settings.scan_method);
unsigned calib_lines =
static_cast<unsigned>(dev->model->y_size_calib_dark_white_mm * resolution / MM_PER_INCH);
unsigned starty =
static_cast<unsigned>(dev->model->y_offset_calib_dark_white_mm * dev->motor.base_ydpi / MM_PER_INCH);
ScanSession session;
session.params.xres = resolution;
session.params.yres = ydpi;
session.params.yres = resolution;
session.params.startx = 0;
session.params.starty = starty;
session.params.pixels = calib_sensor.sensor_pixels / factor;
session.params.lines = dev->model->shading_lines;
session.params.lines = calib_lines;
session.params.depth = 16;
session.params.channels = channels;
session.params.scan_method = dev->settings.scan_method;
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
session.params.color_filter = dev->settings.color_filter;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
/*ScanFlag::DISABLE_BUFFER_FULL_MOVE |*/
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::DISABLE_GAMMA;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -2494,7 +2413,6 @@ SensorExposure CommandSetGl841::led_calibration(Genesys_Device* dev, const Genes
int avg[3], avga, avge;
int turn;
uint16_t exp[3], target;
int move;
/* these 2 boundaries should be per sensor */
uint16_t min_exposure=500;
@ -2502,10 +2420,9 @@ SensorExposure CommandSetGl841::led_calibration(Genesys_Device* dev, const Genes
/* feed to white strip if needed */
if (dev->model->y_offset_calib_white > 0) {
move = static_cast<int>(dev->model->y_offset_calib_white);
move = static_cast<int>((move * (dev->motor.base_ydpi)) / MM_PER_INCH);
DBG(DBG_io, "%s: move=%d lines\n", __func__, move);
gl841_feed(dev, move);
unsigned move = static_cast<unsigned>(
(dev->model->y_offset_calib_white * (dev->motor.base_ydpi)) / MM_PER_INCH);
scanner_move(*dev, dev->model->default_method, move, Direction::FORWARD);
}
/* offset calibration is always done in color mode */
@ -2534,7 +2451,8 @@ SensorExposure CommandSetGl841::led_calibration(Genesys_Device* dev, const Genes
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor_base);
init_regs_for_scan_session(dev, calib_sensor_base, &regs, session);
@ -2728,7 +2646,8 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
dev->cmd_set->init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -2824,7 +2743,8 @@ void CommandSetGl841::offset_calibration(Genesys_Device* dev, const Genesys_Sens
/* Analog Device fronted have a different calibration */
if ((dev->reg.find_reg(0x04).value & REG_0x04_FESET) == 0x02) {
return ad_fe_offset_calibration(dev, sensor, regs);
ad_fe_offset_calibration(dev, sensor, regs);
return;
}
/* offset calibration is always done in color mode */
@ -2853,7 +2773,8 @@ void CommandSetGl841::offset_calibration(Genesys_Device* dev, const Genesys_Sens
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE |
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET |
ScanFlag::DISABLE_LAMP;
compute_session(dev, session, calib_sensor);
@ -3159,14 +3080,12 @@ void CommandSetGl841::coarse_gain_calibration(Genesys_Device* dev, const Genesys
int num_pixels;
float gain[3];
int lines=1;
int move;
// feed to white strip if needed
if (dev->model->y_offset_calib_white > 0) {
move = static_cast<int>(dev->model->y_offset_calib_white);
move = static_cast<int>((move * (dev->motor.base_ydpi)) / MM_PER_INCH);
DBG(DBG_io, "%s: move=%d lines\n", __func__, move);
gl841_feed(dev, move);
unsigned move = static_cast<unsigned>(
(dev->model->y_offset_calib_white * (dev->motor.base_ydpi)) / MM_PER_INCH);
scanner_move(*dev, dev->model->default_method, move, Direction::FORWARD);
}
/* coarse gain calibration is allways done in color mode */
@ -3195,7 +3114,8 @@ void CommandSetGl841::coarse_gain_calibration(Genesys_Device* dev, const Genesys
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -3256,10 +3176,8 @@ void CommandSetGl841::coarse_gain_calibration(Genesys_Device* dev, const Genesys
gain[ch], out_gain);
}
for (unsigned j = 0; j < channels; j++)
{
if(gain[j] > 10)
{
for (unsigned j = 0; j < channels; j++) {
if (gain[j] > 30) {
DBG (DBG_error0, "**********************************************\n");
DBG (DBG_error0, "**********************************************\n");
DBG (DBG_error0, "**** ****\n");
@ -3339,7 +3257,8 @@ void CommandSetGl841::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, local_reg, session);
@ -3359,7 +3278,7 @@ static void sanei_gl841_repark_head(Genesys_Device* dev)
{
DBG_HELPER(dbg);
gl841_feed(dev,232);
scanner_move(*dev, dev->model->default_method, 232, Direction::FORWARD);
// toggle motor flag, put an huge step number and redo move backward
dev->cmd_set->move_back_home(dev, true);
@ -3452,7 +3371,8 @@ void CommandSetGl841::init(Genesys_Device* dev) const
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -3553,9 +3473,9 @@ void CommandSetGl841::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
unsigned dpi = resolution_settings.get_min_resolution_x();
channels = 1;
/* shading calibation is done with dev->motor.base_ydpi */
/* lines = (dev->model->shading_lines * dpi) / dev->motor.base_ydpi; */
lines = static_cast<unsigned>((10 * dpi) / MM_PER_INCH);
// shading calibation is done with dev->motor.base_ydpi
lines = 10; // TODO: use dev->model->search_lines
lines = static_cast<unsigned>((lines * dpi) / MM_PER_INCH);
pixels = (sensor.sensor_pixels * dpi) / sensor.optical_res;

Wyświetl plik

@ -1514,7 +1514,6 @@ void CommandSetGl843::search_start_position(Genesys_Device* dev) const
session.params.color_filter = ColorFilter::GREEN;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE |
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
compute_session(dev, session, sensor);
@ -1567,7 +1566,8 @@ void CommandSetGl843::init_regs_for_coarse_calibration(Genesys_Device* dev,
ScanFlag flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) {
@ -1620,13 +1620,13 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
DBG_HELPER(dbg);
int move, resolution, dpihw, factor;
unsigned calib_lines = 0;
float calib_size_mm = 0;
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{
calib_lines = dev->model->shading_ta_lines;
calib_size_mm = dev->model->y_size_calib_ta_mm;
} else {
calib_lines = dev->model->shading_lines;
calib_size_mm = dev->model->y_size_calib_mm;
}
dpihw = sensor.get_logical_hwdpi(dev->settings.xres);
@ -1658,8 +1658,7 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
ScanFlag flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::DISABLE_BUFFER_FULL_MOVE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
@ -1673,6 +1672,7 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
}
move = static_cast<int>((move * resolution) / MM_PER_INCH);
unsigned calib_lines = static_cast<unsigned>(calib_size_mm * resolution / MM_PER_INCH);
ScanSession session;
session.params.xres = resolution;
@ -1777,7 +1777,8 @@ SensorExposure CommandSetGl843::led_calibration(Genesys_Device* dev, const Genes
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -1972,7 +1973,8 @@ void CommandSetGl843::offset_calibration(Genesys_Device* dev, const Genesys_Sens
ScanFlag flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
@ -2192,7 +2194,8 @@ void CommandSetGl843::coarse_gain_calibration(Genesys_Device* dev, const Genesys
ScanFlag flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
@ -2334,7 +2337,8 @@ void CommandSetGl843::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, reg, session);
@ -2533,7 +2537,7 @@ void CommandSetGl843::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
bool forward, bool black) const
{
DBG_HELPER_ARGS(dbg, "%s %s", black ? "black" : "white", forward ? "forward" : "reverse");
unsigned int pixels, lines, channels;
unsigned int pixels, channels;
Genesys_Register_Set local_reg;
int dpi;
unsigned int pass, count, found, x, y;
@ -2551,7 +2555,7 @@ void CommandSetGl843::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
/* 10 MM */
/* lines = (10 * dpi) / MM_PER_INCH; */
/* shading calibation is done with dev->motor.base_ydpi */
lines = (dev->model->shading_lines * dpi) / dev->motor.base_ydpi;
unsigned lines = static_cast<unsigned>(dev->model->y_size_calib_mm * dpi / MM_PER_INCH);
pixels = (calib_sensor.sensor_pixels * dpi) / calib_sensor.optical_res;
dev->set_head_pos_zero(ScanHeadId::PRIMARY);

Wyświetl plik

@ -867,7 +867,8 @@ void CommandSetGl846::search_start_position(Genesys_Device* dev) const
session.params.color_filter = ColorFilter::GREEN;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &local_reg, session);
@ -931,7 +932,8 @@ void CommandSetGl846::init_regs_for_coarse_calibration(Genesys_Device* dev,
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -952,10 +954,9 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
dev->settings.scan_method);
unsigned calib_lines = dev->model->shading_lines;
if (resolution == 4800) {
calib_lines *= 2;
}
unsigned calib_lines =
static_cast<unsigned>(dev->model->y_size_calib_mm * resolution / MM_PER_INCH);
unsigned calib_pixels = (calib_sensor.sensor_pixels * resolution) /
calib_sensor.optical_res;
@ -980,8 +981,7 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
session.params.color_filter = dev->settings.color_filter;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::DISABLE_BUFFER_FULL_MOVE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -1199,7 +1199,8 @@ SensorExposure CommandSetGl846::led_calibration(Genesys_Device* dev, const Genes
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -1487,7 +1488,7 @@ void CommandSetGl846::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
bool black) const
{
DBG_HELPER_ARGS(dbg, "%s %s", black ? "black" : "white", forward ? "forward" : "reverse");
unsigned int pixels, lines, channels;
unsigned int pixels, channels;
Genesys_Register_Set local_reg;
unsigned int pass, count, found;
char title[80];
@ -1503,8 +1504,8 @@ void CommandSetGl846::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
/* 10 MM */
/* lines = (10 * dpi) / MM_PER_INCH; */
/* shading calibation is done with dev->motor.base_ydpi */
lines = (dev->model->shading_lines * dpi) / dev->motor.base_ydpi;
pixels = (sensor.sensor_pixels * dpi) / sensor.optical_res;
unsigned lines = static_cast<unsigned>(dev->model->y_size_calib_mm * dpi / MM_PER_INCH);
pixels = (sensor.sensor_pixels * dpi) / sensor.optical_res;
dev->set_head_pos_zero(ScanHeadId::PRIMARY);
@ -1736,7 +1737,8 @@ void CommandSetGl846::offset_calibration(Genesys_Device* dev, const Genesys_Sens
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -1879,7 +1881,8 @@ void CommandSetGl846::coarse_gain_calibration(Genesys_Device* dev, const Genesys
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
try {

Wyświetl plik

@ -874,8 +874,7 @@ void CommandSetGl847::search_start_position(Genesys_Device* dev) const
session.params.scan_mode = ScanColorMode::GRAY;
session.params.color_filter = ColorFilter::GREEN;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::DISABLE_GAMMA;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &local_reg, session);
@ -939,7 +938,8 @@ void CommandSetGl847::init_regs_for_coarse_calibration(Genesys_Device* dev,
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -961,16 +961,14 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
dev->settings.scan_method);
unsigned calib_lines = dev->model->shading_lines;
if (resolution == 4800) {
calib_lines *= 2;
}
unsigned calib_lines =
static_cast<unsigned>(dev->model->y_size_calib_mm * resolution / MM_PER_INCH);
unsigned calib_pixels = (calib_sensor.sensor_pixels * resolution) /
calib_sensor.optical_res;
ScanSession session;
session.params.xres = resolution;
session.params.yres = dev->motor.base_ydpi;
session.params.yres = resolution;
session.params.startx = 0;
session.params.starty = 20;
session.params.pixels = calib_pixels;
@ -982,8 +980,7 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
session.params.color_filter = dev->settings.color_filter;
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::DISABLE_BUFFER_FULL_MOVE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::DISABLE_BUFFER_FULL_MOVE;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -1201,7 +1198,8 @@ SensorExposure CommandSetGl847::led_calibration(Genesys_Device* dev, const Genes
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, calib_sensor);
init_regs_for_scan_session(dev, calib_sensor, &regs, session);
@ -1526,7 +1524,7 @@ void CommandSetGl847::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
bool black) const
{
DBG_HELPER_ARGS(dbg, "%s %s", black ? "black" : "white", forward ? "forward" : "reverse");
unsigned int pixels, lines;
unsigned int pixels;
Genesys_Register_Set local_reg;
unsigned int pass, count, found;
char title[80];
@ -1538,10 +1536,8 @@ void CommandSetGl847::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
const auto& resolution_settings = dev->model->get_resolution_settings(dev->settings.scan_method);
unsigned dpi = resolution_settings.get_min_resolution_x();
unsigned channels = 1;
/* 10 MM */
/* lines = (10 * dpi) / MM_PER_INCH; */
/* shading calibation is done with dev->motor.base_ydpi */
lines = (dev->model->shading_lines * dpi) / dev->motor.base_ydpi;
unsigned lines = static_cast<unsigned>(dev->model->y_size_calib_mm * dpi / MM_PER_INCH);
pixels = (sensor.sensor_pixels * dpi) / sensor.optical_res;
dev->set_head_pos_zero(ScanHeadId::PRIMARY);
@ -1773,7 +1769,8 @@ void CommandSetGl847::offset_calibration(Genesys_Device* dev, const Genesys_Sens
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
init_regs_for_scan_session(dev, sensor, &regs, session);
@ -1913,7 +1910,8 @@ void CommandSetGl847::coarse_gain_calibration(Genesys_Device* dev, const Genesys
session.params.flags = ScanFlag::DISABLE_SHADING |
ScanFlag::DISABLE_GAMMA |
ScanFlag::SINGLE_LINE |
ScanFlag::IGNORE_LINE_DISTANCE;
ScanFlag::IGNORE_STAGGER_OFFSET |
ScanFlag::IGNORE_COLOR_OFFSET;
compute_session(dev, session, sensor);
try {

Wyświetl plik

@ -1016,7 +1016,7 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se
s.output_pixels = (s.optical_pixels * s.output_resolution) / s.optical_resolution;
s.num_staggered_lines = 0;
if (!has_flag(s.params.flags, ScanFlag::IGNORE_LINE_DISTANCE))
if (!has_flag(s.params.flags, ScanFlag::IGNORE_STAGGER_OFFSET))
{
s.num_staggered_lines = sensor.stagger_config.stagger_at_resolution(s.params.xres,
s.params.yres);
@ -1038,7 +1038,7 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se
s.color_shift_lines_b = (s.color_shift_lines_b * s.params.yres) / dev->motor.base_ydpi;
s.max_color_shift_lines = 0;
if (s.params.channels > 1 && !has_flag(s.params.flags, ScanFlag::IGNORE_LINE_DISTANCE)) {
if (s.params.channels > 1 && !has_flag(s.params.flags, ScanFlag::IGNORE_COLOR_OFFSET)) {
s.max_color_shift_lines = std::max(s.color_shift_lines_r, std::max(s.color_shift_lines_g,
s.color_shift_lines_b));
}

Wyświetl plik

@ -456,6 +456,7 @@ void genesys_init_frontend_tables();
void genesys_init_gpo_tables();
void genesys_init_motor_tables();
void genesys_init_usb_device_tables();
void verify_usb_device_tables();
template<class T>
void debug_dump(unsigned level, const T& value)

Wyświetl plik

@ -168,15 +168,11 @@ void genesys_init_motor_tables()
motor.id = MotorId::CANON_LIDE_100;
motor.base_ydpi = 1200;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
StepType::HALF, 1424});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 255),
StepType::HALF, 1432});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
StepType::HALF, 2848});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 279),
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 279),
StepType::QUARTER, 2712});
motor.profiles.push_back({MotorSlope::create_from_steps(31680, 534, 247),
motor.profiles.push_back({MotorSlope::create_from_steps(31680, 864, 247),
StepType::EIGHTH, 5280});
s_motors->push_back(std::move(motor));
@ -185,17 +181,13 @@ void genesys_init_motor_tables()
motor.id = MotorId::CANON_LIDE_200;
motor.base_ydpi = 1200;
motor.optical_ydpi = 6400;
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
StepType::HALF, 1424});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 255),
StepType::HALF, 1432});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 255),
StepType::HALF, 2848});
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 534, 279),
motor.profiles.push_back({MotorSlope::create_from_steps(46876, 864, 279),
StepType::QUARTER, 2712});
motor.profiles.push_back({MotorSlope::create_from_steps(31680, 534, 247),
motor.profiles.push_back({MotorSlope::create_from_steps(31680, 864, 247),
StepType::EIGHTH, 5280});
motor.profiles.push_back({MotorSlope::create_from_steps(31680, 534, 247),
motor.profiles.push_back({MotorSlope::create_from_steps(31680, 864, 247),
StepType::EIGHTH, 10416});
s_motors->push_back(std::move(motor));

Wyświetl plik

@ -389,6 +389,7 @@ TestResult perform_single_test(const TestConfig& config, const std::string& chec
std::vector<TestConfig> get_all_test_configs()
{
genesys::genesys_init_usb_device_tables();
genesys::verify_usb_device_tables();
std::vector<TestConfig> configs;
std::unordered_set<std::string> model_names;