diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-02-07 06:56:10 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-02-07 06:56:10 +0100 |
commit | 43f33c72804e63306580755049c09d5a81ad83e3 (patch) | |
tree | 805caeb00a832ed96a331907987d4e6a2056a391 /backend/genesys | |
parent | 0f86c5490ea7c2218a4394bf4c21bf3f9267a47c (diff) | |
parent | 6427d36e269d8c14e6bc55373102a4ebc971ca38 (diff) |
Merge branch 'release/debian/1.1.1-1'debian/1.1.1-1
Diffstat (limited to 'backend/genesys')
74 files changed, 401 insertions, 1983 deletions
diff --git a/backend/genesys/calibration.h b/backend/genesys/calibration.h index fc82850..fd0f627 100644 --- a/backend/genesys/calibration.h +++ b/backend/genesys/calibration.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_CALIBRATION_H diff --git a/backend/genesys/command_set.h b/backend/genesys/command_set.h index 47bdfbd..b031a8c 100644 --- a/backend/genesys/command_set.h +++ b/backend/genesys/command_set.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_COMMAND_SET_H diff --git a/backend/genesys/device.cpp b/backend/genesys/device.cpp index 4b1940b..5411d7b 100644 --- a/backend/genesys/device.cpp +++ b/backend/genesys/device.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/device.h b/backend/genesys/device.h index f998714..842856b 100644 --- a/backend/genesys/device.h +++ b/backend/genesys/device.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_DEVICE_H diff --git a/backend/genesys/enums.cpp b/backend/genesys/enums.cpp index ce0ad10..460e73f 100644 --- a/backend/genesys/enums.cpp +++ b/backend/genesys/enums.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -279,6 +258,7 @@ std::ostream& operator<<(std::ostream& out, GpioId id) case GpioId::CANON_8600F: out << "CANON_8600F"; break; case GpioId::DP665: out << "DP665"; break; case GpioId::DP685: out << "DP685"; break; + case GpioId::G4010: out << "G4010"; break; case GpioId::G4050: out << "G4050"; break; case GpioId::HP2300: out << "HP2300"; break; case GpioId::HP2400: out << "HP2400"; break; diff --git a/backend/genesys/enums.h b/backend/genesys/enums.h index ae5dedd..88fc9c3 100644 --- a/backend/genesys/enums.h +++ b/backend/genesys/enums.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_ENUMS_H @@ -372,6 +351,7 @@ enum class GpioId : unsigned DP665, DP685, G4050, + G4010, HP2300, HP2400, HP3670, @@ -525,6 +505,9 @@ enum class ModelFlag : unsigned // disable fast feeding mode on this scanner DISABLE_FAST_FEEDING = 1 << 14, + // scan gray scans as color and combine on host side + HOST_SIDE_GRAY = 1 << 15, + // the scanner uses multi-segment sensors that must be handled during calibration SIS_SENSOR = 1 << 16, diff --git a/backend/genesys/error.cpp b/backend/genesys/error.cpp index e302e22..6f892de 100644 --- a/backend/genesys/error.cpp +++ b/backend/genesys/error.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/error.h b/backend/genesys/error.h index e95313f..93a428b 100644 --- a/backend/genesys/error.h +++ b/backend/genesys/error.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_ERROR_H diff --git a/backend/genesys/fwd.h b/backend/genesys/fwd.h index 89ca150..9937654 100644 --- a/backend/genesys/fwd.h +++ b/backend/genesys/fwd.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_FWD_H diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp index 9552fa9..5aba58c 100644 --- a/backend/genesys/genesys.cpp +++ b/backend/genesys/genesys.cpp @@ -29,27 +29,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ /* @@ -674,9 +653,9 @@ void scanner_setup_sensor(Genesys_Device& dev, const Genesys_Sensor& sensor, regs.set8(custom_reg.address, custom_reg.value); } - if (dev.model->asic_type != AsicType::GL841 && - dev.model->asic_type != AsicType::GL843) + if (dev.model->asic_type != AsicType::GL843) { + // FIXME: remove the above check regs_set_exposure(dev.model->asic_type, regs, sensor.exposure); } @@ -795,6 +774,8 @@ void scanner_move(Genesys_Device& dev, ScanMethod scan_method, unsigned steps, D session.params.scan_method = scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::GREEN; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | @@ -959,6 +940,8 @@ void scanner_move_back_home(Genesys_Device& dev, bool wait_until_home) session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::GREEN; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | @@ -1100,6 +1083,8 @@ void scanner_move_back_home_ta(Genesys_Device& dev) session.params.scan_method = scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::GREEN; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | @@ -1210,6 +1195,8 @@ void scanner_search_strip(Genesys_Device& dev, bool forward, bool black) session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA; if (dev.model->asic_type != AsicType::GL841 && !forward) { @@ -1506,6 +1493,8 @@ void scanner_offset_calibration(Genesys_Device& dev, const Genesys_Sensor& senso session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev.model->asic_type == AsicType::GL843 ? ColorFilter::RED : dev.settings.color_filter; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = flags; compute_session(&dev, session, *calib_sensor); @@ -1815,6 +1804,8 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor& session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev.settings.color_filter; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = flags; compute_session(&dev, session, *calib_sensor); @@ -1873,7 +1864,8 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor& float curr_output = 0; float target_value = 0; - if (dev.model->asic_type == AsicType::GL842 || + if (dev.model->asic_type == AsicType::GL841 || + dev.model->asic_type == AsicType::GL842 || dev.model->asic_type == AsicType::GL843) { std::vector<uint16_t> values; @@ -1889,18 +1881,6 @@ void scanner_coarse_gain_calibration(Genesys_Device& dev, const Genesys_Sensor& curr_output = static_cast<float>(values[unsigned((values.size() - 1) * 0.95)]); target_value = calib_sensor->gain_white_ref * coeff; - } else if (dev.model->asic_type == AsicType::GL841) { - // FIXME: use the GL843 approach - unsigned max = 0; - for (std::size_t x = 0; x < image.get_width(); x++) { - auto value = image.get_raw_channel(x, 0, ch); - if (value > max) { - max = value; - } - } - - curr_output = max; - target_value = 65535.0f; } else { // FIXME: use the GL843 approach auto width = image.get_width(); @@ -1998,7 +1978,8 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor const auto& calib_sensor = sanei_genesys_find_sensor(&dev, resolution, channels, dev.settings.scan_method); - if (dev.model->asic_type == AsicType::GL845 || + if (dev.model->asic_type == AsicType::GL841 || + dev.model->asic_type == AsicType::GL845 || dev.model->asic_type == AsicType::GL846 || dev.model->asic_type == AsicType::GL847 || dev.model->asic_type == AsicType::GL124) @@ -2006,14 +1987,9 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor regs = dev.reg; // FIXME: apply this to all ASICs } - unsigned yres = resolution; - if (dev.model->asic_type == AsicType::GL841) { - yres = dev.settings.yres; // FIXME: remove this - } - ScanSession session; session.params.xres = resolution; - session.params.yres = yres; + session.params.yres = resolution; session.params.startx = 0; session.params.starty = 0; session.params.pixels = dev.model->x_size_calib_mm * resolution / MM_PER_INCH; @@ -2023,6 +1999,8 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor session.params.scan_method = dev.settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev.settings.color_filter; + session.params.contrast_adjustment = dev.settings.contrast; + session.params.brightness_adjustment = dev.settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -2032,27 +2010,14 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor dev.cmd_set->init_regs_for_scan_session(&dev, calib_sensor, ®s, session); - if (dev.model->asic_type == AsicType::GL841) { - dev.interface->write_registers(regs); // FIXME: remove this - } - std::uint16_t exp[3]; - if (dev.model->asic_type == AsicType::GL841) { - exp[0] = sensor.exposure.red; - exp[1] = sensor.exposure.green; - exp[2] = sensor.exposure.blue; - } else { - exp[0] = calib_sensor.exposure.red; - exp[1] = calib_sensor.exposure.green; - exp[2] = calib_sensor.exposure.blue; - } + exp[0] = calib_sensor.exposure.red; + exp[1] = calib_sensor.exposure.green; + exp[2] = calib_sensor.exposure.blue; std::uint16_t target = sensor.gain_white_ref * 256; - std::uint16_t min_exposure = 500; // only gl841 - std::uint16_t max_exposure = ((exp[0] + exp[1] + exp[2]) / 3) * 2; // only gl841 - std::uint16_t top[3] = {}; std::uint16_t bottom[3] = {}; @@ -2088,16 +2053,6 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor for (unsigned i_test = 0; i_test < 100 && !acceptable; ++i_test) { regs_set_exposure(dev.model->asic_type, regs, { exp[0], exp[1], exp[2] }); - if (dev.model->asic_type == AsicType::GL841) { - // FIXME: remove - dev.interface->write_register(0x10, (exp[0] >> 8) & 0xff); - dev.interface->write_register(0x11, exp[0] & 0xff); - dev.interface->write_register(0x12, (exp[1] >> 8) & 0xff); - dev.interface->write_register(0x13, exp[1] & 0xff); - dev.interface->write_register(0x14, (exp[2] >> 8) & 0xff); - dev.interface->write_register(0x15, exp[2] & 0xff); - } - dev.interface->write_registers(regs); dbg.log(DBG_info, "starting line reading"); @@ -2108,15 +2063,13 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor if (dev.model->asic_type == AsicType::GL841) { scanner_stop_action(dev); dev.cmd_set->move_back_home(&dev, true); - return { exp[0], exp[1], exp[2] }; } else if (dev.model->asic_type == AsicType::GL124) { scanner_stop_action(dev); - return calib_sensor.exposure; } else { scanner_stop_action(dev); dev.cmd_set->move_back_home(&dev, true); - return calib_sensor.exposure; } + return { exp[0], exp[1], exp[2] }; } auto image = read_unshuffled_image_from_scanner(&dev, session, session.output_line_bytes); @@ -2142,57 +2095,8 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor acceptable = true; - if (dev.model->asic_type == AsicType::GL841) { - if (avg[0] < avg[1] * 0.95 || avg[1] < avg[0] * 0.95 || - avg[0] < avg[2] * 0.95 || avg[2] < avg[0] * 0.95 || - avg[1] < avg[2] * 0.95 || avg[2] < avg[1] * 0.95) - { - acceptable = false; - } - - // led exposure is not acceptable if white level is too low. - // ~80 hardcoded value for white level - if (avg[0] < 20000 || avg[1] < 20000 || avg[2] < 20000) { - acceptable = false; - } - - // for scanners using target value - if (target > 0) { - acceptable = true; - for (unsigned i = 0; i < 3; i++) { - // we accept +- 2% delta from target - if (std::abs(avg[i] - target) > target / 50) { - exp[i] = (exp[i] * target) / avg[i]; - acceptable = false; - } - } - } else { - if (!acceptable) { - unsigned avga = (avg[0] + avg[1] + avg[2]) / 3; - exp[0] = (exp[0] * avga) / avg[0]; - exp[1] = (exp[1] * avga) / avg[1]; - exp[2] = (exp[2] * avga) / avg[2]; - /* Keep the resulting exposures below this value. Too long exposure drives - the ccd into saturation. We may fix this by relying on the fact that - we get a striped scan without shading, by means of statistical calculation - */ - unsigned avge = (exp[0] + exp[1] + exp[2]) / 3; - - if (avge > max_exposure) { - exp[0] = (exp[0] * max_exposure) / avge; - exp[1] = (exp[1] * max_exposure) / avge; - exp[2] = (exp[2] * max_exposure) / avge; - } - if (avge < min_exposure) { - exp[0] = (exp[0] * min_exposure) / avge; - exp[1] = (exp[1] * min_exposure) / avge; - exp[2] = (exp[2] * min_exposure) / avge; - } - - } - } - } else if (dev.model->asic_type == AsicType::GL845 || - dev.model->asic_type == AsicType::GL846) + if (dev.model->asic_type == AsicType::GL845 || + dev.model->asic_type == AsicType::GL846) { for (unsigned i = 0; i < 3; i++) { if (avg[i] < bottom[i]) { @@ -2225,7 +2129,9 @@ SensorExposure scanner_led_calibration(Genesys_Device& dev, const Genesys_Sensor acceptable = false; } } - } else if (dev.model->asic_type == AsicType::GL124) { + } else if (dev.model->asic_type == AsicType::GL841 || + dev.model->asic_type == AsicType::GL124) + { for (unsigned i = 0; i < 3; i++) { // we accept +- 2% delta from target if (std::abs(avg[i] - target) > target / 50) { @@ -4366,12 +4272,6 @@ static Genesys_Settings calculate_scan_settings(Genesys_Scanner* s) settings.color_filter = ColorFilter::NONE; } - if (s->color_filter == "None") { - settings.true_gray = 1; - } else { - settings.true_gray = 0; - } - // brightness and contrast only for for 8 bit scans if (s->bit_depth == 8) { settings.contrast = (s->contrast * 127) / 100; @@ -4992,16 +4892,28 @@ static void init_options(Genesys_Scanner* s) s->opt[OPT_POWER_SW].cap = SANE_CAP_INACTIVE; /* extra button */ - s->opt[OPT_EXTRA_SW].name = "extra"; - s->opt[OPT_EXTRA_SW].title = SANE_I18N ("Extra button"); - s->opt[OPT_EXTRA_SW].desc = SANE_I18N ("Extra button"); - s->opt[OPT_EXTRA_SW].type = SANE_TYPE_BOOL; - s->opt[OPT_EXTRA_SW].unit = SANE_UNIT_NONE; - if (model->buttons & GENESYS_HAS_EXTRA_SW) - s->opt[OPT_EXTRA_SW].cap = - SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED; - else - s->opt[OPT_EXTRA_SW].cap = SANE_CAP_INACTIVE; + s->opt[OPT_EXTRA_SW].name = "extra"; + s->opt[OPT_EXTRA_SW].title = SANE_I18N("Extra button"); + s->opt[OPT_EXTRA_SW].desc = SANE_I18N("Extra button"); + s->opt[OPT_EXTRA_SW].type = SANE_TYPE_BOOL; + s->opt[OPT_EXTRA_SW].unit = SANE_UNIT_NONE; + if (model->buttons & GENESYS_HAS_EXTRA_SW) { + s->opt[OPT_EXTRA_SW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED; + } else { + s->opt[OPT_EXTRA_SW].cap = SANE_CAP_INACTIVE; + } + + // transparency/scan_film button + s->opt[OPT_TRANSP_SW].name = "transparency"; + s->opt[OPT_TRANSP_SW].title = SANE_I18N ("Transparency button"); + s->opt[OPT_TRANSP_SW].desc = SANE_I18N ("Transparency button"); + s->opt[OPT_TRANSP_SW].type = SANE_TYPE_BOOL; + s->opt[OPT_TRANSP_SW].unit = SANE_UNIT_NONE; + if (model->buttons & GENESYS_HAS_TRANSP_SW) { + s->opt[OPT_TRANSP_SW].cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED; + } else { + s->opt[OPT_TRANSP_SW].cap = SANE_CAP_INACTIVE; + } /* calibration needed */ s->opt[OPT_NEED_CALIBRATION_SW].name = "need-calibration"; @@ -5231,7 +5143,7 @@ static void probe_genesys_devices() of Genesys_Calibration_Cache as is. */ static const char* CALIBRATION_IDENT = "sane_genesys"; -static const int CALIBRATION_VERSION = 31; +static const int CALIBRATION_VERSION = 32; bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration, const std::string& path) @@ -5821,6 +5733,7 @@ static void get_option_value(Genesys_Scanner* s, int option, void* val) case OPT_OCR_SW: case OPT_POWER_SW: case OPT_EXTRA_SW: + case OPT_TRANSP_SW: s->dev->cmd_set->update_hardware_sensors(s); *reinterpret_cast<SANE_Bool*>(val) = s->buttons[genesys_option_to_button(option)].read(); break; @@ -6456,6 +6369,7 @@ GenesysButtonName genesys_option_to_button(int option) case OPT_OCR_SW: return BUTTON_OCR_SW; case OPT_POWER_SW: return BUTTON_POWER_SW; case OPT_EXTRA_SW: return BUTTON_EXTRA_SW; + case OPT_TRANSP_SW: return BUTTON_TRANSP_SW; default: throw std::runtime_error("Unknown option to convert to button index"); } } diff --git a/backend/genesys/genesys.h b/backend/genesys/genesys.h index 19d6feb..272beaa 100644 --- a/backend/genesys/genesys.h +++ b/backend/genesys/genesys.h @@ -19,27 +19,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef GENESYS_H @@ -124,6 +103,7 @@ enum Genesys_Option OPT_OCR_SW, OPT_POWER_SW, OPT_EXTRA_SW, + OPT_TRANSP_SW, OPT_NEED_CALIBRATION_SW, OPT_BUTTON_GROUP, OPT_CALIBRATE, @@ -144,6 +124,7 @@ enum GenesysButtonName : unsigned { BUTTON_OCR_SW, BUTTON_POWER_SW, BUTTON_EXTRA_SW, + BUTTON_TRANSP_SW, NUM_BUTTONS }; diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index ed733b8..1fa4d99 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -113,7 +92,7 @@ gl124_init_registers (Genesys_Device * dev) dev->reg.init_reg(0x09, 0x00); dev->reg.init_reg(0x0a, 0xc0); dev->reg.init_reg(0x0b, 0x2a); - dev->reg.init_reg(0x0c, 0x12); + dev->reg.init_reg(0x0c, 0x12); // SENSOR_DEF dev->reg.init_reg(0x11, 0x00); dev->reg.init_reg(0x12, 0x00); dev->reg.init_reg(0x13, 0x0f); @@ -453,7 +432,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, ScanFlag flags) { DBG_HELPER(dbg); - int use_fast_fed; unsigned int lincnt, fast_dpi; unsigned int feedl,dist; uint32_t z1, z2; @@ -467,9 +445,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, feed_steps, static_cast<unsigned>(scan_mode), static_cast<unsigned>(flags)); - /* we never use fast fed since we do manual feed for the scans */ - use_fast_fed=0; - /* enforce motor minimal scan speed * @TODO extend motor struct for this value */ if (scan_mode == ScanColorMode::COLOR_SINGLE_PASS) @@ -516,12 +491,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, /* compute register 02 value */ uint8_t r02 = REG_0x02_NOTHOME; - if (use_fast_fed) { - r02 |= REG_0x02_FASTFED; - } else { - r02 &= ~REG_0x02_FASTFED; - } - if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { r02 |= REG_0x02_AGOHOME; } @@ -573,9 +542,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, if (has_flag(flags, ScanFlag::FEEDING)) { dist *= 2; } - if (use_fast_fed) { - dist += fast_table.table.size() * 2; - } /* get sure we don't use insane value */ if (dist < feedl) { @@ -587,7 +553,7 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, reg->set24(REG_FEEDL, feedl); /* doesn't seem to matter that much */ - sanei_genesys_calculate_zmod(use_fast_fed, + sanei_genesys_calculate_zmod(false, scan_exposure_time, scan_table.table, scan_table.table.size(), @@ -815,6 +781,8 @@ ScanSession CommandSetGl124::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::NONE; compute_session(dev, session, sensor); @@ -983,6 +951,8 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::DISABLE_BUFFER_FULL_MOVE; @@ -1116,6 +1086,8 @@ void move_to_calibration_area(Genesys_Device* dev, const Genesys_Sensor& sensor, session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -1202,6 +1174,8 @@ void CommandSetGl124::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); diff --git a/backend/genesys/gl124.h b/backend/genesys/gl124.h index b722e67..02b733b 100644 --- a/backend/genesys/gl124.h +++ b/backend/genesys/gl124.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL124_H diff --git a/backend/genesys/gl124_registers.h b/backend/genesys/gl124_registers.h index 66c5fda..dfc25f6 100644 --- a/backend/genesys/gl124_registers.h +++ b/backend/genesys/gl124_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL124_REGISTERS_H diff --git a/backend/genesys/gl646.cpp b/backend/genesys/gl646.cpp index acc1a4b..bdde703 100644 --- a/backend/genesys/gl646.cpp +++ b/backend/genesys/gl646.cpp @@ -23,27 +23,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -605,7 +584,9 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene } /* true CIS gray if needed */ - if (dev->model->is_cis && session.params.channels == 1 && dev->settings.true_gray) { + if (dev->model->is_cis && session.params.channels == 1 && + session.params.color_filter == ColorFilter::NONE) + { regs->find_reg(0x05).value |= REG_0x05_LEDADD; } else { regs->find_reg(0x05).value &= ~REG_0x05_LEDADD; @@ -1707,6 +1688,8 @@ void CommandSetGl646::move_back_home(Genesys_Device* dev, bool wait_until_home) session.params.scan_method = dev->model->default_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::REVERSE | ScanFlag::AUTO_GO_HOME | ScanFlag::DISABLE_GAMMA; @@ -1823,6 +1806,8 @@ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::IGNORE_COLOR_OFFSET | @@ -1931,6 +1916,8 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = scan_mode; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2110,6 +2097,8 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2222,6 +2211,8 @@ void CommandSetGl646::offset_calibration(Genesys_Device* dev, const Genesys_Sens session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2373,6 +2364,8 @@ void CommandSetGl646::coarse_gain_calibration(Genesys_Device* dev, const Genesys session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; @@ -2485,6 +2478,8 @@ void CommandSetGl646::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::GRAY; session.params.color_filter = ColorFilter::RED; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA; if (dev->settings.scan_method == ScanMethod::TRANSPARENCY) { @@ -2966,6 +2961,8 @@ ScanSession CommandSetGl646::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = ScanFlag::AUTO_GO_HOME; if (settings.scan_method == ScanMethod::TRANSPARENCY) { session.params.flags |= ScanFlag::USE_XPA; diff --git a/backend/genesys/gl646.h b/backend/genesys/gl646.h index e4c8d6b..04e5fb2 100644 --- a/backend/genesys/gl646.h +++ b/backend/genesys/gl646.h @@ -19,27 +19,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL646_H diff --git a/backend/genesys/gl646_registers.h b/backend/genesys/gl646_registers.h index 1c50888..b20bdbd 100644 --- a/backend/genesys/gl646_registers.h +++ b/backend/genesys/gl646_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL646_REGISTERS_H diff --git a/backend/genesys/gl841.cpp b/backend/genesys/gl841.cpp index 62e0e9d..27a6a36 100644 --- a/backend/genesys/gl841.cpp +++ b/backend/genesys/gl841.cpp @@ -25,27 +25,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -149,15 +128,6 @@ gl841_init_registers (Genesys_Device * dev) dev->reg.init_reg(0x13, 0x00); // SENSOR_DEF dev->reg.init_reg(0x14, 0x00); // SENSOR_DEF dev->reg.init_reg(0x15, 0x00); // SENSOR_DEF - if (dev->model->model_id == ModelId::CANON_LIDE_80) { - dev->reg.init_reg(0x10, 0x40); - dev->reg.init_reg(0x11, 0x00); - dev->reg.init_reg(0x12, 0x40); - dev->reg.init_reg(0x13, 0x00); - dev->reg.init_reg(0x14, 0x40); - dev->reg.init_reg(0x15, 0x00); - } - dev->reg.init_reg(0x16, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below dev->reg.init_reg(0x17, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below dev->reg.init_reg(0x18, 0x00); // SENSOR_DEF, overwritten in scanner_setup_sensor() below @@ -184,36 +154,21 @@ gl841_init_registers (Genesys_Device * dev) dev->reg.init_reg(0x27, 0x00); dev->reg.init_reg(0x29, 0xff); - dev->reg.init_reg(0x2c, 0x00); - dev->reg.init_reg(0x2d, 0x00); - if (dev->model->model_id == ModelId::CANON_LIDE_80) { - dev->reg.init_reg(0x2c, sensor.full_resolution >> 8); - dev->reg.init_reg(0x2d, sensor.full_resolution & 0xff); - } + dev->reg.init_reg(0x2c, 0x02); // DPISET: overwritten during scanner setup + dev->reg.init_reg(0x2d, 0x58); // DPISET: overwritten during scanner setup dev->reg.init_reg(0x2e, 0x80); dev->reg.init_reg(0x2f, 0x80); - dev->reg.init_reg(0x30, 0x00); - dev->reg.init_reg(0x31, 0x00); - dev->reg.init_reg(0x32, 0x00); - dev->reg.init_reg(0x33, 0x00); - dev->reg.init_reg(0x34, 0x00); - dev->reg.init_reg(0x35, 0x00); - dev->reg.init_reg(0x36, 0x00); - dev->reg.init_reg(0x37, 0x00); - dev->reg.init_reg(0x38, 0x4f); - dev->reg.init_reg(0x39, 0xc1); - if (dev->model->model_id == ModelId::CANON_LIDE_80) { - dev->reg.init_reg(0x31, 0x10); - dev->reg.init_reg(0x32, 0x15); - dev->reg.init_reg(0x33, 0x0e); - dev->reg.init_reg(0x34, 0x40); - dev->reg.init_reg(0x35, 0x00); - dev->reg.init_reg(0x36, 0x2a); - dev->reg.init_reg(0x37, 0x30); - dev->reg.init_reg(0x38, 0x2a); - dev->reg.init_reg(0x39, 0xf8); - } + dev->reg.init_reg(0x30, 0x00); // STRPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x31, 0x00); // STRPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x32, 0x00); // ENDPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x33, 0x00); // ENDPIXEL: overwritten during scanner setup + dev->reg.init_reg(0x34, 0x00); // DUMMY: overwritten during scanner setup + dev->reg.init_reg(0x35, 0x00); // MAXWD: overwritten during scanner setup + dev->reg.init_reg(0x36, 0x00); // MAXWD: overwritten during scanner setup + dev->reg.init_reg(0x37, 0x00); // MAXWD: overwritten during scanner setup + dev->reg.init_reg(0x38, 0x4f); // LPERIOD: overwritten during scanner setup + dev->reg.init_reg(0x39, 0xc1); // LPERIOD: overwritten during scanner setup dev->reg.init_reg(0x3d, 0x00); dev->reg.init_reg(0x3e, 0x00); @@ -330,11 +285,6 @@ gl841_init_registers (Genesys_Device * dev) dev->interface->write_0x8c(0x10, 0x94); dev->interface->write_register(0x09, 0x10); - - // FIXME: the following code originally changed 0x6b, but due to bug the 0x6c register was - // effectively changed. The current behavior matches the old code, but should probably be fixed. - dev->reg.find_reg(0x6c).value |= REG_0x6B_GPO18; - dev->reg.find_reg(0x6c).value &= ~REG_0x6B_GPO17; } } @@ -541,7 +491,6 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor { DBG_HELPER_ARGS(dbg, "feed_steps=%d, flags=%x", feed_steps, static_cast<unsigned>(flags)); unsigned step_multiplier = 2; - int use_fast_fed = 0; unsigned int feedl; /*number of scan lines to add in a scan_lines line*/ @@ -572,10 +521,6 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor // BUG: fast table is counted in base_ydpi / 4 feedl = feed_steps - fast_table.table.size() * 2; - use_fast_fed = 1; - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } reg->set8(0x3d, (feedl >> 16) & 0xf); reg->set8(0x3e, (feedl >> 8) & 0xff); @@ -590,10 +535,6 @@ static void gl841_init_motor_regs_feed(Genesys_Device* dev, const Genesys_Sensor reg->find_reg(0x02).value &= ~0x80; /*NOT_HOME OFF*/ reg->find_reg(0x02).value |= REG_0x02_MTRPWR; - - if (use_fast_fed) - reg->find_reg(0x02).value |= 0x08; - else reg->find_reg(0x02).value &= ~0x08; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { @@ -640,9 +581,6 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor unsigned step_multiplier = 2; - int use_fast_fed = 0; - unsigned int fast_time; - unsigned int slow_time; unsigned int feedl; unsigned int min_restep = 0x20; @@ -679,54 +617,11 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor fast_table.slice_steps(max_fast_slope_steps_count, step_multiplier); } - /* fast fed special cases handling */ - if (dev->model->gpio_id == GpioId::XP300 - || dev->model->gpio_id == GpioId::DP685) - { - /* quirk: looks like at least this scanner is unable to use - 2-feed mode */ - use_fast_fed = 0; - } - else if (feed_steps < fast_table.table.size() * 2 + - (slow_table.table.size() >> static_cast<unsigned>(motor_profile.step_type))) - { - use_fast_fed = 0; - DBG(DBG_info, "%s: feed too short, slow move forced.\n", __func__); - } else { -/* for deciding whether we should use fast mode we need to check how long we - need for (fast)accelerating, moving, decelerating, (TODO: stopping?) - (slow)accelerating again versus (slow)accelerating and moving. we need - fast and slow tables here. -*/ -/*NOTE: scan_exposure_time is per scan_yres*/ -/*NOTE: fast_exposure is per base_ydpi/4*/ -/*we use full steps as base unit here*/ - fast_time = - (fast_table.table.back() << static_cast<unsigned>(fast_profile->step_type)) / 4 * - (feed_steps - fast_table.table.size()*2 - - (slow_table.table.size() >> static_cast<unsigned>(motor_profile.step_type))) - + fast_table.pixeltime_sum() * 2 + slow_table.pixeltime_sum(); - slow_time = - (scan_exposure_time * scan_yres) / dev->motor.base_ydpi * - (feed_steps - (slow_table.table.size() >> static_cast<unsigned>(motor_profile.step_type))) - + slow_table.pixeltime_sum(); - - use_fast_fed = fast_time < slow_time; - } - - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } - - if (use_fast_fed) { - feedl = feed_steps - fast_table.table.size() * 2 - - (slow_table.table.size() >> static_cast<unsigned>(motor_profile.step_type)); - } else if ((feed_steps << static_cast<unsigned>(motor_profile.step_type)) < slow_table.table.size()) { + if ((feed_steps << static_cast<unsigned>(motor_profile.step_type)) < slow_table.table.size()) { feedl = 0; } else { feedl = (feed_steps << static_cast<unsigned>(motor_profile.step_type)) - slow_table.table.size(); } - DBG(DBG_info, "%s: Decided to use %s mode\n", __func__, use_fast_fed?"fast feed":"slow feed"); reg->set8(0x3d, (feedl >> 16) & 0xf); reg->set8(0x3e, (feedl >> 8) & 0xff); @@ -743,9 +638,6 @@ static void gl841_init_motor_regs_scan(Genesys_Device* dev, const Genesys_Sensor reg->find_reg(0x02).value &= ~REG_0x02_MTRREV; } - if (use_fast_fed) - reg->find_reg(0x02).value |= 0x08; - else reg->find_reg(0x02).value &= ~0x08; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) @@ -819,8 +711,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens const ScanSession& session) { DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time); - uint16_t expavg, expr, expb, expg; - dev->cmd_set->set_fe(dev, sensor, AFE_SET); /* gpio part.*/ @@ -876,11 +766,7 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens /* AFEMOD should depend on FESET, and we should set these * bits separately */ reg->find_reg(0x04).value &= ~(REG_0x04_FILTER | REG_0x04_AFEMOD); - if (has_flag(session.params.flags, ScanFlag::ENABLE_LEDADD)) { - reg->find_reg(0x04).value |= 0x10; /* no filter */ - } - else if (session.params.channels == 1) - { + if (session.params.channels == 1) { switch (session.params.color_filter) { case ColorFilter::RED: @@ -910,23 +796,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens /* CIS scanners can do true gray by setting LEDADD */ reg->find_reg(0x87).value &= ~REG_0x87_LEDADD; - if (has_flag(session.params.flags, ScanFlag::ENABLE_LEDADD)) { - reg->find_reg(0x87).value |= REG_0x87_LEDADD; - expr = reg->get16(REG_EXPR); - expg = reg->get16(REG_EXPG); - expb = reg->get16(REG_EXPB); - - /* use minimal exposure for best image quality */ - expavg = expg; - if (expr < expg) - expavg = expr; - if (expb < expavg) - expavg = expb; - - dev->reg.set16(REG_EXPR, expavg); - dev->reg.set16(REG_EXPG, expavg); - dev->reg.set16(REG_EXPB, expavg); - } // enable gamma tables if (should_enable_gamma(session, sensor)) { @@ -946,27 +815,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens reg->set8(0x34, sensor.dummy_pixel); } -static int -gl841_get_led_exposure(Genesys_Device * dev, const Genesys_Sensor& sensor) -{ - int d,r,g,b,m; - if (!dev->model->is_cis) - return 0; - d = dev->reg.find_reg(0x19).value; - - r = sensor.exposure.red; - g = sensor.exposure.green; - b = sensor.exposure.blue; - - m = r; - if (m < g) - m = g; - if (m < b) - m = b; - - return m + d; -} - /** @brief compute exposure time * Compute exposure time for the device and the given scan resolution */ @@ -975,9 +823,13 @@ static int gl841_exposure_time(Genesys_Device *dev, const Genesys_Sensor& sensor int start, int used_pixels) { -int led_exposure; - - led_exposure=gl841_get_led_exposure(dev, sensor); + int led_exposure = 0; + if (dev->model->is_cis) { + unsigned dummy = dev->reg.find_reg(0x19).value; + unsigned max_sensor_exposure = std::max({sensor.exposure.red, sensor.exposure.green, + sensor.exposure.blue}); + led_exposure = dummy + max_sensor_exposure; + } return sanei_genesys_exposure_time2(dev, profile, slope_dpi, start + used_pixels,/*+tgtime? currently done in sanei_genesys_exposure_time2 with tgtime = 32 pixel*/ led_exposure); @@ -1069,6 +921,9 @@ dummy \ scanned lines dev->total_bytes_read = 0; dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; + if (session.use_host_side_gray) { + dev->total_bytes_to_read /= 3; + } DBG(DBG_info, "%s: total bytes to send = %zu\n", __func__, dev->total_bytes_to_read); } @@ -1106,19 +961,6 @@ ScanSession CommandSetGl841::calculate_scan_session(const Genesys_Device* dev, start += dev->settings.tl_x; start = static_cast<float>((start * dev->settings.xres) / MM_PER_INCH); - // we enable true gray for cis scanners only, and just when doing - // scan since color calibration is OK for this mode - ScanFlag flags = ScanFlag::NONE; - - // true gray (led add for cis scanners) - if (dev->model->is_cis && dev->settings.true_gray && - dev->settings.scan_mode != ScanColorMode::COLOR_SINGLE_PASS && - dev->model->sensor_id != SensorId::CIS_CANON_LIDE_80) - { - // on Lide 80 the LEDADD bit results in only red LED array being lit - flags |= ScanFlag::ENABLE_LEDADD; - } - ScanSession session; session.params.xres = dev->settings.xres; session.params.yres = dev->settings.yres; @@ -1132,7 +974,9 @@ ScanSession CommandSetGl841::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = dev->settings.scan_mode; session.params.color_filter = dev->settings.color_filter; - session.params.flags = flags; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; + session.params.flags = ScanFlag::NONE; compute_session(dev, session, sensor); return session; @@ -1613,6 +1457,8 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA; compute_session(dev, session, calib_sensor); @@ -1690,6 +1536,8 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -1760,14 +1608,10 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor& turn++; } while ((top-bottom)>1 && turn < 100); - // FIXME: don't overwrite the calibrated values - dev->frontend.set_offset(0, 0); - dev->frontend.set_offset(1, 0); - dev->frontend.set_offset(2, 0); - DBG(DBG_info, "%s: offset=(%d,%d,%d)\n", __func__, - dev->frontend.get_offset(0), - dev->frontend.get_offset(1), - dev->frontend.get_offset(2)); + DBG(DBG_info, "%s: offset=(%d,%d,%d)\n", __func__, + dev->frontend.get_offset(0), + dev->frontend.get_offset(1), + dev->frontend.get_offset(2)); } /* this function does the offset calibration by scanning one line of the calibration @@ -1811,6 +1655,8 @@ void CommandSetGl841::offset_calibration(Genesys_Device* dev, const Genesys_Sens session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = ScanFlag::DISABLE_SHADING | ScanFlag::DISABLE_GAMMA | ScanFlag::SINGLE_LINE | @@ -2160,6 +2006,8 @@ void CommandSetGl841::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = flags; compute_session(dev, session, sensor); diff --git a/backend/genesys/gl841.h b/backend/genesys/gl841.h index dbe2e59..64b23c8 100644 --- a/backend/genesys/gl841.h +++ b/backend/genesys/gl841.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl841_registers.h b/backend/genesys/gl841_registers.h index a8d924d..0a59aac 100644 --- a/backend/genesys/gl841_registers.h +++ b/backend/genesys/gl841_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL841_REGISTERS_H diff --git a/backend/genesys/gl842.cpp b/backend/genesys/gl842.cpp index 9d3da67..a593040 100644 --- a/backend/genesys/gl842.cpp +++ b/backend/genesys/gl842.cpp @@ -17,9 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. */ #define DEBUG_DECLARE_ONLY @@ -629,6 +626,8 @@ ScanSession CommandSetGl842::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); @@ -823,6 +822,8 @@ void CommandSetGl842::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = dev->settings.scan_mode; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); @@ -916,6 +917,8 @@ void CommandSetGl842::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = flags; compute_session(dev, session, calib_sensor); diff --git a/backend/genesys/gl842.h b/backend/genesys/gl842.h index b20ef5e..3636bac 100644 --- a/backend/genesys/gl842.h +++ b/backend/genesys/gl842.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl842_registers.h b/backend/genesys/gl842_registers.h index ceb540b..7c5957a 100644 --- a/backend/genesys/gl842_registers.h +++ b/backend/genesys/gl842_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_gl842_REGISTERS_H diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index e768ac0..6180bf9 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -1122,6 +1101,8 @@ ScanSession CommandSetGl843::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); @@ -1240,6 +1221,7 @@ void CommandSetGl843::begin_scan(Genesys_Device* dev, const Genesys_Sensor& sens dev->interface->write_register(0x7e, 0x04); break; case GpioId::G4050: + case GpioId::G4010: dev->interface->write_register(REG_0xA7, 0xfe); dev->interface->write_register(REG_0xA8, 0x3e); dev->interface->write_register(REG_0xA9, 0x06); @@ -1432,6 +1414,8 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = dev->settings.scan_mode; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); @@ -1535,6 +1519,8 @@ void CommandSetGl843::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = 0; + session.params.brightness_adjustment = 0; session.params.flags = flags; compute_session(dev, session, calib_sensor); @@ -1680,6 +1666,7 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const */ uint8_t val = s->dev->interface->read_register(REG_0x6D); + DBG(DBG_io, "%s: read buttons_gpio value=0x%x\n", __func__, (int)val); switch (s->dev->model->gpio_id) { @@ -1692,6 +1679,12 @@ void CommandSetGl843::update_hardware_sensors(Genesys_Scanner* s) const s->buttons[BUTTON_EMAIL_SW].write((val & 0x04) == 0); s->buttons[BUTTON_COPY_SW].write((val & 0x08) == 0); break; + case GpioId::G4010: + s->buttons[BUTTON_FILE_SW].write((val & 0x01) == 0); + s->buttons[BUTTON_COPY_SW].write((val & 0x04) == 0); + s->buttons[BUTTON_TRANSP_SW].write((val & 0x40) == 0); + s->buttons[BUTTON_SCAN_SW].write((val & 0x08) == 0); + break; case GpioId::CANON_4400F: case GpioId::CANON_8400F: default: diff --git a/backend/genesys/gl843.h b/backend/genesys/gl843.h index fe2814d..ac845bd 100644 --- a/backend/genesys/gl843.h +++ b/backend/genesys/gl843.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl843_registers.h b/backend/genesys/gl843_registers.h index ab1f4c7..a1fe156 100644 --- a/backend/genesys/gl843_registers.h +++ b/backend/genesys/gl843_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL843_REGISTERS_H diff --git a/backend/genesys/gl846.cpp b/backend/genesys/gl846.cpp index c8907b2..b427376 100644 --- a/backend/genesys/gl846.cpp +++ b/backend/genesys/gl846.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ /** @file @@ -374,25 +353,13 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, unsigned step_multiplier = gl846_get_step_multiplier(reg); - bool use_fast_fed = false; - if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, ScanFlag::FEEDING)) { - use_fast_fed = true; - } - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } - reg->set24(REG_LINCNT, scan_lines); reg->set8(REG_0x02, 0); sanei_genesys_set_motor_power(*reg, true); std::uint8_t reg02 = reg->get8(REG_0x02); - if (use_fast_fed) { - reg02 |= REG_0x02_FASTFED; - } else { - reg02 &= ~REG_0x02_FASTFED; - } + reg02 &= ~REG_0x02_FASTFED; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME; @@ -446,18 +413,11 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, unsigned feedl = feed_steps; unsigned dist = 0; - if (use_fast_fed) { - feedl <<= static_cast<unsigned>(fast_profile->step_type); - dist = (scan_table.table.size() + 2 * fast_table.table.size()); - // TODO read and decode REG_0xAB - dist += (reg->get8(0x5e) & 31); - dist += reg->get8(REG_FEDCNT); - } else { - feedl <<= static_cast<unsigned>(motor_profile.step_type); - dist = scan_table.table.size(); - if (has_flag(flags, ScanFlag::FEEDING)) { - dist *= 2; - } + + feedl <<= static_cast<unsigned>(motor_profile.step_type); + dist = scan_table.table.size(); + if (has_flag(flags, ScanFlag::FEEDING)) { + dist *= 2; } // check for overflow @@ -513,7 +473,7 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, reg->set8(REG_BWDSTEP, min_restep); std::uint32_t z1, z2; - sanei_genesys_calculate_zmod(use_fast_fed, + sanei_genesys_calculate_zmod(false, scan_exposure_time * ccdlmt * tgtime, scan_table.table, scan_table.table.size(), @@ -759,6 +719,8 @@ ScanSession CommandSetGl846::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; // backtracking isn't handled well, so don't enable it session.params.flags = flags; @@ -882,6 +844,8 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); diff --git a/backend/genesys/gl846.h b/backend/genesys/gl846.h index d06b337..f1d396d 100644 --- a/backend/genesys/gl846.h +++ b/backend/genesys/gl846.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #include "genesys.h" diff --git a/backend/genesys/gl846_registers.h b/backend/genesys/gl846_registers.h index df45e4f..8e3c655 100644 --- a/backend/genesys/gl846_registers.h +++ b/backend/genesys/gl846_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL846_REGISTERS_H diff --git a/backend/genesys/gl847.cpp b/backend/genesys/gl847.cpp index 91ac4eb..13f9dd9 100644 --- a/backend/genesys/gl847.cpp +++ b/backend/genesys/gl847.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -338,25 +317,13 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, unsigned step_multiplier = gl847_get_step_multiplier (reg); - bool use_fast_fed = false; - if (dev->settings.yres == 4444 && feed_steps > 100 && !has_flag(flags, ScanFlag::FEEDING)) { - use_fast_fed = true; - } - if (has_flag(dev->model->flags, ModelFlag::DISABLE_FAST_FEEDING)) { - use_fast_fed = false; - } - reg->set24(REG_LINCNT, scan_lines); reg->set8(REG_0x02, 0); sanei_genesys_set_motor_power(*reg, true); std::uint8_t reg02 = reg->get8(REG_0x02); - if (use_fast_fed) { - reg02 |= REG_0x02_FASTFED; - } else { - reg02 &= ~REG_0x02_FASTFED; - } + reg02 &= ~REG_0x02_FASTFED; if (has_flag(flags, ScanFlag::AUTO_GO_HOME)) { reg02 |= REG_0x02_AGOHOME | REG_0x02_NOTHOME; @@ -402,19 +369,11 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, // correct move distance by acceleration and deceleration amounts unsigned feedl = feed_steps; unsigned dist = 0; - if (use_fast_fed) - { - feedl <<= static_cast<unsigned>(fast_step_type); - dist = (scan_table.table.size() + 2 * fast_table.table.size()); - // TODO read and decode REG_0xAB - dist += (reg->get8(0x5e) & 31); - dist += reg->get8(REG_FEDCNT); - } else { - feedl <<= static_cast<unsigned>(motor_profile.step_type); - dist = scan_table.table.size(); - if (has_flag(flags, ScanFlag::FEEDING)) { - dist *= 2; - } + + feedl <<= static_cast<unsigned>(motor_profile.step_type); + dist = scan_table.table.size(); + if (has_flag(flags, ScanFlag::FEEDING)) { + dist *= 2; } // check for overflow @@ -456,7 +415,7 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, reg->set8(REG_BWDSTEP, min_restep); std::uint32_t z1, z2; - sanei_genesys_calculate_zmod(use_fast_fed, + sanei_genesys_calculate_zmod(false, scan_exposure_time * ccdlmt * tgtime, scan_table.table, scan_table.table.size(), @@ -735,6 +694,8 @@ ScanSession CommandSetGl847::calculate_scan_session(const Genesys_Device* dev, session.params.scan_method = settings.scan_method; session.params.scan_mode = settings.scan_mode; session.params.color_filter = settings.color_filter; + session.params.contrast_adjustment = settings.contrast; + session.params.brightness_adjustment = settings.brightness; session.params.flags = flags; compute_session(dev, session, sensor); @@ -900,6 +861,8 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S session.params.scan_method = dev->settings.scan_method; session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; session.params.color_filter = dev->settings.color_filter; + session.params.contrast_adjustment = dev->settings.contrast; + session.params.brightness_adjustment = dev->settings.brightness; session.params.flags = flags; compute_session(dev, session, calib_sensor); diff --git a/backend/genesys/gl847.h b/backend/genesys/gl847.h index 2cb3a9f..4b98b7a 100644 --- a/backend/genesys/gl847.h +++ b/backend/genesys/gl847.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL847_H diff --git a/backend/genesys/gl847_registers.h b/backend/genesys/gl847_registers.h index 66fda4b..3497c69 100644 --- a/backend/genesys/gl847_registers.h +++ b/backend/genesys/gl847_registers.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_GL847_REGISTERS_H diff --git a/backend/genesys/image.cpp b/backend/genesys/image.cpp index 3ea6ef6..431f996 100644 --- a/backend/genesys/image.cpp +++ b/backend/genesys/image.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/image.h b/backend/genesys/image.h index 0ad344e..07d3be3 100644 --- a/backend/genesys/image.h +++ b/backend/genesys/image.h @@ -15,28 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. + along with this program. If not, see <https://www.gnu.org/licenses/>.s */ #ifndef BACKEND_GENESYS_IMAGE_H diff --git a/backend/genesys/image_buffer.cpp b/backend/genesys/image_buffer.cpp index 46ca292..ed01252 100644 --- a/backend/genesys/image_buffer.cpp +++ b/backend/genesys/image_buffer.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/image_buffer.h b/backend/genesys/image_buffer.h index 516e828..15af742 100644 --- a/backend/genesys/image_buffer.h +++ b/backend/genesys/image_buffer.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_IMAGE_BUFFER_H diff --git a/backend/genesys/image_pipeline.cpp b/backend/genesys/image_pipeline.cpp index 4161e95..f53680f 100644 --- a/backend/genesys/image_pipeline.cpp +++ b/backend/genesys/image_pipeline.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -304,8 +283,8 @@ bool ImagePipelineNodeInvert::get_next_row_data(std::uint8_t* out_data) return got_data; } -ImagePipelineNodeMergeMonoLines::ImagePipelineNodeMergeMonoLines(ImagePipelineNode& source, - ColorOrder color_order) : +ImagePipelineNodeMergeMonoLinesToColor::ImagePipelineNodeMergeMonoLinesToColor( + ImagePipelineNode& source, ColorOrder color_order) : source_(source), buffer_(source_.get_row_bytes()) { @@ -314,7 +293,7 @@ ImagePipelineNodeMergeMonoLines::ImagePipelineNodeMergeMonoLines(ImagePipelineNo output_format_ = get_output_format(source_.get_format(), color_order); } -bool ImagePipelineNodeMergeMonoLines::get_next_row_data(std::uint8_t* out_data) +bool ImagePipelineNodeMergeMonoLinesToColor::get_next_row_data(std::uint8_t* out_data) { bool got_data = true; @@ -341,8 +320,8 @@ bool ImagePipelineNodeMergeMonoLines::get_next_row_data(std::uint8_t* out_data) return got_data; } -PixelFormat ImagePipelineNodeMergeMonoLines::get_output_format(PixelFormat input_format, - ColorOrder order) +PixelFormat ImagePipelineNodeMergeMonoLinesToColor::get_output_format(PixelFormat input_format, + ColorOrder order) { switch (input_format) { case PixelFormat::I1: { @@ -417,6 +396,75 @@ PixelFormat ImagePipelineNodeSplitMonoLines::get_output_format(PixelFormat input throw SaneException("Unsupported input format %d", static_cast<unsigned>(input_format)); } + +ImagePipelineNodeMergeColorToGray::ImagePipelineNodeMergeColorToGray(ImagePipelineNode& source) : + source_(source) +{ + + output_format_ = get_output_format(source_.get_format()); + float red_mult = 0.2125f; + float green_mult = 0.7154f; + float blue_mult = 0.0721f; + + switch (get_pixel_format_color_order(source_.get_format())) { + case ColorOrder::RGB: { + ch0_mult_ = red_mult; + ch1_mult_ = green_mult; + ch2_mult_ = blue_mult; + break; + } + case ColorOrder::BGR: { + ch0_mult_ = blue_mult; + ch1_mult_ = green_mult; + ch2_mult_ = red_mult; + break; + } + case ColorOrder::GBR: { + ch0_mult_ = green_mult; + ch1_mult_ = blue_mult; + ch2_mult_ = red_mult; + break; + } + default: + throw SaneException("Unknown color order"); + } + temp_buffer_.resize(source_.get_row_bytes()); +} + +bool ImagePipelineNodeMergeColorToGray::get_next_row_data(std::uint8_t* out_data) +{ + auto* src_data = temp_buffer_.data(); + + bool got_data = source_.get_next_row_data(src_data); + + auto src_format = source_.get_format(); + + for (std::size_t x = 0, width = get_width(); x < width; ++x) { + std::uint16_t ch0 = get_raw_channel_from_row(src_data, x, 0, src_format); + std::uint16_t ch1 = get_raw_channel_from_row(src_data, x, 1, src_format); + std::uint16_t ch2 = get_raw_channel_from_row(src_data, x, 2, src_format); + float mono = ch0 * ch0_mult_ + ch1 * ch1_mult_ + ch2 * ch2_mult_; + set_raw_channel_to_row(out_data, x, 0, static_cast<std::uint16_t>(mono), output_format_); + } + return got_data; +} + +PixelFormat ImagePipelineNodeMergeColorToGray::get_output_format(PixelFormat input_format) +{ + switch (input_format) { + case PixelFormat::RGB111: + return PixelFormat::I1; + case PixelFormat::RGB888: + case PixelFormat::BGR888: + return PixelFormat::I8; + case PixelFormat::RGB161616: + case PixelFormat::BGR161616: + return PixelFormat::I16; + default: break; + } + throw SaneException("Unsupported format %d", static_cast<unsigned>(input_format)); +} + ImagePipelineNodeComponentShiftLines::ImagePipelineNodeComponentShiftLines( ImagePipelineNode& source, unsigned shift_r, unsigned shift_g, unsigned shift_b) : source_(source), @@ -712,7 +760,7 @@ ImagePipelineNodeCalibrate::ImagePipelineNodeCalibrate(ImagePipelineNode& source const std::vector<std::uint16_t>& bottom, const std::vector<std::uint16_t>& top, std::size_t x_start) : - source_{source} + source_(source) { std::size_t size = 0; if (bottom.size() >= x_start && top.size() >= x_start) { diff --git a/backend/genesys/image_pipeline.h b/backend/genesys/image_pipeline.h index 3632b36..39aed71 100644 --- a/backend/genesys/image_pipeline.h +++ b/backend/genesys/image_pipeline.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_IMAGE_PIPELINE_H @@ -295,11 +274,11 @@ private: }; // A pipeline node that merges 3 mono lines into a color channel -class ImagePipelineNodeMergeMonoLines : public ImagePipelineNode +class ImagePipelineNodeMergeMonoLinesToColor : public ImagePipelineNode { public: - ImagePipelineNodeMergeMonoLines(ImagePipelineNode& source, - ColorOrder color_order); + ImagePipelineNodeMergeMonoLinesToColor(ImagePipelineNode& source, + ColorOrder color_order); std::size_t get_width() const override { return source_.get_width(); } std::size_t get_height() const override { return source_.get_height() / 3; } @@ -342,6 +321,33 @@ private: unsigned next_channel_ = 0; }; + +// A pipeline node that merges 3 mono lines into a gray channel +class ImagePipelineNodeMergeColorToGray : public ImagePipelineNode +{ +public: + ImagePipelineNodeMergeColorToGray(ImagePipelineNode& source); + + std::size_t get_width() const override { return source_.get_width(); } + std::size_t get_height() const override { return source_.get_height(); } + PixelFormat get_format() const override { return output_format_; } + + bool eof() const override { return source_.eof(); } + + bool get_next_row_data(std::uint8_t* out_data) override; + +private: + static PixelFormat get_output_format(PixelFormat input_format); + + ImagePipelineNode& source_; + PixelFormat output_format_ = PixelFormat::UNKNOWN; + float ch0_mult_ = 0; + float ch1_mult_ = 0; + float ch2_mult_ = 0; + + std::vector<std::uint8_t> temp_buffer_; +}; + // A pipeline node that shifts colors across lines by the given offsets class ImagePipelineNodeComponentShiftLines : public ImagePipelineNode { diff --git a/backend/genesys/image_pixel.cpp b/backend/genesys/image_pixel.cpp index 011a086..02ef782 100644 --- a/backend/genesys/image_pixel.cpp +++ b/backend/genesys/image_pixel.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/image_pixel.h b/backend/genesys/image_pixel.h index 4b16083..e414cfb 100644 --- a/backend/genesys/image_pixel.h +++ b/backend/genesys/image_pixel.h @@ -15,28 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. + along with this program. If not, see <https://www.gnu.org/licenses/>.s */ #ifndef BACKEND_GENESYS_IMAGE_PIXEL_H diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index ddd2c88..a6da2c1 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -17,27 +17,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -442,7 +421,11 @@ Image read_unshuffled_image_from_scanner(Genesys_Device* dev, const ScanSession& } if (dev->model->is_cis && session.params.channels == 3) { - pipeline.push_node<ImagePipelineNodeMergeMonoLines>(dev->model->line_mode_color_order); + pipeline.push_node<ImagePipelineNodeMergeMonoLinesToColor>(dev->model->line_mode_color_order); + } + + if (session.use_host_side_gray) { + pipeline.push_node<ImagePipelineNodeMergeColorToGray>(); } if (pipeline.get_output_format() == PixelFormat::BGR888) { @@ -540,7 +523,7 @@ Image read_shuffled_image_from_scanner(Genesys_Device* dev, const ScanSession& s } if (dev->model->is_cis && session.params.channels == 3) { - pipeline.push_node<ImagePipelineNodeMergeMonoLines>(dev->model->line_mode_color_order); + pipeline.push_node<ImagePipelineNodeMergeMonoLinesToColor>(dev->model->line_mode_color_order); } if (pipeline.get_output_format() == PixelFormat::BGR888) { @@ -638,11 +621,16 @@ bool should_enable_gamma(const ScanSession& session, const Genesys_Sensor& senso if ((session.params.flags & ScanFlag::DISABLE_GAMMA) != ScanFlag::NONE) { return false; } - if (sensor.gamma[0] == 1.0f || sensor.gamma[1] == 1.0f || sensor.gamma[2] == 1.0f) { + if (session.params.depth == 16) { return false; } - if (session.params.depth == 16) + if (session.params.brightness_adjustment != 0 || session.params.contrast_adjustment != 0) { + return true; + } + + if (sensor.gamma[0] == 1.0f || sensor.gamma[1] == 1.0f || sensor.gamma[2] == 1.0f) { return false; + } return true; } @@ -949,6 +937,14 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se s.output_startx = static_cast<unsigned>( static_cast<int>(s.params.startx) + sensor.output_pixel_offset); + if (has_flag(dev->model->flags, ModelFlag::HOST_SIDE_GRAY) && s.params.channels == 1 && + s.params.color_filter == ColorFilter::NONE) + { + s.use_host_side_gray = true; + s.params.channels = 3; + s.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS; + } + s.stagger_x = sensor.stagger_x; s.stagger_y = sensor.stagger_y; @@ -1114,7 +1110,8 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846) { - s.enable_ledadd = (s.params.channels == 1 && dev->model->is_cis && dev->settings.true_gray); + s.enable_ledadd = (s.params.channels == 1 && dev->model->is_cis && + s.params.color_filter == ColorFilter::NONE); } s.use_host_side_calib = sensor.use_host_side_calib; @@ -1212,7 +1209,7 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes } if (dev.model->is_cis && session.params.channels == 3) { - pipeline.push_node<ImagePipelineNodeMergeMonoLines>(dev.model->line_mode_color_order); + pipeline.push_node<ImagePipelineNodeMergeMonoLinesToColor>(dev.model->line_mode_color_order); if (log_image_data) { pipeline.push_node<ImagePipelineNodeDebug>(debug_prefix + "_4_after_merge_mono.tiff"); @@ -1274,6 +1271,14 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes } } + if (session.use_host_side_gray) { + pipeline.push_node<ImagePipelineNodeMergeColorToGray>(); + + if (log_image_data) { + pipeline.push_node<ImagePipelineNodeDebug>(debug_prefix + "_10_after_nogray.tiff"); + } + } + if (pipeline.get_output_width() != session.params.get_requested_pixels()) { pipeline.push_node<ImagePipelineNodeScaleRows>(session.params.get_requested_pixels()); } diff --git a/backend/genesys/low.h b/backend/genesys/low.h index ac149b5..b0d23fe 100644 --- a/backend/genesys/low.h +++ b/backend/genesys/low.h @@ -23,27 +23,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef GENESYS_LOW_H @@ -116,6 +95,7 @@ #define GENESYS_HAS_POWER_SW (1 << 6) /**< scanner has power button */ #define GENESYS_HAS_CALIBRATE (1 << 7) /**< scanner has 'calibrate' software button to start calibration */ #define GENESYS_HAS_EXTRA_SW (1 << 8) /**< scanner has extra function button */ +#define GENESYS_HAS_TRANSP_SW (1 << 9) /**< scanner has TRANSPARCY/SCAN_FILM button */ /* USB control message values */ #define REQUEST_TYPE_IN (USB_TYPE_VENDOR | USB_DIR_IN) diff --git a/backend/genesys/motor.cpp b/backend/genesys/motor.cpp index 8450fea..1dfe64f 100644 --- a/backend/genesys/motor.cpp +++ b/backend/genesys/motor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -136,7 +115,8 @@ MotorSlopeTable create_slope_table_for_speed(const MotorSlope& slope, unsigned t unsigned max_speed_shifted_w = slope.max_speed_w >> step_shift; if (target_speed_shifted_w < max_speed_shifted_w) { - dbg.log(DBG_warn, "failed to reach target speed"); + dbg.vlog(DBG_warn, "failed to reach target speed %d %d", target_speed_w, + slope.max_speed_w); } if (target_speed_shifted_w >= std::numeric_limits<std::uint16_t>::max()) { diff --git a/backend/genesys/motor.h b/backend/genesys/motor.h index e5fd695..1981e80 100644 --- a/backend/genesys/motor.h +++ b/backend/genesys/motor.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_MOTOR_H diff --git a/backend/genesys/register.h b/backend/genesys/register.h index cee9adf..8ac549d 100644 --- a/backend/genesys/register.h +++ b/backend/genesys/register.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_REGISTER_H diff --git a/backend/genesys/register_cache.h b/backend/genesys/register_cache.h index c7e5c41..0538529 100644 --- a/backend/genesys/register_cache.h +++ b/backend/genesys/register_cache.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_REGISTER_CACHE_H diff --git a/backend/genesys/row_buffer.h b/backend/genesys/row_buffer.h index a4b9e42..d7f071c 100644 --- a/backend/genesys/row_buffer.h +++ b/backend/genesys/row_buffer.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_LINE_BUFFER_H diff --git a/backend/genesys/scanner_interface.cpp b/backend/genesys/scanner_interface.cpp index 5363f0e..485270e 100644 --- a/backend/genesys/scanner_interface.cpp +++ b/backend/genesys/scanner_interface.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/scanner_interface.h b/backend/genesys/scanner_interface.h index 8258117..3aa9d6b 100644 --- a/backend/genesys/scanner_interface.h +++ b/backend/genesys/scanner_interface.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SCANNER_INTERFACE_H diff --git a/backend/genesys/scanner_interface_usb.cpp b/backend/genesys/scanner_interface_usb.cpp index 117297c..da8823b 100644 --- a/backend/genesys/scanner_interface_usb.cpp +++ b/backend/genesys/scanner_interface_usb.cpp @@ -16,34 +16,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY #include "scanner_interface_usb.h" #include "low.h" -#include <thread> namespace genesys { @@ -481,7 +459,7 @@ void ScannerInterfaceUsb::sleep_us(unsigned microseconds) if (sanei_usb_is_replay_mode_enabled()) { return; } - std::this_thread::sleep_for(std::chrono::microseconds{microseconds}); + usleep(microseconds); } void ScannerInterfaceUsb::record_progress_message(const char* msg) diff --git a/backend/genesys/scanner_interface_usb.h b/backend/genesys/scanner_interface_usb.h index 569d634..d6408df 100644 --- a/backend/genesys/scanner_interface_usb.h +++ b/backend/genesys/scanner_interface_usb.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SCANNER_INTERFACE_USB_H diff --git a/backend/genesys/sensor.cpp b/backend/genesys/sensor.cpp index b09745f..d3cdda1 100644 --- a/backend/genesys/sensor.cpp +++ b/backend/genesys/sensor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/sensor.h b/backend/genesys/sensor.h index 6f87607..2902b0d 100644 --- a/backend/genesys/sensor.h +++ b/backend/genesys/sensor.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SENSOR_H diff --git a/backend/genesys/serialize.h b/backend/genesys/serialize.h index 138ff08..ed67ea3 100644 --- a/backend/genesys/serialize.h +++ b/backend/genesys/serialize.h @@ -15,28 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. + along with this program. If not, see <https://www.gnu.org/licenses/>.s */ #ifndef BACKEND_GENESYS_SERIALIZE_H diff --git a/backend/genesys/settings.cpp b/backend/genesys/settings.cpp index 7f64798..d409683 100644 --- a/backend/genesys/settings.cpp +++ b/backend/genesys/settings.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -86,6 +65,8 @@ std::ostream& operator<<(std::ostream& out, const SetupParams& params) << " channels: " << params.channels << '\n' << " scan_mode: " << params.scan_mode << '\n' << " color_filter: " << params.color_filter << '\n' + << " contrast_adjustment: " << params.contrast_adjustment << '\n' + << " brightness_adjustment: " << params.brightness_adjustment << '\n' << " flags: " << params.flags << '\n' << "}"; return out; @@ -127,7 +108,8 @@ bool ScanSession::operator==(const ScanSession& other) const shading_pixel_offset == other.shading_pixel_offset && buffer_size_read == other.buffer_size_read && enable_ledadd == other.enable_ledadd && - use_host_side_calib == other.use_host_side_calib; + use_host_side_calib == other.use_host_side_calib && + use_host_side_gray == other.use_host_side_gray; } std::ostream& operator<<(std::ostream& out, const ScanSession& session) @@ -164,6 +146,7 @@ std::ostream& operator<<(std::ostream& out, const ScanSession& session) << " buffer_size_read: " << session.buffer_size_read << '\n' << " enable_ledadd: " << session.enable_ledadd << '\n' << " use_host_side_calib: " << session.use_host_side_calib << '\n' + << " use_host_side_gray: " << session.use_host_side_gray << '\n' << " params: " << format_indent_braced_list(4, session.params) << '\n' << "}"; return out; diff --git a/backend/genesys/settings.h b/backend/genesys/settings.h index 4c834fa..d404941 100644 --- a/backend/genesys/settings.h +++ b/backend/genesys/settings.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_SETTINGS_H @@ -76,9 +55,6 @@ struct Genesys_Settings ColorFilter color_filter = ColorFilter::NONE; - // true if scan is true gray, false if monochrome scan - int true_gray = 0; - // value for contrast enhancement in the [-100..100] range int contrast = 0; @@ -102,6 +78,7 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Settings& settings); struct SetupParams { static constexpr unsigned NOT_SET = std::numeric_limits<unsigned>::max(); + static constexpr unsigned NOT_SET_I = std::numeric_limits<int>::max(); // resolution in x direction unsigned xres = NOT_SET; @@ -136,6 +113,10 @@ struct SetupParams { ColorFilter color_filter = static_cast<ColorFilter>(NOT_SET); + // the values for contrast and brightness adjustment in the range of [-100..100] + int contrast_adjustment = NOT_SET_I; + int brightness_adjustment = NOT_SET_I; + ScanFlag flags = ScanFlag::NONE; unsigned get_requested_pixels() const @@ -152,7 +133,8 @@ struct SetupParams { pixels == NOT_SET || lines == NOT_SET ||depth == NOT_SET || channels == NOT_SET || scan_method == static_cast<ScanMethod>(NOT_SET) || scan_mode == static_cast<ScanColorMode>(NOT_SET) || - color_filter == static_cast<ColorFilter>(NOT_SET)) + color_filter == static_cast<ColorFilter>(NOT_SET) || + contrast_adjustment == NOT_SET_I || brightness_adjustment == NOT_SET_I) { throw std::runtime_error("SetupParams are not valid"); } @@ -172,6 +154,8 @@ struct SetupParams { scan_method == other.scan_method && scan_mode == other.scan_mode && color_filter == other.color_filter && + contrast_adjustment == other.contrast_adjustment && + brightness_adjustment == other.brightness_adjustment && flags == other.flags; } }; @@ -193,6 +177,8 @@ void serialize(Stream& str, SetupParams& x) serialize(str, x.scan_method); serialize(str, x.scan_mode); serialize(str, x.color_filter); + serialize(str, x.contrast_adjustment); + serialize(str, x.brightness_adjustment); serialize(str, x.flags); } @@ -317,6 +303,9 @@ struct ScanSession { // whether calibration should be performed host-side bool use_host_side_calib = false; + // whether gray scanning should be performed host-side (scan as color and merge to gray) + bool use_host_side_gray = false; + void assert_computed() const { if (!computed) { @@ -368,6 +357,7 @@ void serialize(Stream& str, ScanSession& x) serialize(str, x.buffer_size_read); serialize(str, x.enable_ledadd); serialize(str, x.use_host_side_calib); + serialize(str, x.use_host_side_gray); } std::ostream& operator<<(std::ostream& out, const SANE_Parameters& params); diff --git a/backend/genesys/static_init.cpp b/backend/genesys/static_init.cpp index 5ed3b50..2d463ee 100644 --- a/backend/genesys/static_init.cpp +++ b/backend/genesys/static_init.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -57,12 +36,15 @@ void add_function_to_run_at_backend_exit(const std::function<void()>& function) void run_functions_at_backend_exit() { - for (auto it = s_functions_run_at_backend_exit->rbegin(); - it != s_functions_run_at_backend_exit->rend(); ++it) + if (s_functions_run_at_backend_exit) { - (*it)(); + for (auto it = s_functions_run_at_backend_exit->rbegin(); + it != s_functions_run_at_backend_exit->rend(); ++it) + { + (*it)(); + } + s_functions_run_at_backend_exit.reset(); } - s_functions_run_at_backend_exit.reset(); } } // namespace genesys diff --git a/backend/genesys/static_init.h b/backend/genesys/static_init.h index e0b39c8..63c242e 100644 --- a/backend/genesys/static_init.h +++ b/backend/genesys/static_init.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_STATIC_INIT_H diff --git a/backend/genesys/status.cpp b/backend/genesys/status.cpp index 170bcd7..b95bcd6 100644 --- a/backend/genesys/status.cpp +++ b/backend/genesys/status.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/status.h b/backend/genesys/status.h index f1a3695..5983bf2 100644 --- a/backend/genesys/status.h +++ b/backend/genesys/status.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_STATUS_H diff --git a/backend/genesys/tables_frontend.cpp b/backend/genesys/tables_frontend.cpp index 02e9998..65fc7f4 100644 --- a/backend/genesys/tables_frontend.cpp +++ b/backend/genesys/tables_frontend.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/tables_gpo.cpp b/backend/genesys/tables_gpo.cpp index 075cafb..f129262 100644 --- a/backend/genesys/tables_gpo.cpp +++ b/backend/genesys/tables_gpo.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -258,6 +237,21 @@ void genesys_init_gpo_tables() gpo = Genesys_Gpo(); + gpo.id = GpioId::G4010; + gpo.regs = { + { 0x6c, 0x20 }, + { 0x6d, 0x00 }, + { 0x6e, 0xfc }, + { 0x6f, 0x00 }, + { 0xa6, 0x08 }, + { 0xa7, 0x1e }, + { 0xa8, 0x3e }, + { 0xa9, 0x06 }, + }; + s_gpo->push_back(gpo); + + + gpo = Genesys_Gpo(); gpo.id = GpioId::HP_N6310; gpo.regs = { { 0x6c, 0xa3 }, diff --git a/backend/genesys/tables_model.cpp b/backend/genesys/tables_model.cpp index 6998a51..d139334 100644 --- a/backend/genesys/tables_model.cpp +++ b/backend/genesys/tables_model.cpp @@ -27,27 +27,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -191,6 +170,7 @@ void genesys_init_usb_device_tables() model.gpio_id = GpioId::CANON_LIDE_35; model.motor_id = MotorId::CANON_LIDE_35; model.flags = ModelFlag::DARK_WHITE_CALIBRATION | + ModelFlag::HOST_SIDE_GRAY | ModelFlag::CUSTOM_GAMMA; model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | @@ -342,12 +322,12 @@ void genesys_init_usb_device_tables() model.is_sheetfed = false; model.sensor_id = SensorId::CCD_G4050; model.adc_id = AdcId::G4050; - model.gpio_id = GpioId::G4050; + model.gpio_id = GpioId::G4010; model.motor_id = MotorId::G4050; model.flags = ModelFlag::WARMUP | ModelFlag::DARK_CALIBRATION | ModelFlag::CUSTOM_GAMMA; - 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 | GENESYS_HAS_TRANSP_SW; model.search_lines = 100; s_usb_devices->emplace_back(0x03f0, 0x4505, model); @@ -619,8 +599,8 @@ void genesys_init_usb_device_tables() model.resolutions = { { { ScanMethod::FLATBED }, - { 2400, 1200, 600, 300, 200, 150, 100, 75 }, - { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, + { 2400, 1200, 600, 300, 200, 150 }, + { 4800, 2400, 1200, 600, 300, 200, 150 }, } }; @@ -1020,8 +1000,8 @@ void genesys_init_usb_device_tables() model.resolutions = { { { ScanMethod::FLATBED }, - { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, - { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 }, + { 4800, 2400, 1200, 600, 300, 200, 150 }, + { 4800, 2400, 1200, 600, 300, 200, 150 }, } }; @@ -1110,6 +1090,7 @@ void genesys_init_usb_device_tables() model.gpio_id = GpioId::CANON_LIDE_35; model.motor_id = MotorId::CANON_LIDE_60; model.flags = ModelFlag::DARK_WHITE_CALIBRATION | + ModelFlag::HOST_SIDE_GRAY | ModelFlag::CUSTOM_GAMMA; model.buttons = GENESYS_HAS_COPY_SW | @@ -1165,6 +1146,7 @@ void genesys_init_usb_device_tables() model.gpio_id = GpioId::CANON_LIDE_80; model.motor_id = MotorId::CANON_LIDE_80; model.flags = ModelFlag::DARK_WHITE_CALIBRATION | + ModelFlag::HOST_SIDE_GRAY | ModelFlag::CUSTOM_GAMMA; model.buttons = GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | diff --git a/backend/genesys/tables_motor.cpp b/backend/genesys/tables_motor.cpp index e8e89c5..3cc576f 100644 --- a/backend/genesys/tables_motor.cpp +++ b/backend/genesys/tables_motor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -472,7 +451,7 @@ void genesys_init_motor_tables() motor.base_ydpi = 4800; motor.profiles.push_back({MotorSlope::create_from_steps(62496, 864, 127), StepType::FULL, 4608}); - motor.profiles.push_back({MotorSlope::create_from_steps(62496, 2010, 63), + motor.profiles.push_back({MotorSlope::create_from_steps(62496, 1338, 63), StepType::HALF, 5360}); motor.profiles.push_back({MotorSlope::create_from_steps(62464, 2632, 3), StepType::QUARTER, 10528}); diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 8383287..fb18abc 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY @@ -471,8 +450,8 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 87; sensor.dummy_pixel = 87; - sensor.fau_gain_white_ref = 0; - sensor.gain_white_ref = 0; + sensor.fau_gain_white_ref = 100; + sensor.gain_white_ref = 100; sensor.exposure = { 0x0400, 0x0400, 0x0400 }; sensor.custom_regs = { { 0x16, 0x00 }, { 0x17, 0x02 }, { 0x18, 0x00 }, { 0x19, 0x50 }, @@ -519,8 +498,8 @@ void genesys_init_sensor_tables() sensor.register_dpihw = 1200; sensor.black_pixels = 87; sensor.dummy_pixel = 87; - sensor.fau_gain_white_ref = 0; - sensor.gain_white_ref = 0; + sensor.fau_gain_white_ref = 100; + sensor.gain_white_ref = 100; sensor.exposure = { 0x0400, 0x0400, 0x0400 }; sensor.custom_regs = { { 0x16, 0x00 }, { 0x17, 0x01 }, { 0x18, 0x00 }, { 0x19, 0x50 }, @@ -1058,30 +1037,6 @@ void genesys_init_sensor_tables() CustomSensorSettings custom_settings[] = { // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 75 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 8, 40, 5136, - std::vector<unsigned>{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, - // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) - { { 100 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 6, 53, 5136, - std::vector<unsigned>{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, - // Note: Windows driver uses 1424 lperiod and enables dummy line (0x17) { { 150 }, 600, 2848, { 304, 203, 180 }, Ratio{1, 8}, 4, 80, 5136, std::vector<unsigned>{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, @@ -1361,28 +1316,6 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 8, 40, 5136, - std::vector<unsigned>{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, - { { 100 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 6, 53, 5136, - std::vector<unsigned>{}, { - { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, - { 0x1a, 0x34 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x04 }, - { 0x52, 0x03 }, { 0x53, 0x07 }, { 0x54, 0x00 }, { 0x55, 0x00 }, - { 0x56, 0x00 }, { 0x57, 0x00 }, { 0x58, 0x2a }, { 0x59, 0xe1 }, { 0x5a, 0x55 }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x3c }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - } - }, { { 150 }, 600, 2304, { 423, 294, 242 }, Ratio{1, 4}, 4, 80, 5136, std::vector<unsigned>{}, { { 0x16, 0x10 }, { 0x17, 0x0a }, { 0x18, 0x00 }, { 0x19, 0xff }, @@ -2635,6 +2568,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } @@ -2805,6 +2745,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } @@ -3000,6 +2947,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } @@ -3196,6 +3150,13 @@ void genesys_init_sensor_tables() sensor.shading_factor = setting.shading_factor; sensor.segment_order = setting.segment_order; sensor.custom_regs = setting.custom_regs; + + sensor.channels = { 1 }; + sensor.custom_regs.set_value(0x0c, 0x10); + s_sensors->push_back(sensor); + + sensor.channels = { 3 }; + sensor.custom_regs.set_value(0x0c, 0x12); s_sensors->push_back(sensor); } } diff --git a/backend/genesys/test_scanner_interface.cpp b/backend/genesys/test_scanner_interface.cpp index 5d0dcd3..412176e 100644 --- a/backend/genesys/test_scanner_interface.cpp +++ b/backend/genesys/test_scanner_interface.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/test_scanner_interface.h b/backend/genesys/test_scanner_interface.h index c1a3b76..9a5f412 100644 --- a/backend/genesys/test_scanner_interface.h +++ b/backend/genesys/test_scanner_interface.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_TEST_SCANNER_INTERFACE_H diff --git a/backend/genesys/test_settings.cpp b/backend/genesys/test_settings.cpp index ba50f36..c0aa43f 100644 --- a/backend/genesys/test_settings.cpp +++ b/backend/genesys/test_settings.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/test_settings.h b/backend/genesys/test_settings.h index 90c6e50..64e8f02 100644 --- a/backend/genesys/test_settings.h +++ b/backend/genesys/test_settings.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_TEST_SETTINGS_H diff --git a/backend/genesys/test_usb_device.cpp b/backend/genesys/test_usb_device.cpp index 46cd4e5..a5dbd78 100644 --- a/backend/genesys/test_usb_device.cpp +++ b/backend/genesys/test_usb_device.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/test_usb_device.h b/backend/genesys/test_usb_device.h index 6fd0ff3..ae8d4a2 100644 --- a/backend/genesys/test_usb_device.h +++ b/backend/genesys/test_usb_device.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_TEST_USB_DEVICE_H diff --git a/backend/genesys/usb_device.cpp b/backend/genesys/usb_device.cpp index 63afb09..41b8fbe 100644 --- a/backend/genesys/usb_device.cpp +++ b/backend/genesys/usb_device.cpp @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #define DEBUG_DECLARE_ONLY diff --git a/backend/genesys/usb_device.h b/backend/genesys/usb_device.h index 72f7017..fa97e5c 100644 --- a/backend/genesys/usb_device.h +++ b/backend/genesys/usb_device.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_USB_DEVICE_H diff --git a/backend/genesys/utilities.h b/backend/genesys/utilities.h index 6e637d0..8c872c9 100644 --- a/backend/genesys/utilities.h +++ b/backend/genesys/utilities.h @@ -16,27 +16,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. - - As a special exception, the authors of SANE give permission for - additional uses of the libraries contained in this release of SANE. - - The exception is that, if you link a SANE library with other files - to produce an executable, this does not by itself cause the - resulting executable to be covered by the GNU General Public - License. Your use of that executable is in no way restricted on - account of linking the SANE library code into it. - - This exception does not, however, invalidate any other reasons why - the executable file might be covered by the GNU General Public - License. - - If you submit changes to SANE to the maintainers to be included in - a subsequent release, you agree by submitting the changes that - those changes may be distributed with this exception intact. - - If you write modifications of your own for SANE, it is your choice - whether to permit this exception to apply to your modifications. - If you do not wish that, delete this exception notice. */ #ifndef BACKEND_GENESYS_UTILITIES_H @@ -226,7 +205,7 @@ class BasicStreamStateSaver { public: explicit BasicStreamStateSaver(std::basic_ios<Char, Traits>& stream) : - stream_{stream} + stream_(stream) { flags_ = stream_.flags(); width_ = stream_.width(); |