kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Deduplicate calculation of scan line count
rodzic
b5b50758f5
commit
8d2081cda8
|
@ -885,8 +885,7 @@ void CommandSetGl124::init_regs_for_scan_session(Genesys_Device* dev, const Gene
|
|||
mflags |= MotorFlag::REVERSE;
|
||||
}
|
||||
gl124_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
|
||||
dev->model->is_cis ? session.output_line_count * session.params.channels :
|
||||
session.output_line_count,
|
||||
session.optical_line_count,
|
||||
dummy, move, session.params.scan_mode, mflags);
|
||||
|
||||
/*** prepares data reordering ***/
|
||||
|
|
|
@ -1603,16 +1603,13 @@ dummy \ scanned lines
|
|||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);*/
|
||||
|
||||
if (has_flag(session.params.flags, ScanFlag::SINGLE_LINE)) {
|
||||
gl841_init_motor_regs_off(reg, dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count);
|
||||
gl841_init_motor_regs_off(reg, session.optical_line_count);
|
||||
} else {
|
||||
auto motor_flag = has_flag(session.params.flags, ScanFlag::DISABLE_BUFFER_FULL_MOVE) ?
|
||||
MotorFlag::DISABLE_BUFFER_FULL_MOVE : MotorFlag::NONE;
|
||||
|
||||
gl841_init_motor_regs_scan(dev, sensor, reg, exposure_time, slope_dpi, scan_step_type,
|
||||
dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count,
|
||||
dummy, move, motor_flag);
|
||||
session.optical_line_count, dummy, move, motor_flag);
|
||||
}
|
||||
|
||||
dev->read_buffer.clear();
|
||||
|
|
|
@ -1196,11 +1196,8 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene
|
|||
mflags |= MotorFlag::REVERSE;
|
||||
}
|
||||
|
||||
unsigned scan_lines = dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count;
|
||||
|
||||
gl843_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure, slope_dpi,
|
||||
scan_lines, dummy, session.params.starty, mflags);
|
||||
session.optical_line_count, dummy, session.params.starty, mflags);
|
||||
|
||||
dev->read_buffer.clear();
|
||||
dev->read_buffer.alloc(session.buffer_size_read);
|
||||
|
|
|
@ -736,9 +736,7 @@ void CommandSetGl846::init_regs_for_scan_session(Genesys_Device* dev, const Gene
|
|||
}
|
||||
|
||||
gl846_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
|
||||
dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count,
|
||||
dummy, move, mflags);
|
||||
session.optical_line_count, dummy, move, mflags);
|
||||
|
||||
/*** prepares data reordering ***/
|
||||
|
||||
|
|
|
@ -740,9 +740,7 @@ void CommandSetGl847::init_regs_for_scan_session(Genesys_Device* dev, const Gene
|
|||
}
|
||||
|
||||
gl847_init_motor_regs_scan(dev, sensor, reg, motor_profile, exposure_time, slope_dpi,
|
||||
dev->model->is_cis ? session.output_line_count * session.params.channels
|
||||
: session.output_line_count,
|
||||
dummy, move, mflags);
|
||||
session.optical_line_count, dummy, move, mflags);
|
||||
|
||||
dev->read_buffer.clear();
|
||||
dev->read_buffer.alloc(session.buffer_size_read);
|
||||
|
|
|
@ -516,7 +516,7 @@ Image read_unshuffled_image_from_scanner(Genesys_Device* dev, const ScanSession&
|
|||
dev->model->line_mode_color_order);
|
||||
|
||||
auto width = get_pixels_from_row_bytes(format, session.output_line_bytes_raw);
|
||||
auto height = session.output_line_count * (dev->model->is_cis ? session.params.channels : 1);
|
||||
auto height = session.optical_line_count;
|
||||
|
||||
Image image(width, height, format);
|
||||
|
||||
|
@ -1103,6 +1103,8 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se
|
|||
}
|
||||
|
||||
s.output_line_count = s.params.lines + s.max_color_shift_lines + s.num_staggered_lines;
|
||||
s.optical_line_count = dev->model->is_cis ? s.output_line_count * s.params.channels
|
||||
: s.output_line_count;
|
||||
|
||||
s.output_channel_bytes = multiply_by_depth_ceil(s.output_pixels, s.params.depth);
|
||||
s.output_line_bytes = s.output_channel_bytes * s.params.channels;
|
||||
|
@ -1261,7 +1263,7 @@ void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
|
|||
return true;
|
||||
};
|
||||
|
||||
auto lines = session.output_line_count * (dev->model->is_cis ? session.params.channels : 1);
|
||||
auto lines = session.optical_line_count;
|
||||
|
||||
dev->pipeline.clear();
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ std::ostream& operator<<(std::ostream& out, const ScanSession& session)
|
|||
<< " optical_resolution: " << session.optical_resolution << '\n'
|
||||
<< " optical_pixels: " << session.optical_pixels << '\n'
|
||||
<< " optical_pixels_raw: " << session.optical_pixels_raw << '\n'
|
||||
<< " optical_line_count: " << session.optical_line_count << '\n'
|
||||
<< " output_resolution: " << session.output_resolution << '\n'
|
||||
<< " output_pixels: " << session.output_pixels << '\n'
|
||||
<< " output_line_bytes: " << session.output_line_bytes << '\n'
|
||||
|
|
|
@ -228,6 +228,9 @@ struct ScanSession {
|
|||
// only on gl846, g847
|
||||
unsigned optical_pixels_raw = 0;
|
||||
|
||||
// the number of optical scan lines. Equal to output_line_count on CCD scanners.
|
||||
unsigned optical_line_count = 0;
|
||||
|
||||
// the resolution of the output data.
|
||||
// gl843-only
|
||||
unsigned output_resolution = 0;
|
||||
|
|
Ładowanie…
Reference in New Issue