From 80d0129f4415a55325f53f3622802f05d4e8f6e5 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Thu, 12 Sep 2019 22:40:55 +0300 Subject: [PATCH] genesys: Pass start pixel to *_init_optical_regs_scan() via session --- backend/genesys_gl124.cc | 23 +++++++++-------------- backend/genesys_gl846.cc | 23 ++++++++--------------- backend/genesys_gl847.cc | 23 ++++++++--------------- 3 files changed, 25 insertions(+), 44 deletions(-) diff --git a/backend/genesys_gl124.cc b/backend/genesys_gl124.cc index 409939bca..7ca4c4b94 100644 --- a/backend/genesys_gl124.cc +++ b/backend/genesys_gl124.cc @@ -778,10 +778,9 @@ static void gl124_setup_sensor(Genesys_Device * dev, */ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor, Genesys_Register_Set* reg, unsigned int exposure_time, - const ScanSession& session, unsigned int start) + const ScanSession& session) { - DBG_HELPER_ARGS(dbg, "exposure_time=%d, start=%d\n", - exposure_time, start); + DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time); unsigned int segcnt; unsigned int startx, endx; unsigned int dpihw; @@ -804,6 +803,12 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens /* start and end coordinate in optical dpi coordinates */ /* startx = start / ccd_pixels_per_system_pixel + sensor.dummy_pixel; XXX STEF XXX */ + unsigned start = session.params.startx; + + if (session.num_staggered_lines > 0) { + start |= 1; + } + startx = start / ccd_pixels_per_system_pixel; endx = startx + session.optical_pixels / ccd_pixels_per_system_pixel; @@ -1003,7 +1008,6 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens DBG_HELPER(dbg); session.assert_computed(); - int start; int move; unsigned int mflags; int exposure_time; @@ -1014,15 +1018,6 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens DBG (DBG_info, "%s: optical_res=%d\n", __func__, session.optical_resolution); - /* compute scan parameters values */ - /* pixels are allways given at full optical resolution */ - /* use detected left margin and fixed value */ - start = session.params.startx; - - if (session.num_staggered_lines > 0) { - start |= 1; - } - /* cis color scan is effectively a gray scan with 3 gray lines per color line and a FILTER of 0 */ if (dev->model->is_cis) { slope_dpi = session.params.yres * session.params.channels; @@ -1057,7 +1052,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens */ // now _LOGICAL_ optical values used are known, setup registers - gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, start); + gl124_init_optical_regs_scan(dev, sensor, reg, exposure_time, session); /* add tl_y to base movement */ move = session.params.starty; diff --git a/backend/genesys_gl846.cc b/backend/genesys_gl846.cc index 5d4acceea..6d72a7343 100644 --- a/backend/genesys_gl846.cc +++ b/backend/genesys_gl846.cc @@ -681,9 +681,9 @@ static void gl846_init_motor_regs_scan(Genesys_Device* dev, */ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor, Genesys_Register_Set* reg, unsigned int exposure_time, - const ScanSession& session, unsigned int start) + const ScanSession& session) { - DBG_HELPER_ARGS(dbg, "exposure_time=%d, start=%d", exposure_time, start); + DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time); unsigned int words_per_line; unsigned int dpihw; GenesysRegister *r; @@ -702,6 +702,11 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens gl846_setup_sensor(dev, sensor, sensor_profile, reg); // start and end coordinate in optical dpi coordinates + unsigned start = session.params.startx; + + if (session.num_staggered_lines > 0) { + start |= 1; + } unsigned startx = start / ccd_pixels_per_system_pixel + sensor.CCD_start_xoffset; unsigned endx = startx + session.optical_pixels / ccd_pixels_per_system_pixel; @@ -888,7 +893,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens DBG_HELPER(dbg); session.assert_computed(); - int start; int move; unsigned int mflags; /**> motor flags */ int exposure_time; @@ -897,17 +901,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens int dummy = 0; int scan_step_type = 1; - /* compute scan parameters values */ - /* pixels are allways given at full optical resolution */ - /* use detected left margin and fixed value */ - /* start */ - /* add x coordinates */ - start = session.params.startx; - - if (session.num_staggered_lines > 0) { - start |= 1; - } - dummy = 3-session.params.channels; /* slope_dpi */ @@ -939,7 +932,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens /* we enable true gray for cis scanners only, and just when doing * scan since color calibration is OK for this mode */ - gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, start); + gl846_init_optical_regs_scan(dev, sensor, reg, exposure_time, session); /*** motor parameters ***/ diff --git a/backend/genesys_gl847.cc b/backend/genesys_gl847.cc index fbe6b6e8a..4cc1f6af9 100644 --- a/backend/genesys_gl847.cc +++ b/backend/genesys_gl847.cc @@ -698,9 +698,9 @@ static void gl847_init_motor_regs_scan(Genesys_Device* dev, */ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sensor& sensor, Genesys_Register_Set* reg, unsigned int exposure_time, - const ScanSession& session, unsigned int start) + const ScanSession& session) { - DBG_HELPER_ARGS(dbg, "exposure_time=%d, start=%d", exposure_time, start); + DBG_HELPER_ARGS(dbg, "exposure_time=%d", exposure_time); unsigned dpiset, dpihw; GenesysRegister *r; @@ -718,6 +718,11 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens gl847_setup_sensor(dev, sensor, sensor_profile, reg); dpiset = session.params.xres * ccd_pixels_per_system_pixel; + unsigned start = session.params.startx; + if (session.num_staggered_lines > 0) { + start |= 1; + } + // start and end coordinate in optical dpi coordinates unsigned startx = start / ccd_pixels_per_system_pixel + sensor.CCD_start_xoffset; unsigned endx = startx + session.optical_pixels / ccd_pixels_per_system_pixel; @@ -902,7 +907,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens DBG_HELPER(dbg); session.assert_computed(); - int start; int move; unsigned int mflags; /**> motor flags */ int exposure_time; @@ -911,17 +915,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens int dummy = 0; int scan_step_type = 1; - /* compute scan parameters values */ - /* pixels are allways given at full optical resolution */ - /* use detected left margin and fixed value */ - /* start */ - /* add x coordinates */ - start = session.params.startx; - - if (session.num_staggered_lines > 0) { - start |= 1; - } - dummy = 3 - session.params.channels; /* slope_dpi */ @@ -953,7 +946,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens /* we enable true gray for cis scanners only, and just when doing * scan since color calibration is OK for this mode */ - gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, session, start); + gl847_init_optical_regs_scan(dev, sensor, reg, exposure_time, session); move = session.params.starty; DBG(DBG_info, "%s: move=%d steps\n", __func__, move);