kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Wrap data into SetupParams in *_calculate_current_setup()
rodzic
6796315cc1
commit
9f3c86cd57
|
@ -1497,12 +1497,6 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
int depth;
|
int depth;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
float xres; /*dpi */
|
|
||||||
float yres; /*dpi */
|
|
||||||
float startx; /*optical_res, from dummy_pixel+1 */
|
|
||||||
float pixels;
|
|
||||||
float lines;
|
|
||||||
|
|
||||||
int used_res;
|
int used_res;
|
||||||
int used_pixels;
|
int used_pixels;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
|
@ -1533,30 +1527,29 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
start += dev->settings.tl_x;
|
start += dev->settings.tl_x;
|
||||||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||||
|
|
||||||
|
SetupParams params;
|
||||||
|
params.xres = dev->settings.xres;
|
||||||
|
params.yres = dev->settings.yres;
|
||||||
|
params.startx = start;
|
||||||
|
params.starty = 0; // not used
|
||||||
|
params.pixels = dev->settings.pixels;
|
||||||
|
params.lines = dev->settings.lines;
|
||||||
|
params.depth = depth;
|
||||||
|
params.channels = channels;
|
||||||
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
|
params.color_filter = dev->settings.color_filter;
|
||||||
|
params.flags = 0;
|
||||||
|
|
||||||
xres = dev->settings.xres;
|
half_ccd=compute_half_ccd(sensor, params.xres);
|
||||||
yres = dev->settings.yres;
|
|
||||||
startx = start;
|
|
||||||
pixels = dev->settings.pixels;
|
|
||||||
lines = dev->settings.lines;
|
|
||||||
|
|
||||||
half_ccd=compute_half_ccd(sensor, xres);
|
DBG(DBG_info, "%s ", __func__);
|
||||||
|
debug_dump(DBG_info, params);
|
||||||
DBG(DBG_info,
|
|
||||||
"%s:\n"
|
|
||||||
"Resolution : %gDPI/%gDPI\n"
|
|
||||||
"Lines : %g\n"
|
|
||||||
"PPL : %g\n"
|
|
||||||
"Startpos : %g\n"
|
|
||||||
"Half ccd : %d\n"
|
|
||||||
"Depth/Channels: %u/%u\n\n",
|
|
||||||
__func__, xres, yres, lines, pixels, startx, depth, half_ccd, channels);
|
|
||||||
|
|
||||||
/* optical_res */
|
/* optical_res */
|
||||||
optical_res = sensor.optical_res;
|
optical_res = sensor.optical_res;
|
||||||
|
|
||||||
if(xres<=optical_res)
|
if (params.xres <= (unsigned) optical_res)
|
||||||
used_res = xres;
|
used_res = params.xres;
|
||||||
else
|
else
|
||||||
used_res=optical_res;
|
used_res=optical_res;
|
||||||
|
|
||||||
|
@ -1565,15 +1558,15 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
used_pixels = (pixels * optical_res) / xres;
|
used_pixels = (params.pixels * optical_res) / params.xres;
|
||||||
DBG (DBG_info, "%s: used_pixels=%d\n", __func__, used_pixels);
|
DBG (DBG_info, "%s: used_pixels=%d\n", __func__, used_pixels);
|
||||||
|
|
||||||
/* exposure */
|
/* exposure */
|
||||||
exposure_time = gl124_compute_exposure (dev, xres, half_ccd);
|
exposure_time = gl124_compute_exposure (dev, params.xres, half_ccd);
|
||||||
DBG (DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
DBG (DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||||
|
|
||||||
/* max_shift */
|
/* max_shift */
|
||||||
max_shift=sanei_genesys_compute_max_shift(dev,channels,yres,0);
|
max_shift=sanei_genesys_compute_max_shift(dev, params.channels, params.yres, 0);
|
||||||
|
|
||||||
/* compute hw dpi for sensor */
|
/* compute hw dpi for sensor */
|
||||||
dpihw=sanei_genesys_compute_dpihw(dev, sensor,used_res);
|
dpihw=sanei_genesys_compute_dpihw(dev, sensor,used_res);
|
||||||
|
@ -1583,22 +1576,22 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
||||||
|
|
||||||
/* stagger */
|
/* stagger */
|
||||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||||
stagger = (4 * yres) / dev->motor.base_ydpi;
|
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||||
else
|
else
|
||||||
stagger = 0;
|
stagger = 0;
|
||||||
DBG (DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
DBG (DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = lines + max_shift + stagger;
|
lincnt = params.lines + max_shift + stagger;
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||||
DBG (DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
DBG (DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = params.depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = params.channels;
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = used_res;
|
dev->current_setup.xres = used_res;
|
||||||
dev->current_setup.yres = yres;
|
dev->current_setup.yres = params.yres;
|
||||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = stagger;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + stagger;
|
||||||
|
|
|
@ -2511,12 +2511,6 @@ static SANE_Status gl841_calculate_current_setup(Genesys_Device * dev, const Gen
|
||||||
int depth;
|
int depth;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
float xres;/*dpi*/
|
|
||||||
float yres;/*dpi*/
|
|
||||||
float startx;/*optical_res, from dummy_pixel+1*/
|
|
||||||
float pixels;
|
|
||||||
float lines;
|
|
||||||
|
|
||||||
int used_res;
|
int used_res;
|
||||||
int used_pixels;
|
int used_pixels;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
|
@ -2554,27 +2548,25 @@ static SANE_Status gl841_calculate_current_setup(Genesys_Device * dev, const Gen
|
||||||
|
|
||||||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||||
|
|
||||||
|
SetupParams params;
|
||||||
|
params.xres = dev->settings.xres;
|
||||||
|
params.yres = dev->settings.yres;
|
||||||
|
params.startx = start;
|
||||||
|
params.starty = 0; // not used
|
||||||
|
params.pixels = dev->settings.pixels;
|
||||||
|
params.lines = dev->settings.lines;
|
||||||
|
params.depth = depth;
|
||||||
|
params.channels = channels;
|
||||||
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
|
params.color_filter = dev->settings.color_filter;
|
||||||
|
params.flags = 0;
|
||||||
|
|
||||||
xres = dev->settings.xres;/*dpi*/
|
DBG(DBG_info, "%s ", __func__);
|
||||||
yres = dev->settings.yres;/*dpi*/
|
debug_dump(DBG_info, params);
|
||||||
startx = start;/*optical_res, from dummy_pixel+1*/
|
|
||||||
pixels = dev->settings.pixels;
|
|
||||||
lines = dev->settings.lines;
|
|
||||||
|
|
||||||
DBG(DBG_info,
|
|
||||||
"%s:\n"
|
|
||||||
"Resolution : %gDPI/%gDPI\n"
|
|
||||||
"Lines : %g\n"
|
|
||||||
"PPL : %g\n"
|
|
||||||
"Startpos : %g\n"
|
|
||||||
"Depth/Channels: %u/%u\n\n",
|
|
||||||
__func__, xres, yres, lines, pixels,
|
|
||||||
startx,
|
|
||||||
depth, channels);
|
|
||||||
|
|
||||||
/* half_ccd */
|
/* half_ccd */
|
||||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||||
if (sensor.get_ccd_size_divisor_for_dpi(xres) > 1) {
|
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||||
half_ccd = SANE_TRUE;
|
half_ccd = SANE_TRUE;
|
||||||
} else {
|
} else {
|
||||||
half_ccd = SANE_FALSE;
|
half_ccd = SANE_FALSE;
|
||||||
|
@ -2589,13 +2581,13 @@ static SANE_Status gl841_calculate_current_setup(Genesys_Device * dev, const Gen
|
||||||
/* stagger */
|
/* stagger */
|
||||||
|
|
||||||
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
if ((!half_ccd) && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||||
stagger = (4 * yres) / dev->motor.base_ydpi;
|
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||||
else
|
else
|
||||||
stagger = 0;
|
stagger = 0;
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||||
|
|
||||||
/* used_res */
|
/* used_res */
|
||||||
i = optical_res / xres;
|
i = optical_res / params.xres;
|
||||||
|
|
||||||
/* gl841 supports 1/1 1/2 1/3 1/4 1/5 1/6 1/8 1/10 1/12 1/15 averaging */
|
/* gl841 supports 1/1 1/2 1/3 1/4 1/5 1/6 1/8 1/10 1/12 1/15 averaging */
|
||||||
|
|
||||||
|
@ -2623,30 +2615,24 @@ static SANE_Status gl841_calculate_current_setup(Genesys_Device * dev, const Gen
|
||||||
/* 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 */
|
||||||
/* start */
|
start = ((sensor.CCD_start_xoffset + params.startx) * used_res) / sensor.optical_res;
|
||||||
/* add x coordinates */
|
|
||||||
start =
|
|
||||||
((sensor.CCD_start_xoffset + startx) * used_res) /
|
|
||||||
sensor.optical_res;
|
|
||||||
|
|
||||||
/* needs to be aligned for used_res */
|
/* needs to be aligned for used_res */
|
||||||
start = (start * optical_res) / used_res;
|
start = (start * optical_res) / used_res;
|
||||||
|
|
||||||
start += sensor.dummy_pixel + 1;
|
start += sensor.dummy_pixel + 1;
|
||||||
|
|
||||||
if (stagger > 0)
|
if (stagger > 0) {
|
||||||
start |= 1;
|
start |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* compute correct pixels number */
|
used_pixels = (params.pixels * optical_res) / params.xres;
|
||||||
/* pixels */
|
|
||||||
used_pixels =
|
|
||||||
(pixels * optical_res) / xres;
|
|
||||||
|
|
||||||
/* round up pixels number if needed */
|
// round up pixels number if needed
|
||||||
if (used_pixels * xres < pixels * optical_res)
|
if (used_pixels * params.xres < params.pixels * optical_res) {
|
||||||
used_pixels++;
|
used_pixels++;
|
||||||
|
}
|
||||||
|
|
||||||
/* dummy */
|
|
||||||
/* 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
|
||||||
slower (higher dpi)
|
slower (higher dpi)
|
||||||
|
@ -2673,17 +2659,17 @@ dummy \ scanned lines
|
||||||
*/
|
*/
|
||||||
dummy = 0;
|
dummy = 0;
|
||||||
|
|
||||||
/* slope_dpi */
|
|
||||||
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
||||||
line and a FILTER of 0 */
|
line and a FILTER of 0 */
|
||||||
if (dev->model->is_cis)
|
if (dev->model->is_cis) {
|
||||||
slope_dpi = yres*channels;
|
slope_dpi = params.yres * params.channels;
|
||||||
else
|
} else {
|
||||||
slope_dpi = yres;
|
slope_dpi = params.yres;
|
||||||
|
}
|
||||||
|
|
||||||
slope_dpi = slope_dpi * (1 + dummy);
|
slope_dpi = slope_dpi * (1 + dummy);
|
||||||
|
|
||||||
scan_step_type = gl841_scan_step_type(dev, yres);
|
scan_step_type = gl841_scan_step_type(dev, params.yres);
|
||||||
exposure_time = gl841_exposure_time(dev, sensor,
|
exposure_time = gl841_exposure_time(dev, sensor,
|
||||||
slope_dpi,
|
slope_dpi,
|
||||||
scan_step_type,
|
scan_step_type,
|
||||||
|
@ -2693,18 +2679,17 @@ dummy \ scanned lines
|
||||||
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||||
|
|
||||||
/* scanned area must be enlarged by max color shift needed */
|
/* scanned area must be enlarged by max color shift needed */
|
||||||
max_shift=sanei_genesys_compute_max_shift(dev,channels,yres,0);
|
max_shift = sanei_genesys_compute_max_shift(dev, params.channels, params.yres, 0);
|
||||||
|
|
||||||
/* lincnt */
|
lincnt = params.lines + max_shift + stagger;
|
||||||
lincnt = lines + max_shift + stagger;
|
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res)/optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res)/optical_res;
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = params.depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = params.channels;
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = used_res;
|
dev->current_setup.xres = used_res;
|
||||||
dev->current_setup.yres = yres;
|
dev->current_setup.yres = params.yres;
|
||||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = stagger;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + stagger;
|
||||||
|
|
|
@ -1621,12 +1621,6 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
int depth;
|
int depth;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
float xres; /*dpi */
|
|
||||||
float yres; /*dpi */
|
|
||||||
float startx; /*optical_res, from dummy_pixel+1 */
|
|
||||||
float pixels;
|
|
||||||
float lines;
|
|
||||||
|
|
||||||
int used_res;
|
int used_res;
|
||||||
int used_pixels;
|
int used_pixels;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
|
@ -1640,11 +1634,8 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
DBG(DBG_info, "%s ", __func__);
|
DBG(DBG_info, "%s ", __func__);
|
||||||
debug_dump(DBG_info, dev->settings);
|
debug_dump(DBG_info, dev->settings);
|
||||||
|
|
||||||
xres = dev->settings.xres;
|
|
||||||
yres = dev->settings.yres;
|
|
||||||
|
|
||||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||||
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(xres);
|
unsigned ccd_size_divisor = sensor.get_ccd_size_divisor_for_dpi(dev->settings.xres);
|
||||||
|
|
||||||
/* channels */
|
/* channels */
|
||||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||||
|
@ -1668,39 +1659,44 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
start += dev->settings.tl_x;
|
start += dev->settings.tl_x;
|
||||||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||||
|
|
||||||
startx = start;
|
SetupParams params;
|
||||||
pixels = dev->settings.pixels;
|
params.xres = dev->settings.xres;
|
||||||
lines = dev->settings.lines;
|
params.yres = dev->settings.yres;
|
||||||
|
params.startx = start; // not used
|
||||||
|
params.starty = 0; // not used
|
||||||
|
params.pixels = dev->settings.pixels;
|
||||||
|
params.lines = dev->settings.lines;
|
||||||
|
params.depth = depth;
|
||||||
|
params.channels = channels;
|
||||||
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
|
params.color_filter = dev->settings.color_filter;
|
||||||
|
params.flags = 0;
|
||||||
|
|
||||||
DBG(DBG_info, "%s settings:\n"
|
DBG(DBG_info, "%s ", __func__);
|
||||||
"Resolution : %gDPI/%gDPI\n"
|
debug_dump(DBG_info, params);
|
||||||
"Lines : %g\n"
|
|
||||||
"PPL : %g\n"
|
|
||||||
"Startpos : %g\n"
|
|
||||||
"Depth/Channels: %u/%u\n\n",
|
|
||||||
__func__, xres, yres, lines, pixels, startx, depth, channels);
|
|
||||||
|
|
||||||
/* optical_res */
|
/* optical_res */
|
||||||
optical_res = sensor.optical_res / ccd_size_divisor;
|
optical_res = sensor.optical_res / ccd_size_divisor;
|
||||||
|
|
||||||
/* stagger */
|
/* stagger */
|
||||||
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
if (ccd_size_divisor == 1 && (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE))
|
||||||
stagger = (4 * yres) / dev->motor.base_ydpi;
|
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||||
else
|
else
|
||||||
stagger = 0;
|
stagger = 0;
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||||
|
|
||||||
if(xres<=optical_res)
|
if (params.xres <= (unsigned) optical_res) {
|
||||||
used_res = xres;
|
used_res = params.xres;
|
||||||
else
|
} else {
|
||||||
used_res=optical_res;
|
used_res = optical_res;
|
||||||
|
}
|
||||||
|
|
||||||
/* 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 */
|
||||||
|
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
used_pixels = (pixels * optical_res) / xres;
|
used_pixels = (params.pixels * optical_res) / params.xres;
|
||||||
DBG(DBG_info, "%s: used_pixels=%d\n", __func__, used_pixels);
|
DBG(DBG_info, "%s: used_pixels=%d\n", __func__, used_pixels);
|
||||||
|
|
||||||
/* exposure */
|
/* exposure */
|
||||||
|
@ -1711,7 +1707,7 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
DBG(DBG_info, "%s : exposure=%d pixels\n", __func__, exposure);
|
DBG(DBG_info, "%s : exposure=%d pixels\n", __func__, exposure);
|
||||||
|
|
||||||
/* it seems base_dpi of the G4050 motor is changed above 600 dpi*/
|
/* it seems base_dpi of the G4050 motor is changed above 600 dpi*/
|
||||||
if (dev->model->motor_type == MOTOR_G4050 && yres>600)
|
if (dev->model->motor_type == MOTOR_G4050 && params.yres>600)
|
||||||
{
|
{
|
||||||
dev->ld_shift_r = (dev->model->ld_shift_r*3800)/dev->motor.base_ydpi;
|
dev->ld_shift_r = (dev->model->ld_shift_r*3800)/dev->motor.base_ydpi;
|
||||||
dev->ld_shift_g = (dev->model->ld_shift_g*3800)/dev->motor.base_ydpi;
|
dev->ld_shift_g = (dev->model->ld_shift_g*3800)/dev->motor.base_ydpi;
|
||||||
|
@ -1725,19 +1721,19 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scanned area must be enlarged by max color shift needed */
|
/* scanned area must be enlarged by max color shift needed */
|
||||||
max_shift=sanei_genesys_compute_max_shift(dev,channels,yres,0);
|
max_shift = sanei_genesys_compute_max_shift(dev, params.channels, params.yres, 0);
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = lines + max_shift + stagger;
|
lincnt = params.lines + max_shift + stagger;
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||||
DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = params.depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = params.channels;
|
||||||
dev->current_setup.exposure_time = exposure;
|
dev->current_setup.exposure_time = exposure;
|
||||||
dev->current_setup.xres = used_res;
|
dev->current_setup.xres = used_res;
|
||||||
dev->current_setup.yres = yres;
|
dev->current_setup.yres = params.yres;
|
||||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = stagger;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + stagger;
|
||||||
|
|
|
@ -1347,12 +1347,6 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
int depth;
|
int depth;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
float xres; /*dpi */
|
|
||||||
float yres; /*dpi */
|
|
||||||
float startx; /*optical_res, from dummy_pixel+1 */
|
|
||||||
float pixels;
|
|
||||||
float lines;
|
|
||||||
|
|
||||||
int used_res;
|
int used_res;
|
||||||
int used_pixels;
|
int used_pixels;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
|
@ -1386,23 +1380,25 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||||
|
|
||||||
|
|
||||||
xres = dev->settings.xres; /*dpi */
|
SetupParams params;
|
||||||
yres = dev->settings.yres; /*dpi */
|
params.xres = dev->settings.xres;
|
||||||
startx = start; /*optical_res, from dummy_pixel+1 */
|
params.yres = dev->settings.yres;
|
||||||
pixels = dev->settings.pixels;
|
params.startx = start; // not used
|
||||||
lines = dev->settings.lines;
|
params.starty = 0; // not used
|
||||||
|
params.pixels = dev->settings.pixels;
|
||||||
|
params.lines = dev->settings.lines;
|
||||||
|
params.depth = depth;
|
||||||
|
params.channels = channels;
|
||||||
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
|
params.color_filter = dev->settings.color_filter;
|
||||||
|
params.flags = 0;
|
||||||
|
|
||||||
DBG(DBG_info, "%s settings:\n"
|
DBG(DBG_info, "%s ", __func__);
|
||||||
"Resolution : %gDPI/%gDPI\n"
|
debug_dump(DBG_info, params);
|
||||||
"Lines : %g\n"
|
|
||||||
"PPL : %g\n"
|
|
||||||
"Startpos : %g\n"
|
|
||||||
"Depth/Channels: %u/%u\n\n",
|
|
||||||
__func__, xres, yres, lines, pixels, startx, depth, channels);
|
|
||||||
|
|
||||||
/* half_ccd */
|
/* half_ccd */
|
||||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||||
if (sensor.get_ccd_size_divisor_for_dpi(xres) > 1) {
|
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||||
half_ccd = SANE_TRUE;
|
half_ccd = SANE_TRUE;
|
||||||
} else {
|
} else {
|
||||||
half_ccd = SANE_FALSE;
|
half_ccd = SANE_FALSE;
|
||||||
|
@ -1413,48 +1409,47 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
/* stagger */
|
/* stagger */
|
||||||
if (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)
|
if (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)
|
||||||
stagger = (4 * yres) / dev->motor.base_ydpi;
|
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||||
else
|
else
|
||||||
stagger = 0;
|
stagger = 0;
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||||
|
|
||||||
/* resolution is choosen from a fixed list */
|
/* resolution is choosen from a fixed list */
|
||||||
used_res = xres;
|
used_res = params.xres;
|
||||||
|
|
||||||
/* 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 */
|
||||||
|
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
used_pixels = (pixels * optical_res) / used_res;
|
used_pixels = (params.pixels * optical_res) / used_res;
|
||||||
dummy = 3-channels;
|
dummy = 3 - params.channels;
|
||||||
|
|
||||||
/* slope_dpi */
|
|
||||||
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
||||||
line and a FILTER of 0 */
|
line and a FILTER of 0 */
|
||||||
if (dev->model->is_cis)
|
if (dev->model->is_cis) {
|
||||||
slope_dpi = yres * channels;
|
slope_dpi = params.yres * params.channels;
|
||||||
else
|
} else {
|
||||||
slope_dpi = yres;
|
slope_dpi = params.yres;
|
||||||
|
}
|
||||||
|
|
||||||
slope_dpi = slope_dpi * (1 + dummy);
|
slope_dpi = slope_dpi * (1 + dummy);
|
||||||
|
|
||||||
exposure_time = gl846_compute_exposure (dev, used_res);
|
exposure_time = gl846_compute_exposure (dev, used_res);
|
||||||
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||||
|
|
||||||
/* max_shift */
|
max_shift = sanei_genesys_compute_max_shift(dev, params.channels, params.yres, 0);
|
||||||
max_shift=sanei_genesys_compute_max_shift(dev,channels,yres,0);
|
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = lines + max_shift + stagger;
|
lincnt = params.lines + max_shift + stagger;
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = params.depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = params.channels;
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = used_res;
|
dev->current_setup.xres = used_res;
|
||||||
dev->current_setup.yres = yres;
|
dev->current_setup.yres = params.yres;
|
||||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = stagger;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + stagger;
|
||||||
|
|
|
@ -1364,12 +1364,6 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
int depth;
|
int depth;
|
||||||
int start;
|
int start;
|
||||||
|
|
||||||
float xres; /*dpi */
|
|
||||||
float yres; /*dpi */
|
|
||||||
float startx; /*optical_res, from dummy_pixel+1 */
|
|
||||||
float pixels;
|
|
||||||
float lines;
|
|
||||||
|
|
||||||
int used_res;
|
int used_res;
|
||||||
int used_pixels;
|
int used_pixels;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
|
@ -1402,24 +1396,25 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
start += dev->settings.tl_x;
|
start += dev->settings.tl_x;
|
||||||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||||
|
|
||||||
|
SetupParams params;
|
||||||
|
params.xres = dev->settings.xres;
|
||||||
|
params.yres = dev->settings.yres;
|
||||||
|
params.startx = start; // not used
|
||||||
|
params.starty = 0; // not used
|
||||||
|
params.pixels = dev->settings.pixels;
|
||||||
|
params.lines = dev->settings.lines;
|
||||||
|
params.depth = depth;
|
||||||
|
params.channels = channels;
|
||||||
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
|
params.color_filter = dev->settings.color_filter;
|
||||||
|
params.flags = 0;
|
||||||
|
|
||||||
xres = dev->settings.xres; /*dpi */
|
DBG(DBG_info, "%s ", __func__);
|
||||||
yres = dev->settings.yres; /*dpi */
|
debug_dump(DBG_info, params);
|
||||||
startx = start; /*optical_res, from dummy_pixel+1 */
|
|
||||||
pixels = dev->settings.pixels;
|
|
||||||
lines = dev->settings.lines;
|
|
||||||
|
|
||||||
DBG(DBG_info, "%s settings:\n"
|
|
||||||
"Resolution : %gDPI/%gDPI\n"
|
|
||||||
"Lines : %g\n"
|
|
||||||
"PPL : %g\n"
|
|
||||||
"Startpos : %g\n"
|
|
||||||
"Depth/Channels: %u/%u\n\n",
|
|
||||||
__func__, xres, yres, lines, pixels, startx, depth, channels);
|
|
||||||
|
|
||||||
/* half_ccd */
|
/* half_ccd */
|
||||||
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
/* we have 2 domains for ccd: xres below or above half ccd max dpi */
|
||||||
if (sensor.get_ccd_size_divisor_for_dpi(xres) > 1) {
|
if (sensor.get_ccd_size_divisor_for_dpi(params.xres) > 1) {
|
||||||
half_ccd = SANE_TRUE;
|
half_ccd = SANE_TRUE;
|
||||||
} else {
|
} else {
|
||||||
half_ccd = SANE_FALSE;
|
half_ccd = SANE_FALSE;
|
||||||
|
@ -1430,29 +1425,30 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
|
|
||||||
/* stagger */
|
/* stagger */
|
||||||
if (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)
|
if (dev->model->flags & GENESYS_FLAG_STAGGERED_LINE)
|
||||||
stagger = (4 * yres) / dev->motor.base_ydpi;
|
stagger = (4 * params.yres) / dev->motor.base_ydpi;
|
||||||
else
|
else
|
||||||
stagger = 0;
|
stagger = 0;
|
||||||
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
DBG(DBG_info, "%s: stagger=%d lines\n", __func__, stagger);
|
||||||
|
|
||||||
/* resolution is choosen from a fixed list */
|
/* resolution is choosen from a fixed list */
|
||||||
used_res = xres;
|
used_res = params.xres;
|
||||||
|
|
||||||
/* 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 */
|
||||||
|
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
used_pixels = (pixels * optical_res) / used_res;
|
used_pixels = (params.pixels * optical_res) / used_res;
|
||||||
dummy = 3-channels;
|
dummy = 3 - params.channels;
|
||||||
|
|
||||||
/* slope_dpi */
|
/* slope_dpi */
|
||||||
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
||||||
line and a FILTER of 0 */
|
line and a FILTER of 0 */
|
||||||
if (dev->model->is_cis)
|
if (dev->model->is_cis) {
|
||||||
slope_dpi = yres * channels;
|
slope_dpi = params.yres * params.channels;
|
||||||
else
|
} else {
|
||||||
slope_dpi = yres;
|
slope_dpi = params.yres;
|
||||||
|
}
|
||||||
|
|
||||||
slope_dpi = slope_dpi * (1 + dummy);
|
slope_dpi = slope_dpi * (1 + dummy);
|
||||||
|
|
||||||
|
@ -1460,18 +1456,18 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
DBG(DBG_info, "%s : exposure_time=%d pixels\n", __func__, exposure_time);
|
||||||
|
|
||||||
/* max_shift */
|
/* max_shift */
|
||||||
max_shift=sanei_genesys_compute_max_shift(dev,channels,yres,0);
|
max_shift = sanei_genesys_compute_max_shift(dev, params.channels, params.yres, 0);
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = lines + max_shift + stagger;
|
lincnt = params.lines + max_shift + stagger;
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = params.depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = params.channels;
|
||||||
dev->current_setup.exposure_time = exposure_time;
|
dev->current_setup.exposure_time = exposure_time;
|
||||||
dev->current_setup.xres = used_res;
|
dev->current_setup.xres = used_res;
|
||||||
dev->current_setup.yres = yres;
|
dev->current_setup.yres = params.yres;
|
||||||
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
dev->current_setup.ccd_size_divisor = half_ccd ? 2 : 1;
|
||||||
dev->current_setup.stagger = stagger;
|
dev->current_setup.stagger = stagger;
|
||||||
dev->current_setup.max_shift = max_shift + stagger;
|
dev->current_setup.max_shift = max_shift + stagger;
|
||||||
|
|
Ładowanie…
Reference in New Issue