Lines Matching refs:calibration

99 #define DARK_TARGET		3.1	/* 3.5 target average for dark calibration */
102 #define OFFSET_TARGET 3.5 /* target average for offset calibration */
105 #define RED_GAIN_TARGET 170 /* target average for gain calibration for blue color */
106 #define GREEN_GAIN_TARGET 170 /* target average for gain calibration for blue color */
107 #define BLUE_GAIN_TARGET 180 /* target average for gain calibration for blue color */
112 /* width used for calibration */
115 /* data size for calibration: one RGB line*/
1174 /* step 1: locate scan area by doing a scan, then goto calibration area */
1246 /* step 2: dark calibration */
1254 DBG (DBG_error, "sane_start: failed to do dark calibration!\n");
1275 /* step 4: gain calibration */
1283 DBG (DBG_error, "sane_start: failed to do gain calibration!\n");
1287 /* step 5: fine offset calibration */
1295 DBG (DBG_error, "sane_start: failed to do offset calibration!\n");
1321 /* step 6: shading calibration */
1331 DBG (DBG_error, "sane_start: failed to do shading calibration!\n");
1364 /* step 8: send calibration data */
1372 DBG (DBG_error, "sane_start: failed to send calibration data!\n");
1566 /* shading calibration is always 66 lines regardless of ydpi, so */
3278 /* now go back to the white area so that calibration can work on it */
3329 * white area of calibration zone, which is start of usable pixels.
4602 * Do dark calibration. We scan a well defined area until average pixel value
4603 * of the black area is about 0x03 for each color channel. This calibration is
4858 * do gain calibration. We do scans until averaged values of the area match
4889 /* same register set than dark calibration */
5046 /* loop on gain calibration until we find until we find stable value
5217 * Do fine offset calibration. Scans are done with gains from gain calibration
5445 * do shading calibration
6123 * do shading calibration
6205 /* now we can compute shading calibration data */
6244 fill_gamma (SANE_Byte * calibration, int *idx, SANE_Word * gamma)
6248 calibration[*idx] = 0;
6252 calibration[*idx] = gamma[i];
6254 if (calibration[*idx] == 0xaa)
6257 calibration[*idx] = 0;
6260 calibration[*idx] = gamma[i];
6262 if (calibration[*idx] == 0xaa)
6265 calibration[*idx] = 0;
6269 calibration[*idx] = 0xff;
6274 * build and send calibration data which contains gamma table and
6283 SANE_Byte *calibration = NULL, format, val;
6300 /* effective data calibration size */
6333 calibration = (SANE_Byte *) malloc (size);
6334 if (calibration == NULL)
6337 "send_calibration_data: failed to allocate memory for calibration data\n");
6340 memset (calibration, 0x00, size);
6361 fill_gamma (calibration, &idx, gamma_r);
6362 fill_gamma (calibration, &idx, gamma_g);
6363 fill_gamma (calibration, &idx, gamma_b);
6365 /* compute calibration coefficients */
6367 * shading data calibration starts at 1542. There are 3 rows of 16 bits values
6368 * first row is green calibration
6412 calibration[idx + i * 2 + 1] = val;
6413 calibration[idx + i * 2] = (SANE_Byte) (value % 256) & 0xC0;
6423 calibration[idx + data_size * 2 + i * 2 + 1] = val;
6424 calibration[idx + data_size * 2 + i * 2] =
6435 calibration[idx + data_size * 4 + i * 2 + 1] = val;
6436 calibration[idx + data_size * 4 + i * 2] =
6443 calib = fopen ("calibration.hex", "wb");
6453 fprintf (calib, "%02x ", calibration[i]);
6468 calibration);
6472 "send_calibration_data: failed to write calibration data (part 1)\n");
6478 calibration + RTS88XX_MAX_XFER_SIZE);
6482 "send_calibration_data: failed to write calibration data (part 2)\n");
6488 status = sanei_rts88xx_write_mem (dev->devnum, size, 6, calibration);
6492 "send_calibration_data: failed to write calibration data\n");
6502 free (calibration);
6722 regs[0x90] = 0x18; /* 0x1c when shading calibration */
6724 /* overwritten when calibration data is sent */