kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-session-settings' into 'master'
genesys: Session settings refactor See merge request sane-project/backends!116merge-requests/117/head
commit
a18ec0faac
|
@ -779,7 +779,7 @@ void sanei_genesys_create_default_gamma_table(Genesys_Device* dev,
|
|||
{
|
||||
int size = 0;
|
||||
int max = 0;
|
||||
if (dev->model->asic_type == GENESYS_GL646) {
|
||||
if (dev->model->asic_type == AsicType::GL646) {
|
||||
if (dev->model->flags & GENESYS_FLAG_14BIT_GAMMA) {
|
||||
size = 16384;
|
||||
} else {
|
||||
|
@ -1644,11 +1644,11 @@ static void genesys_dark_shading_calibration(Genesys_Device* dev, const Genesys_
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME: the current calculation is likely incorrect on non-GENESYS_GL843 implementations,
|
||||
// FIXME: the current calculation is likely incorrect on non-GL843 implementations,
|
||||
// but this needs checking
|
||||
if (dev->calib_total_bytes_to_read > 0) {
|
||||
size = dev->calib_total_bytes_to_read;
|
||||
} else if (dev->model->asic_type == GENESYS_GL843) {
|
||||
} else if (dev->model->asic_type == AsicType::GL843) {
|
||||
size = channels * 2 * pixels_per_line * dev->calib_lines;
|
||||
} else {
|
||||
size = channels * 2 * pixels_per_line * (dev->calib_lines + 1);
|
||||
|
@ -1828,11 +1828,11 @@ static void genesys_white_shading_calibration(Genesys_Device* dev, const Genesys
|
|||
dev->white_average_data.clear();
|
||||
dev->white_average_data.resize(channels * 2 * out_pixels_per_line);
|
||||
|
||||
// FIXME: the current calculation is likely incorrect on non-GENESYS_GL843 implementations,
|
||||
// FIXME: the current calculation is likely incorrect on non-GL843 implementations,
|
||||
// but this needs checking
|
||||
if (dev->calib_total_bytes_to_read > 0) {
|
||||
size = dev->calib_total_bytes_to_read;
|
||||
} else if (dev->model->asic_type == GENESYS_GL843) {
|
||||
} else if (dev->model->asic_type == AsicType::GL843) {
|
||||
size = channels * 2 * pixels_per_line * dev->calib_lines;
|
||||
} else {
|
||||
size = channels * 2 * pixels_per_line * (dev->calib_lines + 1);
|
||||
|
@ -2873,6 +2873,7 @@ static void genesys_save_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
found_cache_it->white_average_data = dev->white_average_data;
|
||||
|
||||
found_cache_it->used_setup = dev->current_setup;
|
||||
found_cache_it->params = dev->session.params;
|
||||
found_cache_it->frontend = dev->frontend;
|
||||
found_cache_it->sensor = sensor;
|
||||
|
||||
|
@ -3503,9 +3504,8 @@ static void genesys_fill_line_interp_buffer(Genesys_Device* dev, uint8_t* work_b
|
|||
while (count < size)
|
||||
{
|
||||
/* line counter */
|
||||
/* dev->line_interp holds the number of lines scanned for one line of data sent */
|
||||
if(((dev->line_count/dev->current_setup.channels) % dev->line_interp)==0)
|
||||
{
|
||||
// dev->line_interp holds the number of lines scanned for one line of data sent
|
||||
if (((dev->line_count / dev->session.params.channels) % dev->line_interp) == 0) {
|
||||
/* copy pixel when line matches */
|
||||
work_buffer_dst[count] = dev->oe_buffer.get_read_pos()[dev->cur];
|
||||
count++;
|
||||
|
@ -3724,11 +3724,11 @@ static void genesys_read_ordered_data(Genesys_Device* dev, SANE_Byte* destinatio
|
|||
}
|
||||
|
||||
debug_dump(DBG_info, dev->current_setup);
|
||||
debug_dump(DBG_info, dev->session.params);
|
||||
|
||||
/* prepare conversion */
|
||||
/* current settings */
|
||||
channels = dev->current_setup.channels;
|
||||
depth = dev->current_setup.depth;
|
||||
channels = dev->session.params.channels;
|
||||
depth = dev->session.params.depth;
|
||||
|
||||
src_pixels = dev->current_setup.pixels;
|
||||
|
||||
|
@ -4135,12 +4135,12 @@ static void calc_parameters(Genesys_Scanner* s)
|
|||
|
||||
/* we need an even pixels number
|
||||
* TODO invert test logic or generalize behaviour across all ASICs */
|
||||
if ((s->dev->model->flags & GENESYS_FLAG_SIS_SENSOR)
|
||||
|| s->dev->model->asic_type == GENESYS_GL847
|
||||
|| s->dev->model->asic_type == GENESYS_GL124
|
||||
|| s->dev->model->asic_type == GENESYS_GL845
|
||||
|| s->dev->model->asic_type == GENESYS_GL846
|
||||
|| s->dev->model->asic_type == GENESYS_GL843)
|
||||
if ((s->dev->model->flags & GENESYS_FLAG_SIS_SENSOR) ||
|
||||
s->dev->model->asic_type == AsicType::GL847 ||
|
||||
s->dev->model->asic_type == AsicType::GL124 ||
|
||||
s->dev->model->asic_type == AsicType::GL845 ||
|
||||
s->dev->model->asic_type == AsicType::GL846 ||
|
||||
s->dev->model->asic_type == AsicType::GL843)
|
||||
{
|
||||
if (s->dev->settings.xres <= 1200)
|
||||
s->params.pixels_per_line = (s->params.pixels_per_line/4)*4;
|
||||
|
@ -4150,12 +4150,10 @@ static void calc_parameters(Genesys_Scanner* s)
|
|||
|
||||
/* corner case for true lineart for sensor with several segments
|
||||
* or when xres is doubled to match yres */
|
||||
if (s->dev->settings.xres >= 1200
|
||||
&& ( s->dev->model->asic_type == GENESYS_GL124
|
||||
|| s->dev->model->asic_type == GENESYS_GL847
|
||||
|| s->dev->current_setup.xres < s->dev->current_setup.yres
|
||||
)
|
||||
)
|
||||
if (s->dev->settings.xres >= 1200 && (
|
||||
s->dev->model->asic_type == AsicType::GL124 ||
|
||||
s->dev->model->asic_type == AsicType::GL847 ||
|
||||
s->dev->current_setup.xres < s->dev->session.params.yres))
|
||||
{
|
||||
s->params.pixels_per_line = (s->params.pixels_per_line/16)*16;
|
||||
}
|
||||
|
@ -4232,9 +4230,9 @@ static void calc_parameters(Genesys_Scanner* s)
|
|||
/* hardware lineart works only when we don't have interleave data
|
||||
* for GL847 scanners, ie up to 600 DPI, then we have to rely on
|
||||
* dynamic_lineart */
|
||||
if(s->dev->settings.xres > 600
|
||||
&& s->dev->model->asic_type==GENESYS_GL847
|
||||
&& s->dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
if (s->dev->settings.xres > 600 &&
|
||||
s->dev->model->asic_type==AsicType::GL847 &&
|
||||
s->dev->settings.scan_mode == ScanColorMode::LINEART)
|
||||
{
|
||||
s->dev->settings.dynamic_lineart = SANE_TRUE;
|
||||
}
|
||||
|
@ -4296,8 +4294,7 @@ init_gamma_vector_option (Genesys_Scanner * scanner, int option)
|
|||
scanner->opt[option].cap |= SANE_CAP_INACTIVE | SANE_CAP_ADVANCED;
|
||||
scanner->opt[option].unit = SANE_UNIT_NONE;
|
||||
scanner->opt[option].constraint_type = SANE_CONSTRAINT_RANGE;
|
||||
if (scanner->dev->model->asic_type == GENESYS_GL646)
|
||||
{
|
||||
if (scanner->dev->model->asic_type == AsicType::GL646) {
|
||||
if ((scanner->dev->model->flags & GENESYS_FLAG_14BIT_GAMMA) != 0)
|
||||
{
|
||||
scanner->opt[option].size = 16384 * sizeof (SANE_Word);
|
||||
|
@ -4768,8 +4765,8 @@ static void init_options(Genesys_Scanner* s)
|
|||
s->disable_dynamic_lineart = false;
|
||||
|
||||
/* fastmod is required for hw lineart to work */
|
||||
if ((s->dev->model->asic_type == GENESYS_GL646)
|
||||
&&(s->dev->model->motor_type != MOTOR_XP200))
|
||||
if ((s->dev->model->asic_type == AsicType::GL646) &&
|
||||
(s->dev->model->motor_type != MOTOR_XP200))
|
||||
{
|
||||
s->opt[OPT_DISABLE_DYNAMIC_LINEART].cap = SANE_CAP_INACTIVE;
|
||||
}
|
||||
|
@ -4796,8 +4793,7 @@ static void init_options(Genesys_Scanner* s)
|
|||
s->opt[OPT_COLOR_FILTER].type = SANE_TYPE_STRING;
|
||||
s->opt[OPT_COLOR_FILTER].constraint_type = SANE_CONSTRAINT_STRING_LIST;
|
||||
/* true gray not yet supported for GL847 and GL124 scanners */
|
||||
if(!model->is_cis || model->asic_type==GENESYS_GL847 || model->asic_type==GENESYS_GL124)
|
||||
{
|
||||
if (!model->is_cis || model->asic_type==AsicType::GL847 || model->asic_type==AsicType::GL124) {
|
||||
s->opt[OPT_COLOR_FILTER].size = max_string_size (color_filter_list);
|
||||
s->opt[OPT_COLOR_FILTER].constraint.string_list = color_filter_list;
|
||||
s->color_filter = s->opt[OPT_COLOR_FILTER].constraint.string_list[1];
|
||||
|
@ -4810,9 +4806,8 @@ static void init_options(Genesys_Scanner* s)
|
|||
s->color_filter = s->opt[OPT_COLOR_FILTER].constraint.string_list[3];
|
||||
}
|
||||
|
||||
/* no support for color filter for cis+gl646 scanners */
|
||||
if (model->asic_type == GENESYS_GL646 && model->is_cis)
|
||||
{
|
||||
// no support for color filter for cis+gl646 scanners
|
||||
if (model->asic_type == AsicType::GL646 && model->is_cis) {
|
||||
DISABLE (OPT_COLOR_FILTER);
|
||||
}
|
||||
|
||||
|
@ -6111,10 +6106,9 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
|
|||
ENABLE (OPT_THRESHOLD);
|
||||
ENABLE (OPT_THRESHOLD_CURVE);
|
||||
DISABLE (OPT_BIT_DEPTH);
|
||||
if (s->dev->model->asic_type != GENESYS_GL646 || !s->dev->model->is_cis)
|
||||
{
|
||||
ENABLE (OPT_COLOR_FILTER);
|
||||
}
|
||||
if (s->dev->model->asic_type != AsicType::GL646 || !s->dev->model->is_cis) {
|
||||
ENABLE(OPT_COLOR_FILTER);
|
||||
}
|
||||
ENABLE (OPT_DISABLE_DYNAMIC_LINEART);
|
||||
}
|
||||
else
|
||||
|
@ -6124,10 +6118,9 @@ set_option_value (Genesys_Scanner * s, int option, void *val,
|
|||
DISABLE (OPT_DISABLE_DYNAMIC_LINEART);
|
||||
if (s->mode == SANE_VALUE_SCAN_MODE_GRAY)
|
||||
{
|
||||
if (s->dev->model->asic_type != GENESYS_GL646 || !s->dev->model->is_cis)
|
||||
{
|
||||
ENABLE (OPT_COLOR_FILTER);
|
||||
}
|
||||
if (s->dev->model->asic_type != AsicType::GL646 || !s->dev->model->is_cis) {
|
||||
ENABLE(OPT_COLOR_FILTER);
|
||||
}
|
||||
create_bpp_list (s, s->dev->model->bpp_gray_values);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -54,6 +54,7 @@ struct Genesys_Calibration_Cache
|
|||
|
||||
// used to check if entry is compatible
|
||||
Genesys_Current_Setup used_setup;
|
||||
SetupParams params;
|
||||
time_t last_calibration = 0;
|
||||
|
||||
Genesys_Frontend frontend;
|
||||
|
@ -68,6 +69,7 @@ struct Genesys_Calibration_Cache
|
|||
bool operator==(const Genesys_Calibration_Cache& other) const
|
||||
{
|
||||
return used_setup == other.used_setup &&
|
||||
params == other.params &&
|
||||
last_calibration == other.last_calibration &&
|
||||
frontend == other.frontend &&
|
||||
sensor == other.sensor &&
|
||||
|
@ -84,6 +86,8 @@ void serialize(Stream& str, Genesys_Calibration_Cache& x)
|
|||
{
|
||||
serialize(str, x.used_setup);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.params);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.last_calibration);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.frontend);
|
||||
|
|
|
@ -92,8 +92,7 @@ struct Genesys_Model
|
|||
const char* model = nullptr;
|
||||
unsigned model_id = 0;
|
||||
|
||||
// ASIC type gl646 or gl841
|
||||
unsigned asic_type = 0;
|
||||
AsicType asic_type = AsicType::UNKNOWN;
|
||||
|
||||
// possible x resolutions
|
||||
std::vector<unsigned> xdpi_values;
|
||||
|
@ -288,6 +287,8 @@ struct Genesys_Device
|
|||
|
||||
// contains the real used values
|
||||
Genesys_Current_Setup current_setup;
|
||||
// contains computed data for the current setup
|
||||
ScanSession session;
|
||||
|
||||
// look up table used in dynamic rasterization
|
||||
unsigned char lineart_lut[256] = {};
|
||||
|
|
|
@ -3015,7 +3015,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "UMAX";
|
||||
model.model = "Astra 4500";
|
||||
model.model_id = MODEL_UMAX_ASTRA_4500;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 };
|
||||
|
@ -3067,7 +3067,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 35/40/50";
|
||||
model.model_id = MODEL_CANON_LIDE_50;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 400, 300, 240, 200, 150, 75 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 240, 200, 150, 75 };
|
||||
|
@ -3126,7 +3126,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Panasonic";
|
||||
model.model = "KV-SS080";
|
||||
model.model_id = MODEL_PANASONIC_KV_SS080;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 600, /* 500, 400,*/ 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { 1200, 600, /* 500, 400, */ 300, 200, 150, 100, 75 };
|
||||
|
@ -3181,7 +3181,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet 4850C";
|
||||
model.model_id = MODEL_HP_SCANJET_4850C;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
|
@ -3237,7 +3237,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet G4010";
|
||||
model.model_id = MODEL_HP_SCANJET_G4010;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
|
@ -3293,7 +3293,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet G4050";
|
||||
model.model_id = MODEL_HP_SCANJET_G4050;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
|
@ -3350,7 +3350,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "Canoscan 4400f";
|
||||
model.model_id = MODEL_CANON_CANOSCAN_4400F;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
|
@ -3409,7 +3409,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "Canoscan 8400f";
|
||||
model.model_id = MODEL_CANON_CANOSCAN_8400F;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300, 200, 150, 100 };
|
||||
|
@ -3470,7 +3470,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "Canoscan 8600f";
|
||||
model.model_id = MODEL_CANON_CANOSCAN_8600F;
|
||||
model.asic_type = GENESYS_GL843;
|
||||
model.asic_type = AsicType::GL843;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 400, 300 }; // TODO: resolutions for non-XPA mode
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 400, 300 }; // TODO: resolutions for non-XPA mode
|
||||
|
@ -3531,7 +3531,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 100";
|
||||
model.model_id = MODEL_CANON_LIDE_100;
|
||||
model.asic_type = GENESYS_GL847;
|
||||
model.asic_type = AsicType::GL847;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
|
||||
|
@ -3591,7 +3591,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 110";
|
||||
model.model_id = MODEL_CANON_LIDE_110;
|
||||
model.asic_type = GENESYS_GL124;
|
||||
model.asic_type = AsicType::GL124;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
|
||||
|
@ -3649,7 +3649,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 120";
|
||||
model.model_id = MODEL_CANON_LIDE_120;
|
||||
model.asic_type = GENESYS_GL124;
|
||||
model.asic_type = AsicType::GL124;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
|
||||
|
@ -3706,7 +3706,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 210";
|
||||
model.model_id = MODEL_CANON_LIDE_210;
|
||||
model.asic_type = GENESYS_GL124;
|
||||
model.asic_type = AsicType::GL124;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, /* 400,*/ 300, 150, 100, 75 };
|
||||
|
@ -3766,7 +3766,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 220";
|
||||
model.model_id = MODEL_CANON_LIDE_220;
|
||||
model.asic_type = GENESYS_GL124; // or a compatible one
|
||||
model.asic_type = AsicType::GL124; // or a compatible one
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 150, 100, 75 };
|
||||
|
@ -3825,7 +3825,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "5600F";
|
||||
model.model_id = MODEL_CANON_CANOSCAN_5600F;
|
||||
model.asic_type = GENESYS_GL847;
|
||||
model.asic_type = AsicType::GL847;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75 };
|
||||
|
@ -3885,7 +3885,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 700F";
|
||||
model.model_id = MODEL_CANON_LIDE_700F;
|
||||
model.asic_type = GENESYS_GL847;
|
||||
model.asic_type = AsicType::GL847;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
|
||||
|
@ -3944,7 +3944,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 200";
|
||||
model.model_id = MODEL_CANON_LIDE_200;
|
||||
model.asic_type = GENESYS_GL847;
|
||||
model.asic_type = AsicType::GL847;
|
||||
|
||||
model.xdpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { 4800, 2400, 1200, 600, 300, 200, 150, 100, 75 };
|
||||
|
@ -4003,7 +4003,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 60";
|
||||
model.model_id = MODEL_CANON_LIDE_60;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 };
|
||||
|
@ -4062,7 +4062,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "LiDE 80";
|
||||
model.model_id = MODEL_CANON_LIDE_80;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 400, 300, 240, 150, 100, 75 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 240, 150, 100, 75 };
|
||||
|
@ -4120,7 +4120,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet 2300c";
|
||||
model.model_id = MODEL_HP_SCANJET_2300C;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4177,7 +4177,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet 2400c";
|
||||
model.model_id = MODEL_HP_SCANJET_2400C;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 100, 50 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 100, 50 };
|
||||
|
@ -4235,7 +4235,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Visioneer";
|
||||
model.model = "Strobe XP200";
|
||||
model.model_id = MODEL_VISIONEER_STROBE_XP200;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 600, 300, 200, 100, 75 };
|
||||
model.ydpi_values = { 600, 300, 200, 100, 75 };
|
||||
|
@ -4292,7 +4292,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet 3670c";
|
||||
model.model_id = MODEL_HP_SCANJET_3670C;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 100, 75 };
|
||||
|
@ -4350,7 +4350,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Plustek";
|
||||
model.model = "OpticPro ST12";
|
||||
model.model_id = MODEL_PLUSTEK_OPTICPRO_ST12;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4401,7 +4401,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Plustek";
|
||||
model.model = "OpticPro ST24";
|
||||
model.model_id = MODEL_PLUSTEK_OPTICPRO_ST24;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 300, 150, 75 };
|
||||
|
@ -4457,7 +4457,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Medion";
|
||||
model.model = "MD5345/MD6228/MD6471";
|
||||
model.model_id = MODEL_MEDION_MD5345;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
|
||||
|
@ -4518,7 +4518,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Visioneer";
|
||||
model.model = "Strobe XP300";
|
||||
model.model_id = MODEL_VISIONEER_STROBE_XP300;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 600, 300, 150, 75 };
|
||||
|
@ -4573,7 +4573,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Syscan/Ambir";
|
||||
model.model = "DocketPORT 665";
|
||||
model.model_id = MODEL_SYSCAN_DOCKETPORT_665;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4628,7 +4628,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Visioneer";
|
||||
model.model = "Readwarrior";
|
||||
model.model_id = MODEL_VISIONEER_ROADWARRIOR;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4683,7 +4683,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Syscan";
|
||||
model.model = "DocketPORT 465";
|
||||
model.model_id = MODEL_SYSCAN_DOCKETPORT_465;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4739,7 +4739,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Visioneer";
|
||||
model.model = "XP100 Revision 3";
|
||||
model.model_id = MODEL_VISIONEER_STROBE_XP100_REVISION3;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4794,7 +4794,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Pentax";
|
||||
model.model = "DSmobile 600";
|
||||
model.model_id = MODEL_PENTAX_DSMOBILE_600;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4851,7 +4851,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Syscan";
|
||||
model.model = "DocketPORT 467";
|
||||
model.model_id = MODEL_SYSCAN_DOCKETPORT_467;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -4905,7 +4905,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Syscan/Ambir";
|
||||
model.model = "DocketPORT 685";
|
||||
model.model_id = MODEL_SYSCAN_DOCKETPORT_685;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 600, 300, 150, 75 };
|
||||
|
@ -4962,7 +4962,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Syscan/Ambir";
|
||||
model.model = "DocketPORT 485";
|
||||
model.model_id = MODEL_SYSCAN_DOCKETPORT_485;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 600, 300, 150, 75 };
|
||||
|
@ -5018,7 +5018,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "DCT";
|
||||
model.model = "DocketPORT 487";
|
||||
model.model_id = MODEL_DCT_DOCKETPORT_487;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 600, 300, 150, 75 };
|
||||
|
@ -5075,7 +5075,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Visioneer";
|
||||
model.model = "OneTouch 7100";
|
||||
model.model_id = MODEL_VISIONEER_7100;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
|
||||
|
@ -5136,7 +5136,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Xerox";
|
||||
model.model = "OneTouch 2400";
|
||||
model.model_id = MODEL_XEROX_2400;
|
||||
model.asic_type = GENESYS_GL646;
|
||||
model.asic_type = AsicType::GL646;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75, 50 };
|
||||
|
@ -5197,7 +5197,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Xerox";
|
||||
model.model = "Travelscanner 100";
|
||||
model.model_id = MODEL_XEROX_TRAVELSCANNER_100;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
|
||||
model.xdpi_values = { 600, 300, 150, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 75 };
|
||||
|
@ -5253,7 +5253,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "PLUSTEK";
|
||||
model.model = "OpticBook 3600";
|
||||
model.model_id = MODEL_PLUSTEK_OPTICPRO_3600;
|
||||
model.asic_type = GENESYS_GL841;
|
||||
model.asic_type = AsicType::GL841;
|
||||
model.xdpi_values = { /*1200,*/ 600, 400, 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { /*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75 };
|
||||
model.bpp_gray_values = { 16, 8 };
|
||||
|
@ -5309,7 +5309,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Hewlett Packard";
|
||||
model.model = "ScanJet N6310";
|
||||
model.model_id = MODEL_HP_SCANJET_N6310;
|
||||
model.asic_type = GENESYS_GL847;
|
||||
model.asic_type = AsicType::GL847;
|
||||
|
||||
model.xdpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75 };
|
||||
model.ydpi_values = { 2400, 1200, 600, 400, 300, 200, 150, 100, 75 };
|
||||
|
@ -5370,7 +5370,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "PLUSTEK";
|
||||
model.model = "OpticBook 3800";
|
||||
model.model_id = MODEL_PLUSTEK_OPTICBOOK_3800;
|
||||
model.asic_type = GENESYS_GL845;
|
||||
model.asic_type = AsicType::GL845;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 100, 75 };
|
||||
|
@ -5425,7 +5425,7 @@ void genesys_init_usb_device_tables()
|
|||
model.vendor = "Canon";
|
||||
model.model = "Image Formula 101";
|
||||
model.model_id = MODEL_CANON_IMAGE_FORMULA_101;
|
||||
model.asic_type = GENESYS_GL846;
|
||||
model.asic_type = AsicType::GL846;
|
||||
|
||||
model.xdpi_values = { 1200, 600, 300, 150, 100, 75 };
|
||||
model.ydpi_values = { 1200, 600, 300, 150, 100, 75 };
|
||||
|
|
|
@ -286,4 +286,18 @@ enum Genesys_Motor_Type
|
|||
MOTOR_CANONLIDE120
|
||||
};
|
||||
|
||||
enum class AsicType : unsigned
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
GL646,
|
||||
GL841,
|
||||
GL843,
|
||||
GL845,
|
||||
GL846,
|
||||
GL847,
|
||||
GL848,
|
||||
GL123,
|
||||
GL124,
|
||||
};
|
||||
|
||||
#endif // BACKEND_GENESYS_ENUMS_H
|
||||
|
|
|
@ -1247,8 +1247,6 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
oflags |= OPTICAL_FLAG_DISABLE_GAMMA;
|
||||
if (params.flags & SCAN_FLAG_DISABLE_LAMP)
|
||||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||
if (params.flags & SCAN_FLAG_CALIBRATION)
|
||||
oflags |= OPTICAL_FLAG_DISABLE_DOUBLE;
|
||||
|
||||
if (dev->model->is_cis && dev->settings.true_gray)
|
||||
{
|
||||
|
@ -1316,15 +1314,12 @@ static void gl124_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
dev->read_active = SANE_TRUE;
|
||||
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1438,15 +1433,12 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
/* lincnt */
|
||||
lincnt = params.lines + max_shift + stagger;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
DBG (DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -2182,7 +2174,7 @@ static void gl124_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
{
|
||||
dev->binary=fopen("binary.pnm","wb");
|
||||
lines = dev->reg.get24(REG_LINCNT);
|
||||
channels=dev->current_setup.channels;
|
||||
channels = dev->session.params.channels;
|
||||
if(dev->binary!=NULL)
|
||||
{
|
||||
fprintf(dev->binary,"P5\n%d %d\n%d\n",(endpixel-strpixel)/factor*channels*dev->segnb,lines/channels,255);
|
||||
|
|
|
@ -943,15 +943,12 @@ static void gl646_setup_registers(Genesys_Device* dev,
|
|||
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__, (u_long) dev->read_bytes_left);
|
||||
dev->read_active = SANE_TRUE;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels =
|
||||
((endx - startx) * sensor_mst->xdpi) / sensor.optical_res;
|
||||
dev->current_setup.lines = linecnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = sensor_mst->exposure;
|
||||
dev->current_setup.xres = sensor_mst->xdpi;
|
||||
dev->current_setup.yres = motor->ydpi;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1734,17 +1731,13 @@ static void gl646_detect_document_end(Genesys_Device* dev)
|
|||
sanei_genesys_read_valid_words(dev, &bytes_left);
|
||||
|
||||
/* we add the number of lines needed to read the last part of the document in */
|
||||
lines =
|
||||
(SANE_UNFIX (dev->model->y_offset) * dev->current_setup.yres) /
|
||||
MM_PER_INCH;
|
||||
lines = (SANE_UNFIX(dev->model->y_offset) * dev->session.params.yres) / MM_PER_INCH;
|
||||
DBG(DBG_io, "%s: adding %d line to flush\n", __func__, lines);
|
||||
bytes_left += lines * dev->wpl;
|
||||
if (dev->current_setup.depth > 8)
|
||||
{
|
||||
if (dev->session.params.depth > 8) {
|
||||
bytes_left = 2 * bytes_left;
|
||||
}
|
||||
if (dev->current_setup.channels > 1)
|
||||
{
|
||||
if (dev->session.params.channels > 1) {
|
||||
bytes_left = 3 * bytes_left;
|
||||
}
|
||||
if (bytes_left < dev->read_bytes_left)
|
||||
|
@ -2256,7 +2249,7 @@ static void gl646_init_regs_for_shading(Genesys_Device* dev, const Genesys_Senso
|
|||
|
||||
/* used when sending shading calibration data */
|
||||
dev->calib_pixels = settings.pixels;
|
||||
dev->calib_channels = dev->current_setup.channels;
|
||||
dev->calib_channels = dev->session.params.channels;
|
||||
if (dev->model->is_cis == SANE_FALSE)
|
||||
{
|
||||
dev->calib_channels = 3;
|
||||
|
@ -3857,36 +3850,31 @@ gl646_is_compatible_calibration (Genesys_Device * dev, const Genesys_Sensor& sen
|
|||
*/
|
||||
if (dev->settings.scan_mode == ScanColorMode::COLOR_SINGLE_PASS)
|
||||
{
|
||||
dev->current_setup.channels = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
dev->current_setup.channels = 1;
|
||||
dev->session.params.channels = 3;
|
||||
} else {
|
||||
dev->session.params.channels = 1;
|
||||
}
|
||||
dev->current_setup.xres = dev->settings.xres;
|
||||
|
||||
DBG(DBG_io, "%s: requested=(%d,%f), tested=(%d,%f)\n", __func__, dev->current_setup.channels,
|
||||
dev->current_setup.xres, cache->used_setup.channels, cache->used_setup.xres);
|
||||
DBG(DBG_io, "%s: requested=(%d,%f), tested=(%d,%f)\n", __func__,
|
||||
dev->session.params.channels, dev->current_setup.xres,
|
||||
cache->params.channels, cache->used_setup.xres);
|
||||
|
||||
/* a calibration cache is compatible if color mode and x dpi match the user
|
||||
* requested scan. In the case of CIS scanners, dpi isn't a criteria */
|
||||
if (dev->model->is_cis == SANE_FALSE)
|
||||
{
|
||||
compatible =
|
||||
((dev->current_setup.channels == cache->used_setup.channels)
|
||||
&& (((int) dev->current_setup.xres) ==
|
||||
((int) cache->used_setup.xres)));
|
||||
compatible = (dev->session.params.channels == cache->params.channels) &&
|
||||
(((int) dev->current_setup.xres) == ((int) cache->used_setup.xres));
|
||||
} else {
|
||||
compatible = dev->session.params.channels == cache->params.channels;
|
||||
}
|
||||
else
|
||||
{
|
||||
compatible =
|
||||
(dev->current_setup.channels == cache->used_setup.channels);
|
||||
}
|
||||
if (dev->current_setup.params.scan_method != cache->used_setup.params.scan_method)
|
||||
|
||||
if (dev->session.params.scan_method != cache->params.scan_method)
|
||||
{
|
||||
DBG(DBG_io, "%s: current method=%d, used=%d\n", __func__,
|
||||
static_cast<unsigned>(dev->current_setup.params.scan_method),
|
||||
static_cast<unsigned>(cache->used_setup.params.scan_method));
|
||||
static_cast<unsigned>(dev->session.params.scan_method),
|
||||
static_cast<unsigned>(cache->params.scan_method));
|
||||
compatible = 0;
|
||||
}
|
||||
if (!compatible)
|
||||
|
|
|
@ -269,7 +269,10 @@ typedef struct
|
|||
unsigned channels;
|
||||
|
||||
/* settings */
|
||||
SANE_Int ydpi; /* real motor dpi, may be different from the resolution */
|
||||
|
||||
// real motor dpi, may be different from the resolution. For the currently known motors it's the
|
||||
// same
|
||||
SANE_Int ydpi;
|
||||
SANE_Int steptype; /* 0=full, 1=half, 2=quarter */
|
||||
SANE_Bool fastmod; /* fast scanning 0/1 */
|
||||
SANE_Bool fastfed; /* fast fed slope tables */
|
||||
|
|
|
@ -2038,14 +2038,11 @@ dummy \ scanned lines
|
|||
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__, (u_long) dev->read_bytes_left);
|
||||
dev->read_active = SANE_TRUE;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res)/optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -2251,14 +2248,11 @@ dummy \ scanned lines
|
|||
|
||||
lincnt = params.lines + max_shift + stagger;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res)/optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -4580,7 +4574,7 @@ static void gl841_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
{
|
||||
dev->binary=fopen("binary.pnm","wb");
|
||||
lines = dev->reg.get24(REG_LINCNT);
|
||||
channels=dev->current_setup.channels;
|
||||
channels = dev->session.params.channels;
|
||||
if(dev->binary!=NULL)
|
||||
{
|
||||
fprintf(dev->binary,"P5\n%d %d\n%d\n",(endpixel-strpixel)/factor*channels,lines/channels,255);
|
||||
|
|
|
@ -1243,53 +1243,6 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
r->value = sensor.dummy_pixel;
|
||||
}
|
||||
|
||||
struct ScanSession {
|
||||
SetupParams params;
|
||||
|
||||
// whether the session setup has been computed via gl843_compute_session()
|
||||
bool computed = false;
|
||||
|
||||
// whether CCD operates as half-resolution or full resolution at a specific resolution
|
||||
unsigned ccd_size_divisor = 1;
|
||||
|
||||
// the optical resolution of the scanner.
|
||||
unsigned optical_resolution = 0;
|
||||
|
||||
// the number of pixels at the optical resolution.
|
||||
unsigned optical_pixels = 0;
|
||||
|
||||
// the number of bytes in the output of a single line directly from scanner
|
||||
unsigned optical_line_bytes = 0;
|
||||
|
||||
// the resolution of the output data.
|
||||
unsigned output_resolution = 0;
|
||||
|
||||
// the number of pixels in output data
|
||||
unsigned output_pixels = 0;
|
||||
|
||||
// the number of bytes in the output of a single line
|
||||
unsigned output_line_bytes = 0;
|
||||
|
||||
// the number of lines in the output of the scanner. This must be larger than the user
|
||||
// requested number due to line staggering and color channel shifting.
|
||||
unsigned output_line_count = 0;
|
||||
|
||||
// the number of staggered lines (i.e. lines that overlap during scanning due to line being
|
||||
// thinner than the CCD element)
|
||||
unsigned num_staggered_lines = 0;
|
||||
|
||||
// the number of lines that color channels shift due to different physical positions of
|
||||
// different color channels
|
||||
unsigned max_color_shift_lines = 0;
|
||||
|
||||
void assert_computed() const
|
||||
{
|
||||
if (!computed) {
|
||||
throw std::runtime_error("ScanSession is not computed");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static unsigned align_int_up(unsigned num, unsigned alignment)
|
||||
{
|
||||
unsigned mask = alignment - 1;
|
||||
|
@ -1307,16 +1260,12 @@ static void gl843_compute_session(Genesys_Device* dev, ScanSession& s,
|
|||
|
||||
s.optical_resolution = sensor.optical_res / s.ccd_size_divisor;
|
||||
|
||||
if (s.params.flags & SCAN_FLAG_USE_OPTICAL_RES) {
|
||||
// resolution is choosen from a fixed list and can be used directly
|
||||
// unless we have ydpi higher than sensor's maximum one
|
||||
if (s.params.xres > s.optical_resolution)
|
||||
s.output_resolution = s.optical_resolution;
|
||||
} else {
|
||||
// resolution is choosen from a fixed list and can be used directly
|
||||
// unless we have ydpi higher than sensor's maximum one
|
||||
if (s.params.xres > s.optical_resolution)
|
||||
s.output_resolution = s.optical_resolution;
|
||||
else
|
||||
s.output_resolution = s.params.xres;
|
||||
}
|
||||
else
|
||||
s.output_resolution = s.params.xres;
|
||||
|
||||
// compute rounded up number of optical pixels
|
||||
s.optical_pixels = (s.params.pixels * s.optical_resolution) / s.params.xres;
|
||||
|
@ -1382,8 +1331,6 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
oflags |= OPTICAL_FLAG_DISABLE_GAMMA;
|
||||
if (session.params.flags & SCAN_FLAG_DISABLE_LAMP)
|
||||
oflags |= OPTICAL_FLAG_DISABLE_LAMP;
|
||||
if (session.params.flags & SCAN_FLAG_CALIBRATION)
|
||||
oflags |= OPTICAL_FLAG_DISABLE_DOUBLE;
|
||||
if (session.num_staggered_lines)
|
||||
oflags |= OPTICAL_FLAG_STAGGER;
|
||||
if (session.params.flags & SCAN_FLAG_USE_XPA)
|
||||
|
@ -1502,15 +1449,12 @@ static void gl843_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__, (u_long) dev->read_bytes_left);
|
||||
dev->read_active = SANE_TRUE;
|
||||
|
||||
dev->current_setup.params = session.params;
|
||||
dev->session = session;
|
||||
dev->current_setup.pixels = session.output_pixels;
|
||||
DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
||||
dev->current_setup.lines = session.output_line_count;
|
||||
dev->current_setup.depth = session.params.depth;
|
||||
dev->current_setup.channels = session.params.channels;
|
||||
dev->current_setup.exposure_time = exposure;
|
||||
dev->current_setup.xres = session.output_resolution;
|
||||
dev->current_setup.yres = session.params.yres;
|
||||
dev->current_setup.ccd_size_divisor = session.ccd_size_divisor;
|
||||
dev->current_setup.stagger = session.num_staggered_lines;
|
||||
dev->current_setup.max_shift = session.max_color_shift_lines + session.num_staggered_lines;
|
||||
|
@ -1649,15 +1593,12 @@ gl843_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
/* lincnt */
|
||||
lincnt = params.lines + max_shift + stagger;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
DBG(DBG_info, "%s: current_setup.pixels=%d\n", __func__, dev->current_setup.pixels);
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1793,7 +1734,7 @@ static void gl843_detect_document_end(Genesys_Device* dev)
|
|||
DBG_HELPER(dbg);
|
||||
SANE_Bool paper_loaded;
|
||||
unsigned int scancnt = 0;
|
||||
int flines, channels, depth, bytes_remain, sublines,
|
||||
int flines, bytes_remain, sublines,
|
||||
bytes_to_flush, lines, sub_bytes, tmp, read_bytes_left;
|
||||
|
||||
gl843_get_paper_sensor(dev, &paper_loaded);
|
||||
|
@ -1804,8 +1745,8 @@ static void gl843_detect_document_end(Genesys_Device* dev)
|
|||
DBG(DBG_info, "%s: no more document\n", __func__);
|
||||
dev->document = SANE_FALSE;
|
||||
|
||||
channels = dev->current_setup.channels;
|
||||
depth = dev->current_setup.depth;
|
||||
unsigned channels = dev->session.params.channels;
|
||||
unsigned depth = dev->session.params.depth;
|
||||
read_bytes_left = (int) dev->read_bytes_left;
|
||||
DBG(DBG_io, "%s: read_bytes_left=%d\n", __func__, read_bytes_left);
|
||||
|
||||
|
@ -1828,12 +1769,11 @@ static void gl843_detect_document_end(Genesys_Device* dev)
|
|||
|
||||
DBG(DBG_io, "%s: %d scanned but not read lines\n", __func__, flines);
|
||||
|
||||
/* adjust number of bytes to read
|
||||
* we need to read the final bytes which are word per line * number of last lines
|
||||
* to have doc leaving feeder */
|
||||
lines =
|
||||
(SANE_UNFIX (dev->model->post_scan) * dev->current_setup.yres) /
|
||||
MM_PER_INCH + flines;
|
||||
// Adjust number of bytes to read. We need to read the final bytes which are word per
|
||||
// line times number of last lines to have doc leaving feeder
|
||||
lines = (SANE_UNFIX(dev->model->post_scan) * dev->session.params.yres) / MM_PER_INCH +
|
||||
flines;
|
||||
|
||||
DBG(DBG_io, "%s: adding %d line to flush\n", __func__, lines);
|
||||
|
||||
/* number of bytes to read from scanner to get document out of it after
|
||||
|
|
|
@ -378,7 +378,6 @@
|
|||
#define SCAN_FLAG_DISABLE_GAMMA 0x004
|
||||
#define SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE 0x008
|
||||
#define SCAN_FLAG_IGNORE_LINE_DISTANCE 0x010
|
||||
#define SCAN_FLAG_USE_OPTICAL_RES 0x020
|
||||
#define SCAN_FLAG_DISABLE_LAMP 0x040
|
||||
#define SCAN_FLAG_DYNAMIC_LINEART 0x080
|
||||
|
||||
|
|
|
@ -218,8 +218,6 @@ static void gl846_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& senso
|
|||
int dpihw;
|
||||
uint16_t exp;
|
||||
|
||||
dpihw = sensor.get_register_hwdpi(dpi);
|
||||
|
||||
for (uint16_t addr = 0x16; addr < 0x1e; addr++) {
|
||||
regs->set8(addr, sensor.custom_regs.get_value(addr));
|
||||
}
|
||||
|
@ -1170,14 +1168,11 @@ static void gl846_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__, (u_long) dev->read_bytes_left);
|
||||
dev->read_active = SANE_TRUE;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1309,14 +1304,11 @@ gl846_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
/* lincnt */
|
||||
lincnt = params.lines + max_shift + stagger;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1916,7 +1908,7 @@ static void gl846_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
|
||||
uint32_t addr, length, i, x, factor, pixels;
|
||||
uint32_t dpiset, dpihw, strpixel, endpixel;
|
||||
uint32_t lines, channels;
|
||||
uint32_t lines;
|
||||
uint8_t val,*ptr,*src;
|
||||
|
||||
/* shading data is plit in 3 (up to 5 with IR) areas
|
||||
|
@ -1941,7 +1933,7 @@ static void gl846_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
{
|
||||
dev->binary=fopen("binary.pnm","wb");
|
||||
lines = dev->reg.get24(REG_LINCNT);
|
||||
channels=dev->current_setup.channels;
|
||||
unsigned channels = dev->session.params.channels;
|
||||
if(dev->binary!=NULL)
|
||||
{
|
||||
fprintf(dev->binary,"P5\n%d %d\n%d\n",(endpixel-strpixel)/factor*channels,lines/channels,255);
|
||||
|
|
|
@ -1185,14 +1185,11 @@ static void gl847_init_scan_regs(Genesys_Device* dev, const Genesys_Sensor& sens
|
|||
DBG(DBG_info, "%s: physical bytes to read = %lu\n", __func__, (u_long) dev->read_bytes_left);
|
||||
dev->read_active = SANE_TRUE;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1325,14 +1322,11 @@ gl847_calculate_current_setup(Genesys_Device * dev, const Genesys_Sensor& sensor
|
|||
/* lincnt */
|
||||
lincnt = params.lines + max_shift + stagger;
|
||||
|
||||
dev->current_setup.params = params;
|
||||
dev->session.params = params;
|
||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||
dev->current_setup.lines = lincnt;
|
||||
dev->current_setup.depth = params.depth;
|
||||
dev->current_setup.channels = params.channels;
|
||||
dev->current_setup.exposure_time = exposure_time;
|
||||
dev->current_setup.xres = used_res;
|
||||
dev->current_setup.yres = params.yres;
|
||||
dev->current_setup.ccd_size_divisor = ccd_size_divisor;
|
||||
dev->current_setup.stagger = stagger;
|
||||
dev->current_setup.max_shift = max_shift + stagger;
|
||||
|
@ -1969,7 +1963,7 @@ static void gl847_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
DBG_HELPER_ARGS(dbg, "writing %d bytes of shading data", size);
|
||||
uint32_t addr, length, i, x, factor, pixels;
|
||||
uint32_t dpiset, dpihw, strpixel, endpixel;
|
||||
uint32_t lines, channels;
|
||||
uint32_t lines;
|
||||
uint8_t val,*ptr,*src;
|
||||
|
||||
/* shading data is plit in 3 (up to 5 with IR) areas
|
||||
|
@ -1994,7 +1988,7 @@ static void gl847_send_shading_data(Genesys_Device* dev, const Genesys_Sensor& s
|
|||
{
|
||||
dev->binary=fopen("binary.pnm","wb");
|
||||
lines = dev->reg.get24(REG_LINCNT);
|
||||
channels=dev->current_setup.channels;
|
||||
unsigned channels = dev->session.params.channels;
|
||||
if(dev->binary!=NULL)
|
||||
{
|
||||
fprintf(dev->binary,"P5\n%d %d\n%d\n",(endpixel-strpixel)/factor*channels,lines/channels,255);
|
||||
|
|
|
@ -68,13 +68,13 @@ void sanei_genesys_init_cmd_set(Genesys_Device* dev)
|
|||
DBG_INIT ();
|
||||
DBG_HELPER(dbg);
|
||||
switch (dev->model->asic_type) {
|
||||
case GENESYS_GL646: dev->cmd_set = &gl646_cmd_set; break;
|
||||
case GENESYS_GL841: dev->cmd_set = &gl841_cmd_set; break;
|
||||
case GENESYS_GL843: dev->cmd_set = &gl843_cmd_set; break;
|
||||
case GENESYS_GL845: // since only a few reg bits differs we handle both together
|
||||
case GENESYS_GL846: dev->cmd_set = &gl846_cmd_set; break;
|
||||
case GENESYS_GL847: dev->cmd_set = &gl847_cmd_set; break;
|
||||
case GENESYS_GL124: dev->cmd_set = &gl124_cmd_set; break;
|
||||
case AsicType::GL646: dev->cmd_set = &gl646_cmd_set; break;
|
||||
case AsicType::GL841: dev->cmd_set = &gl841_cmd_set; break;
|
||||
case AsicType::GL843: dev->cmd_set = &gl843_cmd_set; break;
|
||||
case AsicType::GL845: // since only a few reg bits differs we handle both together
|
||||
case AsicType::GL846: dev->cmd_set = &gl846_cmd_set; break;
|
||||
case AsicType::GL847: dev->cmd_set = &gl847_cmd_set; break;
|
||||
case AsicType::GL124: dev->cmd_set = &gl124_cmd_set; break;
|
||||
default: throw SaneException(SANE_STATUS_INVAL, "unknown ASIC type");
|
||||
}
|
||||
}
|
||||
|
@ -170,9 +170,10 @@ extern unsigned sanei_genesys_get_bulk_max_size(Genesys_Device * dev)
|
|||
b_size is the size of the ring buffer. By default it's 300*1024, so the
|
||||
packet is limited 61440 without any visibility to acquiring software.
|
||||
*/
|
||||
if (dev->model->asic_type == GENESYS_GL124 ||
|
||||
dev->model->asic_type == GENESYS_GL846 ||
|
||||
dev->model->asic_type == GENESYS_GL847) {
|
||||
if (dev->model->asic_type == AsicType::GL124 ||
|
||||
dev->model->asic_type == AsicType::GL846 ||
|
||||
dev->model->asic_type == AsicType::GL847)
|
||||
{
|
||||
return 0xeff0;
|
||||
}
|
||||
return 0xf000;
|
||||
|
@ -183,17 +184,17 @@ void sanei_genesys_bulk_read_data_send_header(Genesys_Device* dev, size_t len)
|
|||
DBG_HELPER(dbg);
|
||||
|
||||
uint8_t outdata[8];
|
||||
if (dev->model->asic_type == GENESYS_GL124 ||
|
||||
dev->model->asic_type == GENESYS_GL846 ||
|
||||
dev->model->asic_type == GENESYS_GL847)
|
||||
if (dev->model->asic_type == AsicType::GL124 ||
|
||||
dev->model->asic_type == AsicType::GL846 ||
|
||||
dev->model->asic_type == AsicType::GL847)
|
||||
{
|
||||
// hard coded 0x10000000 address
|
||||
outdata[0] = 0;
|
||||
outdata[1] = 0;
|
||||
outdata[2] = 0;
|
||||
outdata[3] = 0x10;
|
||||
} else if (dev->model->asic_type == GENESYS_GL841 ||
|
||||
dev->model->asic_type == GENESYS_GL843) {
|
||||
} else if (dev->model->asic_type == AsicType::GL841 ||
|
||||
dev->model->asic_type == AsicType::GL843) {
|
||||
outdata[0] = BULK_IN;
|
||||
outdata[1] = BULK_RAM;
|
||||
outdata[2] = 0x82; //
|
||||
|
@ -226,9 +227,9 @@ void sanei_genesys_bulk_read_data(Genesys_Device * dev, uint8_t addr, uint8_t* d
|
|||
|
||||
unsigned is_addr_used = 1;
|
||||
unsigned has_header_before_each_chunk = 0;
|
||||
if (dev->model->asic_type == GENESYS_GL124 ||
|
||||
dev->model->asic_type == GENESYS_GL846 ||
|
||||
dev->model->asic_type == GENESYS_GL847)
|
||||
if (dev->model->asic_type == AsicType::GL124 ||
|
||||
dev->model->asic_type == AsicType::GL846 ||
|
||||
dev->model->asic_type == AsicType::GL847)
|
||||
{
|
||||
is_addr_used = 0;
|
||||
has_header_before_each_chunk = 1;
|
||||
|
@ -304,7 +305,7 @@ void sanei_genesys_bulk_write_data(Genesys_Device* dev, uint8_t addr, uint8_t* d
|
|||
else
|
||||
size = len;
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL841) {
|
||||
if (dev->model->asic_type == AsicType::GL841) {
|
||||
outdata[0] = BULK_OUT;
|
||||
outdata[1] = BULK_RAM;
|
||||
// both 0x82 and 0x00 works on GL841.
|
||||
|
@ -417,11 +418,11 @@ void sanei_genesys_write_register(Genesys_Device* dev, uint16_t reg, uint8_t val
|
|||
return;
|
||||
}
|
||||
|
||||
/* route to gl847 function if needed */
|
||||
if(dev->model->asic_type==GENESYS_GL847
|
||||
|| dev->model->asic_type==GENESYS_GL845
|
||||
|| dev->model->asic_type==GENESYS_GL846
|
||||
|| dev->model->asic_type==GENESYS_GL124)
|
||||
// route to gl847 function if needed
|
||||
if (dev->model->asic_type == AsicType::GL847 ||
|
||||
dev->model->asic_type == AsicType::GL845 ||
|
||||
dev->model->asic_type == AsicType::GL846 ||
|
||||
dev->model->asic_type == AsicType::GL124)
|
||||
{
|
||||
sanei_genesys_write_gl847_register(dev, reg, val);
|
||||
return;
|
||||
|
@ -489,10 +490,10 @@ void sanei_genesys_read_register(Genesys_Device* dev, uint16_t reg, uint8_t* val
|
|||
}
|
||||
|
||||
// route to gl847 function if needed
|
||||
if (dev->model->asic_type==GENESYS_GL847
|
||||
|| dev->model->asic_type==GENESYS_GL845
|
||||
|| dev->model->asic_type==GENESYS_GL846
|
||||
|| dev->model->asic_type==GENESYS_GL124)
|
||||
if (dev->model->asic_type == AsicType::GL847 ||
|
||||
dev->model->asic_type == AsicType::GL845 ||
|
||||
dev->model->asic_type == AsicType::GL846 ||
|
||||
dev->model->asic_type == AsicType::GL124)
|
||||
{
|
||||
sanei_genesys_read_gl847_register(dev, reg, val);
|
||||
return;
|
||||
|
@ -517,10 +518,10 @@ void sanei_genesys_set_buffer_address(Genesys_Device* dev, uint32_t addr)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
|
||||
if(dev->model->asic_type==GENESYS_GL847
|
||||
|| dev->model->asic_type==GENESYS_GL845
|
||||
|| dev->model->asic_type==GENESYS_GL846
|
||||
|| dev->model->asic_type==GENESYS_GL124)
|
||||
if (dev->model->asic_type==AsicType::GL847 ||
|
||||
dev->model->asic_type==AsicType::GL845 ||
|
||||
dev->model->asic_type==AsicType::GL846 ||
|
||||
dev->model->asic_type==AsicType::GL124)
|
||||
{
|
||||
DBG(DBG_warn, "%s: shouldn't be used for GL846+ ASICs\n", __func__);
|
||||
return;
|
||||
|
@ -573,7 +574,7 @@ void sanei_genesys_fe_write_data(Genesys_Device* dev, uint8_t addr, uint16_t dat
|
|||
Genesys_Register_Set reg(Genesys_Register_Set::SEQUENTIAL);
|
||||
|
||||
reg.init_reg(0x51, addr);
|
||||
if (dev->model->asic_type == GENESYS_GL124) {
|
||||
if (dev->model->asic_type == AsicType::GL124) {
|
||||
reg.init_reg(0x5d, (data / 256) & 0xff);
|
||||
reg.init_reg(0x5e, data & 0xff);
|
||||
} else {
|
||||
|
@ -593,7 +594,7 @@ void sanei_genesys_fe_write_data(Genesys_Device* dev, uint8_t addr, uint16_t dat
|
|||
void sanei_genesys_get_status(Genesys_Device* dev, uint8_t* status)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
if (dev->model->asic_type == GENESYS_GL124) {
|
||||
if (dev->model->asic_type == AsicType::GL124) {
|
||||
sanei_genesys_read_hregister(dev, 0x101, status);
|
||||
return;
|
||||
}
|
||||
|
@ -653,22 +654,22 @@ void sanei_genesys_read_valid_words(Genesys_Device* dev, unsigned int* words)
|
|||
|
||||
switch (dev->model->asic_type)
|
||||
{
|
||||
case GENESYS_GL124:
|
||||
case AsicType::GL124:
|
||||
*words = dev->read_register(0x102) & 0x03;
|
||||
*words = *words * 256 + dev->read_register(0x103);
|
||||
*words = *words * 256 + dev->read_register(0x104);
|
||||
*words = *words * 256 + dev->read_register(0x105);
|
||||
break;
|
||||
|
||||
case GENESYS_GL845:
|
||||
case GENESYS_GL846:
|
||||
case AsicType::GL845:
|
||||
case AsicType::GL846:
|
||||
*words = dev->read_register(0x42) & 0x02;
|
||||
*words = *words * 256 + dev->read_register(0x43);
|
||||
*words = *words * 256 + dev->read_register(0x44);
|
||||
*words = *words * 256 + dev->read_register(0x45);
|
||||
break;
|
||||
|
||||
case GENESYS_GL847:
|
||||
case AsicType::GL847:
|
||||
*words = dev->read_register(0x42) & 0x03;
|
||||
*words = *words * 256 + dev->read_register(0x43);
|
||||
*words = *words * 256 + dev->read_register(0x44);
|
||||
|
@ -678,7 +679,7 @@ void sanei_genesys_read_valid_words(Genesys_Device* dev, unsigned int* words)
|
|||
default:
|
||||
*words = dev->read_register(0x44);
|
||||
*words += dev->read_register(0x43) * 256;
|
||||
if (dev->model->asic_type == GENESYS_GL646) {
|
||||
if (dev->model->asic_type == AsicType::GL646) {
|
||||
*words += ((dev->read_register(0x42) & 0x03) * 256 * 256);
|
||||
} else {
|
||||
*words += ((dev->read_register(0x42) & 0x0f) * 256 * 256);
|
||||
|
@ -695,8 +696,7 @@ void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* words)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL124)
|
||||
{
|
||||
if (dev->model->asic_type == AsicType::GL124) {
|
||||
*words = (dev->read_register(0x10b) & 0x0f) << 16;
|
||||
*words += (dev->read_register(0x10c) << 8);
|
||||
*words += dev->read_register(0x10d);
|
||||
|
@ -705,7 +705,7 @@ void sanei_genesys_read_scancnt(Genesys_Device* dev, unsigned int* words)
|
|||
{
|
||||
*words = dev->read_register(0x4d);
|
||||
*words += dev->read_register(0x4c) * 256;
|
||||
if (dev->model->asic_type == GENESYS_GL646) {
|
||||
if (dev->model->asic_type == AsicType::GL646) {
|
||||
*words += ((dev->read_register(0x4b) & 0x03) * 256 * 256);
|
||||
} else {
|
||||
*words += ((dev->read_register(0x4b) & 0x0f) * 256 * 256);
|
||||
|
@ -776,8 +776,7 @@ void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL124)
|
||||
{
|
||||
if (dev->model->asic_type == AsicType::GL124) {
|
||||
*steps = (dev->read_register(0x108) & 0x1f) << 16;
|
||||
*steps += (dev->read_register(0x109) << 8);
|
||||
*steps += dev->read_register(0x10a);
|
||||
|
@ -786,9 +785,9 @@ void sanei_genesys_read_feed_steps(Genesys_Device* dev, unsigned int* steps)
|
|||
{
|
||||
*steps = dev->read_register(0x4a);
|
||||
*steps += dev->read_register(0x49) * 256;
|
||||
if (dev->model->asic_type == GENESYS_GL646) {
|
||||
if (dev->model->asic_type == AsicType::GL646) {
|
||||
*steps += ((dev->read_register(0x48) & 0x03) * 256 * 256);
|
||||
} else if (dev->model->asic_type == GENESYS_GL841) {
|
||||
} else if (dev->model->asic_type == AsicType::GL841) {
|
||||
*steps += ((dev->read_register(0x48) & 0x0f) * 256 * 256);
|
||||
} else {
|
||||
*steps += ((dev->read_register(0x48) & 0x1f) * 256 * 256);
|
||||
|
@ -806,12 +805,12 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
|
|||
if (set) {
|
||||
regs.find_reg(0x03).value |= REG03_LAMPPWR;
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL841) {
|
||||
if (dev->model->asic_type == AsicType::GL841) {
|
||||
sanei_genesys_set_exposure(regs, sanei_genesys_fixup_exposure(sensor.exposure));
|
||||
regs.set8(0x19, 0x50);
|
||||
}
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL843) {
|
||||
if (dev->model->asic_type == AsicType::GL843) {
|
||||
sanei_genesys_set_exposure(regs, sensor.exposure);
|
||||
|
||||
// we don't actually turn on lamp on infrared scan
|
||||
|
@ -825,12 +824,12 @@ void sanei_genesys_set_lamp_power(Genesys_Device* dev, const Genesys_Sensor& sen
|
|||
} else {
|
||||
regs.find_reg(0x03).value &= ~REG03_LAMPPWR;
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL841) {
|
||||
if (dev->model->asic_type == AsicType::GL841) {
|
||||
sanei_genesys_set_exposure(regs, {0x0101, 0x0101, 0x0101});
|
||||
regs.set8(0x19, 0xff);
|
||||
}
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL843) {
|
||||
if (dev->model->asic_type == AsicType::GL843) {
|
||||
if (dev->model->model_id == MODEL_PANASONIC_KV_SS080 ||
|
||||
dev->model->model_id == MODEL_HP_SCANJET_4850C ||
|
||||
dev->model->model_id == MODEL_HP_SCANJET_G4010 ||
|
||||
|
@ -867,8 +866,8 @@ void sanei_genesys_bulk_write_register(Genesys_Device* dev, const Genesys_Regist
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL646 ||
|
||||
dev->model->asic_type == GENESYS_GL841)
|
||||
if (dev->model->asic_type == AsicType::GL646 ||
|
||||
dev->model->asic_type == AsicType::GL841)
|
||||
{
|
||||
uint8_t outdata[8];
|
||||
std::vector<uint8_t> buffer;
|
||||
|
@ -883,7 +882,7 @@ void sanei_genesys_bulk_write_register(Genesys_Device* dev, const Genesys_Regist
|
|||
DBG(DBG_io, "%s (elems= %lu, size = %lu)\n", __func__, (u_long) reg.size(),
|
||||
(u_long) buffer.size());
|
||||
|
||||
if (dev->model->asic_type == GENESYS_GL646) {
|
||||
if (dev->model->asic_type == AsicType::GL646) {
|
||||
outdata[0] = BULK_OUT;
|
||||
outdata[1] = BULK_REGISTER;
|
||||
outdata[2] = 0x00;
|
||||
|
@ -1476,11 +1475,11 @@ bool sanei_genesys_is_compatible_calibration(Genesys_Device * dev, const Genesys
|
|||
dev->current_setup.ccd_size_divisor, cache->used_setup.ccd_size_divisor);
|
||||
compatible = 0;
|
||||
}
|
||||
if (dev->current_setup.params.scan_method != cache->used_setup.params.scan_method)
|
||||
if (dev->session.params.scan_method != cache->params.scan_method)
|
||||
{
|
||||
DBG (DBG_io, "%s: current method=%d, used=%d\n", __func__,
|
||||
static_cast<unsigned>(dev->current_setup.params.scan_method),
|
||||
static_cast<unsigned>(cache->used_setup.params.scan_method));
|
||||
static_cast<unsigned>(dev->session.params.scan_method),
|
||||
static_cast<unsigned>(cache->params.scan_method));
|
||||
compatible = 0;
|
||||
}
|
||||
if (!compatible)
|
||||
|
@ -1711,19 +1710,15 @@ void debug_dump(unsigned level, const Genesys_Current_Setup& setup)
|
|||
DBG(level, "current_setup:\n"
|
||||
"Pixels: %d\n"
|
||||
"Lines: %d\n"
|
||||
"Depth: %d\n"
|
||||
"Channels: %d\n"
|
||||
"exposure_time: %d\n"
|
||||
"Resolution X/Y: %g %g\n"
|
||||
"Resolution X/Y: %g\n"
|
||||
"ccd_size_divisor: %d\n"
|
||||
"stagger: %d\n"
|
||||
"max_shift: %d\n",
|
||||
setup.pixels,
|
||||
setup.lines,
|
||||
setup.depth,
|
||||
setup.channels,
|
||||
setup.exposure_time,
|
||||
setup.xres, setup.yres,
|
||||
setup.xres,
|
||||
setup.ccd_size_divisor,
|
||||
setup.stagger,
|
||||
setup.max_shift);
|
||||
|
|
|
@ -204,16 +204,6 @@
|
|||
#define MAX_RESOLUTIONS 13
|
||||
#define MAX_DPI 4
|
||||
|
||||
#define GENESYS_GL646 646
|
||||
#define GENESYS_GL841 841
|
||||
#define GENESYS_GL843 843
|
||||
#define GENESYS_GL845 845
|
||||
#define GENESYS_GL846 846
|
||||
#define GENESYS_GL847 847
|
||||
#define GENESYS_GL848 848
|
||||
#define GENESYS_GL123 123
|
||||
#define GENESYS_GL124 124
|
||||
|
||||
/* Forward typedefs */
|
||||
struct Genesys_Scanner;
|
||||
typedef struct Genesys_Calibration_Cache Genesys_Calibration_Cache;
|
||||
|
@ -395,7 +385,6 @@ typedef struct {
|
|||
#define OPTICAL_FLAG_DISABLE_SHADING 0x02 /**< disable shading correction */
|
||||
#define OPTICAL_FLAG_DISABLE_LAMP 0x04 /**< turn off lamp */
|
||||
#define OPTICAL_FLAG_ENABLE_LEDADD 0x08 /**< enable true CIS gray by enabling LED addition */
|
||||
#define OPTICAL_FLAG_DISABLE_DOUBLE 0x10 /**< disable automatic x-direction double data expansion */
|
||||
#define OPTICAL_FLAG_STAGGER 0x20 /**< disable stagger correction */
|
||||
#define OPTICAL_FLAG_USE_XPA 0x40 /**< use XPA lamp rather than regular one */
|
||||
|
||||
|
|
|
@ -174,26 +174,75 @@ void serialize(Stream& str, SetupParams& x)
|
|||
serialize(str, x.flags);
|
||||
}
|
||||
|
||||
struct Genesys_Current_Setup
|
||||
{
|
||||
// params used for this setup
|
||||
struct ScanSession {
|
||||
SetupParams params;
|
||||
|
||||
// whether the session setup has been computed via gl843_compute_session()
|
||||
// gl843-only
|
||||
bool computed = false;
|
||||
|
||||
// whether CCD operates as half-resolution or full resolution at a specific resolution
|
||||
// gl843-only
|
||||
unsigned ccd_size_divisor = 1;
|
||||
|
||||
// the optical resolution of the scanner.
|
||||
// gl843-only
|
||||
unsigned optical_resolution = 0;
|
||||
|
||||
// the number of pixels at the optical resolution.
|
||||
// gl843-only
|
||||
unsigned optical_pixels = 0;
|
||||
|
||||
// the number of bytes in the output of a single line directly from scanner
|
||||
// gl843-only
|
||||
unsigned optical_line_bytes = 0;
|
||||
|
||||
// the resolution of the output data.
|
||||
// gl843-only
|
||||
unsigned output_resolution = 0;
|
||||
|
||||
// the number of pixels in output data
|
||||
// gl843-only
|
||||
unsigned output_pixels = 0;
|
||||
|
||||
// the number of bytes in the output of a single line
|
||||
// gl843-only
|
||||
unsigned output_line_bytes = 0;
|
||||
|
||||
// the number of lines in the output of the scanner. This must be larger than the user
|
||||
// gl843-only
|
||||
// requested number due to line staggering and color channel shifting.
|
||||
unsigned output_line_count = 0;
|
||||
|
||||
// the number of staggered lines (i.e. lines that overlap during scanning due to line being
|
||||
// gl843-only
|
||||
// thinner than the CCD element)
|
||||
unsigned num_staggered_lines = 0;
|
||||
|
||||
// the number of lines that color channels shift due to different physical positions of
|
||||
// gl843-only
|
||||
// different color channels
|
||||
unsigned max_color_shift_lines = 0;
|
||||
|
||||
void assert_computed() const
|
||||
{
|
||||
if (!computed) {
|
||||
throw std::runtime_error("ScanSession is not computed");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct Genesys_Current_Setup
|
||||
{
|
||||
// pixel count expected from scanner
|
||||
int pixels = 0;
|
||||
// line count expected from scanner
|
||||
int lines = 0;
|
||||
// depth expected from scanner
|
||||
int depth = 0;
|
||||
// channel count expected from scanner
|
||||
int channels = 0;
|
||||
|
||||
// used exposure time
|
||||
int exposure_time = 0;
|
||||
// used xres
|
||||
float xres = 0;
|
||||
// used yres
|
||||
float yres = 0;
|
||||
// half ccd mode
|
||||
unsigned ccd_size_divisor = 1;
|
||||
SANE_Int stagger = 0;
|
||||
|
@ -202,14 +251,10 @@ struct Genesys_Current_Setup
|
|||
|
||||
bool operator==(const Genesys_Current_Setup& other) const
|
||||
{
|
||||
return params == other.params &&
|
||||
pixels == other.pixels &&
|
||||
return pixels == other.pixels &&
|
||||
lines == other.lines &&
|
||||
depth == other.depth &&
|
||||
channels == other.channels &&
|
||||
exposure_time == other.exposure_time &&
|
||||
xres == other.xres &&
|
||||
yres == other.yres &&
|
||||
ccd_size_divisor == other.ccd_size_divisor &&
|
||||
stagger == other.stagger &&
|
||||
max_shift == other.max_shift;
|
||||
|
@ -219,15 +264,10 @@ struct Genesys_Current_Setup
|
|||
template<class Stream>
|
||||
void serialize(Stream& str, Genesys_Current_Setup& x)
|
||||
{
|
||||
serialize(str, x.params);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.pixels);
|
||||
serialize(str, x.lines);
|
||||
serialize(str, x.depth);
|
||||
serialize(str, x.channels);
|
||||
serialize(str, x.exposure_time);
|
||||
serialize(str, x.xres);
|
||||
serialize(str, x.yres);
|
||||
serialize(str, x.ccd_size_divisor);
|
||||
serialize(str, x.stagger);
|
||||
serialize(str, x.max_shift);
|
||||
|
|
|
@ -36,6 +36,11 @@ Genesys_Calibration_Cache create_fake_calibration_entry()
|
|||
calib.used_setup.lines = 150;
|
||||
calib.used_setup.xres = 100.5;
|
||||
|
||||
calib.params.channels = 3;
|
||||
calib.params.depth = 8;
|
||||
calib.params.lines = 100;
|
||||
calib.params.pixels = 200;
|
||||
|
||||
GenesysFrontendLayout wolfson_layout;
|
||||
wolfson_layout.offset_addr = { 0x20, 0x21, 0x22 };
|
||||
wolfson_layout.gain_addr = { 0x28, 0x29, 0x2a };
|
||||
|
|
Ładowanie…
Reference in New Issue