genesys: Fix host-side calibration when scan start position is not zero

merge-requests/335/head
Povilas Kanapickas 2020-02-15 14:12:44 +02:00
rodzic 6e7fc639f5
commit 2428efd6af
8 zmienionych plików z 16 dodań i 9 usunięć

Wyświetl plik

@ -816,7 +816,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
dev->line_count = 0;
build_image_pipeline(dev, session);
build_image_pipeline(dev, sensor, session);
// MAXWD is expressed in 2 words unit

Wyświetl plik

@ -550,7 +550,7 @@ void CommandSetGl646::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->read_buffer.clear();
dev->read_buffer.alloc(session.buffer_size_read);
build_image_pipeline(dev, session);
build_image_pipeline(dev, sensor, session);
dev->read_active = true;

Wyświetl plik

@ -1615,7 +1615,7 @@ dummy \ scanned lines
dev->read_buffer.clear();
dev->read_buffer.alloc(session.buffer_size_read);
build_image_pipeline(dev, session);
build_image_pipeline(dev, sensor, session);
dev->read_active = true;

Wyświetl plik

@ -1240,7 +1240,7 @@ void CommandSetGl843::init_regs_for_scan_session(Genesys_Device* dev, const Gene
dev->read_buffer.clear();
dev->read_buffer.alloc(session.buffer_size_read);
build_image_pipeline(dev, session);
build_image_pipeline(dev, sensor, session);
dev->read_active = true;

Wyświetl plik

@ -662,7 +662,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
reg->set16(REG_STRPIXEL, session.pixel_startx);
reg->set16(REG_ENDPIXEL, session.pixel_endx);
build_image_pipeline(dev, session);
build_image_pipeline(dev, sensor, session);
/* MAXWD is expressed in 4 words unit */
// BUG: we shouldn't multiply by channels here

Wyświetl plik

@ -669,7 +669,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
reg->set16(REG_STRPIXEL, session.pixel_startx);
reg->set16(REG_ENDPIXEL, session.pixel_endx);
build_image_pipeline(dev, session);
build_image_pipeline(dev, sensor, session);
/* MAXWD is expressed in 4 words unit */
// BUG: we shouldn't multiply by channels here

Wyświetl plik

@ -1252,7 +1252,8 @@ static FakeBufferModel get_fake_usb_buffer_model(const ScanSession& session)
return model;
}
void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
void build_image_pipeline(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session)
{
static unsigned s_pipeline_index = 0;
@ -1361,9 +1362,14 @@ void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
!has_flag(dev->model->flags, ModelFlag::NO_CALIBRATION) &&
!has_flag(session.params.flags, ScanFlag::DISABLE_SHADING))
{
unsigned pixel_shift = session.params.startx * dev->calib_session.params.xres /
sensor.optical_res;
if (dev->model->model_id == ModelId::CANON_4400F) {
pixel_shift = session.params.startx;
}
dev->pipeline.push_node<ImagePipelineNodeCalibrate>(dev->dark_average_data,
dev->white_average_data,
dev->calib_session.params.startx *
pixel_shift *
dev->calib_session.params.channels);
if (DBG_LEVEL >= DBG_io2) {

Wyświetl plik

@ -407,7 +407,8 @@ extern void sanei_genesys_generate_gamma_buffer(Genesys_Device* dev,
void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Sensor& sensor);
void build_image_pipeline(Genesys_Device* dev, const ScanSession& session);
void build_image_pipeline(Genesys_Device* dev, const Genesys_Sensor& sensor,
const ScanSession& session);
std::uint8_t compute_frontend_gain(float value, float target_value,
FrontendType frontend_type);