diff --git a/backend/genesys/genesys.cpp b/backend/genesys/genesys.cpp index a0e72c477..242738635 100644 --- a/backend/genesys/genesys.cpp +++ b/backend/genesys/genesys.cpp @@ -1524,12 +1524,10 @@ void scanner_offset_calibration(Genesys_Device& dev, const Genesys_Sensor& senso if (should_calibrate_only_active_area(dev, dev.settings)) { float offset = dev.model->x_offset_ta; - offset /= calib_sensor->get_ccd_size_divisor_for_dpi(resolution); - start_pixel = static_cast((offset * resolution) / MM_PER_INCH); + start_pixel = static_cast((offset * calib_sensor->get_optical_resolution()) / MM_PER_INCH); float size = dev.model->x_size_ta; - size /= calib_sensor->get_ccd_size_divisor_for_dpi(resolution); - target_pixels = static_cast((size * resolution) / MM_PER_INCH); + target_pixels = static_cast((size * calib_sensor->get_optical_resolution()) / MM_PER_INCH); } if (dev.model->model_id == ModelId::CANON_4400F && @@ -2867,8 +2865,7 @@ compute_averaged_planar (Genesys_Device * dev, const Genesys_Sensor& sensor, */ res = dev->settings.xres; - if (sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres) > 1) - { + if (sensor.full_resolution > sensor.get_optical_resolution()) { res *= 2; } @@ -3158,7 +3155,7 @@ compute_shifted_coefficients (Genesys_Device * dev, auto cmat = color_order_to_cmat(color_order); x = dev->settings.xres; - if (sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres) > 1) { + if (sensor.full_resolution > sensor.get_optical_resolution()) { x *= 2; // scanner is using half-ccd mode } basepixels = sensor.full_resolution / x; // this should be evenly dividable diff --git a/backend/genesys/gl124.cpp b/backend/genesys/gl124.cpp index f9d32af09..31d0b2740 100644 --- a/backend/genesys/gl124.cpp +++ b/backend/genesys/gl124.cpp @@ -609,22 +609,6 @@ static void gl124_init_motor_regs_scan(Genesys_Device* dev, reg->set16(REG_FMOVDEC, fast_table.table.size()); } -/** @brief setup optical related registers - * start and pixels are expressed in optical sensor resolution coordinate - * space. - * @param dev scanner device to use - * @param reg registers to set up - * @param exposure_time exposure time to use - * @param used_res scanning resolution used, may differ from - * scan's one - * @param start logical start pixel coordinate - * @param pixels logical number of pixels to use - * @param channels number of color channels (currently 1 or 3) - * @param depth bit depth of the scan (1, 8 or 16) - * @param ccd_size_divisor whether sensor's timings are such that x coordinates must be halved - * @param color_filter color channel to use as gray data - * @param flags optical flags (@see ) - */ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor, Genesys_Register_Set* reg, unsigned int exposure_time, const ScanSession& session) @@ -743,7 +727,8 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens // MAXWD is expressed in 2 words unit // BUG: we shouldn't multiply by channels here - reg->set24(REG_MAXWD, session.output_line_bytes_raw / session.ccd_size_divisor * session.params.channels); + reg->set24(REG_MAXWD, session.output_line_bytes_raw * session.params.channels * + session.optical_resolution / session.full_resolution); reg->set24(REG_LPERIOD, exposure_time); reg->set16(REG_DUMMY, sensor.dummy_pixel); } @@ -819,7 +804,7 @@ ScanSession CommandSetGl124::calculate_scan_session(const Genesys_Device* dev, float start = dev->model->x_offset; start += settings.tl_x; - start /= sensor.get_ccd_size_divisor_for_dpi(settings.xres); + start /= sensor.full_resolution / sensor.get_optical_resolution(); start = static_cast((start * settings.xres) / MM_PER_INCH); ScanSession session; diff --git a/backend/genesys/gl646.cpp b/backend/genesys/gl646.cpp index d81667564..853bdde50 100644 --- a/backend/genesys/gl646.cpp +++ b/backend/genesys/gl646.cpp @@ -1803,8 +1803,6 @@ void CommandSetGl646::move_back_home(Genesys_Device* dev, bool wait_until_home) * init registers for shading calibration * we assume that scanner's head is on an area suiting shading calibration. * We scan a full scan width area by the shading line number for the device - * at either at full sensor's resolution or half depending upon ccd_size_divisor - * @param dev scanner's device */ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_Sensor& sensor, Genesys_Register_Set& regs) const @@ -1815,10 +1813,9 @@ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_S /* fill settings for scan : always a color scan */ int channels = 3; - unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres); unsigned cksel = get_cksel(dev->model->sensor_id, dev->settings.xres, channels); - unsigned resolution = sensor.full_resolution / ccd_size_divisor / cksel; + unsigned resolution = sensor.get_optical_resolution() / cksel; // FIXME: we select wrong calibration sensor const auto& calib_sensor = sanei_genesys_find_sensor(dev, dev->settings.xres, channels, dev->settings.scan_method); diff --git a/backend/genesys/gl843.cpp b/backend/genesys/gl843.cpp index 43a2751cf..5a0c50a65 100644 --- a/backend/genesys/gl843.cpp +++ b/backend/genesys/gl843.cpp @@ -871,7 +871,6 @@ static void gl843_init_motor_regs_scan(Genesys_Device* dev, * @param pixels logical number of pixels to use * @param channels number of color channles used (1 or 3) * @param depth bit depth of the scan (1, 8 or 16 bits) - * @param ccd_size_divisor true specifies how much x coordinates must be shrunk * @param color_filter to choose the color channel used in gray scans * @param flags to drive specific settings such no calibration, XPA use ... */ @@ -1006,8 +1005,9 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens /* MAXWD is expressed in 2 words unit */ /* nousedspace = (mem_bank_range * 1024 / 256 -1 ) * 4; */ - // BUG: the division by ccd_size_divisor likely does not make sense - reg->set24(REG_MAXWD, (session.output_line_bytes / session.ccd_size_divisor) >> 1); + // BUG: the division by optical and full resolution factor likely does not make sense + reg->set24(REG_MAXWD, (session.output_line_bytes * + session.optical_resolution / session.full_resolution) >> 1); reg->set16(REG_LPERIOD, exposure / tgtime); reg->set8(REG_DUMMY, sensor.dummy_pixel); } diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index 150fca343..4ae8d9e20 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -809,7 +809,7 @@ void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s, { if (dev->model->asic_type == AsicType::GL646) { s.pixel_startx += s.output_startx * sensor.full_resolution / s.params.xres; - s.pixel_endx = s.pixel_startx + s.optical_pixels * s.ccd_size_divisor; + s.pixel_endx = s.pixel_startx + s.optical_pixels * s.full_resolution / s.optical_resolution; } else if (dev->model->asic_type == AsicType::GL841 || dev->model->asic_type == AsicType::GL842 || @@ -896,13 +896,12 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se } // compute optical and output resolutions - - s.ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(s.params.xres); - s.pixel_count_ratio = sensor.pixel_count_ratio; - - s.optical_resolution = sensor.full_resolution / s.ccd_size_divisor; + s.full_resolution = sensor.full_resolution; + s.optical_resolution = sensor.get_optical_resolution(); s.output_resolution = s.params.xres; + s.pixel_count_ratio = sensor.pixel_count_ratio; + if (s.output_resolution > s.optical_resolution) { throw std::runtime_error("output resolution higher than optical resolution"); } @@ -923,7 +922,8 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se if (dev->model->asic_type == AsicType::GL843) { // ensure the number of optical pixels is divisible by 2. // In quarter-CCD mode optical_pixels is 4x larger than the actual physical number - s.optical_pixels = align_int_up(s.optical_pixels, 2 * s.ccd_size_divisor); + s.optical_pixels = align_int_up(s.optical_pixels, + 2 * s.full_resolution / s.optical_resolution); if (dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200 || dev->model->model_id == ModelId::PLUSTEK_OPTICFILM_7200I || @@ -1019,7 +1019,7 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se if (dev->model->is_cis) { s.output_line_bytes_raw = s.output_channel_bytes; } - s.conseq_pixel_dist = s.output_pixels / s.ccd_size_divisor / s.segment_count; + s.conseq_pixel_dist = s.output_pixels / (s.full_resolution / s.optical_resolution) / s.segment_count; } if (dev->model->asic_type == AsicType::GL842 || @@ -1034,7 +1034,7 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se dev->model->asic_type == AsicType::GL843) { s.output_segment_pixel_group_count = s.output_pixels / - (s.ccd_size_divisor * s.segment_count); + (s.full_resolution / s.optical_resolution * s.segment_count); } if (dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846 || @@ -1086,8 +1086,9 @@ static std::size_t get_usb_buffer_read_size(AsicType asic, const ScanSession& se return 1; case AsicType::GL124: - // BUG: we shouldn't multiply by channels here nor divide by ccd_size_divisor - return session.output_line_bytes_raw / session.ccd_size_divisor * session.params.channels; + // BUG: we shouldn't multiply by channels here nor adjuct by resolution factor + return session.output_line_bytes_raw * session.optical_resolution / session.full_resolution + * session.params.channels; case AsicType::GL845: case AsicType::GL846: diff --git a/backend/genesys/sensor.cpp b/backend/genesys/sensor.cpp index b3fafaeb9..79fc62a8b 100644 --- a/backend/genesys/sensor.cpp +++ b/backend/genesys/sensor.cpp @@ -122,12 +122,12 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Sensor& sensor) out << "Genesys_Sensor{\n" << " sensor_id: " << static_cast(sensor.sensor_id) << '\n' << " full_resolution: " << sensor.full_resolution << '\n' + << " optical_resolution: " << sensor.get_optical_resolution() << '\n' << " resolutions: " << format_indent_braced_list(4, sensor.resolutions) << '\n' << " channels: " << format_vector_unsigned(4, sensor.channels) << '\n' << " method: " << sensor.method << '\n' << " register_dpihw: " << sensor.register_dpihw << '\n' << " register_dpiset: " << sensor.register_dpiset << '\n' - << " ccd_size_divisor: " << sensor.ccd_size_divisor << '\n' << " shading_factor: " << sensor.shading_factor << '\n' << " shading_pixel_offset: " << sensor.shading_pixel_offset << '\n' << " pixel_count_ratio: " << sensor.pixel_count_ratio << '\n' diff --git a/backend/genesys/sensor.h b/backend/genesys/sensor.h index 4a90b029b..face0f8b0 100644 --- a/backend/genesys/sensor.h +++ b/backend/genesys/sensor.h @@ -260,6 +260,11 @@ struct Genesys_Sensor { // pixel, see ccd_pixels_per_system_pixel() unsigned full_resolution = 0; + // sensor resolution in pixel values that are read by the chip. Many scanners make low + // resolutions faster by configuring the timings in such a way that 1/2 or 1/4 of pixel values + // that are read. If zero, then it is equal to `full_resolution`. + unsigned optical_resolution = 0; + // the resolution list that the sensor is usable at. ValueFilterAny resolutions = VALUE_FILTER_ANY; @@ -277,9 +282,6 @@ struct Genesys_Sensor { // resolution. The value zero does not set the override. unsigned register_dpiset = 0; - // CCD may present itself as half or quarter-size CCD on certain resolutions - int ccd_size_divisor = 1; - // The resolution to use for shading calibration unsigned shading_resolution = 0; @@ -331,11 +333,11 @@ struct Genesys_Sensor { // red, green and blue gamma coefficient for default gamma tables AssignableArray gamma; - std::function get_ccd_size_divisor_fun; - - unsigned get_ccd_size_divisor_for_dpi(unsigned xres) const + unsigned get_optical_resolution() const { - return get_ccd_size_divisor_fun(*this, xres); + if (optical_resolution != 0) + return optical_resolution; + return full_resolution; } // how many CCD pixels are processed per system pixel time. This corresponds to CKSEL + 1 @@ -362,10 +364,10 @@ struct Genesys_Sensor { { return sensor_id == other.sensor_id && full_resolution == other.full_resolution && + optical_resolution == other.optical_resolution && resolutions == other.resolutions && method == other.method && shading_resolution == other.shading_resolution && - ccd_size_divisor == other.ccd_size_divisor && shading_factor == other.shading_factor && shading_pixel_offset == other.shading_pixel_offset && pixel_count_ratio == other.pixel_count_ratio && @@ -394,7 +396,6 @@ void serialize(Stream& str, Genesys_Sensor& x) serialize(str, x.resolutions); serialize(str, x.method); serialize(str, x.shading_resolution); - serialize(str, x.ccd_size_divisor); serialize(str, x.shading_factor); serialize(str, x.shading_pixel_offset); serialize(str, x.output_pixel_offset); diff --git a/backend/genesys/settings.cpp b/backend/genesys/settings.cpp index 43e931ca8..c80bc71be 100644 --- a/backend/genesys/settings.cpp +++ b/backend/genesys/settings.cpp @@ -97,7 +97,7 @@ bool ScanSession::operator==(const ScanSession& other) const { return params == other.params && computed == other.computed && - ccd_size_divisor == other.ccd_size_divisor && + full_resolution == other.full_resolution && optical_resolution == other.optical_resolution && optical_pixels == other.optical_pixels && optical_pixels_raw == other.optical_pixels_raw && @@ -136,7 +136,7 @@ std::ostream& operator<<(std::ostream& out, const ScanSession& session) { out << "ScanSession{\n" << " computed: " << session.computed << '\n' - << " ccd_size_divisor: " << session.ccd_size_divisor << '\n' + << " full_resolution: " << session.full_resolution << '\n' << " optical_resolution: " << session.optical_resolution << '\n' << " optical_pixels: " << session.optical_pixels << '\n' << " optical_pixels_raw: " << session.optical_pixels_raw << '\n' diff --git a/backend/genesys/settings.h b/backend/genesys/settings.h index df1180ee2..0836d6b59 100644 --- a/backend/genesys/settings.h +++ b/backend/genesys/settings.h @@ -212,11 +212,10 @@ struct ScanSession { // whether the session setup has been computed via compute_session() bool computed = false; - // specifies the reduction (if any) of CCD effective dpi which is performed by latching the - // data coming from CCD in such a way that 1/2 or 3/4 of pixel data is ignored. - unsigned ccd_size_divisor = 1; + // specifies the full resolution of the sensor that is being used. + unsigned full_resolution = 0; - // the optical resolution of the scanner. + // the optical resolution of the sensor that is being used. unsigned optical_resolution = 0; // the number of pixels at the optical resolution, not including segmentation overhead. @@ -230,7 +229,6 @@ struct ScanSession { unsigned optical_line_count = 0; // the resolution of the output data. - // gl843-only unsigned output_resolution = 0; // the offset in pixels from the beginning of output data @@ -343,7 +341,7 @@ void serialize(Stream& str, ScanSession& x) serialize(str, x.params); serialize_newline(str); serialize(str, x.computed); - serialize(str, x.ccd_size_divisor); + serialize(str, x.full_resolution); serialize(str, x.optical_resolution); serialize(str, x.optical_pixels); serialize(str, x.optical_pixels_raw); diff --git a/backend/genesys/tables_sensor.cpp b/backend/genesys/tables_sensor.cpp index 638fca515..ffda95717 100644 --- a/backend/genesys/tables_sensor.cpp +++ b/backend/genesys/tables_sensor.cpp @@ -48,45 +48,6 @@ namespace genesys { -inline unsigned get_sensor_optical_with_ccd_divisor(const Genesys_Sensor& sensor, unsigned xres) -{ - unsigned hwres = sensor.full_resolution / sensor.get_ccd_size_divisor_for_dpi(xres); - - if (xres <= hwres / 4) { - return hwres / 4; - } - if (xres <= hwres / 2) { - return hwres / 2; - } - return hwres; -} - -inline unsigned default_get_ccd_size_divisor_for_dpi(const Genesys_Sensor& sensor, unsigned xres) -{ - if (sensor.ccd_size_divisor >= 4 && xres * 4 <= static_cast(sensor.full_resolution)) { - return 4; - } - if (sensor.ccd_size_divisor >= 2 && xres * 2 <= static_cast(sensor.full_resolution)) { - return 2; - } - return 1; -} - -inline unsigned get_ccd_size_divisor_exact(const Genesys_Sensor& sensor, unsigned xres) -{ - (void) xres; - return sensor.ccd_size_divisor; -} - -inline unsigned get_ccd_size_divisor_gl124(const Genesys_Sensor& sensor, unsigned xres) -{ - // we have 2 domains for ccd: xres below or above half ccd max dpi - if (xres <= 300 && sensor.ccd_size_divisor > 1) { - return 2; - } - return 1; -} - StaticInit> s_sensors; void genesys_init_sensor_tables() @@ -112,7 +73,6 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -155,7 +115,6 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -196,7 +155,6 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -225,7 +183,6 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CCD_5345; // gl646 sensor.full_resolution = 1200; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 48; sensor.dummy_pixel = 16; sensor.fau_gain_white_ref = 190; @@ -233,21 +190,20 @@ void genesys_init_sensor_tables() sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.stagger_config = StaggerConfig{ 1200, 4 }; // FIXME: may be incorrect sensor.gamma = { 2.38f, 2.35f, 2.34f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpiset; unsigned exposure_lperiod; - unsigned ccd_size_divisor; Ratio pixel_count_ratio; int output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 50 }, 100, 12000, 2, Ratio{1, 2}, 0, { + { { 50 }, 600, 100, 12000, Ratio{1, 2}, 0, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -256,7 +212,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 75 }, 150, 11000, 2, Ratio{1, 2}, 1, { + { { 75 }, 600, 150, 11000, Ratio{1, 2}, 1, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -265,7 +221,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 100 }, 200, 11000, 2, Ratio{1, 2}, 1, { + { { 100 }, 600, 200, 11000, Ratio{1, 2}, 1, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -274,7 +230,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 150 }, 300, 11000, 2, Ratio{1, 2}, 2, { + { { 150 }, 600, 300, 11000, Ratio{1, 2}, 2, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -283,7 +239,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 200 }, 400, 11000, 2, Ratio{1, 2}, 2, { + { { 200 }, 600, 400, 11000, Ratio{1, 2}, 2, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -292,7 +248,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 300 }, 600, 11000, 2, Ratio{1, 2}, 4, { + { { 300 }, 600, 600, 11000, Ratio{1, 2}, 4, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -301,7 +257,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 400 }, 800, 11000, 2, Ratio{1, 2}, 5, { + { { 400 }, 600, 800, 11000, Ratio{1, 2}, 5, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -310,7 +266,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 600 }, 1200, 11000, 2, Ratio{1, 2}, 8, { + { { 600 }, 600, 1200, 11000, Ratio{1, 2}, 8, { { 0x08, 0x00 }, { 0x09, 0x05 }, { 0x0a, 0x06 }, { 0x0b, 0x08 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x28 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -319,7 +275,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } } }, - { { 1200 }, 1200, 11000, 1, Ratio{1, 1}, 16, { + { { 1200 }, 1200, 1200, 11000, Ratio{1, 1}, 16, { { 0x08, 0x0d }, { 0x09, 0x0f }, { 0x0a, 0x11 }, { 0x0b, 0x13 }, { 0x16, 0x0b }, { 0x17, 0x0a }, { 0x18, 0x30 }, { 0x19, 0x2a }, { 0x1a, 0x00 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x03 }, @@ -333,9 +289,9 @@ void genesys_init_sensor_tables() for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.exposure_lperiod = setting.exposure_lperiod; - sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = setting.custom_regs; @@ -354,7 +310,6 @@ void genesys_init_sensor_tables() sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.stagger_config = StaggerConfig{1200, 4}; // FIXME: may be incorrect sensor.gamma = { 2.1f, 2.1f, 2.1f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { @@ -439,28 +394,26 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CCD_HP2300; // gl646 sensor.full_resolution = 600; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 48; sensor.dummy_pixel = 20; sensor.fau_gain_white_ref = 180; sensor.gain_white_ref = 180; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.gamma = { 2.1f, 2.1f, 2.1f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpiset; unsigned exposure_lperiod; - unsigned ccd_size_divisor; Ratio pixel_count_ratio; int output_pixel_offset; GenesysRegisterSettingSet custom_regs; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150, 4480, 2, Ratio{1, 2}, 2, { + { { 75 }, 300, 150, 4480, Ratio{1, 2}, 2, { { 0x08, 0x16 }, { 0x09, 0x00 }, { 0x0a, 0x01 }, { 0x0b, 0x03 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x85 }, @@ -469,7 +422,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x06 }, { 0x5c, 0x0b }, { 0x5d, 0x10 }, { 0x5e, 0x16 } } }, - { { 150 }, 300, 4350, 2, Ratio{1, 2}, 5, { + { { 150 }, 300, 300, 4350, Ratio{1, 2}, 5, { { 0x08, 0x16 }, { 0x09, 0x00 }, { 0x0a, 0x01 }, { 0x0b, 0x03 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x85 }, @@ -478,7 +431,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x06 }, { 0x5c, 0x0b }, { 0x5d, 0x10 }, { 0x5e, 0x16 } } }, - { { 300 }, 600, 4350, 2, Ratio{1, 2}, 10, { + { { 300 }, 300, 600, 4350, Ratio{1, 2}, 10, { { 0x08, 0x16 }, { 0x09, 0x00 }, { 0x0a, 0x01 }, { 0x0b, 0x03 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x85 }, @@ -487,7 +440,7 @@ void genesys_init_sensor_tables() { 0x5b, 0x06 }, { 0x5c, 0x0b }, { 0x5d, 0x10 }, { 0x5e, 0x16 } } }, - { { 600 }, 600, 8700, 1, Ratio{1, 1}, 20, { + { { 600 }, 600, 600, 8700, Ratio{1, 1}, 20, { { 0x08, 0x01 }, { 0x09, 0x03 }, { 0x0a, 0x04 }, { 0x0b, 0x06 }, { 0x16, 0xb7 }, { 0x17, 0x0a }, { 0x18, 0x20 }, { 0x19, 0x2a }, { 0x1a, 0x6a }, { 0x1b, 0x8a }, { 0x1c, 0x00 }, { 0x1d, 0x05 }, @@ -501,9 +454,9 @@ void genesys_init_sensor_tables() for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.exposure_lperiod = setting.exposure_lperiod; - sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.output_pixel_offset = setting.output_pixel_offset; sensor.custom_regs = setting.custom_regs; @@ -515,7 +468,7 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CIS_CANON_LIDE_35; // gl841 sensor.full_resolution = 1200; - sensor.ccd_size_divisor = 2; + sensor.register_dpihw = 1200; sensor.black_pixels = 87; sensor.dummy_pixel = 87; sensor.fau_gain_white_ref = 0; @@ -529,30 +482,29 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { ValueFilterAny resolutions; - unsigned register_dpihw; + unsigned optical_resolution; unsigned register_dpiset; unsigned shading_resolution; int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 1200, 150, 600, 11 }, - { { 100 }, 1200, 200, 600, 14 }, - { { 150 }, 1200, 300, 600, 22 }, - { { 200 }, 1200, 400, 600, 29 }, - { { 300 }, 1200, 600, 600, 44 }, - { { 600 }, 1200, 1200, 600, 88 }, + { { 75 }, 600, 150, 600, 11 }, + { { 100 }, 600, 200, 600, 14 }, + { { 150 }, 600, 300, 600, 22 }, + { { 200 }, 600, 400, 600, 29 }, + { { 300 }, 600, 600, 600, 44 }, + { { 600 }, 600, 1200, 600, 88 }, { { 1200 }, 1200, 1200, 1200, 88 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; - sensor.register_dpihw = setting.register_dpihw; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; sensor.output_pixel_offset = setting.output_pixel_offset; @@ -564,7 +516,7 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CIS_CANON_LIDE_60; // gl841 sensor.full_resolution = 1200; - sensor.ccd_size_divisor = 2; + sensor.register_dpihw = 1200; sensor.black_pixels = 87; sensor.dummy_pixel = 87; sensor.fau_gain_white_ref = 0; @@ -578,30 +530,29 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { ValueFilterAny resolutions; - unsigned register_dpihw; + unsigned optical_resolution; unsigned register_dpiset; unsigned shading_resolution; int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 1200, 150, 600, 11 }, - { { 100 }, 1200, 200, 600, 14 }, - { { 150 }, 1200, 300, 600, 22 }, - { { 200 }, 1200, 400, 600, 29 }, - { { 300 }, 1200, 600, 600, 44 }, - { { 600 }, 1200, 1200, 600, 88 }, + { { 75 }, 600, 150, 600, 11 }, + { { 100 }, 600, 200, 600, 14 }, + { { 150 }, 600, 300, 600, 22 }, + { { 200 }, 600, 400, 600, 29 }, + { { 300 }, 600, 600, 600, 44 }, + { { 600 }, 600, 1200, 600, 88 }, { { 1200 }, 1200, 1200, 1200, 88 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; - sensor.register_dpihw = setting.register_dpihw; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; sensor.output_pixel_offset = setting.output_pixel_offset; @@ -627,7 +578,6 @@ void genesys_init_sensor_tables() { 0x5b, 0x00 }, { 0x5c, 0x00 }, { 0x5d, 0x00 }, { 0x5e, 0x00 } }; sensor.gamma = { 2.1f, 2.1f, 2.1f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { @@ -674,7 +624,6 @@ void genesys_init_sensor_tables() sensor.exposure = { 0, 0, 0 }; sensor.stagger_config = StaggerConfig{1200, 4}; // FIXME: may be incorrect sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { @@ -783,7 +732,6 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -826,7 +774,6 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -870,7 +817,6 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -913,7 +859,6 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -956,7 +901,6 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1000,7 +944,6 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1034,7 +977,6 @@ void genesys_init_sensor_tables() sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.gamma = { 2.2f, 2.2f, 2.2f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1195,7 +1137,6 @@ void genesys_init_sensor_tables() sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1340,7 +1281,6 @@ void genesys_init_sensor_tables() sensor.gain_white_ref = 200; sensor.exposure = { 0x01c1, 0x0126, 0x00e5 }; sensor.gamma = { 2.2f, 2.2f, 2.2f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1502,7 +1442,6 @@ void genesys_init_sensor_tables() { 0x7d, 0x90 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1542,7 +1481,6 @@ void genesys_init_sensor_tables() sensor.stagger_config = StaggerConfig{ 2400, 4 }; // FIXME: may be incorrect sensor.custom_regs = {}; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1669,7 +1607,6 @@ void genesys_init_sensor_tables() sensor.stagger_config = StaggerConfig{ 2400, 4 }; // FIXME: may be incorrect sensor.custom_regs = {}; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -1785,7 +1722,6 @@ void genesys_init_sensor_tables() sensor.sensor_id = SensorId::CCD_CANON_4400F; // gl843 sensor.full_resolution = 4800; sensor.register_dpihw = 4800; - sensor.ccd_size_divisor = 4; sensor.black_pixels = 50*8; // 31 at 600 dpi, 58 at 1200 dpi sensor.dummy_pixel = 20; @@ -1794,11 +1730,11 @@ void genesys_init_sensor_tables() sensor.exposure = { 0x9c40, 0x9c40, 0x9c40 }; sensor.stagger_config = StaggerConfig{4800, 8}; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpiset; int exposure_lperiod; bool use_host_side_calib; @@ -1809,7 +1745,7 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 300 }, 1200, 11640, false, 197, { ScanMethod::FLATBED }, { + { { 300 }, 1200, 1200, 11640, false, 197, { ScanMethod::FLATBED }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1821,7 +1757,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 600 }, 2400, 11640, false, 392, { ScanMethod::FLATBED }, { + { { 600 }, 1200, 2400, 11640, false, 392, { ScanMethod::FLATBED }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1833,7 +1769,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 1200 }, 4800, 11640, false, 794, { ScanMethod::FLATBED }, { + { { 1200 }, 1200, 4800, 11640, false, 794, { ScanMethod::FLATBED }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1845,7 +1781,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 1200 }, 4800, 33300, true, 5, { ScanMethod::TRANSPARENCY }, { + { { 1200 }, 1200, 4800, 33300, true, 5, { ScanMethod::TRANSPARENCY }, { { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, { 0x52, 0x0a }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1857,7 +1793,7 @@ void genesys_init_sensor_tables() { 0x9e, 0x2d }, }, {} }, - { { 2400 }, 4800, 33300, true, 10, { ScanMethod::TRANSPARENCY }, { + { { 2400 }, 2400, 4800, 33300, true, 10, { ScanMethod::TRANSPARENCY }, { { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x01 }, { 0x1d, 0x75 }, { 0x52, 0x0b }, { 0x53, 0x0d }, { 0x54, 0x00 }, { 0x55, 0x03 }, @@ -1871,7 +1807,7 @@ void genesys_init_sensor_tables() { 0x03, 0x1f }, } }, - { { 4800 }, 4800, 33300, true, -2063, { ScanMethod::TRANSPARENCY }, { + { { 4800 }, 4800, 4800, 33300, true, -2063, { ScanMethod::TRANSPARENCY }, { { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 }, { 0x52, 0x02 }, { 0x53, 0x05 }, { 0x54, 0x08 }, { 0x55, 0x0b }, @@ -1890,6 +1826,7 @@ void genesys_init_sensor_tables() for (auto method : setting.methods) { for (auto resolution : setting.resolutions.values()) { sensor.resolutions = { resolution }; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = resolution; sensor.exposure_lperiod = setting.exposure_lperiod; @@ -1909,7 +1846,6 @@ void genesys_init_sensor_tables() sensor.sensor_id = SensorId::CCD_CANON_8400F; // gl843 sensor.full_resolution = 3200; sensor.register_dpihw = 4800; - sensor.ccd_size_divisor = 1; sensor.black_pixels = 50*8; // 31 at 600 dpi, 58 at 1200 dpi sensor.dummy_pixel = 20; @@ -1919,7 +1855,6 @@ void genesys_init_sensor_tables() sensor.stagger_config = StaggerConfig{ 3200, 6 }; sensor.custom_regs = {}; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -2070,7 +2005,6 @@ void genesys_init_sensor_tables() sensor.sensor_id = SensorId::CCD_CANON_8600F; // gl843 sensor.full_resolution = 4800; sensor.register_dpihw = 4800; - sensor.ccd_size_divisor = 4; sensor.black_pixels = 31; sensor.dummy_pixel = 20; sensor.fau_gain_white_ref = 160; @@ -2079,11 +2013,11 @@ void genesys_init_sensor_tables() sensor.stagger_config = StaggerConfig{4800, 8}; sensor.custom_regs = {}; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpiset; int exposure_lperiod; int output_pixel_offset; @@ -2093,7 +2027,7 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 300 }, 1200, 24000, 1, { ScanMethod::FLATBED }, { + { { 300 }, 1200, 1200, 24000, 1, { ScanMethod::FLATBED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2108,7 +2042,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 600 }, 2400, 24000, 2, { ScanMethod::FLATBED }, { + { { 600 }, 1200, 2400, 24000, 2, { ScanMethod::FLATBED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2123,7 +2057,7 @@ void genesys_init_sensor_tables() }, {}, }, - { { 1200 }, 4800, 24000, 5, { ScanMethod::FLATBED }, { + { { 1200 }, 1200, 4800, 24000, 5, { ScanMethod::FLATBED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2138,8 +2072,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 300 }, 1200, 45000, 6, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 300 }, 1200, 1200, 45000, 6, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2154,8 +2088,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 600 }, 2400, 45000, 11, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 600 }, 1200, 2400, 45000, 11, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2170,8 +2104,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 1200 }, 4800, 45000, 23, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 1200 }, 1200, 4800, 45000, 23, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x0a }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x00 }, { 0x1d, 0x6b }, @@ -2186,8 +2120,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 2400 }, 4800, 45000, 10, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 2400 }, 2400, 4800, 45000, 10, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x01 }, { 0x1d, 0x75 }, @@ -2202,8 +2136,8 @@ void genesys_init_sensor_tables() }, {}, }, - { { 4800 }, 4800, 45000, -1982, { ScanMethod::TRANSPARENCY, - ScanMethod::TRANSPARENCY_INFRARED }, { + { { 4800 }, 4800, 4800, 45000, -1982, { ScanMethod::TRANSPARENCY, + ScanMethod::TRANSPARENCY_INFRARED }, { { 0x0c, 0x00 }, { 0x16, 0x13 }, { 0x17, 0x15 }, { 0x18, 0x10 }, { 0x19, 0x2a }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x61 }, { 0x1d, 0x75 }, @@ -2225,6 +2159,7 @@ void genesys_init_sensor_tables() for (auto method : setting.methods) { for (auto resolution : setting.resolutions.values()) { sensor.resolutions = { resolution }; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = resolution; sensor.output_pixel_offset = setting.output_pixel_offset; @@ -2242,7 +2177,6 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CCD_HP_N6310; // gl847 sensor.full_resolution = 2400; - // sensor.ccd_size_divisor = 2; Possibly half CCD, needs checking sensor.black_pixels = 96; sensor.dummy_pixel = 26; sensor.pixel_count_ratio = Ratio{1, 4}; @@ -2269,7 +2203,6 @@ void genesys_init_sensor_tables() { 0x5a, 0x40 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -2305,18 +2238,17 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CIS_CANON_LIDE_110; // gl124 sensor.full_resolution = 2400; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.gamma = { 2.2f, 2.2f, 2.2f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_gl124; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpihw; unsigned register_dpiset; unsigned shading_resolution; @@ -2329,24 +2261,7 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 150, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 4, std::vector{}, { - { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, - { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x01 }, { 0x20, 0x0c }, - { 0x52, 0x00 }, { 0x53, 0x02 }, { 0x54, 0x04 }, { 0x55, 0x06 }, - { 0x56, 0x04 }, { 0x57, 0x04 }, { 0x58, 0x04 }, { 0x59, 0x04 }, - { 0x5a, 0x1a }, { 0x5b, 0x00 }, { 0x5c, 0xc0 }, - { 0x61, 0x20 }, - { 0x70, 0x06 }, { 0x71, 0x08 }, { 0x72, 0x08 }, { 0x73, 0x0a }, - { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x1e }, - { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, - { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, - { 0x88, 0x00 }, { 0x89, 0x65 }, - { 0x93, 0x00 }, { 0x94, 0x0a }, { 0x95, 0x18 }, - { 0x96, 0x00 }, { 0x97, 0x9a }, - { 0x98, 0x21 }, - } - }, - { { 100 }, 600, 200, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 3, + { { 75 }, 1200, 600, 150, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 4, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x01 }, { 0x20, 0x0c }, @@ -2364,7 +2279,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 150 }, 600, 300, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 2, + { { 100 }, 1200, 600, 200, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 3, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x01 }, { 0x20, 0x0c }, @@ -2382,7 +2297,25 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 300 }, 600, 600, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 1, + { { 150 }, 1200, 600, 300, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 2, + std::vector{}, { + { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, + { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x01 }, { 0x20, 0x0c }, + { 0x52, 0x00 }, { 0x53, 0x02 }, { 0x54, 0x04 }, { 0x55, 0x06 }, + { 0x56, 0x04 }, { 0x57, 0x04 }, { 0x58, 0x04 }, { 0x59, 0x04 }, + { 0x5a, 0x1a }, { 0x5b, 0x00 }, { 0x5c, 0xc0 }, + { 0x61, 0x20 }, + { 0x70, 0x06 }, { 0x71, 0x08 }, { 0x72, 0x08 }, { 0x73, 0x0a }, + { 0x74, 0x00 }, { 0x75, 0x00 }, { 0x76, 0x1e }, + { 0x77, 0x00 }, { 0x78, 0x00 }, { 0x79, 0x9f }, + { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, + { 0x88, 0x00 }, { 0x89, 0x65 }, + { 0x93, 0x00 }, { 0x94, 0x0a }, { 0x95, 0x18 }, + { 0x96, 0x00 }, { 0x97, 0x9a }, + { 0x98, 0x21 }, + } + }, + { { 300 }, 1200, 600, 600, 300, 4608, { 462, 609, 453 }, Ratio{1, 4}, 1, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x0c }, @@ -2400,7 +2333,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 600 }, 600, 600, 600, 5360, { 823, 1117, 805 }, Ratio{1, 4}, 1, + { { 600 }, 2400, 600, 600, 600, 5360, { 823, 1117, 805 }, Ratio{1, 4}, 1, std::vector{}, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x0a }, @@ -2418,7 +2351,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 1200 }, 1200, 1200, 1200, 10528, { 6071, 6670, 6042 }, Ratio{1, 4}, 1, + { { 1200 }, 2400, 1200, 1200, 1200, 10528, { 6071, 6670, 6042 }, Ratio{1, 4}, 1, { 0, 1 }, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 },{ 0x20, 0x08 }, @@ -2436,7 +2369,7 @@ void genesys_init_sensor_tables() { 0x98, 0x22 }, } }, - { { 2400 }, 2400, 2400, 2400, 20864, { 7451, 8661, 7405 }, Ratio{1, 4}, 1, + { { 2400 }, 2400, 2400, 2400, 2400, 20864, { 7451, 8661, 7405 }, Ratio{1, 4}, 1, { 0, 2, 1, 3 }, { { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x06 }, @@ -2458,6 +2391,7 @@ void genesys_init_sensor_tables() for (const auto& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; @@ -2474,18 +2408,17 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CIS_CANON_LIDE_120; // gl124 sensor.full_resolution = 2400; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.gamma = { 2.2f, 2.2f, 2.2f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_gl124; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpihw; unsigned register_dpiset; unsigned shading_resolution; @@ -2498,7 +2431,7 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 150, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 4, + { { 75 }, 1200, 600, 150, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 4, std::vector{}, { { 0x16, 0x15 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2516,7 +2449,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 100 }, 600, 200, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 3, + { { 100 }, 1200, 600, 200, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 3, std::vector{}, { { 0x16, 0x15 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2534,7 +2467,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 150 }, 600, 300, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 2, + { { 150 }, 1200, 600, 300, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 2, std::vector{}, { { 0x16, 0x15 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2552,7 +2485,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 300 }, 600, 600, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 1, + { { 300 }, 1200, 600, 600, 300, 4608, { 1244, 1294, 1144 }, Ratio{1, 4}, 1, std::vector{}, { { 0x16, 0x15 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2570,7 +2503,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 600 }, 600, 600, 600, 5360, { 2394, 2444, 2144 }, Ratio{1, 4}, 1, + { { 600 }, 2400, 600, 600, 600, 5360, { 2394, 2444, 2144 }, Ratio{1, 4}, 1, std::vector{}, { { 0x16, 0x11 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2588,7 +2521,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 1200 }, 1200, 1200, 1200, 10528, { 4694, 4644, 4094 }, Ratio{1, 2}, 1, + { { 1200 }, 2400, 1200, 1200, 1200, 10528, { 4694, 4644, 4094 }, Ratio{1, 2}, 1, std::vector{}, { { 0x16, 0x15 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2606,7 +2539,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, }, }, - { { 2400 }, 2400, 2400, 2400, 20864, { 8944, 8144, 7994 }, Ratio{1, 1}, 1, + { { 2400 }, 2400, 2400, 2400, 2400, 20864, { 8944, 8144, 7994 }, Ratio{1, 1}, 1, std::vector{}, { { 0x16, 0x11 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x00 }, { 0x20, 0x02 }, @@ -2628,6 +2561,7 @@ void genesys_init_sensor_tables() for (const auto& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; @@ -2644,18 +2578,17 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CIS_CANON_LIDE_210; // gl124 sensor.full_resolution = 4800; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.gamma = { 2.2f, 2.2f, 2.2f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_gl124; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpihw; unsigned register_dpiset; unsigned shading_resolution; @@ -2668,7 +2601,7 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 150, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 4, + { { 75 }, 2400, 600, 150, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 4, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2687,7 +2620,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 100 }, 600, 200, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 3, + { { 100 }, 2400, 600, 200, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 3, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2706,7 +2639,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 150 }, 600, 300, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 2, + { { 150 }, 2400, 600, 300, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 2, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2725,7 +2658,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 300 }, 600, 600, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 1, + { { 300 }, 2400, 600, 600, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 1, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2744,7 +2677,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 600 }, 600, 600, 600, 5360, { 388, 574, 393 }, Ratio{1, 8}, 1, + { { 600 }, 4800, 600, 600, 600, 5360, { 388, 574, 393 }, Ratio{1, 8}, 1, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2763,7 +2696,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 1200 }, 1200, 1200, 1200, 10528, { 388, 574, 393 }, Ratio{1, 8}, 1, {0, 1}, { + { { 1200 }, 4800, 1200, 1200, 1200, 10528, { 388, 574, 393 }, Ratio{1, 8}, 1, {0, 1}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x01 }, { 0x20, 0x08 }, @@ -2781,7 +2714,7 @@ void genesys_init_sensor_tables() { 0x98, 0x22 }, }, }, - { { 2400 }, 2400, 2400, 2400, 20864, { 6839, 8401, 6859 }, Ratio{1, 8}, 1, + { { 2400 }, 4800, 2400, 2400, 2400, 20864, { 6839, 8401, 6859 }, Ratio{1, 8}, 1, {0, 2, 1, 3}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2800,7 +2733,7 @@ void genesys_init_sensor_tables() { 0x98, 0x24 }, }, }, - { { 4800 }, 4800, 4800, 4800, 41536, { 9735, 14661, 11345 }, Ratio{1, 8}, 1, + { { 4800 }, 4800, 4800, 4800, 4800, 41536, { 9735, 14661, 11345 }, Ratio{1, 8}, 1, { 0, 2, 4, 6, 1, 3, 5, 7 }, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2823,6 +2756,7 @@ void genesys_init_sensor_tables() for (const auto& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; @@ -2839,18 +2773,17 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CIS_CANON_LIDE_220; // gl124 sensor.full_resolution = 4800; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 16; sensor.fau_gain_white_ref = 210; sensor.gain_white_ref = 200; sensor.exposure = { 0x0000, 0x0000, 0x0000 }; sensor.gamma = { 2.2f, 2.2f, 2.2f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_gl124; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpihw; unsigned register_dpiset; unsigned shading_resolution; @@ -2863,7 +2796,7 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 150, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 4, + { { 75 }, 2400, 600, 150, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 4, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2882,7 +2815,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 100 }, 600, 200, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 3, + { { 100 }, 2400, 600, 200, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 3, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2901,7 +2834,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 150 }, 600, 300, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 2, + { { 150 }, 2400, 600, 300, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 2, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2920,7 +2853,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 300 }, 600, 600, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 1, + { { 300 }, 2400, 600, 600, 300, 2768, { 388, 574, 393 }, Ratio{1, 8}, 1, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2939,7 +2872,7 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 600 }, 600, 600, 600, 5360, { 388, 574, 393 }, Ratio{1, 8}, 1, + { { 600 }, 4800, 600, 600, 600, 5360, { 388, 574, 393 }, Ratio{1, 8}, 1, std::vector{}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2958,7 +2891,8 @@ void genesys_init_sensor_tables() { 0x98, 0x21 }, } }, - { { 1200 }, 1200, 1200, 1200, 10528, { 388, 574, 393 }, Ratio{1, 8}, 1, {0, 1}, { + { { 1200 }, 4800, 1200, 1200, 1200, 10528, { 388, 574, 393 }, Ratio{1, 8}, 1, + {0, 1}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, { 0x1a, 0x30 }, { 0x1b, 0x00 }, { 0x1c, 0x02 }, { 0x1d, 0x01 }, { 0x20, 0x08 }, @@ -2976,7 +2910,7 @@ void genesys_init_sensor_tables() { 0x98, 0x22 }, } }, - { { 2400 }, 2400, 2400, 2400, 20864, { 6839, 8401, 6859 }, Ratio{1, 8}, 1, + { { 2400 }, 4800, 2400, 2400, 2400, 20864, { 6839, 8401, 6859 }, Ratio{1, 8}, 1, {0, 2, 1, 3}, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -2995,7 +2929,7 @@ void genesys_init_sensor_tables() { 0x98, 0x24 }, }, }, - { { 4800 }, 4800, 4800, 4800, 41536, { 9735, 14661, 11345 }, Ratio{1, 8}, 1, + { { 4800 }, 4800, 4800, 4800, 4800, 41536, { 9735, 14661, 11345 }, Ratio{1, 8}, 1, { 0, 2, 4, 6, 1, 3, 5, 7 }, { // { 0x16, 0x00 }, // FIXME: check if default value is different { 0x16, 0x10 }, { 0x17, 0x04 }, { 0x18, 0x00 }, { 0x19, 0x01 }, @@ -3018,6 +2952,7 @@ void genesys_init_sensor_tables() for (const auto& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; @@ -3034,7 +2969,6 @@ void genesys_init_sensor_tables() sensor = Genesys_Sensor(); sensor.sensor_id = SensorId::CCD_PLUSTEK_OPTICPRO_3600; // gl841 sensor.full_resolution = 1200; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 87; sensor.dummy_pixel = 87; sensor.fau_gain_white_ref = 210; @@ -3048,28 +2982,29 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x00 }, { 0x72, 0x00 }, { 0x73, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpihw; unsigned register_dpiset; int output_pixel_offset; }; CustomSensorSettings custom_settings[] = { - { { 75 }, 600, 150, 11 }, - { { 100 }, 600, 200, 14 }, - { { 150 }, 600, 300, 22 }, - { { 200 }, 600, 400, 29 }, - { { 300 }, 600, 600, 44 }, - { { 600 }, 600, 1200, 88 }, - { { 1200 }, 1200, 1200, 88 }, + { { 75 }, 600, 600, 150, 11 }, + { { 100 }, 600, 600, 200, 14 }, + { { 150 }, 600, 600, 300, 22 }, + { { 200 }, 600, 600, 400, 29 }, + { { 300 }, 600, 600, 600, 44 }, + { { 600 }, 600, 600, 1200, 88 }, + { { 1200 }, 1200, 1200, 1200, 88 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpihw = setting.register_dpihw; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.register_dpihw; @@ -3102,7 +3037,6 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, { 0x7d, 0x00 }, { 0x7f, 0x01 } }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { @@ -3173,13 +3107,11 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { ValueFilterAny resolutions; ScanMethod method; - unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; int output_pixel_offset; @@ -3189,26 +3121,25 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 2, 0x2538, 150, {} }, - { { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 5, 0x2538, 300, {} }, - { { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 10, 0x2538, 600, {} }, - { { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 20, 0x19c8, 1200, { + { { 900 }, ScanMethod::TRANSPARENCY, 900, Ratio{8, 8}, 2, 0x2538, 150, {} }, + { { 1800 }, ScanMethod::TRANSPARENCY, 1800, Ratio{4, 4}, 5, 0x2538, 300, {} }, + { { 3600 }, ScanMethod::TRANSPARENCY, 3600, Ratio{2, 2}, 10, 0x2538, 600, {} }, + { { 7200 }, ScanMethod::TRANSPARENCY, 7200, Ratio{1, 1}, 20, 0x19c8, 1200, { { 0x02, 0x1b }, { 0x03, 0x14 }, { 0x04, 0x20 }, } }, - { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 2, 0x1f54, 150, {} }, - { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 5, 0x1f54, 300, {} }, - { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 10, 0x1f54, 600, {} }, - { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 20, 0x1f54, 1200, {} }, + { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 900, Ratio{8, 8}, 2, 0x1f54, 150, {} }, + { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1800, Ratio{4, 4}, 5, 0x1f54, 300, {} }, + { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 3600, Ratio{2, 2}, 10, 0x1f54, 600, {} }, + { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 7200, Ratio{1, 1}, 20, 0x1f54, 1200, {} }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.method = setting.method; sensor.shading_resolution = setting.shading_resolution; - sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.output_pixel_offset = setting.output_pixel_offset; sensor.exposure_lperiod = setting.exposure_lperiod; @@ -3262,12 +3193,10 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { ValueFilterAny resolutions; - unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; int output_pixel_offset; @@ -3275,15 +3204,14 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 900 }, 1, 900, Ratio{8, 8}, 2, 150 }, - { { 1800 }, 1, 1800, Ratio{4, 4}, 5, 300 }, - { { 3600 }, 1, 3600, Ratio{2, 2}, 10, 600 }, - { { 7200 }, 1, 7200, Ratio{1, 1}, 20, 1200 }, + { { 900 }, 900, Ratio{8, 8}, 2, 150 }, + { { 1800 }, 1800, Ratio{4, 4}, 5, 300 }, + { { 3600 }, 3600, Ratio{2, 2}, 10, 600 }, + { { 7200 }, 7200, Ratio{1, 1}, 20, 1200 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; - sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.shading_resolution = setting.shading_resolution; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.output_pixel_offset = setting.output_pixel_offset; @@ -3319,7 +3247,6 @@ void genesys_init_sensor_tables() { 0x87, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { @@ -3386,13 +3313,11 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { ValueFilterAny resolutions; ScanMethod method; - unsigned ccd_size_divisor; unsigned shading_resolution; Ratio pixel_count_ratio; int output_pixel_offset; @@ -3401,20 +3326,19 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 900 }, ScanMethod::TRANSPARENCY, 1, 900, Ratio{8, 8}, 2, 0x2f44, 150 }, - { { 1800 }, ScanMethod::TRANSPARENCY, 1, 1800, Ratio{4, 4}, 5, 0x2f44, 300 }, - { { 3600 }, ScanMethod::TRANSPARENCY, 1, 3600, Ratio{2, 2}, 10, 0x2f44, 600 }, - { { 7200 }, ScanMethod::TRANSPARENCY, 1, 7200, Ratio{1, 1}, 20, 0x2f44, 1200 }, - { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 900, Ratio{8, 8}, 2, 0x2af8, 150 }, - { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 1800, Ratio{4, 4}, 5, 0x2af8, 300 }, - { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 3600, Ratio{2, 2}, 10, 0x2af8, 600 }, - { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 1, 7200, Ratio{1, 1}, 20, 0x2af8, 1200 }, + { { 900 }, ScanMethod::TRANSPARENCY, 900, Ratio{8, 8}, 2, 0x2f44, 150 }, + { { 1800 }, ScanMethod::TRANSPARENCY, 1800, Ratio{4, 4}, 5, 0x2f44, 300 }, + { { 3600 }, ScanMethod::TRANSPARENCY, 3600, Ratio{2, 2}, 10, 0x2f44, 600 }, + { { 7200 }, ScanMethod::TRANSPARENCY, 7200, Ratio{1, 1}, 20, 0x2f44, 1200 }, + { { 900 }, ScanMethod::TRANSPARENCY_INFRARED, 900, Ratio{8, 8}, 2, 0x2af8, 150 }, + { { 1800 }, ScanMethod::TRANSPARENCY_INFRARED, 1800, Ratio{4, 4}, 5, 0x2af8, 300 }, + { { 3600 }, ScanMethod::TRANSPARENCY_INFRARED, 3600, Ratio{2, 2}, 10, 0x2af8, 600 }, + { { 7200 }, ScanMethod::TRANSPARENCY_INFRARED, 7200, Ratio{1, 1}, 20, 0x2af8, 1200 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; sensor.method = setting.method; - sensor.ccd_size_divisor = setting.ccd_size_divisor; sensor.shading_resolution = setting.shading_resolution; sensor.pixel_count_ratio = setting.pixel_count_ratio; sensor.output_pixel_offset = setting.output_pixel_offset; @@ -3451,7 +3375,6 @@ void genesys_init_sensor_tables() { 0x87, 0x00 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = get_ccd_size_divisor_exact; { struct CustomSensorSettings { @@ -3505,7 +3428,6 @@ void genesys_init_sensor_tables() { 0x7a, 0x00 }, { 0x7b, 0x00 }, { 0x7c, 0x55 }, }; sensor.gamma = { 1.7f, 1.7f, 1.7f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -3562,7 +3484,6 @@ void genesys_init_sensor_tables() { 0x87, 0x02 }, }; sensor.gamma = { 1.7f, 1.7f, 1.7f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { @@ -3596,7 +3517,6 @@ void genesys_init_sensor_tables() sensor.sensor_id = SensorId::CIS_CANON_LIDE_80; // gl841 sensor.full_resolution = 1200; // real hardware limit is 2400 sensor.register_dpihw = 1200; - sensor.ccd_size_divisor = 2; sensor.black_pixels = 20; sensor.dummy_pixel = 6; sensor.fau_gain_white_ref = 150; @@ -3611,11 +3531,11 @@ void genesys_init_sensor_tables() { 0x70, 0x00 }, { 0x71, 0x05 }, { 0x72, 0x07 }, { 0x73, 0x09 }, }; sensor.gamma = { 1.0f, 1.0f, 1.0f }; - sensor.get_ccd_size_divisor_fun = default_get_ccd_size_divisor_for_dpi; { struct CustomSensorSettings { ValueFilterAny resolutions; + unsigned optical_resolution; unsigned register_dpiset; unsigned shading_resolution; unsigned shading_factor; @@ -3623,17 +3543,18 @@ void genesys_init_sensor_tables() }; CustomSensorSettings custom_settings[] = { - { { 75 }, 150, 600, 8, 2 }, - { { 100 }, 200, 600, 6, 3 }, - { { 150 }, 300, 600, 4, 4 }, - { { 200 }, 400, 600, 3, 6 }, - { { 300 }, 600, 600, 2, 9 }, - { { 600 }, 1200, 600, 1, 17 }, - { { 1200 }, 1200, 1200, 1, 35 }, + { { 75 }, 600, 150, 600, 8, 2 }, + { { 100 }, 600, 200, 600, 6, 3 }, + { { 150 }, 600, 300, 600, 4, 4 }, + { { 200 }, 600, 400, 600, 3, 6 }, + { { 300 }, 600, 600, 600, 2, 9 }, + { { 600 }, 600, 1200, 600, 1, 17 }, + { { 1200 }, 1200, 1200, 1200, 1, 35 }, }; for (const CustomSensorSettings& setting : custom_settings) { sensor.resolutions = setting.resolutions; + sensor.optical_resolution = setting.optical_resolution; sensor.register_dpiset = setting.register_dpiset; sensor.shading_resolution = setting.shading_resolution; sensor.shading_factor = setting.shading_factor; @@ -3655,6 +3576,10 @@ void verify_sensor_tables() } auto asic_type = sensor_to_asic[sensor.sensor_id]; + if (sensor.full_resolution == 0) { + throw SaneException("full_resolution is not defined"); + } + if (sensor.register_dpiset == 0) { throw SaneException("register_dpiset is not defined"); }