kopia lustrzana https://gitlab.com/sane-project/backends
add 1200 dpi support for KV-SS080
- fix case where motor resolution is higher than sensor resolutionmerge-requests/1/head
rodzic
c731ed017e
commit
58968c0ee1
|
@ -55,7 +55,7 @@
|
||||||
|
|
||||||
#include "../include/sane/config.h"
|
#include "../include/sane/config.h"
|
||||||
|
|
||||||
#define BUILD 31
|
#define BUILD 32
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -5838,7 +5838,7 @@ calc_parameters (Genesys_Scanner * s)
|
||||||
|
|
||||||
s->params.lines = ((br_y - tl_y) * s->dev->settings.yres) / MM_PER_INCH;
|
s->params.lines = ((br_y - tl_y) * s->dev->settings.yres) / MM_PER_INCH;
|
||||||
s->params.pixels_per_line =
|
s->params.pixels_per_line =
|
||||||
((br_x - tl_x) * s->dev->settings.xres) / MM_PER_INCH;
|
((br_x - tl_x) * resolution) / MM_PER_INCH;
|
||||||
|
|
||||||
/* we need an even number of pixels for even/odd handling */
|
/* we need an even number of pixels for even/odd handling */
|
||||||
if (s->dev->model->flags & GENESYS_FLAG_ODD_EVEN_CIS
|
if (s->dev->model->flags & GENESYS_FLAG_ODD_EVEN_CIS
|
||||||
|
@ -5873,7 +5873,7 @@ calc_parameters (Genesys_Scanner * s)
|
||||||
else /* Lineart */
|
else /* Lineart */
|
||||||
s->dev->settings.scan_mode = SCAN_MODE_LINEART;
|
s->dev->settings.scan_mode = SCAN_MODE_LINEART;
|
||||||
|
|
||||||
/* todo: change and check */
|
/* TODO: change and check */
|
||||||
if (strcmp (source, FLATBED) == 0)
|
if (strcmp (source, FLATBED) == 0)
|
||||||
s->dev->settings.scan_method = SCAN_METHOD_FLATBED;
|
s->dev->settings.scan_method = SCAN_METHOD_FLATBED;
|
||||||
else /* transparency */
|
else /* transparency */
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ static Genesys_Model panasonic_kvss080_model = {
|
||||||
NULL,
|
NULL,
|
||||||
|
|
||||||
{ 600, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
|
{ 600, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
|
||||||
{ 600, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
|
{ 1200, 600, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
|
||||||
{16, 8, 0}, /* possible depths in gray mode */
|
{16, 8, 0}, /* possible depths in gray mode */
|
||||||
{16, 8, 0}, /* possible depths in color mode */
|
{16, 8, 0}, /* possible depths in color mode */
|
||||||
|
|
||||||
|
|
|
@ -907,7 +907,8 @@ gl843_init_motor_regs_scan (Genesys_Device * dev,
|
||||||
factor = gl843_get_step_multiplier (reg);
|
factor = gl843_get_step_multiplier (reg);
|
||||||
|
|
||||||
use_fast_fed = 0;
|
use_fast_fed = 0;
|
||||||
if(scan_yres>=300 && feed_steps>300)
|
|
||||||
|
if(scan_yres>=300 && feed_steps>900)
|
||||||
use_fast_fed=1;
|
use_fast_fed=1;
|
||||||
lincnt=scan_lines;
|
lincnt=scan_lines;
|
||||||
|
|
||||||
|
@ -1394,6 +1395,9 @@ independent of our calculated values:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* resolution is choosen from a fixed list and can be used directly */
|
/* resolution is choosen from a fixed list and can be used directly */
|
||||||
|
if(xres>optical_res)
|
||||||
|
used_res=optical_res;
|
||||||
|
else
|
||||||
used_res = xres;
|
used_res = xres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1410,6 +1414,7 @@ independent of our calculated values:
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
/* pixels */
|
/* pixels */
|
||||||
used_pixels = (pixels * optical_res) / xres;
|
used_pixels = (pixels * optical_res) / xres;
|
||||||
|
DBG (DBG_info, "%s: used_pixels=%d\n", __FUNCTION__, used_pixels);
|
||||||
|
|
||||||
/* round up pixels number if needed */
|
/* round up pixels number if needed */
|
||||||
if (used_pixels * xres < pixels * optical_res)
|
if (used_pixels * xres < pixels * optical_res)
|
||||||
|
@ -1518,11 +1523,9 @@ independent of our calculated values:
|
||||||
move,
|
move,
|
||||||
scan_power_mode,
|
scan_power_mode,
|
||||||
(flags & SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE) ? MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE : 0);
|
(flags & SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE) ? MOTOR_FLAG_DISABLE_BUFFER_FULL_MOVE : 0);
|
||||||
|
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
|
||||||
/*** prepares data reordering ***/
|
/*** prepares data reordering ***/
|
||||||
|
|
||||||
/* words_per_line */
|
/* words_per_line */
|
||||||
|
@ -1563,6 +1566,7 @@ independent of our calculated values:
|
||||||
|
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||||
|
DBG (DBG_info, "%s: current_setup.pixels=%d\n", __FUNCTION__, dev->current_setup.pixels);
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = channels;
|
||||||
|
@ -1608,7 +1612,6 @@ gl843_calculate_current_setup (Genesys_Device * dev)
|
||||||
int used_pixels;
|
int used_pixels;
|
||||||
unsigned int lincnt;
|
unsigned int lincnt;
|
||||||
int exposure_time;
|
int exposure_time;
|
||||||
int i;
|
|
||||||
int stagger;
|
int stagger;
|
||||||
|
|
||||||
int slope_dpi = 0;
|
int slope_dpi = 0;
|
||||||
|
@ -1622,11 +1625,12 @@ gl843_calculate_current_setup (Genesys_Device * dev)
|
||||||
|
|
||||||
DBG (DBG_info,
|
DBG (DBG_info,
|
||||||
"gl843_calculate_current_setup settings:\n"
|
"gl843_calculate_current_setup settings:\n"
|
||||||
"Resolution: %uDPI\n"
|
"Resolution: %ux%uDPI\n"
|
||||||
"Lines : %u\n"
|
"Lines : %u\n"
|
||||||
"PPL : %u\n"
|
"PPL : %u\n"
|
||||||
"Startpos : %.3f/%.3f\n"
|
"Startpos : %.3f/%.3f\n"
|
||||||
"Scan mode : %d\n\n",
|
"Scan mode : %d\n\n",
|
||||||
|
dev->settings.xres,
|
||||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
||||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
||||||
|
|
||||||
|
@ -1647,9 +1651,9 @@ gl843_calculate_current_setup (Genesys_Device * dev)
|
||||||
start = (start * dev->sensor.optical_res) / MM_PER_INCH;
|
start = (start * dev->sensor.optical_res) / MM_PER_INCH;
|
||||||
|
|
||||||
|
|
||||||
xres = dev->settings.xres; /*dpi */
|
xres = dev->settings.xres;
|
||||||
yres = dev->settings.yres; /*dpi */
|
yres = dev->settings.yres;
|
||||||
startx = start; /*optical_res, from dummy_pixel+1 */
|
startx = start;
|
||||||
pixels = dev->settings.pixels;
|
pixels = dev->settings.pixels;
|
||||||
lines = dev->settings.lines;
|
lines = dev->settings.lines;
|
||||||
color_filter = dev->settings.color_filter;
|
color_filter = dev->settings.color_filter;
|
||||||
|
@ -1676,60 +1680,35 @@ gl843_calculate_current_setup (Genesys_Device * dev)
|
||||||
half_ccd = SANE_TRUE;
|
half_ccd = SANE_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* optical_res */
|
|
||||||
|
|
||||||
|
/* optical_res */
|
||||||
optical_res = dev->sensor.optical_res;
|
optical_res = dev->sensor.optical_res;
|
||||||
if (half_ccd)
|
if (half_ccd)
|
||||||
optical_res /= 2;
|
optical_res /= 2;
|
||||||
|
|
||||||
/* 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 * yres) / dev->motor.base_ydpi;
|
||||||
else
|
else
|
||||||
stagger = 0;
|
stagger = 0;
|
||||||
DBG (DBG_info, "gl843_calculate_current_setup: stagger=%d lines\n",
|
DBG (DBG_info, "%s: stagger=%d lines\n", __FUNCTION__, stagger);
|
||||||
stagger);
|
|
||||||
|
|
||||||
/* used_res */
|
if(xres<=optical_res)
|
||||||
i = optical_res / xres;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* gl843 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) /* optical_res >= xres > optical_res/2 */
|
|
||||||
used_res = optical_res;
|
|
||||||
else if (i < 3) /* optical_res/2 >= xres > optical_res/3 */
|
|
||||||
used_res = optical_res / 2;
|
|
||||||
else if (i < 4) /* optical_res/3 >= xres > optical_res/4 */
|
|
||||||
used_res = optical_res / 3;
|
|
||||||
else if (i < 5) /* optical_res/4 >= xres > optical_res/5 */
|
|
||||||
used_res = optical_res / 4;
|
|
||||||
else if (i < 6) /* optical_res/5 >= xres > optical_res/6 */
|
|
||||||
used_res = optical_res / 5;
|
|
||||||
else if (i < 8) /* optical_res/6 >= xres > optical_res/8 */
|
|
||||||
used_res = optical_res / 6;
|
|
||||||
else if (i < 10) /* optical_res/8 >= xres > optical_res/10 */
|
|
||||||
used_res = optical_res / 8;
|
|
||||||
else if (i < 12) /* optical_res/10 >= xres > optical_res/12 */
|
|
||||||
used_res = optical_res / 10;
|
|
||||||
else if (i < 15) /* optical_res/12 >= xres > optical_res/15 */
|
|
||||||
used_res = optical_res / 12;
|
|
||||||
else
|
|
||||||
used_res = optical_res / 15;
|
|
||||||
#endif
|
|
||||||
/* resolution is choosen from a fixed list */
|
|
||||||
used_res = xres;
|
used_res = xres;
|
||||||
|
else
|
||||||
|
used_res=optical_res;
|
||||||
|
|
||||||
/* compute scan parameters values */
|
/* compute scan parameters values */
|
||||||
/* pixels are allways given at half or full CCD optical resolution */
|
/* pixels are allways given at half or full CCD optical resolution */
|
||||||
/* use detected left margin and fixed value */
|
/* use detected left margin and fixed value */
|
||||||
|
|
||||||
/* compute correct pixels number */
|
/* compute correct pixels number */
|
||||||
used_pixels = (pixels * optical_res) / used_res;
|
used_pixels = (pixels * optical_res) / xres;
|
||||||
|
DBG (DBG_info, "%s: used_pixels=%d\n", __FUNCTION__, used_pixels);
|
||||||
dummy = 0;
|
dummy = 0;
|
||||||
|
|
||||||
/* slope_dpi */
|
/* slope_dpi */
|
||||||
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
/* cis color scan is effectively a gray scan with 3 gray lines per color
|
||||||
line and a FILTER of 0 */
|
line and a FILTER of 0 */
|
||||||
if (dev->model->is_cis)
|
if (dev->model->is_cis)
|
||||||
slope_dpi = yres * channels;
|
slope_dpi = yres * channels;
|
||||||
|
@ -1746,9 +1725,7 @@ gl843_calculate_current_setup (Genesys_Device * dev)
|
||||||
gl843_get_led_exposure (dev),
|
gl843_get_led_exposure (dev),
|
||||||
scan_power_mode);
|
scan_power_mode);
|
||||||
|
|
||||||
DBG (DBG_info,
|
DBG (DBG_info, "%s : exposure_time=%d pixels\n", __FUNCTION__, exposure_time);
|
||||||
"gl843_calculate_current_setup : exposure_time=%d pixels\n",
|
|
||||||
exposure_time);
|
|
||||||
|
|
||||||
/* max_shift */
|
/* max_shift */
|
||||||
/* scanned area must be enlarged by max color shift needed */
|
/* scanned area must be enlarged by max color shift needed */
|
||||||
|
@ -1767,10 +1744,11 @@ gl843_calculate_current_setup (Genesys_Device * dev)
|
||||||
max_shift = 0;
|
max_shift = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lincnt */
|
/* lincnt */
|
||||||
lincnt = lines + max_shift + stagger;
|
lincnt = lines + max_shift + stagger;
|
||||||
|
|
||||||
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
dev->current_setup.pixels = (used_pixels * used_res) / optical_res;
|
||||||
|
DBG (DBG_info, "%s: current_setup.pixels=%d\n", __FUNCTION__, dev->current_setup.pixels);
|
||||||
dev->current_setup.lines = lincnt;
|
dev->current_setup.lines = lincnt;
|
||||||
dev->current_setup.depth = depth;
|
dev->current_setup.depth = depth;
|
||||||
dev->current_setup.channels = channels;
|
dev->current_setup.channels = channels;
|
||||||
|
@ -2591,11 +2569,6 @@ gl843_init_regs_for_shading (Genesys_Device * dev)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is an hack to make calibration cache working .... */
|
|
||||||
/* if we don't do this, cache will be identified at the shading calibration
|
|
||||||
* dpi which is diferent from calibration one */
|
|
||||||
dev->current_setup.xres = resolution;
|
|
||||||
|
|
||||||
DBGCOMPLETED;
|
DBGCOMPLETED;
|
||||||
return SANE_STATUS_GOOD;
|
return SANE_STATUS_GOOD;
|
||||||
}
|
}
|
||||||
|
@ -2615,10 +2588,15 @@ gl843_init_regs_for_scan (Genesys_Device * dev)
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
|
|
||||||
DBG (DBG_info,
|
DBG (DBG_info,
|
||||||
"gl843_init_regs_for_scan settings:\nResolution: %uDPI\n"
|
"gl843_init_regs_for_scan settings:\nResolution: %ux%uDPI\n"
|
||||||
"Lines : %u\nPPL : %u\nStartpos : %.3f/%.3f\nScan mode : %d\n\n",
|
"Lines : %u\npixels : %u\nStartpos : %.3f/%.3f\nScan mode : %d\n\n",
|
||||||
dev->settings.yres, dev->settings.lines, dev->settings.pixels,
|
dev->settings.xres,
|
||||||
dev->settings.tl_x, dev->settings.tl_y, dev->settings.scan_mode);
|
dev->settings.yres,
|
||||||
|
dev->settings.lines,
|
||||||
|
dev->settings.pixels,
|
||||||
|
dev->settings.tl_x,
|
||||||
|
dev->settings.tl_y,
|
||||||
|
dev->settings.scan_mode);
|
||||||
|
|
||||||
/* ensure head is parked in case of calibration */
|
/* ensure head is parked in case of calibration */
|
||||||
gl843_slow_back_home (dev, SANE_TRUE);
|
gl843_slow_back_home (dev, SANE_TRUE);
|
||||||
|
@ -2669,7 +2647,7 @@ gl843_init_regs_for_scan (Genesys_Device * dev)
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
DBG (DBG_proc, "gl843_init_register_for_scan: completed\n");
|
DBGCOMPLETED;
|
||||||
return SANE_STATUS_GOOD;
|
return SANE_STATUS_GOOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3016,10 +2994,6 @@ gl843_offset_calibration (Genesys_Device * dev)
|
||||||
|
|
||||||
/* offset calibration is always done in color mode */
|
/* offset calibration is always done in color mode */
|
||||||
channels = 3;
|
channels = 3;
|
||||||
/* follow CKSEL */
|
|
||||||
if(dev->settings.xres<dev->sensor.optical_res)
|
|
||||||
resolution=dev->sensor.optical_res/2;
|
|
||||||
else
|
|
||||||
resolution=dev->sensor.optical_res;
|
resolution=dev->sensor.optical_res;
|
||||||
dev->calib_pixels = dev->sensor.sensor_pixels;
|
dev->calib_pixels = dev->sensor.sensor_pixels;
|
||||||
lines=1;
|
lines=1;
|
||||||
|
|
Ładowanie…
Reference in New Issue