diff --git a/backend/genesys_gl124.cc b/backend/genesys_gl124.cc index efdaa8885..b29e9b8f2 100644 --- a/backend/genesys_gl124.cc +++ b/backend/genesys_gl124.cc @@ -1154,7 +1154,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens /*** prepares data reordering ***/ /* words_per_line */ - bytes_per_line = (session.optical_pixels * session.params.xres) / session.optical_resolution; + bytes_per_line = session.output_pixels; bytes_per_line = (bytes_per_line * session.params.channels * session.params.depth) / 8; /* since we don't have sheetfed scanners to handle, @@ -1184,7 +1184,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->read_active = SANE_TRUE; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution; + dev->current_setup.pixels = session.output_pixels; DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels); dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; @@ -1265,7 +1265,7 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso lincnt = session.params.lines + max_shift + session.num_staggered_lines; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res; + dev->current_setup.pixels = session.output_pixels; DBG (DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels); dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; diff --git a/backend/genesys_gl646.cc b/backend/genesys_gl646.cc index 6d1b04300..26fbf59f3 100644 --- a/backend/genesys_gl646.cc +++ b/backend/genesys_gl646.cc @@ -592,7 +592,7 @@ static void gl646_setup_registers(Genesys_Device* dev, /* words_per_line must be computed according to the scan's resolution */ /* in fact, words_per_line _gives_ the actual scan resolution */ - words_per_line = (((endx - startx) * session.output_resolution) / sensor.optical_res); + words_per_line = session.output_pixels; bpp = session.params.depth/8; if (session.params.depth == 1) { words_per_line = (words_per_line+7)/8 ; @@ -790,7 +790,7 @@ static void gl646_setup_registers(Genesys_Device* dev, dev->read_active = SANE_TRUE; dev->session = session; - dev->current_setup.pixels = ((endx - startx) * session.output_resolution) / sensor.optical_res; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = linecnt; dev->current_setup.exposure_time = sensor.exposure_lperiod; dev->current_setup.xres = session.output_resolution; diff --git a/backend/genesys_gl841.cc b/backend/genesys_gl841.cc index c41dc64a6..122f8a30c 100644 --- a/backend/genesys_gl841.cc +++ b/backend/genesys_gl841.cc @@ -1929,7 +1929,7 @@ dummy \ scanned lines /*** prepares data reordering ***/ /* words_per_line */ - bytes_per_line = (session.optical_pixels * session.params.xres) / session.optical_resolution; + bytes_per_line = session.output_pixels; bytes_per_line = (bytes_per_line * session.params.channels * session.params.depth) / 8; requested_buffer_size = 8 * bytes_per_line; @@ -1960,7 +1960,7 @@ dummy \ scanned lines dev->read_active = SANE_TRUE; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; dev->current_setup.xres = session.params.xres; @@ -2099,7 +2099,7 @@ dummy \ scanned lines lincnt = session.params.lines + max_shift + session.num_staggered_lines; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; dev->current_setup.xres = session.params.xres; diff --git a/backend/genesys_gl843.cc b/backend/genesys_gl843.cc index f418cf400..008d784cd 100644 --- a/backend/genesys_gl843.cc +++ b/backend/genesys_gl843.cc @@ -1193,12 +1193,6 @@ static void gl843_compute_session(Genesys_Device* dev, ScanSession& s, // compute optical and output resolutions s.hwdpi_divisor = sensor.get_hwdpi_divisor_for_dpi(s.params.xres); - // after all adjustments on the optical pixels have been made, compute the number of pixels - // to retrieve from the chip - s.output_pixels = (s.optical_pixels * s.output_resolution) / s.optical_resolution; - - - s.max_color_shift_lines = sanei_genesys_compute_max_shift(dev, s.params.channels, s.params.yres, s.params.flags); @@ -1450,7 +1444,7 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor lincnt = session.params.lines + max_shift + session.num_staggered_lines; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution; + dev->current_setup.pixels = session.output_pixels; DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels); dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure; diff --git a/backend/genesys_gl846.cc b/backend/genesys_gl846.cc index 6459950c1..c6b0faa49 100644 --- a/backend/genesys_gl846.cc +++ b/backend/genesys_gl846.cc @@ -1034,7 +1034,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens /*** prepares data reordering ***/ /* words_per_line */ - bytes_per_line = (session.optical_pixels * session.params.xres) / session.optical_resolution; + bytes_per_line = session.output_pixels; bytes_per_line = (bytes_per_line * session.params.channels * session.params.depth) / 8; requested_buffer_size = 8 * bytes_per_line; @@ -1061,7 +1061,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->read_active = SANE_TRUE; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; dev->current_setup.xres = session.params.xres; @@ -1159,7 +1159,7 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor lincnt = session.params.lines + max_shift + session.num_staggered_lines; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; dev->current_setup.xres = session.params.xres; diff --git a/backend/genesys_gl847.cc b/backend/genesys_gl847.cc index f8bd06c75..0623081fc 100644 --- a/backend/genesys_gl847.cc +++ b/backend/genesys_gl847.cc @@ -1052,7 +1052,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens /*** prepares data reordering ***/ /* words_per_line */ - bytes_per_line = (session.optical_pixels * session.params.xres) / session.optical_resolution; + bytes_per_line = session.output_pixels; bytes_per_line = (bytes_per_line * session.params.channels * session.params.depth) / 8; requested_buffer_size = 8 * bytes_per_line; @@ -1079,7 +1079,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->read_active = SANE_TRUE; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; dev->current_setup.xres = session.params.xres; @@ -1177,7 +1177,7 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor lincnt = session.params.lines + max_shift + session.num_staggered_lines; dev->session = session; - dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res; + dev->current_setup.pixels = session.output_pixels; dev->current_setup.lines = lincnt; dev->current_setup.exposure_time = exposure_time; dev->current_setup.xres = session.params.xres; diff --git a/backend/genesys_low.cc b/backend/genesys_low.cc index 46b41bc59..26ffbdbf1 100644 --- a/backend/genesys_low.cc +++ b/backend/genesys_low.cc @@ -1180,7 +1180,9 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& s.optical_pixels = align_int_up(s.optical_pixels, 2 * s.ccd_size_divisor); } - // TODO output_pixels + // after all adjustments on the optical pixels have been made, compute the number of pixels + // to retrieve from the chip + s.output_pixels = (s.optical_pixels * s.output_resolution) / s.optical_resolution; // Note: staggering is not applied for calibration. Staggering starts at 2400 dpi s.num_staggered_lines = 0; diff --git a/backend/genesys_settings.h b/backend/genesys_settings.h index c26196222..e0c01ce9a 100644 --- a/backend/genesys_settings.h +++ b/backend/genesys_settings.h @@ -239,7 +239,6 @@ struct ScanSession { unsigned output_resolution = 0; // the number of pixels in output data - // gl843-only unsigned output_pixels = 0; // the number of bytes in the output of a single line