genesys: Simplify dpihw calculation on gl846

fix-build-obselete-jpeg
Povilas Kanapickas 2020-03-21 00:03:32 +02:00
rodzic dd16101d44
commit 0c0b484728
2 zmienionych plików z 23 dodań i 20 usunięć

Wyświetl plik

@ -219,7 +219,9 @@ gl846_init_registers (Genesys_Device * dev)
dev->reg.init_reg(0xf8, 0x05);
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, ScanMethod::FLATBED);
sanei_genesys_set_dpihw(dev->reg, dpihw_sensor, 0);
}
/**@brief send slope table for motor movement
@ -514,18 +516,12 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
const ScanSession& session)
{
DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time);
unsigned int dpihw;
GenesysRegister *r;
// resolution is divided according to ccd_pixels_per_system_pixel()
unsigned ccd_pixels_per_system_pixel = sensor.ccd_pixels_per_system_pixel();
DBG(DBG_io2, "%s: ccd_pixels_per_system_pixel=%d\n", __func__, ccd_pixels_per_system_pixel);
// to manage high resolution device while keeping good low resolution scanning speed,
// we make hardware dpi vary
dpihw = sensor.get_register_hwdpi(session.params.xres * ccd_pixels_per_system_pixel);
DBG(DBG_io2, "%s: dpihw=%d\n", __func__, dpihw);
gl846_setup_sensor(dev, sensor, reg);
dev->cmd_set->set_fe(dev, sensor, AFE_SET);
@ -589,7 +585,10 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
r->value |= 0x20; // mono
}
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)) {
reg->find_reg(REG_0x05).value |= REG_0x05_GMMENB;

Wyświetl plik

@ -3058,23 +3058,25 @@ void genesys_init_sensor_tables()
struct CustomSensorSettings
{
ValueFilterAny<unsigned> resolutions;
unsigned register_dpihw_override;
Ratio pixel_count_ratio;
unsigned shading_factor;
GenesysRegisterSettingSet extra_custom_regs;
};
CustomSensorSettings custom_settings[] = {
{ { 75 }, Ratio{1, 4}, 8, { { 0x7e, 0x00 } } },
{ { 100 }, Ratio{1, 4}, 6, { { 0x7e, 0x00 } } },
{ { 150 }, Ratio{1, 4}, 4, { { 0x7e, 0x00 } } },
{ { 300 }, Ratio{1, 4}, 2, { { 0x7e, 0x00 } } },
{ { 600 }, Ratio{1, 4}, 1, { { 0x7e, 0x01 } } },
{ { 1200 }, Ratio{1, 2}, 1, { { 0x7e, 0x01 } } },
{ { 75 }, 600, Ratio{1, 4}, 8, { { 0x7e, 0x00 } } },
{ { 100 }, 600, Ratio{1, 4}, 6, { { 0x7e, 0x00 } } },
{ { 150 }, 600, Ratio{1, 4}, 4, { { 0x7e, 0x00 } } },
{ { 300 }, 600, Ratio{1, 4}, 2, { { 0x7e, 0x00 } } },
{ { 600 }, 600, Ratio{1, 4}, 1, { { 0x7e, 0x01 } } },
{ { 1200 }, 1200, Ratio{1, 2}, 1, { { 0x7e, 0x01 } } },
};
auto base_custom_regs = sensor.custom_regs;
for (const CustomSensorSettings& setting : custom_settings) {
sensor.resolutions = setting.resolutions;
sensor.register_dpihw_override = setting.register_dpihw_override;
sensor.pixel_count_ratio = setting.pixel_count_ratio;
sensor.shading_factor = setting.shading_factor;
sensor.custom_regs = base_custom_regs;
@ -3111,21 +3113,23 @@ void genesys_init_sensor_tables()
struct CustomSensorSettings
{
ValueFilterAny<unsigned> resolutions;
unsigned register_dpihw_override;
Ratio pixel_count_ratio;
unsigned shading_factor;
};
CustomSensorSettings custom_settings[] = {
{ { 75 }, Ratio{1, 2}, 8 },
{ { 100 }, Ratio{1, 2}, 6 },
{ { 150 }, Ratio{1, 2}, 4 },
{ { 300 }, Ratio{1, 2}, 2 },
{ { 600 }, Ratio{1, 2}, 1 },
{ { 1200 }, Ratio{1, 1}, 1 },
{ { 75 }, 600, Ratio{1, 2}, 8 },
{ { 100 }, 600, Ratio{1, 2}, 6 },
{ { 150 }, 600, Ratio{1, 2}, 4 },
{ { 300 }, 600, Ratio{1, 2}, 2 },
{ { 600 }, 600, Ratio{1, 2}, 1 },
{ { 1200 }, 1200, Ratio{1, 1}, 1 },
};
for (const CustomSensorSettings& setting : custom_settings) {
sensor.resolutions = setting.resolutions;
sensor.register_dpihw_override = setting.register_dpihw_override;
sensor.pixel_count_ratio = setting.pixel_count_ratio;
sensor.shading_factor = setting.shading_factor;
s_sensors->push_back(sensor);