kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Simplify code as dynamic_lineart is always enabled for lineart
rodzic
3263b986ce
commit
8be96ecd60
|
@ -3154,7 +3154,7 @@ static void genesys_start_scan(Genesys_Device* dev, bool lamp_off)
|
|||
}
|
||||
|
||||
/* build look up table for dynamic lineart */
|
||||
if (dev->settings.dynamic_lineart) {
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
sanei_genesys_load_lut(dev->lineart_lut, 8, 8, 50, 205, dev->settings.threshold_curve,
|
||||
dev->settings.threshold-127);
|
||||
}
|
||||
|
@ -3551,13 +3551,6 @@ static void calc_parameters(Genesys_Scanner* s)
|
|||
s->dev->settings.true_gray = 0;
|
||||
}
|
||||
|
||||
/* dynamic lineart */
|
||||
s->dev->settings.dynamic_lineart = false;
|
||||
s->dev->settings.threshold_curve=0;
|
||||
if (s->dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
s->dev->settings.dynamic_lineart = true;
|
||||
}
|
||||
|
||||
// threshold curve for dynamic rasterization
|
||||
s->dev->settings.threshold_curve = s->threshold_curve;
|
||||
|
||||
|
@ -4589,7 +4582,7 @@ static void genesys_buffer_image(Genesys_Scanner *s)
|
|||
|
||||
/* maximum bytes to read */
|
||||
maximum = s->params.bytes_per_line * lines;
|
||||
if (s->dev->settings.dynamic_lineart) {
|
||||
if (s->dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
maximum *= 8;
|
||||
}
|
||||
|
||||
|
@ -4641,7 +4634,7 @@ static void genesys_buffer_image(Genesys_Scanner *s)
|
|||
|
||||
/* in case of dynamic lineart, we have buffered gray data which
|
||||
* must be converted to lineart first */
|
||||
if (s->dev->settings.dynamic_lineart) {
|
||||
if (s->dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
total/=8;
|
||||
std::vector<uint8_t> lineart(total);
|
||||
|
||||
|
@ -5748,7 +5741,7 @@ SANE_Status sane_start_impl(SANE_Handle handle)
|
|||
s->scanning = true;
|
||||
|
||||
/* allocate intermediate buffer when doing dynamic lineart */
|
||||
if (s->dev->settings.dynamic_lineart) {
|
||||
if (s->dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
s->dev->binarize_buffer.clear();
|
||||
s->dev->binarize_buffer.alloc(s->dev->settings.pixels);
|
||||
s->dev->local_buffer.clear();
|
||||
|
@ -5878,7 +5871,7 @@ sane_read_impl(SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int*
|
|||
{
|
||||
/* dynamic lineart is another kind of digital processing that needs
|
||||
* another layer of buffering on top of genesys_read_ordered_data */
|
||||
if (dev->settings.dynamic_lineart) {
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
/* if buffer is empty, fill it with genesys_read_ordered_data */
|
||||
if(dev->binarize_buffer.avail() == 0)
|
||||
{
|
||||
|
|
|
@ -1714,9 +1714,7 @@ void CommandSetGl124::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
flags = 0;
|
||||
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
}
|
||||
|
||||
|
|
|
@ -1716,7 +1716,6 @@ void CommandSetGl646::slow_back_home(Genesys_Device* dev, bool wait_until_home)
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, 3,
|
||||
dev->model->default_method);
|
||||
|
@ -1810,7 +1809,6 @@ void CommandSetGl646::search_start_position(Genesys_Device* dev) const
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
// scan the desired area
|
||||
std::vector<uint8_t> data;
|
||||
|
@ -1907,7 +1905,6 @@ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
|
||||
settings.disable_interpolation = dev->settings.disable_interpolation;
|
||||
settings.threshold = dev->settings.threshold;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
/* keep account of the movement for final scan move */
|
||||
dev->scanhead_position_in_steps += settings.lines;
|
||||
|
@ -1992,23 +1989,9 @@ static void setup_for_scan(Genesys_Device* dev,
|
|||
bool ycorrection)
|
||||
{
|
||||
DBG_HELPER(dbg);
|
||||
SANE_Int depth;
|
||||
|
||||
debug_dump(DBG_info, dev->settings);
|
||||
|
||||
depth=settings.depth;
|
||||
if (settings.scan_mode == ScanColorMode::LINEART)
|
||||
{
|
||||
if (settings.dynamic_lineart) {
|
||||
depth = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* XXX STEF XXX : why does the common layer never send depth=1 ? */
|
||||
depth = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// compute distance to move
|
||||
float move = 0;
|
||||
// XXX STEF XXX MD5345 -> optical_ydpi, other base_ydpi => half/full step ? */
|
||||
|
@ -2048,7 +2031,7 @@ static void setup_for_scan(Genesys_Device* dev,
|
|||
session.params.pixels = settings.pixels;
|
||||
session.params.requested_pixels = settings.requested_pixels;
|
||||
session.params.lines = settings.lines;
|
||||
session.params.depth = depth;
|
||||
session.params.depth = settings.depth;
|
||||
session.params.channels = settings.get_channels();
|
||||
session.params.scan_method = dev->settings.scan_method;
|
||||
session.params.scan_mode = settings.scan_mode;
|
||||
|
@ -2169,7 +2152,6 @@ SensorExposure CommandSetGl646::led_calibration(Genesys_Device* dev, const Genes
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
/* colors * bytes_per_color * scan lines */
|
||||
total_size = settings.pixels * channels * 2 * 1;
|
||||
|
@ -2340,7 +2322,6 @@ static void ad_fe_offset_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
/* scan first line of data with no gain */
|
||||
dev->frontend.set_gain(0, 0);
|
||||
|
@ -2448,7 +2429,6 @@ void CommandSetGl646::offset_calibration(Genesys_Device* dev, const Genesys_Sens
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
/* scan first line of data with no gain, but with offset from
|
||||
* last calibration */
|
||||
|
@ -2578,7 +2558,6 @@ static void ad_fe_coarse_gain_calibration(Genesys_Device* dev, const Genesys_Sen
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
size = channels * settings.pixels * settings.lines;
|
||||
|
||||
|
@ -2691,7 +2670,6 @@ void CommandSetGl646::coarse_gain_calibration(Genesys_Device* dev, const Genesys
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
/* start gain value */
|
||||
dev->frontend.set_gain(0, 1);
|
||||
|
@ -2834,7 +2812,6 @@ void CommandSetGl646::init_regs_for_warmup(Genesys_Device* dev, const Genesys_Se
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
// setup for scan
|
||||
setup_for_scan(dev, local_sensor, &dev->reg, settings, true, false, false);
|
||||
|
@ -2887,7 +2864,6 @@ static void gl646_repark_head(Genesys_Device* dev)
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
const auto& sensor = sanei_genesys_find_sensor(dev, settings.xres, 3,
|
||||
dev->model->default_method);
|
||||
|
@ -3255,7 +3231,6 @@ static void simple_move(Genesys_Device* dev, SANE_Int distance)
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
std::vector<uint8_t> data;
|
||||
simple_scan(dev, sensor, settings, true, true, false, data);
|
||||
|
@ -3551,7 +3526,6 @@ void CommandSetGl646::search_strip(Genesys_Device* dev, const Genesys_Sensor& se
|
|||
|
||||
settings.disable_interpolation = 0;
|
||||
settings.threshold = 0;
|
||||
settings.dynamic_lineart = false;
|
||||
|
||||
/* signals if a strip of the given color has been found */
|
||||
found = 0;
|
||||
|
|
|
@ -2777,10 +2777,8 @@ void CommandSetGl841::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
}
|
||||
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
}
|
||||
|
||||
ScanSession session;
|
||||
|
|
|
@ -2382,10 +2382,8 @@ void CommandSetGl843::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
start = (start * sensor.optical_res) / MM_PER_INCH;
|
||||
|
||||
/* enable emulated lineart from gray data */
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
}
|
||||
|
||||
ScanSession session;
|
||||
|
|
|
@ -1462,10 +1462,8 @@ void CommandSetGl846::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
flags = 0;
|
||||
|
||||
/* emulated lineart from gray data is required for now */
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
}
|
||||
|
||||
/* backtracking isn't handled well, so don't enable it */
|
||||
|
|
|
@ -1501,10 +1501,8 @@ void CommandSetGl847::init_regs_for_scan(Genesys_Device* dev, const Genesys_Sens
|
|||
flags = 0;
|
||||
|
||||
/* emulated lineart from gray data is required for now */
|
||||
if(dev->settings.scan_mode == ScanColorMode::LINEART
|
||||
&& dev->settings.dynamic_lineart)
|
||||
{
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
if (dev->settings.scan_mode == ScanColorMode::LINEART) {
|
||||
flags |= SCAN_FLAG_DYNAMIC_LINEART;
|
||||
}
|
||||
|
||||
/* backtracking isn't handled well, so don't enable it */
|
||||
|
|
|
@ -86,9 +86,6 @@ struct Genesys_Settings
|
|||
// Disable interpolation for xres<yres
|
||||
int disable_interpolation = 0;
|
||||
|
||||
// true is lineart is generated from gray data by the dynamic rasterization algoright
|
||||
int dynamic_lineart = 0;
|
||||
|
||||
// value for contrast enhancement in the [-100..100] range
|
||||
int contrast = 0;
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue