From 49b81e26b5696924c956bef2e3b10b8788f13214 Mon Sep 17 00:00:00 2001 From: Oliver Schwartz Date: Tue, 15 Nov 2005 20:11:19 +0000 Subject: [PATCH] Enabled quality calibration for the Epson 3490 --- ChangeLog | 5 +++++ backend/snapscan-options.c | 4 +++- backend/snapscan-scsi.c | 32 ++++++++++++++++++-------------- backend/snapscan.c | 11 +++++++++-- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c63d5262..d084ee136 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-11-15 Oliver Schwartz + * backend/snapscan.c backend/snapscan-options.c + backend/snapscan-scsi.c: Enabled quality calibration for the + Epson 3490 + 2005-11-15 Henning Meier-Geinitz * doc/descriptions/unsupported.desc: Added HP Scanjet 4890. Added diff --git a/backend/snapscan-options.c b/backend/snapscan-options.c index 90bc3a610..2a2496853 100644 --- a/backend/snapscan-options.c +++ b/backend/snapscan-options.c @@ -600,7 +600,6 @@ static void init_options (SnapScan_Scanner * ps) if ((!(ps->hconfig & HCFG_CAL_ALLOWED)) || (ps->pdev->model == SNAPSCANE52) || (ps->pdev->model == PERFECTION1670) - || (ps->pdev->model == PERFECTION3490) || (ps->pdev->model == PRISA5300)) { po[OPT_QUALITY_CAL].cap |= SANE_CAP_INACTIVE; ps->val[OPT_QUALITY_CAL].b = SANE_FALSE; @@ -1607,6 +1606,9 @@ SANE_Status sane_control_option (SANE_Handle h, /* * $Log$ + * Revision 1.30 2005/11/15 20:11:18 oliver-guest + * Enabled quality calibration for the Epson 3490 + * * Revision 1.29 2005/10/31 21:08:47 oliver-guest * Distinguish between Benq 5000/5000E/5000U * diff --git a/backend/snapscan-scsi.c b/backend/snapscan-scsi.c index 24f8487eb..cb889ae89 100644 --- a/backend/snapscan-scsi.c +++ b/backend/snapscan-scsi.c @@ -1128,24 +1128,24 @@ static SANE_Status wait_scanner_ready (SnapScan_Scanner *pss) #define READ_CALIBRATION 0x82 #define READ_CALIBRATION_BLACK 0x89 #define NUM_CALIBRATION_LINES 16 -#define NUM_CALIBRATION_LINES_2480 48 -#define NUM_CALIBRATION_LINES_2480_BLACK 128 +#define NUM_CALIBRATION_LINES_EPSON 48 +#define NUM_CALIBRATION_LINES_EPSON_BLACK 128 -#define PIXELS_PER_LINE_2480 10200 - -static SANE_Status calibrate_2480 (SnapScan_Scanner *pss) +static SANE_Status calibrate_epson (SnapScan_Scanner *pss) { u_char *buf, *pbuf; int *bins; - static const char *me = "calibrate_2480"; - int num_bins = PIXELS_PER_LINE_2480; + static const char *me = "calibrate_epson"; + /* pixels_per_line = 8.5 inch * resolution of one sensor */ + int pixels_per_line = pss->actual_res * 17/4; + int num_bins = pixels_per_line; int i, j, k, loop_inc, tl; int r, g, b; size_t expected_read_bytes; size_t read_bytes; SANE_Status status; int pass; - int cal_lines = NUM_CALIBRATION_LINES_2480; + int cal_lines = NUM_CALIBRATION_LINES_EPSON; int dtc = READ_CALIBRATION; int bytes_per_bin = 1; @@ -1155,11 +1155,11 @@ static SANE_Status calibrate_2480 (SnapScan_Scanner *pss) /* calculate number of bins depending on mode and resolution * colour mode requires bins for each of rgb - * 2400 dpi doubles it because of second sensor line */ + * full resolution doubles it because of second sensor line */ if (is_colour_mode(actual_mode(pss))) { num_bins *= 3; } - if (pss->res > 1200) { + if (pss->res >= (SANE_Int)pss->actual_res) { num_bins *= 2; } @@ -1171,7 +1171,7 @@ static SANE_Status calibrate_2480 (SnapScan_Scanner *pss) } /* allocate buffer for receive data */ - expected_read_bytes = PIXELS_PER_LINE_2480 * 3 * 4; + expected_read_bytes = pixels_per_line * 3 * 4; buf = (u_char *) malloc (expected_read_bytes); if (!buf) { DBG (DL_MAJOR_ERROR, "%s: out of memory allocating calibration, %ld bytes.", me, (u_long)expected_read_bytes); @@ -1186,7 +1186,7 @@ static SANE_Status calibrate_2480 (SnapScan_Scanner *pss) if (pass == 1) { if (pss->source == SRC_TPO) { /* pass 1 is for black level calibration of transparency adaptor */ - cal_lines = NUM_CALIBRATION_LINES_2480_BLACK; + cal_lines = NUM_CALIBRATION_LINES_EPSON_BLACK; dtc = READ_CALIBRATION_BLACK; } else continue; @@ -1326,8 +1326,9 @@ static SANE_Status calibrate (SnapScan_Scanner *pss) SANE_Status status; int line_length = calibration_line_length(pss); - if (pss->pdev->model == PERFECTION2480) { - return calibrate_2480 (pss); + if ((pss->pdev->model == PERFECTION2480) || + (pss->pdev->model == PERFECTION3490)) { + return calibrate_epson (pss); } if ((pss->hconfig & HCFG_CAL_ALLOWED) && line_length) { @@ -1482,6 +1483,9 @@ static SANE_Status download_firmware(SnapScan_Scanner * pss) /* * $Log$ + * Revision 1.48 2005/11/15 20:11:19 oliver-guest + * Enabled quality calibration for the Epson 3490 + * * Revision 1.47 2005/11/02 19:22:06 oliver-guest * Fixes for Benq 5000 * diff --git a/backend/snapscan.c b/backend/snapscan.c index f52440c5d..c745bd7f2 100644 --- a/backend/snapscan.c +++ b/backend/snapscan.c @@ -1645,7 +1645,9 @@ SANE_Status sane_start (SANE_Handle h) status = download_halftone_matrices(pss); CHECK_STATUS (status, me, "download_halftone_matrices"); - if (pss->pdev->model == PERFECTION2480 && pss->val[OPT_QUALITY_CAL].b) + if (pss->val[OPT_QUALITY_CAL].b && + ((pss->pdev->model == PERFECTION2480) || + (pss->pdev->model == PERFECTION3490))) { status = calibrate(pss); if (status != SANE_STATUS_GOOD) @@ -1676,7 +1678,9 @@ SANE_Status sane_start (SANE_Handle h) pss->bytes_per_line/pss->ms_per_line); - if (pss->pdev->model != PERFECTION2480 && pss->val[OPT_QUALITY_CAL].b) + if (pss->val[OPT_QUALITY_CAL].b && + ((pss->pdev->model != PERFECTION2480) && + (pss->pdev->model != PERFECTION3490))) { status = calibrate(pss); if (status != SANE_STATUS_GOOD) @@ -1916,6 +1920,9 @@ SANE_Status sane_get_select_fd (SANE_Handle h, SANE_Int * fd) /* * $Log$ + * Revision 1.61 2005/11/15 20:11:19 oliver-guest + * Enabled quality calibration for the Epson 3490 + * * Revision 1.60 2005/11/10 19:42:02 oliver-guest * Added deinterlacing for Epson 3490 *