wip 10 : uncalibrated scans are ok

merge-requests/1/head
Stphane Voltz 2010-08-28 08:09:35 +02:00
rodzic 4d9852b3fe
commit 2dd8d2d765
5 zmienionych plików z 861 dodań i 1620 usunięć

Wyświetl plik

@ -746,9 +746,12 @@ sanei_genesys_get_address (Genesys_Register_Set * regs, SANE_Byte addr)
SANE_Int
sanei_genesys_generate_slope_table (uint16_t * slope_table,
unsigned int max_steps,
unsigned int use_steps, uint16_t stop_at,
uint16_t vstart, uint16_t vend,
unsigned int steps, double g,
unsigned int use_steps,
uint16_t stop_at,
uint16_t vstart,
uint16_t vend,
unsigned int steps,
double g,
unsigned int *used_steps,
unsigned int *vfinal)
{
@ -887,21 +890,20 @@ sanei_genesys_create_slope_table3 (Genesys_Device * dev,
if (vend > 65535)
vend = 65535;
sum_time = sanei_genesys_generate_slope_table (slope_table, max_step,
sum_time = sanei_genesys_generate_slope_table (slope_table,
max_step,
use_steps,
vtarget,
vstart,
vend,
dev->motor.slopes[power_mode]
[step_type].minimum_steps <<
step_type,
dev->motor.slopes[power_mode]
[step_type].g, used_steps,
dev->motor.slopes[power_mode][step_type].minimum_steps << step_type,
dev->motor.slopes[power_mode][step_type].g,
used_steps,
&vfinal);
if (final_exposure)
*final_exposure = (vfinal * dev->motor.base_ydpi) / yres;
DBG (DBG_proc,
"sanei_genesys_create_slope_table: returns sum_time=%d, completed\n",
sum_time);
@ -1477,6 +1479,8 @@ genesys_send_offset_and_shading (Genesys_Device * dev, uint8_t * data,
* tested instead of adding all the others */
/* many scanners send coefficient for lineart/gray like in color mode */
if (dev->settings.scan_mode < 2
&& dev->model->ccd_type != CCD_KVSS080
&& dev->model->ccd_type != CCD_G4050
&& dev->model->ccd_type != CCD_DSMOBILE600
&& dev->model->ccd_type != CCD_XP300
&& dev->model->ccd_type != CCD_DP665
@ -2577,6 +2581,11 @@ genesys_dummy_dark_shading (Genesys_Device * dev)
skip = 4;
xend = 68;
}
if(dev->model->ccd_type==CCD_KVSS080)
{
skip = 0;
xend = 40;
}
/* average each channels on half left margin */
dummy1 = 0;
@ -3441,6 +3450,21 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
coeff,
target_code);
break;
case CCD_KVSS080:
target_code = 0xe000;
o = 4;
cmat[0] = 0;
cmat[1] = 1;
cmat[2] = 2;
compute_coefficients (dev,
shading_data,
pixels_per_line,
3,
cmat,
o,
coeff,
target_code);
break;
case CIS_CANONLIDE100:
case CIS_CANONLIDE200:
/* we are using SHDAREA, and AVEENB is disabled */
@ -4455,6 +4479,7 @@ genesys_warmup_lamp (Genesys_Device * dev)
do
{
sanei_genesys_test_buffer_empty (dev, &empty);
usleep (100 * 1000);
}
while (empty);
RIE (sanei_genesys_read_data_from_scanner
@ -4480,13 +4505,13 @@ genesys_warmup_lamp (Genesys_Device * dev)
}
if (dev->model->cmd_set->get_bitset_bit (dev->reg))
{
first_average /= pixel;
second_average /= pixel;
difference = abs (first_average - second_average);
DBG (DBG_info,
"genesys_warmup_lamp: average = %.2f, diff = %.3f\n",
100 * ((second_average) / (256 * 256)),
100 * (difference / second_average));
first_average /= pixel;
second_average /= pixel;
difference = abs (first_average - second_average);
if (second_average > (100 * 256)
&& (difference / second_average) < 0.002)
@ -4511,7 +4536,7 @@ genesys_warmup_lamp (Genesys_Device * dev)
"genesys_warmup_lamp: average 1 = %.2f %%, average 2 = %.2f %%\n",
first_average, second_average);
if (abs (first_average - second_average) < 15
&& second_average > 120)
&& second_average > 55)
break;
}
@ -5759,7 +5784,8 @@ calc_parameters (Genesys_Scanner * s)
((br_x - tl_x) * s->dev->settings.xres) / MM_PER_INCH;
/* 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
|| s->dev->model->asic_type == GENESYS_GL843)
{
s->params.pixels_per_line = (s->params.pixels_per_line/2)*2;
}
@ -6366,6 +6392,13 @@ init_options (Genesys_Scanner * s)
return SANE_STATUS_GOOD;
}
static SANE_Bool present;
static SANE_Status
check_present (SANE_String_Const devname)
{
present=SANE_TRUE;
}
static SANE_Status
attach (SANE_String_Const devname, Genesys_Device ** devp, SANE_Bool may_wait)
{
@ -6420,6 +6453,21 @@ attach (SANE_String_Const devname, Genesys_Device ** devp, SANE_Bool may_wait)
return status;
}
/* KV-SS080 is an auxiliary device which requires a master device to be here */
if(vendor == 0x04da && product == 0x100f)
{
present=SANE_FALSE;
sanei_usb_find_devices (vendor, 0x1006, check_present);
sanei_usb_find_devices (vendor, 0x1007, check_present);
sanei_usb_find_devices (vendor, 0x1010, check_present);
sanei_usb_find_devices (vendor, 0x100f, check_present);
if(present==SANE_FALSE)
{
DBG (DBG_error,"attach: master device not present\n");
return SANE_STATUS_INVAL;
}
}
for (i = 0; i < MAX_SCANNERS && genesys_usb_device_list[i].model != 0; i++)
{
if (vendor == genesys_usb_device_list[i].vendor &&

Wyświetl plik

@ -470,10 +470,10 @@ static Genesys_Sensor Sensor[] = {
,
{CCD_KVSS080,
600,
48,
85,
64, /* 48 */
36,
152,
5110,
5100,
210,
230,
/* 08 09 0a 0b */
@ -602,25 +602,19 @@ static Genesys_Gpo Gpo[] = {
,
/* CANONLIDE200 */
{GPO_CANONLIDE200,
{0xfb, 0x20} /* 0xfb when idle , 0xf9/0xe9 (1200) when scanning */
,
{0xff, 0x00}
,
}
{0xfb, 0x20}, /* 0xfb when idle , 0xf9/0xe9 (1200) when scanning */
{0xff, 0x00},
}
,
{GPO_KVSS080,
{0xe5, 0x20} ,
{0x7e, 0xa1} ,
}
{0xf5, 0x20},
{0x7e, 0xa1},
}
,
{GPO_G4050,
{0x20, 0x00} ,
{0xfc, 0x00} ,
}
/*
uint8_t value[2]; 6c/6d
uint8_t enable[2]; 6e/6f
*/
{0x20, 0x00},
{0xfc, 0x00},
}
,
};
@ -870,25 +864,26 @@ static Genesys_Motor Motor[] = {
},
{MOTOR_KVSS080,
1200,
2400,
1,
1,
{ /* motor slopes */
{ /* power mode 0 */
{ 3500, 1300, 60, 0.8 },
{ 3500, 1400, 60, 0.8 },
},
},
},
{MOTOR_G4050,
1200, 4800,
1200,
2,
1,
{ /* motor slopes */
{ /* power mode 0 */
{ 3500, 1300, 60, 0.5 }, /* full step */
{ 3500, 1400, 60, 0.5 }, /* half step */
{ 3500, 1400, 60, 0.5 }, /* quarter step */
{ 22222, 500, 246, 0.5 }, /* max speed / dpi * base dpi => exposure */
{ 22222, 500, 246, 0.5 },
{ 22222, 500, 246, 0.5 },
},
},
},
{MOTOR_G4050,
1200, 2400,
2,
1,
{ /* motor slopes */
{ /* power mode 0 */
{ 3961, 240, 95, 0.8 }, /* full step */
{ 3961, 240, 95, 0.8 }, /* half step */
{ 3961, 240, 95, 0.8 }, /* quarter step */
},
},
},
@ -1008,23 +1003,23 @@ static Genesys_Model panasonic_kvss080_model = {
GENESYS_GL843,
NULL,
{ 600, 300, 150, 75, 0}, /* possible x-resolutions */
{ 600, 300, 150, 75, 0}, /* possible y-resolutions */
{ 600, 300, 200, 150, 100, 75, 0}, /* possible x-resolutions */
{ 600, 300, 200, 150, 100, 75, 0}, /* possible y-resolutions */
{16, 8, 0}, /* possible depths in gray mode */
{16, 8, 0}, /* possible depths in color mode */
SANE_FIX (0.42), /* Start of scan area in mm (x) */
SANE_FIX (7.9), /* Start of scan area in mm (y) */
SANE_FIX (218.0), /* Size of scan area in mm (x) */
SANE_FIX (299.0), /* Size of scan area in mm (y) */
SANE_FIX (7.6), /* Start of scan area in mm (x) */
SANE_FIX (12.6), /* Start of scan area in mm (y) */
SANE_FIX (218.5), /* Size of scan area in mm (x) */
SANE_FIX (297.0), /* Size of scan area in mm (y) */
SANE_FIX (3.0), /* Start of white strip in mm (y) */
SANE_FIX (0.0), /* Start of white strip in mm (y) */
SANE_FIX (0.0), /* Start of black mark in mm (x) */
SANE_FIX (0.0), /* Start of scan area in TA mode in mm (x) */
SANE_FIX (0.0), /* Start of scan area in TA mode in mm (y) */
SANE_FIX (100.0), /* Size of scan area in TA mode in mm (x) */
SANE_FIX (100.0), /* Size of scan area in TA mode in mm (y) */
SANE_FIX (0.0), /* Size of scan area in TA mode in mm (x) */
SANE_FIX (0.0), /* Size of scan area in TA mode in mm (y) */
SANE_FIX (0.0), /* Start of white strip in TA mode in mm (y) */
@ -1043,13 +1038,12 @@ static Genesys_Model panasonic_kvss080_model = {
DAC_KVSS080,
GPO_KVSS080,
MOTOR_KVSS080,
GENESYS_FLAG_LAZY_INIT | /* Which flags are needed for this scanner? */
GENESYS_FLAG_LAZY_INIT |
GENESYS_FLAG_NO_CALIBRATION |
GENESYS_FLAG_SKIP_WARMUP |
GENESYS_FLAG_OFFSET_CALIBRATION |
GENESYS_FLAG_DARK_WHITE_CALIBRATION |
GENESYS_FLAG_CUSTOM_GAMMA |
GENESYS_FLAG_ODD_EVEN_CIS,
GENESYS_HAS_SCAN_SW | GENESYS_HAS_FILE_SW | GENESYS_HAS_EMAIL_SW | GENESYS_HAS_COPY_SW,
GENESYS_FLAG_OFFSET_CALIBRATION |
GENESYS_FLAG_CUSTOM_GAMMA,
GENESYS_HAS_SCAN_SW ,
280,
400
};
@ -1086,7 +1080,7 @@ static Genesys_Model hpg4050_model = {
SANE_FIX (0.0), /* Amount of feeding needed to eject document
after finishing scanning in mm */
0, 8, 16, /* RGB CCD Line-distance correction in pixel */
0, 32, 48, /* RGB CCD Line-distance correction in pixel */
COLOR_ORDER_RGB, /* Order of the CCD/CIS colors */

Plik diff jest za duży Load Diff

Wyświetl plik

@ -52,8 +52,10 @@
#include "../include/sane/sanei.h"
#include "../include/sane/saneopts.h"
#ifndef HACK
#undef BACKEND_NAME
#define BACKEND_NAME genesys_gl843
#endif
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_config.h"
@ -179,6 +181,7 @@
#define REG17_TGW 0x3f
#define REG17S_TGW 0
#define REG18 0x18
#define REG18_CNSET 0x80
#define REG18_DCKSEL 0x60
#define REG18_CKTOGGLE 0x10
@ -208,6 +211,8 @@
#define REG1E_LINESEL 0x0f
#define REG1ES_LINESEL 0
#define REG21 0x21
#define REG29 0x29
#define REG2A 0x2a
#define REG2B 0x2b
@ -248,11 +253,14 @@
#define REG5A_RLC 0x0f
#define REG5AS_RLC 0
#define REG5E 0x5e
#define REG5E_DECSEL 0xe0
#define REG5ES_DECSEL 5
#define REG5E_STOPTIM 0x1f
#define REG5ES_STOPTIM 0
#define REG5F 0x5f
#define REG60 0x60
#define REG60_Z1MOD 0x1f
#define REG61 0x61
@ -268,25 +276,26 @@
#define REG65_Z2MOD 0xff
#define REG67 0x67
#define REG67_MTRPWM 0x80
#define REG68 0x68
#define REG68_FASTPWM 0x80
#define REG67S_STEPSEL 5
#define REG67_STEPSEL 0xe0
#define REG67S_STEPSEL 6
#define REG67_STEPSEL 0xc0
#define REG67_FULLSTEP 0x00
#define REG67_HALFSTEP 0x20
#define REG67_EIGHTHSTEP 0x60
#define REG67_16THSTEP 0x80
#define REG68S_FSTPSEL 5
#define REG68_FSTPSEL 0xe0
#define REG68S_FSTPSEL 6
#define REG68_FSTPSEL 0xc0
#define REG68_FULLSTEP 0x00
#define REG68_HALFSTEP 0x20
#define REG68_EIGHTHSTEP 0x60
#define REG68_16THSTEP 0x80
#define REG69 0x69
#define REG6A 0x6a
#define REG6B 0x6b
#define REG6B_MULTFILM 0x80
#define REG6B_GPOM13 0x40
@ -320,14 +329,20 @@
#define REGA7 0xa7
#define REGA9 0xa9
#define SCAN_FLAG_SINGLE_LINE 0x01
#define SCAN_FLAG_DISABLE_SHADING 0x02
#define SCAN_FLAG_DISABLE_GAMMA 0x04
#define SCAN_FLAG_DISABLE_BUFFER_FULL_MOVE 0x08
#define SCAN_FLAG_IGNORE_LINE_DISTANCE 0x10
#define SCAN_FLAG_USE_OPTICAL_RES 0x20
#define SCAN_FLAG_DISABLE_LAMP 0x40
#define SCAN_FLAG_DYNAMIC_LINEART 0x80
#define SCAN_TABLE 0 /* table 1 at 0x4000 */
#define BACKTRACK_TABLE 1 /* table 2 at 0x4800 */
#define STOP_TABLE 2 /* table 3 at 0x5000 */
#define FAST_TABLE 3 /* table 4 at 0x5800 */
#define HOME_TABLE 4 /* table 5 at 0x6000 */
#define SCAN_FLAG_SINGLE_LINE 0x001
#define SCAN_FLAG_DISABLE_SHADING 0x002
#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
/**
* writable scanner registers */
@ -344,8 +359,6 @@ enum
reg_0x0a,
reg_0x0b,
reg_0x0c,
reg_0x0d,
reg_0x0e,
reg_0x0f,
reg_0x10,
reg_0x11,
@ -372,9 +385,6 @@ enum
reg_0x26,
reg_0x27,
reg_0x28,
reg_0x29,
reg_0x2a,
reg_0x2b,
reg_0x2c,
reg_0x2d,
reg_0x2e,
@ -405,8 +415,6 @@ enum
reg_0x58,
reg_0x59,
reg_0x5a,
reg_0x5b,
reg_0x5c,
reg_0x5d,
reg_0x5e,
reg_0x5f,
@ -421,10 +429,6 @@ enum
reg_0x69,
reg_0x6a,
reg_0x6b,
reg_0x6c,
reg_0x6d,
reg_0x6e,
reg_0x6f,
reg_0x70,
reg_0x71,
reg_0x72,
@ -446,6 +450,8 @@ enum
reg_0x82,
reg_0x83,
reg_0x84,
reg_0x85,
reg_0x86,
reg_0x87,
reg_0x88,
reg_0x89,
@ -475,10 +481,6 @@ enum
reg_0xa3,
reg_0xa4,
reg_0xa5,
reg_0xa6,
reg_0xa7,
reg_0xa8,
reg_0xa9,
reg_0xab,
reg_0xac,
reg_0xad,
@ -504,6 +506,8 @@ static Gpio_layout gpios[]={
},
/* KV-SS080 */
{
0x06, 0x0f, 0x0c, 0x08
0x06, 0x0f, 0x00, 0x08
}
};
static uint16_t kvss080_profile[]={44444, 34188, 32520, 29630, 26666, 24242, 22222, 19048, 16666, 15686, 14814, 14034, 12402, 11110, 8888, 7618, 6666, 5926, 5228, 4678, 4172, 3682, 3336, 3074, 2866, 2702, 2566, 2450, 2352, 2266, 2188, 2118, 2056, 2002, 1950, 1904, 1860, 1820, 1784, 1748, 1716, 1684, 1656, 1628, 1600, 1576, 1552, 1528, 1506, 1486, 1466, 1446, 1428, 1410, 1394, 1376, 1360, 1346, 1330, 1316, 1302, 1288, 1276, 1264, 1250, 1238, 1228, 1216, 1206, 1194, 1184, 1174, 1164, 1154, 1146, 1136, 1128, 1120, 1110, 1102, 1094, 1088, 1080, 1072, 1064, 1058, 1050, 1044, 1038, 1030, 1024, 1018, 1012, 1006, 1000, 994, 988, 984, 978, 972, 968, 962, 958, 952, 948, 942, 938, 934, 928, 924, 920, 916, 912, 908, 904, 900, 896, 892, 888, 884, 882, 878, 874, 870, 868, 864, 860, 858, 854, 850, 848, 844, 842, 838, 836, 832, 830, 826, 824, 822, 820, 816, 814, 812, 808, 806, 804, 802, 800, 796, 794, 792, 790, 788, 786, 784, 782, 778, 776, 774, 772, 770, 768, 766, 764, 762, 760, 758, 756, 754, 752, 750, 750, 748, 746, 744, 742, 740, 738, 736, 734, 734, 732, 730, 728, 726, 724, 724, 722, 720, 718, 716, 716, 714, 712, 710, 710, 708, 706, 704, 704, 702, 700, 698, 698, 696, 694, 694, 692, 690, 690, 688, 686, 686, 684, 682, 682, 680, 678, 678, 676, 674, 674, 672, 672, 670, 668, 668, 666, 666, 664, 662, 662, 660, 660, 658, 656, 656, 654, 654, 652, 652, 650, 650, 648, 646, 646, 644, 644, 642, 642, 640, 640, 638, 638, 636, 636, 636, 634, 634, 632, 632, 630, 630, 628, 628, 626, 626, 624, 624, 624, 622, 622, 620, 620, 618, 618, 618, 616, 616, 614, 614, 612, 612, 612, 610, 610, 608, 608, 608, 606, 606, 606, 604, 604, 602, 602, 602, 600, 600, 600, 598, 598, 596, 596, 596, 594, 594, 594, 592, 592, 592, 590, 590, 590, 588, 588, 588, 586, 586, 586, 584, 584, 584, 582, 582, 582, 590, 590, 590, 588, 588, 588, 586, 586, 586, 584, 584, 584, 582, 582, 582, 580, 580, 580, 578, 578, 578, 576, 576, 576, 576, 574, 574, 574, 572, 572, 572, 570, 570, 570, 568, 568, 568, 568, 566, 566, 566, 564, 564, 564, 562, 562, 562, 562, 560, 560, 560, 558, 558, 558, 558, 556, 556, 556, 554, 554, 554, 552, 552, 552, 552, 550, 550, 550, 548, 548, 548, 548, 546, 546, 546, 546, 544, 544, 544, 542, 542, 542, 542, 540, 540, 540, 538, 538, 538, 538, 536, 536, 536, 536, 534, 534, 534, 534, 532, 532, 532, 530, 530, 530, 530, 528, 528, 528, 528, 526, 526, 526, 526, 524, 524, 524, 524, 522, 522, 522, 522, 520, 520, 520, 520, 518, 518, 518, 516, 516, 516, 516, 514, 514, 514, 514, 514, 512, 512, 512, 512, 510, 510, 510, 510, 508, 508, 508, 508, 506, 506, 506, 506, 504, 504, 504, 504, 502, 502, 502, 502, 500, 500, 500, 500};

Wyświetl plik

@ -130,7 +130,6 @@
/* todo: used?
#define VALUE_READ_STATUS 0x86
#define VALUE_BUF_ENDACCESS 0x8C
*/
/* Read/write bulk data/registers */