diff --git a/backend/genesys_gl124.cc b/backend/genesys_gl124.cc index 340749b6a..dcff5bf3b 100644 --- a/backend/genesys_gl124.cc +++ b/backend/genesys_gl124.cc @@ -1042,9 +1042,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines; dev->total_bytes_read = 0; - dev->total_bytes_to_read = - multiply_by_depth_ceil(session.params.get_requested_pixels() * session.params.lines, - session.params.depth) * session.params.channels; + dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; DBG(DBG_info, "%s: total bytes to send to frontend = %lu\n", __func__, (u_long) dev->total_bytes_to_read); diff --git a/backend/genesys_gl646.cc b/backend/genesys_gl646.cc index bb729b86d..b3a5f7cba 100644 --- a/backend/genesys_gl646.cc +++ b/backend/genesys_gl646.cc @@ -706,9 +706,7 @@ static void gl646_setup_registers(Genesys_Device* dev, dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines; dev->total_bytes_read = 0; - dev->total_bytes_to_read = - multiply_by_depth_ceil(session.params.get_requested_pixels() * session.params.lines, - session.params.depth) * session.params.channels; + dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; /* select color filter based on settings */ regs->find_reg(0x04).value &= ~REG04_FILTER; diff --git a/backend/genesys_gl841.cc b/backend/genesys_gl841.cc index 16efdd59d..2a39874cc 100644 --- a/backend/genesys_gl841.cc +++ b/backend/genesys_gl841.cc @@ -1864,9 +1864,7 @@ dummy \ scanned lines dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines; dev->total_bytes_read = 0; - dev->total_bytes_to_read = - multiply_by_depth_ceil(session.params.get_requested_pixels() * session.params.lines, - session.params.depth) * session.params.channels; + dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read); } diff --git a/backend/genesys_gl843.cc b/backend/genesys_gl843.cc index 272ce4d12..fcc77fcea 100644 --- a/backend/genesys_gl843.cc +++ b/backend/genesys_gl843.cc @@ -1292,9 +1292,7 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines; dev->total_bytes_read = 0; - dev->total_bytes_to_read = - multiply_by_depth_ceil(session.params.get_requested_pixels() * session.params.lines, - session.params.depth) * session.params.channels; + dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read); } diff --git a/backend/genesys_gl846.cc b/backend/genesys_gl846.cc index 588969fe9..44c11ba32 100644 --- a/backend/genesys_gl846.cc +++ b/backend/genesys_gl846.cc @@ -916,9 +916,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines; dev->total_bytes_read = 0; - dev->total_bytes_to_read = - multiply_by_depth_ceil(session.params.get_requested_pixels() * session.params.lines, - session.params.depth) * session.params.channels; + dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read); } diff --git a/backend/genesys_gl847.cc b/backend/genesys_gl847.cc index 34e29e179..41a4f0a4a 100644 --- a/backend/genesys_gl847.cc +++ b/backend/genesys_gl847.cc @@ -927,9 +927,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines; dev->total_bytes_read = 0; - dev->total_bytes_to_read = - multiply_by_depth_ceil(session.params.get_requested_pixels() * session.params.lines, - session.params.depth) * session.params.channels; + dev->total_bytes_to_read = session.output_line_bytes_requested * session.params.lines; DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read); /* END TODO */ diff --git a/backend/genesys_low.cc b/backend/genesys_low.cc index 08b97f528..5cbe6f2fe 100644 --- a/backend/genesys_low.cc +++ b/backend/genesys_low.cc @@ -1522,6 +1522,9 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& s.params.depth); } + s.output_line_bytes_requested = multiply_by_depth_ceil( + s.params.get_requested_pixels() * s.params.channels, s.params.depth); + s.output_total_bytes_raw = s.output_line_bytes_raw * s.output_line_count; s.output_total_bytes = s.output_line_bytes * s.output_line_count; diff --git a/backend/genesys_settings.h b/backend/genesys_settings.h index 63173a4e8..7cedf36fe 100644 --- a/backend/genesys_settings.h +++ b/backend/genesys_settings.h @@ -251,6 +251,9 @@ struct ScanSession { // Equal to output_line_bytes if sensor does not have segments unsigned output_line_bytes_raw = 0; + // the number of bytes per line as requested by the frontend + unsigned output_line_bytes_requested = 0; + // the number of lines in the output of the scanner. This must be larger than the user // requested number due to line staggering and color channel shifting. unsigned output_line_count = 0;