genesys: Simplify dpihw calculation on gl843

fix-build-obselete-jpeg
Povilas Kanapickas 2020-03-21 00:03:37 +02:00
rodzic cf4ce94fc4
commit 2d7758f5f2
2 zmienionych plików z 20 dodań i 12 usunięć

Wyświetl plik

@ -149,8 +149,16 @@ gl843_init_registers (Genesys_Device * dev)
dev->reg.init_reg(0x05, 0x08); dev->reg.init_reg(0x05, 0x08);
} }
auto initial_scan_method = dev->model->default_method;
if (dev->model->model_id == ModelId::CANON_4400F ||
dev->model->model_id == ModelId::CANON_8600F)
{
initial_scan_method = ScanMethod::TRANSPARENCY;
}
const auto& sensor = sanei_genesys_find_sensor_any(dev); const auto& sensor = sanei_genesys_find_sensor_any(dev);
sanei_genesys_set_dpihw(dev->reg, sensor, sensor.optical_res); const auto& dpihw_sensor = sanei_genesys_find_sensor(dev, sensor.optical_res,
3, initial_scan_method);
sanei_genesys_set_dpihw(dev->reg, dpihw_sensor, 0);
// TODO: on 8600F the windows driver turns off GAIN4 which is recommended // TODO: on 8600F the windows driver turns off GAIN4 which is recommended
dev->reg.init_reg(0x06, 0xd8); /* SCANMOD=110, PWRBIT and GAIN4 */ dev->reg.init_reg(0x06, 0xd8); /* SCANMOD=110, PWRBIT and GAIN4 */
@ -935,7 +943,6 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
const ScanSession& session) const ScanSession& session)
{ {
DBG_HELPER_ARGS(dbg, "exposure=%d", exposure); DBG_HELPER_ARGS(dbg, "exposure=%d", exposure);
unsigned int dpihw;
unsigned int tgtime; /**> exposure time multiplier */ unsigned int tgtime; /**> exposure time multiplier */
GenesysRegister *r; GenesysRegister *r;
@ -943,11 +950,6 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
tgtime = exposure / 65536 + 1; tgtime = exposure / 65536 + 1;
DBG(DBG_io2, "%s: tgtime=%d\n", __func__, tgtime); DBG(DBG_io2, "%s: tgtime=%d\n", __func__, tgtime);
// to manage high resolution device while keeping good low resolution scanning speed, we make
// hardware dpi vary
dpihw = sensor.get_register_hwdpi(session.output_resolution);
DBG(DBG_io2, "%s: dpihw=%d\n", __func__, dpihw);
/* sensor parameters */ /* sensor parameters */
gl843_setup_sensor(dev, sensor, reg); gl843_setup_sensor(dev, sensor, reg);
@ -1058,7 +1060,10 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
} }
} }
sanei_genesys_set_dpihw(*reg, sensor, dpihw); const auto& dpihw_sensor = sanei_genesys_find_sensor(dev, session.output_resolution,
session.params.channels,
session.params.scan_method);
sanei_genesys_set_dpihw(*reg, dpihw_sensor, 0);
if (should_enable_gamma(session, sensor)) { if (should_enable_gamma(session, sensor)) {
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB; reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;

Wyświetl plik

@ -1326,6 +1326,7 @@ void genesys_init_sensor_tables()
sensor = Genesys_Sensor(); sensor = Genesys_Sensor();
sensor.sensor_id = SensorId::CCD_KVSS080; sensor.sensor_id = SensorId::CCD_KVSS080;
sensor.optical_res = 600; sensor.optical_res = 600;
sensor.register_dpihw_override = 600;
sensor.shading_resolution = 600; sensor.shading_resolution = 600;
sensor.black_pixels = 38; sensor.black_pixels = 38;
sensor.dummy_pixel = 38; sensor.dummy_pixel = 38;
@ -1401,7 +1402,7 @@ void genesys_init_sensor_tables()
{ {
struct CustomSensorSettings { struct CustomSensorSettings {
ValueFilterAny<unsigned> resolutions; ValueFilterAny<unsigned> resolutions;
unsigned shading_resolution; unsigned register_dpihw_override;
int exposure_lperiod; int exposure_lperiod;
ScanMethod method; ScanMethod method;
Ratio pixel_count_ratio; Ratio pixel_count_ratio;
@ -1555,7 +1556,8 @@ void genesys_init_sensor_tables()
for (const CustomSensorSettings& setting : custom_settings) for (const CustomSensorSettings& setting : custom_settings)
{ {
sensor.resolutions = setting.resolutions; sensor.resolutions = setting.resolutions;
sensor.shading_resolution = setting.shading_resolution; sensor.register_dpihw_override = setting.register_dpihw_override;
sensor.shading_resolution = setting.register_dpihw_override;
sensor.exposure_lperiod = setting.exposure_lperiod; sensor.exposure_lperiod = setting.exposure_lperiod;
sensor.method = setting.method; sensor.method = setting.method;
sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.pixel_count_ratio = setting.pixel_count_ratio;
@ -1583,7 +1585,7 @@ void genesys_init_sensor_tables()
{ {
struct CustomSensorSettings { struct CustomSensorSettings {
ValueFilterAny<unsigned> resolutions; ValueFilterAny<unsigned> resolutions;
unsigned shading_resolution; unsigned register_dpihw_override;
int exposure_lperiod; int exposure_lperiod;
ScanMethod method; ScanMethod method;
Ratio pixel_count_ratio; Ratio pixel_count_ratio;
@ -1667,7 +1669,8 @@ void genesys_init_sensor_tables()
for (const CustomSensorSettings& setting : custom_settings) for (const CustomSensorSettings& setting : custom_settings)
{ {
sensor.resolutions = setting.resolutions; sensor.resolutions = setting.resolutions;
sensor.shading_resolution = setting.shading_resolution; sensor.register_dpihw_override = setting.register_dpihw_override;
sensor.shading_resolution = setting.register_dpihw_override;
sensor.exposure_lperiod = setting.exposure_lperiod; sensor.exposure_lperiod = setting.exposure_lperiod;
sensor.method = setting.method; sensor.method = setting.method;
sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.pixel_count_ratio = setting.pixel_count_ratio;