diff --git a/backend/genesys/low.cpp b/backend/genesys/low.cpp index 3a6a31f0c..226e69cfd 100644 --- a/backend/genesys/low.cpp +++ b/backend/genesys/low.cpp @@ -921,6 +921,8 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se s.buffer_size_read = s.output_line_bytes_raw * 64; compute_session_pixel_offsets(dev, s, sensor); + s.shading_pixel_offset = sensor.shading_pixel_offset; + if (dev->model->asic_type == AsicType::GL124 || dev->model->asic_type == AsicType::GL845 || dev->model->asic_type == AsicType::GL846) @@ -1071,10 +1073,10 @@ ImagePipelineStack build_image_pipeline(const Genesys_Device& dev, const ScanSes !has_flag(dev.model->flags, ModelFlag::DISABLE_SHADING_CALIBRATION) && !has_flag(session.params.flags, ScanFlag::DISABLE_SHADING)) { + unsigned offset_pixels = session.params.startx + dev.calib_session.shading_pixel_offset; + unsigned offset_bytes = offset_pixels * dev.calib_session.params.channels; pipeline.push_node(dev.dark_average_data, - dev.white_average_data, - session.params.startx * - dev.calib_session.params.channels); + dev.white_average_data, offset_bytes); if (log_image_data) { pipeline.push_node(debug_prefix + "_9_after_calibrate.tiff"); diff --git a/backend/genesys/sensor.h b/backend/genesys/sensor.h index 9505cb5d1..1492b60ea 100644 --- a/backend/genesys/sensor.h +++ b/backend/genesys/sensor.h @@ -286,7 +286,8 @@ struct Genesys_Sensor { // How many real pixels correspond to one shading pixel that is sent to the scanner unsigned shading_factor = 1; - // How many pixels the shading data is offset from the acquired data + // How many pixels the shading data is offset to the right from the acquired data. Calculated + // in shading resolution. int shading_pixel_offset = 0; // This defines the ratio between logical pixel coordinates and the pixel coordinates sent to diff --git a/backend/genesys/settings.cpp b/backend/genesys/settings.cpp index bc60502c5..c2b54dcfc 100644 --- a/backend/genesys/settings.cpp +++ b/backend/genesys/settings.cpp @@ -126,6 +126,7 @@ bool ScanSession::operator==(const ScanSession& other) const conseq_pixel_dist == other.conseq_pixel_dist && output_segment_pixel_group_count == other.output_segment_pixel_group_count && output_segment_start_offset == other.output_segment_start_offset && + 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; @@ -161,6 +162,7 @@ std::ostream& operator<<(std::ostream& out, const ScanSession& session) << " conseq_pixel_dist: " << session.conseq_pixel_dist << '\n' << " output_segment_pixel_group_count: " << session.output_segment_pixel_group_count << '\n' + << " shading_pixel_offset: " << session.shading_pixel_offset << '\n' << " buffer_size_read: " << session.buffer_size_read << '\n' << " enable_ledadd: " << session.enable_ledadd << '\n' << " use_host_side_calib: " << session.use_host_side_calib << '\n' diff --git a/backend/genesys/settings.h b/backend/genesys/settings.h index d6d02ebc1..f78845b1c 100644 --- a/backend/genesys/settings.h +++ b/backend/genesys/settings.h @@ -306,6 +306,10 @@ struct ScanSession { // Currently it's always zero. unsigned output_segment_start_offset = 0; + // How many pixels the shading data is offset to the right from the acquired data. Calculated + // in shading resolution. + int shading_pixel_offset = 0; + // the size of the read buffer. size_t buffer_size_read = 0; @@ -362,6 +366,7 @@ void serialize(Stream& str, ScanSession& x) serialize(str, x.conseq_pixel_dist); serialize(str, x.output_segment_pixel_group_count); serialize(str, x.output_segment_start_offset); + serialize(str, x.shading_pixel_offset); serialize(str, x.buffer_size_read); serialize(str, x.enable_ledadd); serialize(str, x.use_host_side_calib);