kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify physical pixel count computation on gl843
rodzic
f34176edf2
commit
ceb13f77d7
|
@ -1996,7 +1996,7 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
|||
|
||||
// FIXME: the following is likely incorrect
|
||||
// start coordinate in optical dpi coordinates
|
||||
startx = (sensor.dummy_pixel / sensor.ccd_pixels_per_system_pixel()) / dev->session.hwdpi_divisor;
|
||||
startx = sensor.dummy_pixel;
|
||||
startx = dev->session.pixel_count_ratio.apply(startx);
|
||||
|
||||
/* current scan coordinates */
|
||||
|
@ -2008,8 +2008,8 @@ void CommandSetGl843::send_shading_data(Genesys_Device* dev, const Genesys_Senso
|
|||
{
|
||||
int half_ccd_factor = dev->session.optical_resolution /
|
||||
sensor.get_register_hwdpi(dev->session.output_resolution);
|
||||
strpixel /= half_ccd_factor * sensor.ccd_pixels_per_system_pixel();
|
||||
endpixel /= half_ccd_factor * sensor.ccd_pixels_per_system_pixel();
|
||||
strpixel = dev->session.pixel_count_ratio.apply(strpixel / half_ccd_factor);
|
||||
endpixel = dev->session.pixel_count_ratio.apply(endpixel / half_ccd_factor);
|
||||
}
|
||||
|
||||
/* 16 bit words, 2 words per color, 3 color channels */
|
||||
|
|
|
@ -871,9 +871,6 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s,
|
|||
s.pixel_startx = (startx + sensor.dummy_pixel);
|
||||
s.pixel_endx = s.pixel_startx + s.optical_pixels;
|
||||
|
||||
s.pixel_startx /= s.hwdpi_divisor * ccd_pixels_per_system_pixel;
|
||||
s.pixel_endx /= s.hwdpi_divisor * ccd_pixels_per_system_pixel;
|
||||
|
||||
} else if (dev->model->asic_type == AsicType::GL845 ||
|
||||
dev->model->asic_type == AsicType::GL846 ||
|
||||
dev->model->asic_type == AsicType::GL847)
|
||||
|
@ -899,6 +896,14 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s,
|
|||
s.pixel_startx = sensor.pixel_count_ratio.apply(s.pixel_startx);
|
||||
s.pixel_endx = sensor.pixel_count_ratio.apply(s.pixel_endx);
|
||||
|
||||
if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200I ||
|
||||
dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7300 ||
|
||||
dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7500I)
|
||||
{
|
||||
s.pixel_startx = align_multiple_floor(s.pixel_startx, sensor.pixel_count_ratio.divisor());
|
||||
s.pixel_endx = align_multiple_floor(s.pixel_endx, sensor.pixel_count_ratio.divisor());
|
||||
}
|
||||
|
||||
if (dev->model->asic_type == AsicType::GL646) {
|
||||
if (sensor.stagger_config.stagger_at_resolution(s.params.xres, s.params.yres) > 0 &&
|
||||
(s.pixel_startx & 1) == 0)
|
||||
|
|
|
@ -1260,8 +1260,23 @@ void genesys_init_sensor_tables()
|
|||
sensor.get_register_hwdpi_fun = default_get_register_hwdpi;
|
||||
sensor.get_hwdpi_divisor_fun = default_get_hwdpi_divisor_for_dpi;
|
||||
sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi;
|
||||
s_sensors->push_back(sensor);
|
||||
{
|
||||
struct CustomSensorSettings
|
||||
{
|
||||
ValueFilterAny<unsigned> resolutions;
|
||||
Ratio pixel_count_ratio;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 75, 100, 150, 200, 300, 600 }, Ratio{1, 1} },
|
||||
};
|
||||
|
||||
for (const CustomSensorSettings& setting : custom_settings) {
|
||||
sensor.resolutions = setting.resolutions;
|
||||
sensor.pixel_count_ratio = setting.pixel_count_ratio;
|
||||
s_sensors->push_back(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
sensor = Genesys_Sensor();
|
||||
sensor.sensor_id = SensorId::CCD_G4050;
|
||||
|
@ -1285,11 +1300,12 @@ void genesys_init_sensor_tables()
|
|||
ValueFilterAny<unsigned> resolutions;
|
||||
int exposure_lperiod;
|
||||
ScanMethod method;
|
||||
Ratio pixel_count_ratio;
|
||||
GenesysRegisterSettingSet extra_custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 100, 150, 200, 300, 400, 600 }, 8016, ScanMethod::FLATBED, {
|
||||
{ { 100, 150, 200, 300, 400, 600 }, 8016, ScanMethod::FLATBED, Ratio{1, 8}, {
|
||||
{ 0x74, 0x00 }, { 0x75, 0x01 }, { 0x76, 0xff },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
|
||||
|
@ -1317,7 +1333,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ { 1200 }, 56064, ScanMethod::FLATBED, {
|
||||
{ { 1200 }, 56064, ScanMethod::FLATBED, Ratio{1, 4}, {
|
||||
{ 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x00 }, { 0x78, 0x01 }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x01 }, { 0x7c, 0xff },
|
||||
|
@ -1345,7 +1361,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ { 2400 }, 56064, ScanMethod::FLATBED, {
|
||||
{ { 2400 }, 56064, ScanMethod::FLATBED, Ratio{1, 2}, {
|
||||
{ 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
|
||||
|
@ -1373,7 +1389,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ { 4800 }, 42752, ScanMethod::FLATBED, {
|
||||
{ { 4800 }, 42752, ScanMethod::FLATBED, Ratio{1, 1}, {
|
||||
{ 0x74, 0x0f }, { 0x75, 0xff }, { 0x76, 0xff },
|
||||
{ 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x00 },
|
||||
{ 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 },
|
||||
|
@ -1401,7 +1417,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x5a, 0x40 },
|
||||
}
|
||||
},
|
||||
{ VALUE_FILTER_ANY, 15624, ScanMethod::TRANSPARENCY, {
|
||||
{ VALUE_FILTER_ANY, 15624, ScanMethod::TRANSPARENCY, Ratio{1, 1}, {
|
||||
{ 0x74, 0x00 }, { 0x75, 0x1c }, { 0x76, 0x7f },
|
||||
{ 0x77, 0x03 }, { 0x78, 0xff }, { 0x79, 0xff },
|
||||
{ 0x7a, 0x03 }, { 0x7b, 0xff }, { 0x7c, 0xff },
|
||||
|
@ -1437,6 +1453,7 @@ void genesys_init_sensor_tables()
|
|||
sensor.resolutions = setting.resolutions;
|
||||
sensor.exposure_lperiod = setting.exposure_lperiod;
|
||||
sensor.method = setting.method;
|
||||
sensor.pixel_count_ratio = setting.pixel_count_ratio;
|
||||
sensor.custom_regs = base_custom_regs;
|
||||
sensor.custom_regs.merge(setting.extra_custom_regs);
|
||||
s_sensors->push_back(sensor);
|
||||
|
@ -1464,11 +1481,12 @@ void genesys_init_sensor_tables()
|
|||
ValueFilterAny<unsigned> resolutions;
|
||||
int exposure_lperiod;
|
||||
ScanMethod method;
|
||||
Ratio pixel_count_ratio;
|
||||
GenesysRegisterSettingSet extra_custom_regs;
|
||||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 100, 150, 200, 300, 400, 600 }, 8016, ScanMethod::FLATBED, {
|
||||
{ { 100, 150, 200, 300, 400, 600 }, 8016, ScanMethod::FLATBED, Ratio{1, 8}, {
|
||||
{ 0x0c, 0x00 },
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x00 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x08 },
|
||||
|
@ -1482,7 +1500,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0xaa, 0x00 },
|
||||
}
|
||||
},
|
||||
{ { 1200 }, 56064, ScanMethod::FLATBED, {
|
||||
{ { 1200 }, 56064, ScanMethod::FLATBED, Ratio{1, 4}, {
|
||||
{ 0x0c, 0x20 },
|
||||
{ 0x16, 0x3b }, { 0x17, 0x0c }, { 0x18, 0x10 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x38 }, { 0x1b, 0x10 }, { 0x1c, 0x00 }, { 0x1d, 0x08 },
|
||||
|
@ -1496,7 +1514,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0xaa, 0x05 },
|
||||
}
|
||||
},
|
||||
{ { 2400 }, 56064, ScanMethod::FLATBED, {
|
||||
{ { 2400 }, 56064, ScanMethod::FLATBED, Ratio{1, 2}, {
|
||||
{ 0x0c, 0x20 },
|
||||
{ 0x16, 0x3b }, { 0x17, 0x0c }, { 0x18, 0x10 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x38 }, { 0x1b, 0x10 }, { 0x1c, 0xc0 }, { 0x1d, 0x08 },
|
||||
|
@ -1510,7 +1528,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0xaa, 0x05 },
|
||||
}
|
||||
},
|
||||
{ { 4800 }, 42752, ScanMethod::FLATBED, {
|
||||
{ { 4800 }, 42752, ScanMethod::FLATBED, Ratio{1, 1}, {
|
||||
{ 0x0c, 0x21 },
|
||||
{ 0x16, 0x3b }, { 0x17, 0x0c }, { 0x18, 0x10 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x38 }, { 0x1b, 0x10 }, { 0x1c, 0xc1 }, { 0x1d, 0x08 },
|
||||
|
@ -1524,7 +1542,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0xaa, 0x07 },
|
||||
}
|
||||
},
|
||||
{ VALUE_FILTER_ANY, 15624, ScanMethod::TRANSPARENCY, {
|
||||
{ VALUE_FILTER_ANY, 15624, ScanMethod::TRANSPARENCY, Ratio{1, 1}, {
|
||||
{ 0x0c, 0x00 },
|
||||
{ 0x16, 0x33 }, { 0x17, 0x4c }, { 0x18, 0x01 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x08 },
|
||||
|
@ -1546,6 +1564,7 @@ void genesys_init_sensor_tables()
|
|||
sensor.resolutions = setting.resolutions;
|
||||
sensor.exposure_lperiod = setting.exposure_lperiod;
|
||||
sensor.method = setting.method;
|
||||
sensor.pixel_count_ratio = setting.pixel_count_ratio;
|
||||
sensor.custom_regs = base_custom_regs;
|
||||
sensor.custom_regs.merge(setting.extra_custom_regs);
|
||||
s_sensors->push_back(sensor);
|
||||
|
@ -1679,7 +1698,7 @@ void genesys_init_sensor_tables()
|
|||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 400 }, 2400, Ratio{1, 1}, 7200, { ScanMethod::FLATBED }, {
|
||||
{ { 400 }, 2400, Ratio{1, 4}, 7200, { ScanMethod::FLATBED }, {
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 },
|
||||
{ 0x52, 0x0d }, { 0x53, 0x10 }, { 0x54, 0x01 }, { 0x55, 0x04 },
|
||||
|
@ -1691,7 +1710,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x80, 0x2a },
|
||||
}, {}
|
||||
},
|
||||
{ { 800 }, 4800, Ratio{1, 1}, 7200, { ScanMethod::FLATBED }, {
|
||||
{ { 800 }, 4800, Ratio{1, 4}, 7200, { ScanMethod::FLATBED }, {
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 },
|
||||
{ 0x52, 0x0d }, { 0x53, 0x10 }, { 0x54, 0x01 }, { 0x55, 0x04 },
|
||||
|
@ -1703,7 +1722,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x80, 0x20 },
|
||||
}, {}
|
||||
},
|
||||
{ { 1600 }, 4800, Ratio{1, 1}, 14400, { ScanMethod::FLATBED }, {
|
||||
{ { 1600 }, 4800, Ratio{1, 2}, 14400, { ScanMethod::FLATBED }, {
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x11 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa1 },
|
||||
{ 0x52, 0x0b }, { 0x53, 0x0e }, { 0x54, 0x11 }, { 0x55, 0x02 },
|
||||
|
@ -1731,7 +1750,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x03, 0x1f },
|
||||
},
|
||||
},
|
||||
{ { 400 }, 2400, Ratio{1, 1}, 14400, { ScanMethod::TRANSPARENCY,
|
||||
{ { 400 }, 2400, Ratio{1, 4}, 14400, { ScanMethod::TRANSPARENCY,
|
||||
ScanMethod::TRANSPARENCY_INFRARED }, {
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 },
|
||||
|
@ -1744,7 +1763,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x80, 0x20 },
|
||||
}, {}
|
||||
},
|
||||
{ { 800 }, 4800, Ratio{1, 1}, 14400, { ScanMethod::TRANSPARENCY,
|
||||
{ { 800 }, 4800, Ratio{1, 4}, 14400, { ScanMethod::TRANSPARENCY,
|
||||
ScanMethod::TRANSPARENCY_INFRARED }, {
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x13 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 },
|
||||
|
@ -1757,7 +1776,7 @@ void genesys_init_sensor_tables()
|
|||
{ 0x80, 0x20 },
|
||||
}, {}
|
||||
},
|
||||
{ { 1600 }, 4800, Ratio{1, 1}, 28800, { ScanMethod::TRANSPARENCY,
|
||||
{ { 1600 }, 4800, Ratio{1, 2}, 28800, { ScanMethod::TRANSPARENCY,
|
||||
ScanMethod::TRANSPARENCY_INFRARED }, {
|
||||
{ 0x16, 0x33 }, { 0x17, 0x0c }, { 0x18, 0x11 }, { 0x19, 0x2a },
|
||||
{ 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x84 }, { 0x1e, 0xa0 },
|
||||
|
@ -2506,18 +2525,18 @@ void genesys_init_sensor_tables()
|
|||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 1}, 0x2538, 150, {} },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 1}, 0x2538, 300, {} },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 1}, 0x2538, 600, {} },
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 0x2538, 150, {} },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 0x2538, 300, {} },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 0x2538, 600, {} },
|
||||
{ { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 0x19c8, 1200, {
|
||||
{ 0x02, 0x1b },
|
||||
{ 0x03, 0x14 },
|
||||
{ 0x04, 0x20 },
|
||||
}
|
||||
},
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 1}, 0x1f54, 150, {} },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 1}, 0x1f54, 300, {} },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 1}, 0x1f54, 600, {} },
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 0x1f54, 150, {} },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 0x1f54, 300, {} },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 0x1f54, 600, {} },
|
||||
{ { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 0x1f54, 1200, {} },
|
||||
};
|
||||
|
||||
|
@ -2593,9 +2612,9 @@ void genesys_init_sensor_tables()
|
|||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 900 }, 1, 900, Ratio{8, 1}, 150 },
|
||||
{ { 1800 }, 1, 1800, Ratio{4, 1}, 300 },
|
||||
{ { 3600 }, 1, 3600, Ratio{2, 1}, 600 },
|
||||
{ { 900 }, 1, 900, Ratio{8, 8}, 150 },
|
||||
{ { 1800 }, 1, 1800, Ratio{4, 4}, 300 },
|
||||
{ { 3600 }, 1, 3600, Ratio{2, 2}, 600 },
|
||||
{ { 7200 }, 1, 7200, Ratio{1, 1}, 1200 },
|
||||
};
|
||||
|
||||
|
@ -2668,13 +2687,13 @@ void genesys_init_sensor_tables()
|
|||
};
|
||||
|
||||
CustomSensorSettings custom_settings[] = {
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 1}, 0x2f44, 150 },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 1}, 0x2f44, 300 },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 1}, 0x2f44, 600 },
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 0x2f44, 150 },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 0x2f44, 300 },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 0x2f44, 600 },
|
||||
{ { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 0x2f44, 1200 },
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 1}, 0x2af8, 150 },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 1}, 0x2af8, 300 },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 1}, 0x2af8, 600 },
|
||||
{ { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 0x2af8, 150 },
|
||||
{ { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 0x2af8, 300 },
|
||||
{ { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 0x2af8, 600 },
|
||||
{ { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 0x2af8, 1200 },
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue