kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Implement infrared channel support for 8600F
rodzic
78cdb347be
commit
144ed1f29b
|
@ -1366,10 +1366,13 @@ genesys_average_white (Genesys_Device * dev, Genesys_Sensor& sensor, int channel
|
|||
|
||||
range = size / 50;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) /* transparency mode */
|
||||
gain_white_ref = sensor.fau_gain_white_ref * 256;
|
||||
else
|
||||
gain_white_ref = sensor.gain_white_ref * 256;
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
gain_white_ref = sensor.fau_gain_white_ref * 256;
|
||||
} else {
|
||||
gain_white_ref = sensor.gain_white_ref * 256;
|
||||
}
|
||||
|
||||
if (range < 1)
|
||||
range = 1;
|
||||
|
@ -1502,11 +1505,15 @@ static SANE_Status genesys_coarse_calibration(Genesys_Device * dev, Genesys_Sens
|
|||
double applied_multi;
|
||||
double gain_white_ref;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) /* Transparency */
|
||||
gain_white_ref = sensor.fau_gain_white_ref * 256;
|
||||
else
|
||||
gain_white_ref = sensor.gain_white_ref * 256;
|
||||
/* white and black are defined downwards */
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
gain_white_ref = sensor.fau_gain_white_ref * 256;
|
||||
} else {
|
||||
gain_white_ref = sensor.gain_white_ref * 256;
|
||||
}
|
||||
|
||||
// white and black are defined downwards
|
||||
|
||||
uint8_t gain0 = genesys_adjust_gain(&applied_multi,
|
||||
gain_white_ref / (white[0] - dark[0]),
|
||||
|
@ -1779,6 +1786,11 @@ genesys_dark_shading_calibration(Genesys_Device * dev, const Genesys_Sensor& sen
|
|||
dev->dark_average_data.clear();
|
||||
dev->dark_average_data.resize(dev->average_size);
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) {
|
||||
// FIXME: dark shading currently not supported on infrared transparency scans
|
||||
return SANE_STATUS_GOOD;
|
||||
}
|
||||
|
||||
// FIXME: the current calculation is likely incorrect on non-GENESYS_GL843 implementations,
|
||||
// but this needs checking
|
||||
if (dev->calib_total_bytes_to_read > 0) {
|
||||
|
@ -1969,7 +1981,9 @@ static void genesys_repark_sensor_before_shading(Genesys_Device* dev)
|
|||
TIE(dev->model->cmd_set->slow_back_home(dev, SANE_TRUE));
|
||||
}
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) {
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
dev->model->cmd_set->move_to_ta(dev);
|
||||
}
|
||||
}
|
||||
|
@ -3274,7 +3288,9 @@ genesys_flatbed_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
|
|||
return status;
|
||||
}
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) {
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
RIE(dev->model->cmd_set->move_to_ta(dev));
|
||||
}
|
||||
|
||||
|
@ -3846,8 +3862,9 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
|
|||
}
|
||||
|
||||
/* move to calibration area for transparency adapter */
|
||||
if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY)
|
||||
&& dev->model->cmd_set->move_to_ta != NULL)
|
||||
if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) &&
|
||||
dev->model->cmd_set->move_to_ta != NULL)
|
||||
{
|
||||
status=dev->model->cmd_set->move_to_ta(dev);
|
||||
if (status != SANE_STATUS_GOOD)
|
||||
|
@ -3930,7 +3947,9 @@ genesys_start_scan (Genesys_Device * dev, SANE_Bool lamp_off)
|
|||
RIE(dev->model->cmd_set->slow_back_home(dev, SANE_TRUE));
|
||||
}
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) {
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
RIE(dev->model->cmd_set->move_to_ta(dev));
|
||||
}
|
||||
|
||||
|
|
|
@ -1751,6 +1751,35 @@ void genesys_init_sensor_tables()
|
|||
{ { 0x03, 0x1f },
|
||||
},
|
||||
},
|
||||
{ -1, 1200, 45000, ScanMethod::TRANSPARENCY_INFRARED, {
|
||||
{ 0x74, 0x03 }, { 0x75, 0xf0 }, { 0x76, 0xf0 },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xfe }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x92 }, { 0x7c, 0x49 },
|
||||
{ 0x0c, 0x00 },
|
||||
{ 0x70, 0x00 },
|
||||
{ 0x71, 0x02 },
|
||||
{ 0x9e, 0x2d },
|
||||
{ 0xaa, 0x00 },
|
||||
{ 0x16, 0x13 },
|
||||
{ 0x17, 0x0a },
|
||||
{ 0x18, 0x10 },
|
||||
{ 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 },
|
||||
{ 0x1b, 0x00 },
|
||||
{ 0x1c, 0x00 },
|
||||
{ 0x1d, 0x6b },
|
||||
{ 0x52, 0x0c },
|
||||
{ 0x53, 0x0f },
|
||||
{ 0x54, 0x00 },
|
||||
{ 0x55, 0x03 },
|
||||
{ 0x56, 0x06 },
|
||||
{ 0x57, 0x09 },
|
||||
{ 0x58, 0x6b },
|
||||
{ 0x59, 0x00 },
|
||||
{ 0x5a, 0x40 },
|
||||
},
|
||||
{},
|
||||
},
|
||||
};
|
||||
|
||||
auto base_custom_regs = sensor.custom_regs;
|
||||
|
@ -3223,6 +3252,7 @@ static Genesys_Model canon_8600f_model = {
|
|||
GPO_CS8600F,
|
||||
MOTOR_CS8600F,
|
||||
GENESYS_FLAG_HAS_UTA |
|
||||
GENESYS_FLAG_HAS_UTA_INFRARED |
|
||||
GENESYS_FLAG_LAZY_INIT |
|
||||
GENESYS_FLAG_OFFSET_CALIBRATION |
|
||||
GENESYS_FLAG_STAGGERED_LINE |
|
||||
|
|
|
@ -1697,14 +1697,17 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
|
||||
/* depth */
|
||||
depth = dev->settings.depth;
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
depth = 1;
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
depth = 1;
|
||||
}
|
||||
|
||||
/* start */
|
||||
if(dev->settings.scan_method==ScanMethod::TRANSPARENCY)
|
||||
start = SANE_UNFIX (dev->model->x_offset_ta);
|
||||
else
|
||||
start = SANE_UNFIX (dev->model->x_offset);
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
start = SANE_UNFIX(dev->model->x_offset_ta);
|
||||
} else {
|
||||
start = SANE_UNFIX(dev->model->x_offset);
|
||||
}
|
||||
|
||||
start /= ccd_size_divisor;
|
||||
|
||||
|
@ -2203,7 +2206,9 @@ static SANE_Status gl843_set_xpa_lamp_power(Genesys_Device *dev, bool set)
|
|||
val &= ~(REGA6_GPIO24 | REGA6_GPIO23);
|
||||
|
||||
// set XPA lamp power
|
||||
val |= REGA6_GPIO22 | REGA6_GPIO21 | REGA6_GPIO19;
|
||||
if (dev->settings.scan_method != ScanMethod::TRANSPARENCY_INFRARED) {
|
||||
val |= REGA6_GPIO22 | REGA6_GPIO21 | REGA6_GPIO19;
|
||||
}
|
||||
|
||||
RIE(sanei_genesys_write_register(dev, REGA6, val));
|
||||
|
||||
|
@ -2224,6 +2229,20 @@ static SANE_Status gl843_set_xpa_lamp_power(Genesys_Device *dev, bool set)
|
|||
RIE(sanei_genesys_write_register(dev, REGA6, val));
|
||||
}
|
||||
|
||||
if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F &&
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
if (set) {
|
||||
RIE(sanei_genesys_read_register(dev, REG6C, &val));
|
||||
val |= REG6C_GPIO16;
|
||||
RIE(sanei_genesys_write_register(dev, REG6C, val));
|
||||
} else {
|
||||
RIE(sanei_genesys_read_register(dev, REG6C, &val));
|
||||
val &= ~REG6C_GPIO16;
|
||||
RIE(sanei_genesys_write_register(dev, REG6C, val));
|
||||
}
|
||||
}
|
||||
|
||||
DBGCOMPLETED;
|
||||
return status;
|
||||
}
|
||||
|
@ -2283,6 +2302,9 @@ gl843_begin_scan (Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Re
|
|||
RIE (sanei_genesys_write_register (dev, REG7E, 0x01));
|
||||
break;
|
||||
case GPO_CS8600F:
|
||||
if (reg->state.is_xpa_on && reg->state.is_lamp_on) {
|
||||
RIE(gl843_set_xpa_lamp_power(dev, true));
|
||||
}
|
||||
if (reg->state.is_xpa_on) {
|
||||
dev->needs_home_ta = SANE_TRUE;
|
||||
RIE(gl843_set_xpa_motor_power(dev, true));
|
||||
|
@ -2724,7 +2746,8 @@ gl843_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) {
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) {
|
||||
flags |= SCAN_FLAG_USE_XPA;
|
||||
}
|
||||
|
||||
|
@ -2881,10 +2904,15 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
regs = dev->reg;
|
||||
|
||||
dev->calib_channels = 3;
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY)
|
||||
dev->calib_lines = dev->model->shading_ta_lines;
|
||||
else
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
dev->calib_lines = dev->model->shading_ta_lines;
|
||||
} else {
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
}
|
||||
|
||||
dpihw = sanei_genesys_compute_dpihw_calibration(dev, sensor, dev->settings.xres);
|
||||
factor=sensor.optical_res/dpihw;
|
||||
resolution=dpihw;
|
||||
|
@ -2892,7 +2920,8 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution,
|
||||
dev->settings.scan_method);
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY &&
|
||||
if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) &&
|
||||
dev->model->model_id == MODEL_CANON_CANOSCAN_8600F &&
|
||||
dev->settings.xres == 4800)
|
||||
{
|
||||
|
@ -2920,8 +2949,9 @@ gl843_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY)
|
||||
{
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
// note: move_to_ta() function has already been called and the sensor is at the
|
||||
// transparency adapter
|
||||
move = SANE_UNFIX(dev->model->y_offset_calib_ta) -
|
||||
|
@ -3007,7 +3037,8 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
move_dpi = dev->motor.base_ydpi;
|
||||
|
||||
flags = 0;
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY)
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
// note: move_to_ta() function has already been called and the sensor is at the
|
||||
// transparency adapter
|
||||
|
@ -3022,10 +3053,13 @@ gl843_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
|||
DBG(DBG_info, "%s: move=%f steps\n", __func__, move);
|
||||
|
||||
/* start */
|
||||
if(dev->settings.scan_method==ScanMethod::TRANSPARENCY)
|
||||
start = SANE_UNFIX (dev->model->x_offset_ta);
|
||||
else
|
||||
start = SANE_UNFIX (dev->model->x_offset);
|
||||
if (dev->settings.scan_method==ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
start = SANE_UNFIX(dev->model->x_offset_ta);
|
||||
} else {
|
||||
start = SANE_UNFIX(dev->model->x_offset);
|
||||
}
|
||||
|
||||
start /= sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres);
|
||||
start += dev->settings.tl_x;
|
||||
|
@ -3367,7 +3401,8 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
int start_pixel = 0;
|
||||
black_pixels = calib_sensor.black_pixels / factor;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY &&
|
||||
if ((dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED) &&
|
||||
dev->model->model_id == MODEL_CANON_CANOSCAN_8600F &&
|
||||
dev->settings.xres == 4800)
|
||||
{
|
||||
|
@ -3385,10 +3420,11 @@ gl843_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY)
|
||||
{
|
||||
flags |= SCAN_FLAG_USE_XPA;
|
||||
}
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
flags |= SCAN_FLAG_USE_XPA;
|
||||
}
|
||||
|
||||
ScanSession session;
|
||||
session.params.xres = resolution;
|
||||
|
@ -3615,10 +3651,11 @@ gl843_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
SCAN_FLAG_SINGLE_LINE |
|
||||
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY)
|
||||
{
|
||||
flags |= SCAN_FLAG_USE_XPA;
|
||||
}
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
flags |= SCAN_FLAG_USE_XPA;
|
||||
}
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution,
|
||||
dev->settings.scan_method);
|
||||
|
|
|
@ -999,6 +999,13 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
|
|||
|
||||
if (dev->model->asic_type == GENESYS_GL843) {
|
||||
sanei_genesys_set_exposure(regs, sensor.exposure);
|
||||
|
||||
// we don't actually turn on lamp on infrared scan
|
||||
if (dev->model->model_id == MODEL_CANON_CANOSCAN_8600F &&
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
{
|
||||
regs.find_reg(0x03).value &= ~REG03_LAMPPWR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
regs.find_reg(0x03).value &= ~REG03_LAMPPWR;
|
||||
|
|
Ładowanie…
Reference in New Issue