kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Use common code path to compute session num_staggered_lines
rodzic
6b7052c4cf
commit
453a6b75be
|
@ -1071,7 +1071,6 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
unsigned int mflags;
|
unsigned int mflags;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
|
@ -1081,20 +1080,12 @@ 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);
|
DBG (DBG_info, "%s: optical_res=%d\n", __func__, session.optical_resolution);
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG (DBG_info, "gl124_init_scan_regs : stagger=%d lines\n", stagger);
|
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at full optical resolution */
|
/* pixels are allways given at full optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
start = session.params.startx;
|
start = session.params.startx;
|
||||||
|
|
||||||
if (stagger > 0) {
|
if (session.num_staggered_lines > 0) {
|
||||||
start |= 1;
|
start |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,7 +1134,7 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres,
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres,
|
||||||
session.params.flags);
|
session.params.flags);
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
/* add tl_y to base movement */
|
/* add tl_y to base movement */
|
||||||
move = session.params.starty;
|
move = session.params.starty;
|
||||||
|
@ -1172,8 +1163,8 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
requested_buffer_size = 16 * bytes_per_line;
|
requested_buffer_size = 16 * bytes_per_line;
|
||||||
|
|
||||||
read_buffer_size = 2 * requested_buffer_size +
|
read_buffer_size = 2 * requested_buffer_size +
|
||||||
((max_shift + stagger) * session.optical_pixels * session.params.channels *
|
((max_shift + session.num_staggered_lines) * session.optical_pixels *
|
||||||
session.params.depth) / 8;
|
session.params.channels * session.params.depth) / 8;
|
||||||
|
|
||||||
dev->read_buffer.clear();
|
dev->read_buffer.clear();
|
||||||
dev->read_buffer.alloc(read_buffer_size);
|
dev->read_buffer.alloc(read_buffer_size);
|
||||||
|
@ -1199,8 +1190,8 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
dev->total_bytes_read = 0;
|
dev->total_bytes_read = 0;
|
||||||
if (session.params.depth == 1) {
|
if (session.params.depth == 1) {
|
||||||
|
@ -1222,7 +1213,6 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
|
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int max_shift, dpihw;
|
int max_shift, dpihw;
|
||||||
|
|
||||||
|
@ -1272,15 +1262,7 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
session.ccd_size_divisor);
|
session.ccd_size_divisor);
|
||||||
dev->segnb = sensor_profile.custom_regs.get_value(0x98) & 0x0f;
|
dev->segnb = sensor_profile.custom_regs.get_value(0x98) & 0x0f;
|
||||||
|
|
||||||
/* stagger */
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG (DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
|
||||||
|
|
||||||
dev->session = session;
|
dev->session = session;
|
||||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res;
|
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res;
|
||||||
|
@ -1289,8 +1271,8 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -362,7 +362,7 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
||||||
unsigned int bpp; /**> bytes per pixel */
|
unsigned int bpp; /**> bytes per pixel */
|
||||||
uint32_t z1, z2;
|
uint32_t z1, z2;
|
||||||
uint16_t ex, sx;
|
uint16_t ex, sx;
|
||||||
int stagger, words_per_line, max_shift;
|
int words_per_line, max_shift;
|
||||||
size_t requested_buffer_size;
|
size_t requested_buffer_size;
|
||||||
size_t read_buffer_size;
|
size_t read_buffer_size;
|
||||||
SANE_Int xresolution;
|
SANE_Int xresolution;
|
||||||
|
@ -565,18 +565,9 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
||||||
linecnt = (linecnt * motor->ydpi) / session.params.yres + max_shift;
|
linecnt = (linecnt * motor->ydpi) / session.params.yres + max_shift;
|
||||||
|
|
||||||
/* at QUATER_STEP lines are 'staggered' and need correction */
|
/* at QUATER_STEP lines are 'staggered' and need correction */
|
||||||
stagger = 0;
|
linecnt += session.num_staggered_lines;
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
// for HP3670, stagger happens only at >=1200 dpi
|
|
||||||
if ((dev->model->motor_type != MOTOR_HP3670 && dev->model->motor_type != MOTOR_HP2400)
|
|
||||||
|| session.params.yres >= (unsigned) sensor.optical_res)
|
|
||||||
{
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
linecnt += stagger;
|
|
||||||
|
|
||||||
DBG(DBG_info, "%s : max_shift=%d, stagger=%d lines\n", __func__, max_shift, stagger);
|
DBG(DBG_info, "%s : max_shift=%d lines\n", __func__, max_shift);
|
||||||
|
|
||||||
/* CIS scanners read one line per color channel
|
/* CIS scanners read one line per color channel
|
||||||
* since gray mode use 'add' we also read 3 channels even not in
|
* since gray mode use 'add' we also read 3 channels even not in
|
||||||
|
@ -625,13 +616,12 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
||||||
/* move distance must be adjusted to take into account the extra lines
|
/* move distance must be adjusted to take into account the extra lines
|
||||||
* read to reorder data */
|
* read to reorder data */
|
||||||
feedl = move;
|
feedl = move;
|
||||||
if (stagger + max_shift > 0 && feedl != 0)
|
if (session.num_staggered_lines + max_shift > 0 && feedl != 0) {
|
||||||
{
|
int feed_offset = ((max_shift + session.num_staggered_lines) * dev->motor.optical_ydpi) /
|
||||||
if (feedl >
|
motor->ydpi;
|
||||||
((max_shift + stagger) * dev->motor.optical_ydpi) / motor->ydpi)
|
if (feedl > feed_offset) {
|
||||||
feedl =
|
feedl = feedl - feed_offset;
|
||||||
feedl -
|
}
|
||||||
((max_shift + stagger) * dev->motor.optical_ydpi) / motor->ydpi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we assume all scans are done with 2 tables */
|
/* we assume all scans are done with 2 tables */
|
||||||
|
@ -778,7 +768,8 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
||||||
/* we must use a round number of words_per_line */
|
/* we must use a round number of words_per_line */
|
||||||
requested_buffer_size = 8 * words_per_line;
|
requested_buffer_size = 8 * words_per_line;
|
||||||
read_buffer_size = 2 * requested_buffer_size +
|
read_buffer_size = 2 * requested_buffer_size +
|
||||||
((max_shift + stagger) * session.params.pixels * session.params.channels * session.params.depth) / 8;
|
((max_shift + session.num_staggered_lines) * session.params.pixels *
|
||||||
|
session.params.channels * session.params.depth) / 8;
|
||||||
|
|
||||||
dev->read_buffer.clear();
|
dev->read_buffer.clear();
|
||||||
dev->read_buffer.alloc(read_buffer_size);
|
dev->read_buffer.alloc(read_buffer_size);
|
||||||
|
@ -804,8 +795,8 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
||||||
dev->current_setup.exposure_time = sensor.exposure_lperiod;
|
dev->current_setup.exposure_time = sensor.exposure_lperiod;
|
||||||
dev->current_setup.xres = sensor.real_resolution;
|
dev->current_setup.xres = sensor.real_resolution;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
/* total_bytes_to_read is the number of byte to send to frontend
|
/* total_bytes_to_read is the number of byte to send to frontend
|
||||||
* total_bytes_read is the number of bytes sent to frontend
|
* total_bytes_read is the number of bytes sent to frontend
|
||||||
|
|
|
@ -1767,7 +1767,6 @@ static void gl841_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
int move;
|
int move;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
int avg;
|
int avg;
|
||||||
|
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
|
@ -1804,15 +1803,6 @@ independent of our calculated values:
|
||||||
dev->bytes_to_read
|
dev->bytes_to_read
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
|
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG(DBG_info, "%s : stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
gl841_assert_supported_resolution(session);
|
gl841_assert_supported_resolution(session);
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
|
@ -1824,8 +1814,9 @@ independent of our calculated values:
|
||||||
|
|
||||||
start += sensor.dummy_pixel + 1;
|
start += sensor.dummy_pixel + 1;
|
||||||
|
|
||||||
if (stagger > 0)
|
if (session.num_staggered_lines > 0) {
|
||||||
start |= 1;
|
start |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* in case of SHDAREA, we need to align start
|
/* in case of SHDAREA, we need to align start
|
||||||
* on pixel average factor, startx is different of
|
* on pixel average factor, startx is different of
|
||||||
|
@ -1906,7 +1897,7 @@ dummy \ scanned lines
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels,
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels,
|
||||||
session.params.yres, session.params.flags);
|
session.params.yres, session.params.flags);
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
move = session.params.starty;
|
move = session.params.starty;
|
||||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
||||||
|
@ -1948,7 +1939,8 @@ dummy \ scanned lines
|
||||||
}
|
}
|
||||||
|
|
||||||
read_buffer_size = 2 * requested_buffer_size +
|
read_buffer_size = 2 * requested_buffer_size +
|
||||||
((max_shift + stagger) * session.optical_pixels * session.params.channels * session.params.depth) / 8;
|
((max_shift + session.num_staggered_lines) * session.optical_pixels *
|
||||||
|
session.params.channels * session.params.depth) / 8;
|
||||||
|
|
||||||
dev->read_buffer.clear();
|
dev->read_buffer.clear();
|
||||||
dev->read_buffer.alloc(read_buffer_size);
|
dev->read_buffer.alloc(read_buffer_size);
|
||||||
|
@ -1973,8 +1965,8 @@ dummy \ scanned lines
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
/* TODO: should this be done elsewhere? */
|
/* TODO: should this be done elsewhere? */
|
||||||
/* scan bytes to send to the frontend */
|
/* scan bytes to send to the frontend */
|
||||||
|
@ -2010,7 +2002,6 @@ static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Se
|
||||||
|
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
@ -2044,15 +2035,6 @@ static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Se
|
||||||
|
|
||||||
gl841_compute_session(dev, session, sensor);
|
gl841_compute_session(dev, session, sensor);
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
|
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
gl841_assert_supported_resolution(session);
|
gl841_assert_supported_resolution(session);
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
|
@ -2062,9 +2044,9 @@ static void gl841_calculate_current_setup(Genesys_Device * dev, const Genesys_Se
|
||||||
|
|
||||||
start += sensor.dummy_pixel + 1;
|
start += sensor.dummy_pixel + 1;
|
||||||
|
|
||||||
if (stagger > 0) {
|
if (session.num_staggered_lines > 0) {
|
||||||
start |= 1;
|
start |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dummy lines: may not be usefull, for instance 250 dpi works with 0 or 1
|
/* dummy lines: may not be usefull, for instance 250 dpi works with 0 or 1
|
||||||
dummy line. Maybe the dummy line adds correctness since the motor runs
|
dummy line. Maybe the dummy line adds correctness since the motor runs
|
||||||
|
@ -2114,7 +2096,7 @@ dummy \ scanned lines
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels,
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels,
|
||||||
session.params.yres, 0);
|
session.params.yres, 0);
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
dev->session = session;
|
dev->session = session;
|
||||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution;
|
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution;
|
||||||
|
@ -2122,8 +2104,8 @@ dummy \ scanned lines
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for fast power saving methods only, like disabling certain amplifiers
|
// for fast power saving methods only, like disabling certain amplifiers
|
||||||
|
|
|
@ -1197,14 +1197,7 @@ static void gl843_compute_session(Genesys_Device* dev, ScanSession& s,
|
||||||
// to retrieve from the chip
|
// to retrieve from the chip
|
||||||
s.output_pixels = (s.optical_pixels * s.output_resolution) / s.optical_resolution;
|
s.output_pixels = (s.optical_pixels * s.output_resolution) / s.optical_resolution;
|
||||||
|
|
||||||
// Note: staggering is not applied for calibration. Staggering starts at 2400 dpi
|
|
||||||
s.num_staggered_lines = 0;
|
|
||||||
if ((s.params.yres > 1200) &&
|
|
||||||
((s.params.flags & SCAN_FLAG_IGNORE_LINE_DISTANCE) == 0) &&
|
|
||||||
(dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
|
||||||
{
|
|
||||||
s.num_staggered_lines = (4 * s.params.yres) / dev->motor.base_ydpi;
|
|
||||||
}
|
|
||||||
|
|
||||||
s.max_color_shift_lines = sanei_genesys_compute_max_shift(dev, s.params.channels,
|
s.max_color_shift_lines = sanei_genesys_compute_max_shift(dev, s.params.channels,
|
||||||
s.params.yres, s.params.flags);
|
s.params.yres, s.params.flags);
|
||||||
|
@ -1383,7 +1376,6 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure;
|
int exposure;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int max_shift;
|
int max_shift;
|
||||||
|
|
||||||
|
@ -1428,14 +1420,6 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
gl843_compute_session(dev, session, sensor);
|
gl843_compute_session(dev, session, sensor);
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at half or full CCD optical resolution */
|
/* pixels are allways given at half or full CCD optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
@ -1463,7 +1447,7 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
session.params.yres, 0);
|
session.params.yres, 0);
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
dev->session = session;
|
dev->session = session;
|
||||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution;
|
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / session.optical_resolution;
|
||||||
|
@ -1472,8 +1456,8 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
dev->current_setup.exposure_time = exposure;
|
dev->current_setup.exposure_time = exposure;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
DBG(DBG_proc, "%s: completed\n", __func__);
|
DBG(DBG_proc, "%s: completed\n", __func__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -956,7 +956,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
unsigned int mflags; /**> motor flags */
|
unsigned int mflags; /**> motor flags */
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
@ -964,14 +963,6 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
int max_shift;
|
int max_shift;
|
||||||
size_t requested_buffer_size, read_buffer_size;
|
size_t requested_buffer_size, read_buffer_size;
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG(DBG_info, "%s : stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at full optical resolution */
|
/* pixels are allways given at full optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
@ -979,7 +970,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
/* add x coordinates */
|
/* add x coordinates */
|
||||||
start = session.params.startx;
|
start = session.params.startx;
|
||||||
|
|
||||||
if (stagger > 0) {
|
if (session.num_staggered_lines > 0) {
|
||||||
start |= 1;
|
start |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,8 +1013,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres,
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres,
|
||||||
session.params.flags);
|
session.params.flags);
|
||||||
|
|
||||||
/* lincnt */
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
|
||||||
|
|
||||||
/* add tl_y to base movement */
|
/* add tl_y to base movement */
|
||||||
move = session.params.starty;
|
move = session.params.starty;
|
||||||
|
@ -1050,7 +1040,7 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
requested_buffer_size = 8 * bytes_per_line;
|
requested_buffer_size = 8 * bytes_per_line;
|
||||||
|
|
||||||
read_buffer_size = 2 * requested_buffer_size +
|
read_buffer_size = 2 * requested_buffer_size +
|
||||||
((max_shift + stagger) * session.optical_pixels * session.params.channels *
|
((max_shift + session.num_staggered_lines) * session.optical_pixels * session.params.channels *
|
||||||
session.params.depth) / 8;
|
session.params.depth) / 8;
|
||||||
|
|
||||||
dev->read_buffer.clear();
|
dev->read_buffer.clear();
|
||||||
|
@ -1076,8 +1066,8 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
/* TODO: should this be done elsewhere? */
|
/* TODO: should this be done elsewhere? */
|
||||||
/* scan bytes to send to the frontend */
|
/* scan bytes to send to the frontend */
|
||||||
|
@ -1114,7 +1104,6 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int slope_dpi;
|
int slope_dpi;
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
@ -1145,13 +1134,6 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
gl846_compute_session(dev, session, sensor);
|
gl846_compute_session(dev, session, sensor);
|
||||||
|
|
||||||
if (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at half or full CCD optical resolution */
|
/* pixels are allways given at half or full CCD optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
@ -1174,7 +1156,7 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres, 0);
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres, 0);
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
dev->session = session;
|
dev->session = session;
|
||||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res;
|
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / sensor.optical_res;
|
||||||
|
@ -1182,8 +1164,8 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for fast power saving methods only, like disabling certain amplifiers
|
// for fast power saving methods only, like disabling certain amplifiers
|
||||||
|
|
|
@ -975,7 +975,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
unsigned int mflags; /**> motor flags */
|
unsigned int mflags; /**> motor flags */
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
@ -983,14 +982,6 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
int max_shift;
|
int max_shift;
|
||||||
size_t requested_buffer_size, read_buffer_size;
|
size_t requested_buffer_size, read_buffer_size;
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
if (session.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
DBG(DBG_info, "%s : stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at full optical resolution */
|
/* pixels are allways given at full optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
@ -998,7 +989,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
/* add x coordinates */
|
/* add x coordinates */
|
||||||
start = session.params.startx;
|
start = session.params.startx;
|
||||||
|
|
||||||
if (stagger > 0) {
|
if (session.num_staggered_lines > 0) {
|
||||||
start |= 1;
|
start |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,7 +1032,7 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres,
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres,
|
||||||
session.params.flags);
|
session.params.flags);
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
move = session.params.starty;
|
move = session.params.starty;
|
||||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
||||||
|
@ -1067,8 +1058,8 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
requested_buffer_size = 8 * bytes_per_line;
|
requested_buffer_size = 8 * bytes_per_line;
|
||||||
|
|
||||||
read_buffer_size = 2 * requested_buffer_size +
|
read_buffer_size = 2 * requested_buffer_size +
|
||||||
((max_shift + stagger) * session.optical_pixels * session.params.channels *
|
((max_shift + session.num_staggered_lines) * session.optical_pixels *
|
||||||
session.params.depth) / 8;
|
session.params.channels * session.params.depth) / 8;
|
||||||
|
|
||||||
dev->read_buffer.clear();
|
dev->read_buffer.clear();
|
||||||
dev->read_buffer.alloc(read_buffer_size);
|
dev->read_buffer.alloc(read_buffer_size);
|
||||||
|
@ -1093,8 +1084,8 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
/* TODO: should this be done elsewhere? */
|
/* TODO: should this be done elsewhere? */
|
||||||
/* scan bytes to send to the frontend */
|
/* scan bytes to send to the frontend */
|
||||||
|
@ -1130,7 +1121,6 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int stagger;
|
|
||||||
|
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
@ -1166,15 +1156,6 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
/* optical_res */
|
/* optical_res */
|
||||||
optical_res = sensor.optical_res;
|
optical_res = sensor.optical_res;
|
||||||
|
|
||||||
/* stagger */
|
|
||||||
if (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE) {
|
|
||||||
stagger = (4 * session.params.yres) / dev->motor.base_ydpi;
|
|
||||||
} else {
|
|
||||||
stagger = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at half or full CCD optical resolution */
|
/* pixels are allways given at half or full CCD optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
@ -1198,7 +1179,7 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres, 0);
|
max_shift = sanei_genesys_compute_max_shift(dev, session.params.channels, session.params.yres, 0);
|
||||||
|
|
||||||
lincnt = session.params.lines + max_shift + stagger;
|
lincnt = session.params.lines + max_shift + session.num_staggered_lines;
|
||||||
|
|
||||||
dev->session = session;
|
dev->session = session;
|
||||||
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / optical_res;
|
dev->current_setup.pixels = (session.optical_pixels * session.params.xres) / optical_res;
|
||||||
|
@ -1206,8 +1187,8 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = session.params.xres;
|
dev->current_setup.xres = session.params.xres;
|
||||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = session.num_staggered_lines;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + session.num_staggered_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for fast power saving methods only, like disabling certain amplifiers
|
// for fast power saving methods only, like disabling certain amplifiers
|
||||||
|
|
|
@ -1179,6 +1179,45 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor&
|
||||||
// In quarter-CCD mode optical_pixels is 4x larger than the actual physical number
|
// In quarter-CCD mode optical_pixels is 4x larger than the actual physical number
|
||||||
s.optical_pixels = align_int_up(s.optical_pixels, 2 * s.ccd_size_divisor);
|
s.optical_pixels = align_int_up(s.optical_pixels, 2 * s.ccd_size_divisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO output_pixels
|
||||||
|
|
||||||
|
// Note: staggering is not applied for calibration. Staggering starts at 2400 dpi
|
||||||
|
s.num_staggered_lines = 0;
|
||||||
|
|
||||||
|
if (dev->model->asic_type == AsicType::GL124 ||
|
||||||
|
dev->model->asic_type == AsicType::GL841 ||
|
||||||
|
dev->model->asic_type == AsicType::GL845 ||
|
||||||
|
dev->model->asic_type == AsicType::GL846 ||
|
||||||
|
dev->model->asic_type == AsicType::GL847)
|
||||||
|
{
|
||||||
|
if (s.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||||
|
s.num_staggered_lines = (4 * s.params.yres) / dev->motor.base_ydpi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dev->model->asic_type == AsicType::GL646) {
|
||||||
|
if (s.ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)) {
|
||||||
|
// for HP3670, stagger happens only at >=1200 dpi
|
||||||
|
if ((dev->model->motor_type != MOTOR_HP3670 &&
|
||||||
|
dev->model->motor_type != MOTOR_HP2400) ||
|
||||||
|
s.params.yres >= (unsigned) sensor.optical_res)
|
||||||
|
{
|
||||||
|
s.num_staggered_lines = (4 * s.params.yres) / dev->motor.base_ydpi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (dev->model->asic_type == AsicType::GL843) {
|
||||||
|
if ((s.params.yres > 1200) && // FIXME: maybe ccd_size_divisor is the one that controls this?
|
||||||
|
((s.params.flags & SCAN_FLAG_IGNORE_LINE_DISTANCE) == 0) &&
|
||||||
|
(dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||||
|
{
|
||||||
|
s.num_staggered_lines = (4 * s.params.yres) / dev->motor.base_ydpi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief initialize device
|
/** @brief initialize device
|
||||||
|
|
|
@ -252,7 +252,6 @@ struct ScanSession {
|
||||||
unsigned output_line_count = 0;
|
unsigned output_line_count = 0;
|
||||||
|
|
||||||
// the number of staggered lines (i.e. lines that overlap during scanning due to line being
|
// the number of staggered lines (i.e. lines that overlap during scanning due to line being
|
||||||
// gl843-only
|
|
||||||
// thinner than the CCD element)
|
// thinner than the CCD element)
|
||||||
unsigned num_staggered_lines = 0;
|
unsigned num_staggered_lines = 0;
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue