kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Move setup of read buffer to a single function
rodzic
28d15784e4
commit
05ed63fa34
|
@ -951,9 +951,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
DBG (DBG_io2, "%s: pixels =%d\n", __func__, session.optical_pixels);
|
||||
DBG (DBG_io2, "%s: depth =%d\n", __func__, session.params.depth);
|
||||
|
||||
// BUG: we shouldn't multiply by channels here
|
||||
dev->oe_buffer.clear();
|
||||
dev->oe_buffer.alloc(session.output_line_bytes_raw * session.params.channels);
|
||||
build_image_pipeline(dev, session);
|
||||
|
||||
// MAXWD is expressed in 2 words unit
|
||||
|
||||
|
|
|
@ -1301,8 +1301,7 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
dev->out_buffer.clear();
|
||||
dev->out_buffer.alloc(session.buffer_size_out);
|
||||
|
||||
dev->oe_buffer.clear();
|
||||
dev->oe_buffer.alloc(session.output_line_bytes_raw * 2);
|
||||
build_image_pipeline(dev, session);
|
||||
|
||||
dev->read_bytes_left_after_deseg = session.output_line_bytes * session.output_line_count;
|
||||
|
||||
|
|
|
@ -821,9 +821,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
DBG (DBG_io2, "%s: pixels =%d\n", __func__, session.optical_pixels);
|
||||
DBG (DBG_io2, "%s: depth =%d\n", __func__, session.params.depth);
|
||||
|
||||
// BUG: we shouldn't multiply by channels here
|
||||
dev->oe_buffer.clear();
|
||||
dev->oe_buffer.alloc(session.output_line_bytes_raw * session.params.channels);
|
||||
build_image_pipeline(dev, session);
|
||||
|
||||
/* MAXWD is expressed in 4 words unit */
|
||||
// BUG: we shouldn't multiply by channels here
|
||||
|
|
|
@ -838,9 +838,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
DBG (DBG_io2, "%s: pixels =%d\n", __func__, session.optical_pixels);
|
||||
DBG (DBG_io2, "%s: depth =%d\n", __func__, session.params.depth);
|
||||
|
||||
// BUG: we shouldn't multiply by channels here
|
||||
dev->oe_buffer.clear();
|
||||
dev->oe_buffer.alloc(session.output_line_bytes_raw * session.params.channels);
|
||||
build_image_pipeline(dev, session);
|
||||
|
||||
/* MAXWD is expressed in 4 words unit */
|
||||
// BUG: we shouldn't multiply by channels here
|
||||
|
|
|
@ -1387,6 +1387,33 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor&
|
|||
compute_session_buffer_sizes(dev->model->asic_type, s);
|
||||
}
|
||||
|
||||
static std::size_t get_usb_buffer_read_size(AsicType asic, const ScanSession& session)
|
||||
{
|
||||
switch (asic) {
|
||||
case AsicType::GL646:
|
||||
// buffer not used on this chip set
|
||||
return 1;
|
||||
|
||||
case AsicType::GL124:
|
||||
case AsicType::GL846:
|
||||
case AsicType::GL847:
|
||||
// BUG: we shouldn't multiply by channels here
|
||||
return session.output_line_bytes_raw * session.params.channels;
|
||||
|
||||
case AsicType::GL843:
|
||||
return session.output_line_bytes_raw * 2;
|
||||
|
||||
default:
|
||||
throw SaneException("Unknown asic type");
|
||||
}
|
||||
}
|
||||
|
||||
void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
|
||||
{
|
||||
dev->oe_buffer.clear();
|
||||
dev->oe_buffer.alloc(get_usb_buffer_read_size(dev->model->asic_type, session));
|
||||
}
|
||||
|
||||
const SensorProfile& get_sensor_profile(AsicType asic_type, const Genesys_Sensor& sensor,
|
||||
unsigned dpi, unsigned ccd_size_divisor)
|
||||
{
|
||||
|
|
|
@ -638,6 +638,8 @@ extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
|
|||
|
||||
void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& sensor);
|
||||
|
||||
void build_image_pipeline(Genesys_Device* dev, const ScanSession& session);
|
||||
|
||||
void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buffer_dst, size_t size);
|
||||
|
||||
const SensorProfile& get_sensor_profile(AsicType asic_type, const Genesys_Sensor& sensor,
|
||||
|
|
Ładowanie…
Reference in New Issue