kopia lustrzana https://gitlab.com/sane-project/backends
Epjitsu backend v19, better calibration from Richard at fascinationsoftware dot com
rodzic
e54c2ae2ee
commit
6c13f7d522
|
@ -79,7 +79,7 @@ static unsigned char setWindowFineCal_FI60F_300[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0x3840 bytes) */
|
||||
|
@ -121,7 +121,7 @@ static unsigned char setWindowFineCal_FI60F_600[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x58, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0x42c0 bytes) */
|
||||
|
@ -163,7 +163,7 @@ static unsigned char setWindowFineCal_S300_150[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x90, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0xc780 bytes) */
|
||||
|
@ -207,7 +207,7 @@ static unsigned char setWindowFineCal_S300_225[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0xc780 bytes) */
|
||||
|
@ -251,7 +251,7 @@ static unsigned char setWindowFineCal_S300_300[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0xc000 bytes) */
|
||||
|
@ -295,7 +295,7 @@ static unsigned char setWindowFineCal_S300_600[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x58, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0x17880 bytes) */
|
||||
|
@ -338,7 +338,7 @@ static unsigned char setWindowFineCal_S300_150_U[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x08, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0xc780 bytes) */
|
||||
|
@ -382,7 +382,7 @@ static unsigned char setWindowFineCal_S300_225_U[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0xc780 bytes) */
|
||||
|
@ -426,7 +426,7 @@ static unsigned char setWindowFineCal_S300_300_U[] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x2c, 0x03, 0x20, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0xf0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x05, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
/* 1b d1 (set window) before gain/offset tables (write 1 line of 0xc780 bytes) */
|
||||
|
|
1583
backend/epjitsu.c
1583
backend/epjitsu.c
Plik diff jest za duży
Load Diff
|
@ -51,23 +51,36 @@ enum scanner_Option
|
|||
#define MAX_IMG_PASS 0x10000
|
||||
#define MAX_IMG_BLOCK 0x80000
|
||||
|
||||
struct transfer {
|
||||
int height;
|
||||
|
||||
struct image {
|
||||
int width_pix;
|
||||
int width_bytes;
|
||||
|
||||
int total_pix;
|
||||
int total_bytes;
|
||||
|
||||
int rx_bytes;
|
||||
int tx_bytes;
|
||||
|
||||
int done;
|
||||
int height;
|
||||
int pages;
|
||||
|
||||
unsigned char * buffer;
|
||||
};
|
||||
|
||||
struct transfer {
|
||||
int plane_width; /* in RGB pixels */
|
||||
int plane_stride; /* in bytes */
|
||||
int line_stride; /* in bytes */
|
||||
|
||||
int total_bytes;
|
||||
int rx_bytes;
|
||||
int done;
|
||||
|
||||
unsigned char * raw_data;
|
||||
struct image * image;
|
||||
};
|
||||
|
||||
struct page {
|
||||
int bytes_total;
|
||||
int bytes_scanned;
|
||||
int bytes_read;
|
||||
int done;
|
||||
struct image *image;
|
||||
};
|
||||
|
||||
struct scanner
|
||||
{
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -185,42 +198,46 @@ struct scanner
|
|||
int started;
|
||||
int side;
|
||||
|
||||
/* requested size params (almost no relation to actual data?) */
|
||||
int req_width; /* pixel width of first read-head? */
|
||||
int head_width;
|
||||
int pad_width;
|
||||
|
||||
/* holds temp buffer for getting 1 line of cal data */
|
||||
struct transfer coarsecal;
|
||||
|
||||
/* holds temp buffer for getting 32 lines of cal data */
|
||||
struct transfer darkcal;
|
||||
|
||||
/* holds temp buffer for getting 32 lines of cal data */
|
||||
struct transfer lightcal;
|
||||
/* holds temp buffers for getting 16 lines of cal data */
|
||||
struct transfer cal_image;
|
||||
struct image coarsecal;
|
||||
struct image darkcal;
|
||||
struct image lightcal;
|
||||
|
||||
/* holds temp buffer for building calibration data */
|
||||
struct transfer sendcal;
|
||||
struct transfer cal_data;
|
||||
struct image sendcal;
|
||||
|
||||
/* scanner transmits more data per line than requested */
|
||||
/* due to padding and/or duplex interlacing */
|
||||
/* the scan struct holds these larger numbers, but buffer is unused */
|
||||
struct transfer scan;
|
||||
/* the scan struct holds these larger numbers, but image buffer is unused */
|
||||
struct {
|
||||
int done;
|
||||
int height;
|
||||
int rx_bytes;
|
||||
int width_bytes;
|
||||
int total_bytes;
|
||||
} fullscan;
|
||||
|
||||
/* The page structs contain data about the progress as the application reads */
|
||||
/* data from the front/back image buffers via the sane_read() function */
|
||||
struct page pages[2];
|
||||
|
||||
/* scanner transmits data in blocks, up to 512k */
|
||||
/* but always ends on a scanline. */
|
||||
/* the block struct holds the most recent buffer */
|
||||
struct transfer block;
|
||||
struct transfer block_xfr;
|
||||
struct image block_img;
|
||||
|
||||
/* temporary buffers used by dynamic threshold code */
|
||||
struct transfer dt;
|
||||
struct image dt;
|
||||
unsigned char dt_lut[256];
|
||||
|
||||
/* final-sized front image, always used */
|
||||
struct transfer front;
|
||||
struct image front;
|
||||
|
||||
/* final-sized back image, only used during duplex/backside */
|
||||
struct transfer back;
|
||||
struct image back;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* values used by the command and data sending function */
|
||||
|
@ -354,10 +371,9 @@ static SANE_Status set_window(struct scanner *s, int window);
|
|||
static SANE_Status scan(struct scanner *s);
|
||||
|
||||
static SANE_Status read_from_scanner(struct scanner *s, struct transfer *tp);
|
||||
static SANE_Status copy_S300_color(struct scanner *s, int side);
|
||||
static SANE_Status copy_S300_gray(struct scanner *s, int side);
|
||||
static SANE_Status copy_S300_binary(struct scanner *s, int side);
|
||||
static SANE_Status fill_frontback_buffers_FI60F(struct scanner *s);
|
||||
static SANE_Status descramble_raw(struct scanner *s, struct transfer * tp);
|
||||
static SANE_Status copy_block_to_page(struct scanner *s, int side);
|
||||
static SANE_Status binarize_line(struct scanner *s, unsigned char *lineOut, int width);
|
||||
|
||||
static SANE_Status get_hardware_status (struct scanner *s);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue