genesys: Add initial support for transparency on 4400F

merge-requests/340/head
Povilas Kanapickas 2020-02-15 14:12:43 +02:00
rodzic aec9d74845
commit 6e7fc639f5
7 zmienionych plików z 58 dodań i 23 usunięć

Wyświetl plik

@ -82,6 +82,7 @@ void CommandSetCommon::set_xpa_lamp_power(Genesys_Device& dev, bool set) const
// FIXME: BUG: we're not clearing the registers to the previous state when returning back when // FIXME: BUG: we're not clearing the registers to the previous state when returning back when
// turning off the lamp // turning off the lamp
LampSettings settings[] = { LampSettings settings[] = {
{ ModelId::CANON_4400F, ScanMethod::TRANSPARENCY, {}, {} },
{ ModelId::CANON_8400F, ScanMethod::TRANSPARENCY, { { ModelId::CANON_8400F, ScanMethod::TRANSPARENCY, {
{ 0xa6, 0x34, 0xf4 }, { 0xa6, 0x34, 0xf4 },
}, { }, {

Wyświetl plik

@ -483,6 +483,9 @@ enum class ModelFlag : unsigned
// the scanner outputs 16-bit data that is byte-inverted // the scanner outputs 16-bit data that is byte-inverted
INVERTED_16BIT_DATA = 1 << 20, INVERTED_16BIT_DATA = 1 << 20,
// the scanner has transparency, but it's implemented using only one motor
UTA_NO_SECONDARY_MOTOR = 1 << 21
}; };
inline ModelFlag operator|(ModelFlag left, ModelFlag right) inline ModelFlag operator|(ModelFlag left, ModelFlag right)

Wyświetl plik

@ -899,7 +899,9 @@ void scanner_move(Genesys_Device& dev, ScanMethod scan_method, unsigned steps, D
const auto& sensor = sanei_genesys_find_sensor(&dev, resolution, 3, scan_method); const auto& sensor = sanei_genesys_find_sensor(&dev, resolution, 3, scan_method);
bool uses_secondary_head = (scan_method == ScanMethod::TRANSPARENCY || bool uses_secondary_head = (scan_method == ScanMethod::TRANSPARENCY ||
scan_method == ScanMethod::TRANSPARENCY_INFRARED); scan_method == ScanMethod::TRANSPARENCY_INFRARED) &&
(!has_flag(dev.model->flags, ModelFlag::UTA_NO_SECONDARY_MOTOR));
bool uses_secondary_pos = uses_secondary_head && bool uses_secondary_pos = uses_secondary_head &&
dev.model->default_method == ScanMethod::FLATBED; dev.model->default_method == ScanMethod::FLATBED;
@ -1039,10 +1041,11 @@ void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home)
} }
// FIXME: also check whether the scanner actually has a secondary head // FIXME: also check whether the scanner actually has a secondary head
if (!dev.is_head_pos_known(ScanHeadId::SECONDARY) || if ((!dev.is_head_pos_known(ScanHeadId::SECONDARY) ||
dev.head_pos(ScanHeadId::SECONDARY) > 0 || dev.head_pos(ScanHeadId::SECONDARY) > 0 ||
dev.settings.scan_method == ScanMethod::TRANSPARENCY || dev.settings.scan_method == ScanMethod::TRANSPARENCY ||
dev.settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) dev.settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) &&
(!has_flag(dev.model->flags, ModelFlag::UTA_NO_SECONDARY_MOTOR)))
{ {
scanner_move_back_home_ta(dev); scanner_move_back_home_ta(dev);
} }

Wyświetl plik

@ -1258,6 +1258,9 @@ static float get_model_x_offset_ta(const Genesys_Device& dev,
if (dev.model->model_id == ModelId::CANON_8600F && settings.xres == 4800) { if (dev.model->model_id == ModelId::CANON_8600F && settings.xres == 4800) {
return 85.0f; return 85.0f;
} }
if (dev.model->model_id == ModelId::CANON_4400F && settings.xres == 4800) {
return dev.model->x_offset_ta - 10.0;
}
return dev.model->x_offset_ta; return dev.model->x_offset_ta;
} }
@ -1301,7 +1304,9 @@ ScanSession CommandSetGl843::calculate_scan_session(const Genesys_Device* dev,
} }
start = start + settings.tl_x; start = start + settings.tl_x;
if (dev->model->model_id == ModelId::CANON_8400F || if ((dev->model->model_id == ModelId::CANON_4400F &&
settings.scan_method == ScanMethod::TRANSPARENCY) ||
dev->model->model_id == ModelId::CANON_8400F ||
dev->model->model_id == ModelId::CANON_8600F) dev->model->model_id == ModelId::CANON_8600F)
{ {
// FIXME: this is probably just an artifact of a bug elsewhere // FIXME: this is probably just an artifact of a bug elsewhere
@ -1685,6 +1690,9 @@ static bool should_calibrate_only_active_area(const Genesys_Device& dev,
if (settings.scan_method == ScanMethod::TRANSPARENCY || if (settings.scan_method == ScanMethod::TRANSPARENCY ||
settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
{ {
if (dev.model->model_id == ModelId::CANON_4400F && settings.xres >= 4800) {
return true;
}
if (dev.model->model_id == ModelId::CANON_8600F && settings.xres == 4800) { if (dev.model->model_id == ModelId::CANON_8600F && settings.xres == 4800) {
return true; return true;
} }
@ -2598,7 +2606,8 @@ void CommandSetGl843::move_to_ta(Genesys_Device* dev) const
float resolution = resolution_settings.get_min_resolution_y(); float resolution = resolution_settings.get_min_resolution_y();
unsigned multiplier = 16; unsigned multiplier = 16;
if (dev->model->model_id == ModelId::CANON_8400F) { if (dev->model->model_id == ModelId::CANON_8400F ||
dev->model->model_id == ModelId::CANON_4400F) {
multiplier = 4; multiplier = 4;
} }
unsigned feed = static_cast<unsigned>(multiplier * (dev->model->y_offset_sensor_to_ta * resolution) / unsigned feed = static_cast<unsigned>(multiplier * (dev->model->y_offset_sensor_to_ta * resolution) /

Wyświetl plik

@ -952,7 +952,13 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s,
s.pixel_endx /= s.hwdpi_divisor; s.pixel_endx /= s.hwdpi_divisor;
// in case of stagger we have to start at an odd coordinate // in case of stagger we have to start at an odd coordinate
bool stagger_starts_even = dev->model->model_id == ModelId::CANON_8400F; bool stagger_starts_even = false;
if (dev->model->model_id == ModelId::CANON_4400F ||
dev->model->model_id == ModelId::CANON_8400F)
{
stagger_starts_even = true;
}
if (s.num_staggered_lines > 0) { if (s.num_staggered_lines > 0) {
if (!stagger_starts_even && (s.pixel_startx & 1) == 0) { if (!stagger_starts_even && (s.pixel_startx & 1) == 0) {
s.pixel_startx++; s.pixel_startx++;

Wyświetl plik

@ -438,6 +438,10 @@ void genesys_init_usb_device_tables()
{ ScanMethod::FLATBED }, { ScanMethod::FLATBED },
{ 1200, 600, 300 }, { 1200, 600, 300 },
{ 1200, 600, 300 }, { 1200, 600, 300 },
}, {
{ ScanMethod::TRANSPARENCY },
{ 4800, 2400, 1200 },
{ 9600, 4800, 2400, 1200 },
} }
}; };
@ -452,13 +456,13 @@ void genesys_init_usb_device_tables()
model.y_offset_calib_white = 0.0; model.y_offset_calib_white = 0.0;
model.x_offset_calib_black = 0.0; model.x_offset_calib_black = 0.0;
model.x_offset_ta = 8.0; model.x_offset_ta = 115.0;
model.y_offset_ta = 13.00; model.y_offset_ta = 60.0;
model.x_size_ta = 217.9; model.x_size_ta = 35.0;
model.y_size_ta = 250.0; model.y_size_ta = 230.0;
model.y_offset_sensor_to_ta = 0.0; model.y_offset_sensor_to_ta = 46.0;
model.y_offset_calib_white_ta = 40.0; model.y_offset_calib_white_ta = 47.0;
model.post_scan = 0.0; model.post_scan = 0.0;
model.eject_feed = 0.0; model.eject_feed = 0.0;
@ -480,10 +484,12 @@ void genesys_init_usb_device_tables()
ModelFlag::DARK_CALIBRATION | ModelFlag::DARK_CALIBRATION |
ModelFlag::FULL_HWDPI_MODE | ModelFlag::FULL_HWDPI_MODE |
ModelFlag::CUSTOM_GAMMA | ModelFlag::CUSTOM_GAMMA |
ModelFlag::SHADING_REPARK; ModelFlag::SHADING_REPARK |
ModelFlag::UTA_NO_SECONDARY_MOTOR;
model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW; model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_COPY_SW;
model.shading_lines = 100; model.shading_lines = 100;
model.shading_ta_lines = 0; model.shading_ta_lines = 50;
model.search_lines = 100; model.search_lines = 100;
s_usb_devices->emplace_back(0x04a9, 0x2228, model); s_usb_devices->emplace_back(0x04a9, 0x2228, model);

Wyświetl plik

@ -2261,6 +2261,7 @@ void genesys_init_sensor_tables()
sensor.fau_gain_white_ref = 160; sensor.fau_gain_white_ref = 160;
sensor.gain_white_ref = 160; sensor.gain_white_ref = 160;
sensor.exposure = { 0x9c40, 0x9c40, 0x9c40 }; sensor.exposure = { 0x9c40, 0x9c40, 0x9c40 };
sensor.stagger_config = StaggerConfig{4800, 8};
sensor.gamma = { 1.0f, 1.0f, 1.0f }; sensor.gamma = { 1.0f, 1.0f, 1.0f };
sensor.get_logical_hwdpi_fun = get_sensor_optical_with_ccd_divisor; sensor.get_logical_hwdpi_fun = get_sensor_optical_with_ccd_divisor;
sensor.get_register_hwdpi_fun = [](const Genesys_Sensor&, unsigned) { return 4800; }; sensor.get_register_hwdpi_fun = [](const Genesys_Sensor&, unsigned) { return 4800; };
@ -2271,12 +2272,14 @@ void genesys_init_sensor_tables()
struct CustomSensorSettings { struct CustomSensorSettings {
ResolutionFilter resolutions; ResolutionFilter resolutions;
int exposure_lperiod; int exposure_lperiod;
bool use_host_side_calib;
std::vector<ScanMethod> methods; std::vector<ScanMethod> methods;
GenesysRegisterSettingSet extra_custom_regs; GenesysRegisterSettingSet extra_custom_regs;
GenesysRegisterSettingSet extra_custom_fe_regs;
}; };
CustomSensorSettings custom_settings[] = { CustomSensorSettings custom_settings[] = {
{ { 300, 600, 1200 }, 11640, { ScanMethod::FLATBED }, { { { 300, 600, 1200 }, 11640, false, { ScanMethod::FLATBED }, {
{ 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a },
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b },
{ 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 },
@ -2286,9 +2289,9 @@ void genesys_init_sensor_tables()
{ 0x77, 0x00 }, { 0x78, 0xfc }, { 0x79, 0x00 }, { 0x77, 0x00 }, { 0x78, 0xfc }, { 0x79, 0x00 },
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0xa4 }, { 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0xa4 },
{ 0x9e, 0x2d }, { 0x9e, 0x2d },
} }, {}
}, },
{ { 300, 600, 1200 }, 33300, { ScanMethod::TRANSPARENCY }, { { { 1200 }, 33300, true, { ScanMethod::TRANSPARENCY }, {
{ 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a },
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b },
{ 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 },
@ -2298,10 +2301,10 @@ void genesys_init_sensor_tables()
{ 0x77, 0x00 }, { 0x78, 0xfc }, { 0x79, 0x00 }, { 0x77, 0x00 }, { 0x78, 0xfc }, { 0x79, 0x00 },
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0xa4 }, { 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0xa4 },
{ 0x9e, 0x2d }, { 0x9e, 0x2d },
} }, {}
}, },
{ { 2400 }, 33300, { ScanMethod::TRANSPARENCY }, { { { 2400 }, 33300, true, { ScanMethod::TRANSPARENCY }, {
{ 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a },
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x01 }, { 0x1d, 0x75 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x01 }, { 0x1d, 0x75 },
{ 0x52, 0x0b }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, { 0x52, 0x0b }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 },
{ 0x56, 0x06 }, { 0x57, 0x09 }, { 0x58, 0x53 }, { 0x59, 0x00 }, { 0x5a, 0x40 }, { 0x56, 0x06 }, { 0x57, 0x09 }, { 0x58, 0x53 }, { 0x59, 0x00 }, { 0x5a, 0x40 },
@ -2310,10 +2313,12 @@ void genesys_init_sensor_tables()
{ 0x77, 0x00 }, { 0x78, 0xff }, { 0x79, 0x00 }, { 0x77, 0x00 }, { 0x78, 0xff }, { 0x79, 0x00 },
{ 0x7a, 0x00 }, { 0x7b, 0x54 }, { 0x7c, 0x92 }, { 0x7a, 0x00 }, { 0x7b, 0x54 }, { 0x7c, 0x92 },
{ 0x9e, 0x2d }, { 0x9e, 0x2d },
}, {
{ 0x03, 0x1f },
} }
}, },
{ { 4800 }, 33300, { ScanMethod::TRANSPARENCY }, { { { 4800 }, 33300, true, { ScanMethod::TRANSPARENCY }, {
{ 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a },
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 },
{ 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b }, { 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b },
{ 0x56, 0x0d }, { 0x57, 0x0f }, { 0x58, 0x1b }, { 0x59, 0x00 }, { 0x5a, 0x40 }, { 0x56, 0x0d }, { 0x57, 0x0f }, { 0x58, 0x1b }, { 0x59, 0x00 }, { 0x5a, 0x40 },
@ -2322,7 +2327,7 @@ void genesys_init_sensor_tables()
{ 0x77, 0x00 }, { 0x78, 0xff }, { 0x79, 0xff }, { 0x77, 0x00 }, { 0x78, 0xff }, { 0x79, 0xff },
{ 0x7a, 0x00 }, { 0x7b, 0x54 }, { 0x7c, 0x92 }, { 0x7a, 0x00 }, { 0x7b, 0x54 }, { 0x7c, 0x92 },
{ 0x9e, 0x2d }, { 0x9e, 0x2d },
} }, {}
} }
}; };
@ -2331,8 +2336,10 @@ void genesys_init_sensor_tables()
for (auto method : setting.methods) { for (auto method : setting.methods) {
sensor.resolutions = setting.resolutions; sensor.resolutions = setting.resolutions;
sensor.exposure_lperiod = setting.exposure_lperiod; sensor.exposure_lperiod = setting.exposure_lperiod;
sensor.use_host_side_calib = setting.use_host_side_calib;
sensor.method = method; sensor.method = method;
sensor.custom_regs = setting.extra_custom_regs; sensor.custom_regs = setting.extra_custom_regs;
sensor.custom_fe_regs = setting.extra_custom_fe_regs;
s_sensors->push_back(sensor); s_sensors->push_back(sensor);
} }
} }