kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Reuse SetupParams on GL841 code
rodzic
50f5007b3d
commit
6719f885da
|
@ -2156,20 +2156,11 @@ int scan_step_type=0;
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
SANE_Status
|
SANE_Status
|
||||||
gl841_init_scan_regs (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
gl841_init_scan_regs(Genesys_Device * dev, const Genesys_Sensor& sensor, Genesys_Register_Set * reg,
|
||||||
Genesys_Register_Set * reg,
|
SetupParams& params)
|
||||||
float xres,/*dpi*/
|
|
||||||
float yres,/*dpi*/
|
|
||||||
float startx,/*optical_res, from dummy_pixel+1*/
|
|
||||||
float starty,/*base_ydpi, from home!*/
|
|
||||||
float pixels,
|
|
||||||
float lines,
|
|
||||||
unsigned int depth,
|
|
||||||
unsigned int channels,
|
|
||||||
int color_filter,
|
|
||||||
unsigned int flags
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
params.assert_valid();
|
||||||
|
|
||||||
int used_res;
|
int used_res;
|
||||||
int start, used_pixels;
|
int start, used_pixels;
|
||||||
int bytes_per_line;
|
int bytes_per_line;
|
||||||
|
@ -2200,10 +2191,10 @@ gl841_init_scan_regs (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
"Startpos : %g/%g\n"
|
"Startpos : %g/%g\n"
|
||||||
"Depth/Channels: %u/%u\n"
|
"Depth/Channels: %u/%u\n"
|
||||||
"Flags : %x\n\n",
|
"Flags : %x\n\n",
|
||||||
__func__, xres, yres, lines, pixels,
|
__func__, params.xres, params.yres, params.lines, params.pixels,
|
||||||
startx, starty,
|
params.startx, params.starty,
|
||||||
depth, channels,
|
params.depth, params.channels,
|
||||||
flags);
|
params.flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
results:
|
results:
|
||||||
|
@ -2236,7 +2227,7 @@ independent of our calculated values:
|
||||||
|
|
||||||
/* 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;
|
||||||
|
@ -2251,17 +2242,17 @@ independent of our calculated values:
|
||||||
/* 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 */
|
||||||
|
|
||||||
if (i < 2 || (flags & SCAN_FLAG_USE_OPTICAL_RES)) /* optical_res >= xres > optical_res/2 */
|
if (i < 2 || (params.flags & SCAN_FLAG_USE_OPTICAL_RES)) /* optical_res >= xres > optical_res/2 */
|
||||||
used_res = optical_res;
|
used_res = optical_res;
|
||||||
else if (i < 3) /* optical_res/2 >= xres > optical_res/3 */
|
else if (i < 3) /* optical_res/2 >= xres > optical_res/3 */
|
||||||
used_res = optical_res/2;
|
used_res = optical_res/2;
|
||||||
|
@ -2287,7 +2278,7 @@ independent of our calculated values:
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
/* start */
|
/* start */
|
||||||
/* add x coordinates */
|
/* add x coordinates */
|
||||||
start = ((sensor.CCD_start_xoffset + startx) * used_res) / sensor.optical_res;
|
start = ((sensor.CCD_start_xoffset + params.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;
|
||||||
|
@ -2309,10 +2300,10 @@ independent of our calculated values:
|
||||||
|
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
/* pixels */
|
/* pixels */
|
||||||
used_pixels = (pixels * optical_res) / xres;
|
used_pixels = (params.pixels * optical_res) / params.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 */
|
||||||
|
@ -2346,13 +2337,13 @@ dummy \ scanned lines
|
||||||
/* 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,
|
||||||
|
@ -2364,25 +2355,25 @@ dummy \ scanned lines
|
||||||
/*** optical parameters ***/
|
/*** optical parameters ***/
|
||||||
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
/* in case of dynamic lineart, we use an internal 8 bit gray scan
|
||||||
* to generate 1 lineart data */
|
* to generate 1 lineart data */
|
||||||
if(flags & SCAN_FLAG_DYNAMIC_LINEART)
|
if(params.flags & SCAN_FLAG_DYNAMIC_LINEART)
|
||||||
{
|
{
|
||||||
depth=8;
|
params.depth=8;
|
||||||
}
|
}
|
||||||
|
|
||||||
oflags=0;
|
oflags=0;
|
||||||
if (flags & SCAN_FLAG_DISABLE_SHADING)
|
if (params.flags & SCAN_FLAG_DISABLE_SHADING)
|
||||||
{
|
{
|
||||||
oflags |= OPTICAL_FLAG_DISABLE_SHADING;
|
oflags |= OPTICAL_FLAG_DISABLE_SHADING;
|
||||||
}
|
}
|
||||||
if ((flags & SCAN_FLAG_DISABLE_GAMMA) || (depth==16))
|
if ((params.flags & SCAN_FLAG_DISABLE_GAMMA) || (params.depth==16))
|
||||||
{
|
{
|
||||||
oflags |= OPTICAL_FLAG_DISABLE_GAMMA;
|
oflags |= OPTICAL_FLAG_DISABLE_GAMMA;
|
||||||
}
|
}
|
||||||
if (flags & SCAN_FLAG_DISABLE_LAMP)
|
if (params.flags & SCAN_FLAG_DISABLE_LAMP)
|
||||||
{
|
{
|
||||||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||||
}
|
}
|
||||||
if (flags & SCAN_FLAG_ENABLE_LEDADD)
|
if (params.flags & SCAN_FLAG_ENABLE_LEDADD)
|
||||||
{
|
{
|
||||||
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
oflags |= OPTICAL_FLAG_ENABLE_LEDADD;
|
||||||
}
|
}
|
||||||
|
@ -2393,10 +2384,10 @@ dummy \ scanned lines
|
||||||
used_res,
|
used_res,
|
||||||
start,
|
start,
|
||||||
used_pixels,
|
used_pixels,
|
||||||
channels,
|
params.channels,
|
||||||
depth,
|
params.depth,
|
||||||
half_ccd,
|
half_ccd,
|
||||||
color_filter,
|
params.color_filter,
|
||||||
oflags);
|
oflags);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -2406,13 +2397,13 @@ dummy \ scanned lines
|
||||||
/*** motor parameters ***/
|
/*** motor parameters ***/
|
||||||
|
|
||||||
/* 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,flags);
|
max_shift=sanei_genesys_compute_max_shift(dev, params.channels,params.yres,params.flags);
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = lines + max_shift + stagger;
|
lincnt = params.lines + max_shift + stagger;
|
||||||
|
|
||||||
/* add tl_y to base movement */
|
/* add tl_y to base movement */
|
||||||
move = starty;
|
move = params.starty;
|
||||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);
|
||||||
|
|
||||||
/* subtract current head position */
|
/* subtract current head position */
|
||||||
|
@ -2427,19 +2418,19 @@ dummy \ scanned lines
|
||||||
/* move = ((move + dummy) / (dummy + 1)) * (dummy + 1);
|
/* move = ((move + dummy) / (dummy + 1)) * (dummy + 1);
|
||||||
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);*/
|
DBG(DBG_info, "%s: move=%d steps\n", __func__, move);*/
|
||||||
|
|
||||||
if (flags & SCAN_FLAG_SINGLE_LINE)
|
if (params.flags & SCAN_FLAG_SINGLE_LINE)
|
||||||
status = gl841_init_motor_regs_off(reg, dev->model->is_cis?lincnt*channels:lincnt);
|
status = gl841_init_motor_regs_off(reg, dev->model->is_cis?lincnt* params.channels:lincnt);
|
||||||
else
|
else
|
||||||
status = gl841_init_motor_regs_scan(dev, sensor,
|
status = gl841_init_motor_regs_scan(dev, sensor,
|
||||||
reg,
|
reg,
|
||||||
exposure_time,
|
exposure_time,
|
||||||
slope_dpi,
|
slope_dpi,
|
||||||
scan_step_type,
|
scan_step_type,
|
||||||
dev->model->is_cis?lincnt*channels:lincnt,
|
dev->model->is_cis?lincnt* params.channels:lincnt,
|
||||||
dummy,
|
dummy,
|
||||||
move,
|
move,
|
||||||
scan_power_mode,
|
scan_power_mode,
|
||||||
(flags & SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE)?
|
(params.flags & SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE)?
|
||||||
MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE:0
|
MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE:0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2451,7 +2442,7 @@ dummy \ scanned lines
|
||||||
|
|
||||||
/* words_per_line */
|
/* words_per_line */
|
||||||
bytes_per_line = (used_pixels * used_res) / optical_res;
|
bytes_per_line = (used_pixels * used_res) / optical_res;
|
||||||
bytes_per_line = (bytes_per_line * channels * depth) / 8;
|
bytes_per_line = (bytes_per_line * params.channels * params.depth) / 8;
|
||||||
|
|
||||||
requested_buffer_size = 8 * bytes_per_line;
|
requested_buffer_size = 8 * bytes_per_line;
|
||||||
/* we must use a round number of bytes_per_line */
|
/* we must use a round number of bytes_per_line */
|
||||||
|
@ -2461,7 +2452,7 @@ dummy \ scanned lines
|
||||||
|
|
||||||
read_buffer_size =
|
read_buffer_size =
|
||||||
2 * requested_buffer_size +
|
2 * requested_buffer_size +
|
||||||
((max_shift + stagger) * used_pixels * channels * depth) / 8;
|
((max_shift + stagger) * used_pixels * params.channels * 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);
|
||||||
|
@ -2473,7 +2464,7 @@ dummy \ scanned lines
|
||||||
dev->shrink_buffer.alloc(requested_buffer_size);
|
dev->shrink_buffer.alloc(requested_buffer_size);
|
||||||
|
|
||||||
dev->out_buffer.clear();
|
dev->out_buffer.clear();
|
||||||
dev->out_buffer.alloc((8 * dev->settings.pixels * channels * depth) / 8);
|
dev->out_buffer.alloc((8 * dev->settings.pixels * params.channels * params.depth) / 8);
|
||||||
|
|
||||||
dev->read_bytes_left = bytes_per_line * lincnt;
|
dev->read_bytes_left = bytes_per_line * lincnt;
|
||||||
|
|
||||||
|
@ -2483,11 +2474,11 @@ dummy \ scanned lines
|
||||||
|
|
||||||
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;
|
||||||
|
@ -2508,14 +2499,14 @@ dummy \ scanned lines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dev->total_bytes_read = 0;
|
dev->total_bytes_read = 0;
|
||||||
if (depth == 1)
|
if (params.depth == 1)
|
||||||
dev->total_bytes_to_read =
|
dev->total_bytes_to_read =
|
||||||
((dev->settings.pixels * dev->settings.lines) / 8 +
|
((dev->settings.pixels * dev->settings.lines) / 8 +
|
||||||
(((dev->settings.pixels * dev->settings.lines)%8)?1:0)
|
(((dev->settings.pixels * dev->settings.lines)%8)?1:0)
|
||||||
) * channels;
|
) * params.channels;
|
||||||
else
|
else
|
||||||
dev->total_bytes_to_read =
|
dev->total_bytes_to_read =
|
||||||
dev->settings.pixels * dev->settings.lines * channels * (depth / 8);
|
dev->settings.pixels * dev->settings.lines * params.channels * (params.depth / 8);
|
||||||
|
|
||||||
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
DBG(DBG_info, "%s: total bytes to send = %lu\n", __func__, (u_long) dev->total_bytes_to_read);
|
||||||
/* END TODO */
|
/* END TODO */
|
||||||
|
@ -3638,21 +3629,24 @@ gl841_search_start_position (Genesys_Device * dev)
|
||||||
// whith employ different sensors with potentially different settings.
|
// whith employ different sensors with potentially different settings.
|
||||||
auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi);
|
auto& sensor = sanei_genesys_find_sensor_for_write(dev, dpi);
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
&local_reg,
|
params.xres = dpi;
|
||||||
dpi,
|
params.yres = dpi;
|
||||||
dpi,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0; /*we should give a small offset here~60 steps*/
|
||||||
0,/*we should give a small offset here~60 steps*/
|
params.pixels = 600;
|
||||||
600,
|
params.lines = dev->model->search_lines;
|
||||||
dev->model->search_lines,
|
params.depth = 8;
|
||||||
8,
|
params.channels = 1;
|
||||||
1,
|
params.scan_mode = ScanColorMode::GRAY;
|
||||||
1,/*green*/
|
params.color_filter = 1; /*green*/
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE);
|
SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, &local_reg, params);
|
||||||
|
|
||||||
if(status!=SANE_STATUS_GOOD)
|
if(status!=SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
DBG(DBG_error, "%s: failed to init scan registers: %s\n", __func__, sane_strstatus(status));
|
DBG(DBG_error, "%s: failed to init scan registers: %s\n", __func__, sane_strstatus(status));
|
||||||
|
@ -3738,25 +3732,28 @@ gl841_init_regs_for_coarse_calibration(Genesys_Device * dev, const Genesys_Senso
|
||||||
/* set line size */
|
/* set line size */
|
||||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||||
channels = 3;
|
channels = 3;
|
||||||
else
|
else {
|
||||||
channels = 1;
|
channels = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupParams params;
|
||||||
|
params.xres = dev->settings.xres;
|
||||||
|
params.yres = dev->settings.yres;
|
||||||
|
params.startx = 0;
|
||||||
|
params.starty = 0;
|
||||||
|
params.pixels = sensor.optical_res / cksel; /* XXX STEF XXX !!! */
|
||||||
|
params.lines = 20;
|
||||||
|
params.depth = 16;
|
||||||
|
params.channels = channels;
|
||||||
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
|
params.color_filter = dev->settings.color_filter;
|
||||||
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
|
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
|
||||||
®s,
|
|
||||||
dev->settings.xres,
|
|
||||||
dev->settings.yres,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
sensor.optical_res / cksel, /* XXX STEF XXX !!! */
|
|
||||||
20,
|
|
||||||
16,
|
|
||||||
channels,
|
|
||||||
dev->settings.color_filter,
|
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE
|
|
||||||
);
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||||
|
@ -3820,22 +3817,26 @@ gl841_init_regs_for_shading(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
|
|
||||||
dev->calib_channels = 3;
|
dev->calib_channels = 3;
|
||||||
dev->calib_lines = dev->model->shading_lines;
|
dev->calib_lines = dev->model->shading_lines;
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
|
||||||
®s,
|
SetupParams params;
|
||||||
dev->settings.xres,
|
params.xres = dev->settings.xres;
|
||||||
ydpi,
|
params.yres = ydpi;
|
||||||
0,
|
params.startx = 0;
|
||||||
starty,
|
params.starty = starty;
|
||||||
(sensor.sensor_pixels * dev->settings.xres) / sensor.optical_res,
|
params.pixels = (sensor.sensor_pixels * dev->settings.xres) / sensor.optical_res;
|
||||||
dev->calib_lines,
|
params.lines = dev->calib_lines;
|
||||||
16,
|
params.depth = 16;
|
||||||
dev->calib_channels,
|
params.channels = dev->calib_channels;
|
||||||
dev->settings.color_filter,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.color_filter = dev->settings.color_filter;
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_USE_OPTICAL_RES |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
/*SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |*/
|
SCAN_FLAG_USE_OPTICAL_RES |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE);
|
/*SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE |*/
|
||||||
|
SCAN_FLAG_IGNORE_LINE_DISTANCE;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
DBG(DBG_error, "%s: failed to setup scan: %s\n", __func__, sane_strstatus(status));
|
||||||
|
@ -3955,18 +3956,20 @@ gl841_init_regs_for_scan (Genesys_Device * dev, const Genesys_Sensor& sensor)
|
||||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
&dev->reg,
|
params.xres = dev->settings.xres;
|
||||||
dev->settings.xres,
|
params.yres = dev->settings.yres;
|
||||||
dev->settings.yres,
|
params.startx = start;
|
||||||
start,
|
params.starty = move;
|
||||||
move,
|
params.pixels = dev->settings.pixels;
|
||||||
dev->settings.pixels,
|
params.lines = dev->settings.lines;
|
||||||
dev->settings.lines,
|
params.depth = depth;
|
||||||
depth,
|
params.channels = channels;
|
||||||
channels,
|
params.scan_mode = dev->settings.scan_mode;
|
||||||
dev->settings.color_filter,
|
params.color_filter = dev->settings.color_filter;
|
||||||
flags);
|
params.flags = flags;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, &dev->reg, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return status;
|
return status;
|
||||||
|
@ -4060,23 +4063,24 @@ gl841_led_calibration (Genesys_Device * dev, Genesys_Sensor& sensor, Genesys_Reg
|
||||||
/* offset calibration is always done in color mode */
|
/* offset calibration is always done in color mode */
|
||||||
channels = 3;
|
channels = 3;
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
®s,
|
params.xres = dev->settings.xres;
|
||||||
dev->settings.xres,
|
params.yres = dev->settings.yres;
|
||||||
dev->settings.yres,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = (sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res;
|
||||||
(sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res,
|
params.lines = 1;
|
||||||
1,
|
params.depth = 16;
|
||||||
16,
|
params.channels = channels;
|
||||||
channels,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
dev->settings.color_filter,
|
params.color_filter = dev->settings.color_filter;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
SCAN_FLAG_USE_OPTICAL_RES
|
SCAN_FLAG_USE_OPTICAL_RES;
|
||||||
);
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -4264,22 +4268,24 @@ ad_fe_offset_calibration (Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
®s,
|
params.xres = dev->settings.xres;
|
||||||
dev->settings.xres,
|
params.yres = dev->settings.yres;
|
||||||
dev->settings.yres,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = (sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res;
|
||||||
(sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res,
|
params.lines = 1;
|
||||||
1,
|
params.depth = 8;
|
||||||
8,
|
params.channels = 3;
|
||||||
3,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
dev->settings.color_filter,
|
params.color_filter = dev->settings.color_filter;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
SCAN_FLAG_USE_OPTICAL_RES);
|
SCAN_FLAG_USE_OPTICAL_RES;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -4389,24 +4395,25 @@ gl841_offset_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
/* offset calibration is always done in color mode */
|
/* offset calibration is always done in color mode */
|
||||||
channels = 3;
|
channels = 3;
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
®s,
|
params.xres = dev->settings.xres;
|
||||||
dev->settings.xres,
|
params.yres = dev->settings.yres;
|
||||||
dev->settings.yres,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = (sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res;
|
||||||
(sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res,
|
params.lines = 1;
|
||||||
1,
|
params.depth = 16;
|
||||||
16,
|
params.channels = channels;
|
||||||
channels,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
dev->settings.color_filter,
|
params.color_filter = dev->settings.color_filter;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
SCAN_FLAG_USE_OPTICAL_RES |
|
SCAN_FLAG_USE_OPTICAL_RES |
|
||||||
SCAN_FLAG_DISABLE_LAMP
|
SCAN_FLAG_DISABLE_LAMP;
|
||||||
);
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -4776,23 +4783,24 @@ gl841_coarse_gain_calibration(Genesys_Device * dev, const Genesys_Sensor& sensor
|
||||||
/* coarse gain calibration is allways done in color mode */
|
/* coarse gain calibration is allways done in color mode */
|
||||||
channels = 3;
|
channels = 3;
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
®s,
|
params.xres = dev->settings.xres;
|
||||||
dev->settings.xres,
|
params.yres = dev->settings.yres;
|
||||||
dev->settings.yres,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = (sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res;
|
||||||
(sensor.sensor_pixels*dev->settings.xres) / sensor.optical_res,
|
params.lines = lines;
|
||||||
lines,
|
params.depth = 16;
|
||||||
16,
|
params.channels = channels;
|
||||||
channels,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
dev->settings.color_filter,
|
params.color_filter = dev->settings.color_filter;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
SCAN_FLAG_USE_OPTICAL_RES
|
SCAN_FLAG_USE_OPTICAL_RES;
|
||||||
);
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -4939,23 +4947,28 @@ gl841_init_regs_for_warmup (Genesys_Device * dev,
|
||||||
dev->frontend.set_offset(1, 0x80);
|
dev->frontend.set_offset(1, 0x80);
|
||||||
dev->frontend.set_offset(2, 0x80);
|
dev->frontend.set_offset(2, 0x80);
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
local_reg,
|
params.xres = sensor.optical_res;
|
||||||
sensor.optical_res,
|
params.yres = dev->settings.yres;
|
||||||
dev->settings.yres,
|
params.startx = sensor.dummy_pixel;
|
||||||
sensor.dummy_pixel,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = num_pixels;
|
||||||
num_pixels,
|
params.lines = 1;
|
||||||
1,
|
params.depth = 16;
|
||||||
16,
|
params.channels = *channels;
|
||||||
*channels,
|
if (*channels == 3) {
|
||||||
dev->settings.color_filter,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
} else {
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
params.scan_mode = ScanColorMode::GRAY;
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
}
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
params.color_filter = dev->settings.color_filter;
|
||||||
SCAN_FLAG_USE_OPTICAL_RES
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
);
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
|
SCAN_FLAG_USE_OPTICAL_RES;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, local_reg, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
|
@ -5139,23 +5152,24 @@ gl841_init (Genesys_Device * dev)
|
||||||
Genesys_Register_Set& regs = dev->calib_reg;
|
Genesys_Register_Set& regs = dev->calib_reg;
|
||||||
regs = dev->reg;
|
regs = dev->reg;
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
®s,
|
params.xres = 300;
|
||||||
300,
|
params.yres = 300;
|
||||||
300,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = (16 * 300) / sensor.optical_res;
|
||||||
(16 * 300) / sensor.optical_res,
|
params.lines = 1;
|
||||||
1,
|
params.depth = 16;
|
||||||
16,
|
params.channels = 3;
|
||||||
3,
|
params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||||
0,
|
params.color_filter = 0;
|
||||||
SCAN_FLAG_DISABLE_SHADING |
|
params.flags = SCAN_FLAG_DISABLE_SHADING |
|
||||||
SCAN_FLAG_DISABLE_GAMMA |
|
SCAN_FLAG_DISABLE_GAMMA |
|
||||||
SCAN_FLAG_SINGLE_LINE |
|
SCAN_FLAG_SINGLE_LINE |
|
||||||
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
SCAN_FLAG_IGNORE_LINE_DISTANCE |
|
||||||
SCAN_FLAG_USE_OPTICAL_RES
|
SCAN_FLAG_USE_OPTICAL_RES;
|
||||||
);
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, ®s, params);
|
||||||
|
|
||||||
RIE(sanei_genesys_bulk_write_register(dev, regs));
|
RIE(sanei_genesys_bulk_write_register(dev, regs));
|
||||||
|
|
||||||
|
@ -5285,18 +5299,21 @@ gl841_search_strip(Genesys_Device * dev, const Genesys_Sensor& sensor,
|
||||||
|
|
||||||
local_reg = dev->reg;
|
local_reg = dev->reg;
|
||||||
|
|
||||||
status = gl841_init_scan_regs (dev, sensor,
|
SetupParams params;
|
||||||
&local_reg,
|
params.xres = dpi;
|
||||||
dpi,
|
params.yres = dpi;
|
||||||
dpi,
|
params.startx = 0;
|
||||||
0,
|
params.starty = 0;
|
||||||
0,
|
params.pixels = pixels;
|
||||||
pixels,
|
params.lines = lines;
|
||||||
lines,
|
params.depth = depth;
|
||||||
depth,
|
params.channels = channels;
|
||||||
channels,
|
params.scan_mode = ScanColorMode::GRAY;
|
||||||
0,
|
params.color_filter = 0;
|
||||||
SCAN_FLAG_DISABLE_SHADING | SCAN_FLAG_DISABLE_GAMMA);
|
params.flags = SCAN_FLAG_DISABLE_SHADING | SCAN_FLAG_DISABLE_GAMMA;
|
||||||
|
|
||||||
|
status = gl841_init_scan_regs(dev, sensor, &local_reg, params);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
{
|
{
|
||||||
DBG(DBG_error, "%s: failed to setup for scan: %s\n", __func__, sane_strstatus(status));
|
DBG(DBG_error, "%s: failed to setup for scan: %s\n", __func__, sane_strstatus(status));
|
||||||
|
|
Ładowanie…
Reference in New Issue