genesys: Store segment order as a std::vector

merge-requests/134/head
Povilas Kanapickas 2019-08-17 11:02:35 +03:00
rodzic 4a9738b719
commit ba546d5370
8 zmienionych plików z 74 dodań i 93 usunięć

Wyświetl plik

@ -3501,7 +3501,7 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
k=count+(i*dev->segnb)/8; k=count+(i*dev->segnb)/8;
for (n=0;n<dev->segnb;n++) { for (n=0;n<dev->segnb;n++) {
work_buffer_dst[k] = work_buffer_dst[k] << 1; work_buffer_dst[k] = work_buffer_dst[k] << 1;
if ((dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->order[n]])&(128>>i)) { if ((dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->segment_order[n]])&(128>>i)) {
work_buffer_dst[k] |= 1; work_buffer_dst[k] |= 1;
} }
} }
@ -3515,7 +3515,7 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
if (depth==8) { if (depth==8) {
while (dev->cur < dev->len && count < size) { while (dev->cur < dev->len && count < size) {
for (n=0;n<dev->segnb;n++) { for (n=0;n<dev->segnb;n++) {
work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->order[n]]; work_buffer_dst[count+n] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->segment_order[n]];
} }
/* update counter and pointer */ /* update counter and pointer */
count += dev->segnb; count += dev->segnb;
@ -3525,8 +3525,8 @@ static void genesys_fill_segmented_buffer(Genesys_Device* dev, uint8_t* work_buf
if (depth==16) { if (depth==16) {
while (dev->cur < dev->len && count < size) { while (dev->cur < dev->len && count < size) {
for (n=0;n<dev->segnb;n++) { for (n=0;n<dev->segnb;n++) {
work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->order[n]]; work_buffer_dst[count+n*2] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->segment_order[n]];
work_buffer_dst[count+n*2+1] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->order[n] + 1]; work_buffer_dst[count+n*2+1] = dev->oe_buffer.get_read_pos()[dev->cur + dev->skip + dev->dist*dev->segment_order[n] + 1];
} }
/* update counter and pointer */ /* update counter and pointer */
count += dev->segnb*2; count += dev->segnb*2;

Wyświetl plik

@ -314,7 +314,7 @@ struct Genesys_Device
size_t skip = 0; size_t skip = 0;
// array describing the order of the sub-segments of the sensor // array describing the order of the sub-segments of the sensor
size_t* order = nullptr; std::vector<unsigned> segment_order;
// buffer to handle even/odd data // buffer to handle even/odd data
Genesys_Buffer oe_buffer = {}; Genesys_Buffer oe_buffer = {};

Wyświetl plik

@ -101,14 +101,14 @@ gl124_test_motor_flag_bit (SANE_Byte val)
* @param ccd_size_divisor flag to signal half ccd mode * @param ccd_size_divisor flag to signal half ccd mode
* @return a pointer to a Sensor_Profile struct * @return a pointer to a Sensor_Profile struct
*/ */
static Sensor_Profile* get_sensor_profile(int sensor_type, int dpi, unsigned ccd_size_divisor) static SensorProfileGl124* get_sensor_profile(int sensor_type, int dpi, unsigned ccd_size_divisor)
{ {
unsigned int i; unsigned int i;
int idx; int idx;
i=0; i=0;
idx=-1; idx=-1;
while(i<sizeof(sensors)/sizeof(Sensor_Profile)) while(i<sizeof(sensors)/sizeof(SensorProfileGl124))
{ {
/* exact match */ /* exact match */
if (sensors[i].sensor_type == sensor_type && sensors[i].dpi == dpi && if (sensors[i].sensor_type == sensor_type && sensors[i].dpi == dpi &&
@ -818,8 +818,8 @@ static void gl124_setup_sensor(Genesys_Device * dev,
} }
// set EXPDUMMY and CKxMAP // set EXPDUMMY and CKxMAP
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw, SensorProfileGl124* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw,
ccd_size_divisor); ccd_size_divisor);
regs->set8(0x18, sensor_profile->reg18); regs->set8(0x18, sensor_profile->reg18);
regs->set8(0x20, sensor_profile->reg20); regs->set8(0x20, sensor_profile->reg20);
@ -863,8 +863,7 @@ static void gl124_setup_sensor(Genesys_Device * dev,
regs->set24(REG_CK3MAP, sensor_profile->ck3map); regs->set24(REG_CK3MAP, sensor_profile->ck3map);
regs->set24(REG_CK4MAP, sensor_profile->ck4map); regs->set24(REG_CK4MAP, sensor_profile->ck4map);
/* order of the sub-segments */ dev->segment_order = sensor_profile->order;
dev->order=sensor_profile->order;
} }
/** @brief setup optical related registers /** @brief setup optical related registers
@ -1383,8 +1382,8 @@ gl124_calculate_current_setup (Genesys_Device * dev, const Genesys_Sensor& senso
// compute hw dpi for sensor // compute hw dpi for sensor
dpihw = sensor.get_register_hwdpi(used_res); dpihw = sensor.get_register_hwdpi(used_res);
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw, SensorProfileGl124* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw,
ccd_size_divisor); ccd_size_divisor);
dev->segnb=sensor_profile->reg98 & 0x0f; dev->segnb=sensor_profile->reg98 & 0x0f;
/* stagger */ /* stagger */
@ -2312,8 +2311,8 @@ static void gl124_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
unsigned ccd_size_divisor = compute_ccd_size_divisor(sensor, dev->settings.xres); unsigned ccd_size_divisor = compute_ccd_size_divisor(sensor, dev->settings.xres);
resolution /= ccd_size_divisor; resolution /= ccd_size_divisor;
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw, SensorProfileGl124* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw,
ccd_size_divisor); ccd_size_divisor);
num_pixels = (sensor.sensor_pixels*resolution)/sensor.optical_res; num_pixels = (sensor.sensor_pixels*resolution)/sensor.optical_res;
/* initial calibration reg values */ /* initial calibration reg values */

Wyświetl plik

@ -369,7 +369,7 @@ static Memory_layout layouts[]={
* - sensor hardware dpi * - sensor hardware dpi
* - half ccd mode * - half ccd mode
*/ */
struct Sensor_Profile struct SensorProfileGl124
{ {
int sensor_type; /**> sensor id */ int sensor_type; /**> sensor id */
int dpi; /**> maximum dpi for which data are valid */ int dpi; /**> maximum dpi for which data are valid */
@ -384,7 +384,7 @@ struct Sensor_Profile
int expr; /**> initial red exposure */ int expr; /**> initial red exposure */
int expg; /**> initial green exposure */ int expg; /**> initial green exposure */
int expb; /**> initial blue exposure */ int expb; /**> initial blue exposure */
size_t *order; /**> order of sub-segments */ std::vector<unsigned> order; // order of sub-segments
uint8_t reg18; /**> register 0x18 value */ uint8_t reg18; /**> register 0x18 value */
uint8_t reg20; /**> register 0x20 value */ uint8_t reg20; /**> register 0x20 value */
uint8_t reg61; /**> register 0x61 value */ uint8_t reg61; /**> register 0x61 value */
@ -393,37 +393,34 @@ struct Sensor_Profile
uint8_t reg70; /**> register 0x70 value */ uint8_t reg70; /**> register 0x70 value */
}; };
static size_t order_01[]={0,1};
static size_t order_0213[]={0,2,1,3};
/** @brief database of sensor profiles /** @brief database of sensor profiles
* database of sensor profiles giving for each sensor and a given resolution, the period, and timings * database of sensor profiles giving for each sensor and a given resolution, the period, and timings
* to setup the sensor for the scan. * to setup the sensor for the scan.
*/ */
static Sensor_Profile sensors[]={ static SensorProfileGl124 sensors[]={
/* LiDE 110 */ /* LiDE 110 */
{CIS_CANONLIDE110, 600, 2, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00}, {CIS_CANONLIDE110, 600, 2, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, {} , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
{CIS_CANONLIDE110, 600, 1, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00}, {CIS_CANONLIDE110, 600, 1, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, {} , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
{CIS_CANONLIDE110, 1200, 1, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00}, {CIS_CANONLIDE110, 1200, 1, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, {0, 1} , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
{CIS_CANONLIDE110, 2400, 1, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00}, {CIS_CANONLIDE110, 2400, 1, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, {0, 2, 1, 3}, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
/* LiDE 120 */ /* LiDE 120 */
{CIS_CANONLIDE120, 600, 2, 4608, 0x0f, 0x00, 0x55, 2552, 112, 94, 894, 1044, 994, NULL , 0x00, 0x02, 0x20, 0x21, 0x15, 0x00}, {CIS_CANONLIDE120, 600, 2, 4608, 0x0f, 0x00, 0x55, 2552, 112, 94, 894, 1044, 994, {} , 0x00, 0x02, 0x20, 0x21, 0x15, 0x00},
{CIS_CANONLIDE120, 600, 1, 5360, 0x0f, 0x00, 0x55, 5104, 139, 94, 1644, 1994, 1844, NULL , 0x00, 0x02, 0x20, 0x21, 0x11, 0x1f}, {CIS_CANONLIDE120, 600, 1, 5360, 0x0f, 0x00, 0x55, 5104, 139, 94, 1644, 1994, 1844, {} , 0x00, 0x02, 0x20, 0x21, 0x11, 0x1f},
{CIS_CANONLIDE120, 1200, 1, 10528, 0x0f, 0x00, 0x55,10208, 192, 94, 3194, 3794, 3594, NULL , 0x00, 0x02, 0x20, 0x21, 0x15, 0x1f}, {CIS_CANONLIDE120, 1200, 1, 10528, 0x0f, 0x00, 0x55,10208, 192, 94, 3194, 3794, 3594, {} , 0x00, 0x02, 0x20, 0x21, 0x15, 0x1f},
{CIS_CANONLIDE120, 2400, 1, 20864, 0x0f, 0x00, 0x55,20416, 298, 94, 6244, 7544, 7094, NULL , 0x00, 0x02, 0x20, 0x21, 0x11, 0x00}, {CIS_CANONLIDE120, 2400, 1, 20864, 0x0f, 0x00, 0x55,20416, 298, 94, 6244, 7544, 7094, {} , 0x00, 0x02, 0x20, 0x21, 0x11, 0x00},
/* LiDE 210 */ /* LiDE 210 */
{CIS_CANONLIDE210, 600, 2, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00}, {CIS_CANONLIDE210, 600, 2, 2768, 0x1e, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, {} , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
{CIS_CANONLIDE210, 600, 1, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00}, {CIS_CANONLIDE210, 600, 1, 5360, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, {} , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
{CIS_CANONLIDE210, 1200, 1, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00}, {CIS_CANONLIDE210, 1200, 1, 10528, 0x1e, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, {0, 1} , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
{CIS_CANONLIDE210, 2400, 1, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00}, {CIS_CANONLIDE210, 2400, 1, 20864, 0x1e, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, {0, 2, 1, 3}, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
/* LiDE 220 */ /* LiDE 220 */
{CIS_CANONLIDE220, 600, 2, 2768, 0x0f, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, NULL , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00}, {CIS_CANONLIDE220, 600, 2, 2768, 0x0f, 0x9f, 0x55, 2584, 154, 101, 388, 574, 393, {} , 0x00, 0x0c, 0x20, 0x21, 0x00, 0x00},
{CIS_CANONLIDE220, 600, 1, 5360, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, NULL , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00}, {CIS_CANONLIDE220, 600, 1, 5360, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, {} , 0x00, 0x0a, 0x20, 0x21, 0x00, 0x00},
{CIS_CANONLIDE220, 1200, 1, 10528, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, order_01 , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00}, {CIS_CANONLIDE220, 1200, 1, 10528, 0x0f, 0x9f, 0x55, 5168, 163, 101, 388, 574, 393, {0, 1} , 0x00, 0x08, 0x20, 0x22, 0x00, 0x00},
{CIS_CANONLIDE220, 2400, 1, 20864, 0x0f, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, order_0213, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00}, {CIS_CANONLIDE220, 2400, 1, 20864, 0x0f, 0x9f, 0x55, 5168, 163, 4679, 6839, 8401, 6859, {0, 2, 1, 3}, 0x00, 0x06, 0x20, 0x24, 0x00, 0x00},
}; };

Wyświetl plik

@ -154,14 +154,14 @@ gl846_get_step_multiplier (Genesys_Register_Set * regs)
* @param dpi hardware dpi for the scan * @param dpi hardware dpi for the scan
* @return a pointer to a Sensor_Profile struct * @return a pointer to a Sensor_Profile struct
*/ */
static Sensor_Profile *get_sensor_profile(int sensor_type, int dpi) static SensorProfileGl846 *get_sensor_profile(int sensor_type, int dpi)
{ {
unsigned int i; unsigned int i;
int idx; int idx;
i=0; i=0;
idx=-1; idx=-1;
while(i<sizeof(sensors)/sizeof(Sensor_Profile)) while(i<sizeof(sensors)/sizeof(SensorProfileGl846))
{ {
/* exact match */ /* exact match */
if(sensors[i].sensor_type==sensor_type && sensors[i].dpi==dpi) if(sensors[i].sensor_type==sensor_type && sensors[i].dpi==dpi)
@ -203,7 +203,7 @@ static Sensor_Profile *get_sensor_profile(int sensor_type, int dpi)
*/ */
static int gl846_compute_exposure(Genesys_Device *dev, int xres) static int gl846_compute_exposure(Genesys_Device *dev, int xres)
{ {
Sensor_Profile* sensor_profile=get_sensor_profile(dev->model->ccd_type, xres); SensorProfileGl846* sensor_profile=get_sensor_profile(dev->model->ccd_type, xres);
return sensor_profile->exposure; return sensor_profile->exposure;
} }
@ -228,7 +228,7 @@ static void gl846_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& senso
// set EXPDUMMY and CKxMAP // set EXPDUMMY and CKxMAP
dpihw = sensor.get_register_hwdpi(dpi); dpihw = sensor.get_register_hwdpi(dpi);
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw); SensorProfileGl846* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw);
regs->set8(REG_EXPDMY, (uint8_t)((sensor_profile->expdummy) & 0xff)); regs->set8(REG_EXPDMY, (uint8_t)((sensor_profile->expdummy) & 0xff));
@ -258,8 +258,7 @@ static void gl846_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& senso
regs->set24(REG_CK3MAP, sensor_profile->ck3map); regs->set24(REG_CK3MAP, sensor_profile->ck3map);
regs->set24(REG_CK4MAP, sensor_profile->ck4map); regs->set24(REG_CK4MAP, sensor_profile->ck4map);
/* order of the sub-segments */ dev->segment_order = sensor_profile->order;
dev->order=sensor_profile->order;
r = sanei_genesys_get_address (regs, 0x17); r = sanei_genesys_get_address (regs, 0x17);
r->value = sensor_profile->r17; r->value = sensor_profile->r17;
@ -779,7 +778,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
DBG(DBG_io2, "%s: dpihw=%d (factor=%d)\n", __func__, dpihw, factor); DBG(DBG_io2, "%s: dpihw=%d (factor=%d)\n", __func__, dpihw, factor);
/* sensor parameters */ /* sensor parameters */
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw); SensorProfileGl846* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw);
gl846_setup_sensor(dev, sensor, reg, dpihw); gl846_setup_sensor(dev, sensor, reg, dpihw);
dpiset = used_res * ccd_pixels_per_system_pixel ; dpiset = used_res * ccd_pixels_per_system_pixel ;
@ -1985,7 +1984,7 @@ static void gl846_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
channels = 3; channels = 3;
depth=16; depth=16;
used_res = sensor.get_register_hwdpi(dev->settings.xres); used_res = sensor.get_register_hwdpi(dev->settings.xres);
Sensor_Profile* sensor_profile = get_sensor_profile(dev->model->ccd_type, used_res); SensorProfileGl846* sensor_profile = get_sensor_profile(dev->model->ccd_type, used_res);
num_pixels = (sensor.sensor_pixels*used_res)/sensor.optical_res; num_pixels = (sensor.sensor_pixels*used_res)/sensor.optical_res;
/* initial calibration reg values */ /* initial calibration reg values */

Wyświetl plik

@ -440,7 +440,7 @@ static Memory_layout layouts[]={
* this structure describes the sensor settings to use for a given * this structure describes the sensor settings to use for a given
* exposure. * exposure.
*/ */
typedef struct { struct SensorProfileGl846 {
int sensor_type; /**> sensor id */ int sensor_type; /**> sensor id */
int dpi; /**> maximum dpi for which data are valid */ int dpi; /**> maximum dpi for which data are valid */
int exposure; /**> exposure */ int exposure; /**> exposure */
@ -452,19 +452,14 @@ typedef struct {
int expr; /**> initial red exposure */ int expr; /**> initial red exposure */
int expg; /**> initial green exposure */ int expg; /**> initial green exposure */
int expb; /**> initial blue exposure */ int expb; /**> initial blue exposure */
size_t *order; /**> order of sub-segments */ std::vector<unsigned> order; // order of sub-segments
uint8_t r17; /**> TG width */ uint8_t r17; /**> TG width */
} Sensor_Profile; };
/**
* order of the scanned pixel
*/
static size_t order_01[]={0,1};
/** /**
* database of sensor profiles * database of sensor profiles
*/ */
static Sensor_Profile sensors[]={ static SensorProfileGl846 sensors[]={
{CCD_IMG101, 1200, 11000, 60, 159, 85, 5136, 255, 0, 0, 0, order_01 , 0x13}, {CCD_IMG101, 1200, 11000, 60, 159, 85, 5136, 255, 0, 0, 0, {0, 1}, 0x13},
{CCD_PLUSTEK3800, 1200, 11000, 60, 159, 85, 5136, 255, 0, 0, 0, order_01 , 0x13}, {CCD_PLUSTEK3800, 1200, 11000, 60, 159, 85, 5136, 255, 0, 0, 0, {0, 1}, 0x13},
}; };

Wyświetl plik

@ -149,15 +149,14 @@ gl847_get_step_multiplier (Genesys_Register_Set * regs)
* @param dpi hardware dpi for the scan * @param dpi hardware dpi for the scan
* @return a pointer to a Sensor_Profile struct * @return a pointer to a Sensor_Profile struct
*/ */
static Sensor_Profile *get_sensor_profile(int sensor_type, int dpi) static SensorProfileGl847 *get_sensor_profile(int sensor_type, int dpi)
{ {
unsigned int i; unsigned int i;
int idx; int idx;
i=0; i=0;
idx=-1; idx=-1;
while(i<sizeof(sensors)/sizeof(Sensor_Profile)) while (i < sizeof(sensors)/sizeof(SensorProfileGl847)) {
{
/* exact match */ /* exact match */
if(sensors[i].sensor_type==sensor_type && sensors[i].dpi==dpi) if(sensors[i].sensor_type==sensor_type && sensors[i].dpi==dpi)
{ {
@ -198,7 +197,7 @@ static Sensor_Profile *get_sensor_profile(int sensor_type, int dpi)
*/ */
static int gl847_compute_exposure(Genesys_Device *dev, int xres) static int gl847_compute_exposure(Genesys_Device *dev, int xres)
{ {
Sensor_Profile* sensor_profile=get_sensor_profile(dev->model->ccd_type, xres); SensorProfileGl847* sensor_profile=get_sensor_profile(dev->model->ccd_type, xres);
return sensor_profile->exposure; return sensor_profile->exposure;
} }
@ -225,7 +224,7 @@ static void gl847_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& senso
// set EXPDUMMY and CKxMAP // set EXPDUMMY and CKxMAP
dpihw = sensor.get_register_hwdpi(dpi); dpihw = sensor.get_register_hwdpi(dpi);
Sensor_Profile* sensor_profile=get_sensor_profile(dev->model->ccd_type, dpihw); SensorProfileGl847* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw);
regs->set8(REG_EXPDMY, (uint8_t)((sensor_profile->expdummy) & 0xff)); regs->set8(REG_EXPDMY, (uint8_t)((sensor_profile->expdummy) & 0xff));
@ -255,8 +254,7 @@ static void gl847_setup_sensor(Genesys_Device * dev, const Genesys_Sensor& senso
regs->set24(REG_CK3MAP,sensor_profile->ck3map); regs->set24(REG_CK3MAP,sensor_profile->ck3map);
regs->set24(REG_CK4MAP,sensor_profile->ck4map); regs->set24(REG_CK4MAP,sensor_profile->ck4map);
/* order of the sub-segments */ dev->segment_order = sensor_profile->order;
dev->order=sensor_profile->order;
r = sanei_genesys_get_address (regs, 0x17); r = sanei_genesys_get_address (regs, 0x17);
r->value = sensor_profile->r17; r->value = sensor_profile->r17;
@ -800,7 +798,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
DBG(DBG_io2, "%s: dpihw=%d (factor=%d)\n", __func__, dpihw, factor); DBG(DBG_io2, "%s: dpihw=%d (factor=%d)\n", __func__, dpihw, factor);
/* sensor parameters */ /* sensor parameters */
Sensor_Profile* sensor_profile=get_sensor_profile(dev->model->ccd_type, dpihw); SensorProfileGl847* sensor_profile = get_sensor_profile(dev->model->ccd_type, dpihw);
gl847_setup_sensor(dev, sensor, reg, dpihw); gl847_setup_sensor(dev, sensor, reg, dpihw);
dpiset = used_res * ccd_pixels_per_system_pixel; dpiset = used_res * ccd_pixels_per_system_pixel;
@ -2041,7 +2039,7 @@ static void gl847_led_calibration(Genesys_Device* dev, Genesys_Sensor& sensor,
channels = 3; channels = 3;
depth=16; depth=16;
used_res = sensor.get_register_hwdpi(dev->settings.xres); used_res = sensor.get_register_hwdpi(dev->settings.xres);
Sensor_Profile* sensor_profile=get_sensor_profile(dev->model->ccd_type, used_res); SensorProfileGl847* sensor_profile=get_sensor_profile(dev->model->ccd_type, used_res);
num_pixels = (sensor.sensor_pixels*used_res)/sensor.optical_res; num_pixels = (sensor.sensor_pixels*used_res)/sensor.optical_res;
/* initial calibration reg values */ /* initial calibration reg values */

Wyświetl plik

@ -408,7 +408,7 @@ static Memory_layout layouts[]={
* this structure describes the sensor settings to use for a given * this structure describes the sensor settings to use for a given
* exposure. * exposure.
*/ */
typedef struct { struct SensorProfileGl847 {
int sensor_type; /**> sensor id */ int sensor_type; /**> sensor id */
int dpi; /**> maximum dpi for which data are valid */ int dpi; /**> maximum dpi for which data are valid */
int exposure; /**> exposure */ int exposure; /**> exposure */
@ -420,42 +420,35 @@ typedef struct {
int expr; /**> initial red exposure */ int expr; /**> initial red exposure */
int expg; /**> initial green exposure */ int expg; /**> initial green exposure */
int expb; /**> initial blue exposure */ int expb; /**> initial blue exposure */
size_t *order; /**> order of sub-segments */ std::vector<unsigned> order; // order of sub-segments
uint8_t r17; /**> TG width */ uint8_t r17; /**> TG width */
} Sensor_Profile; };
static size_t order_01[]={0,1};
static size_t order_0213[]={0,2,1,3};
static size_t order_0246[]={0,2,4,6,1,3,5,7};
static size_t new_order[]={0,1,2,3};
static size_t order_0145[]={0,1,4,5,2,3,6,7};
/** /**
* database of sensor profiles * database of sensor profiles
*/ */
static Sensor_Profile sensors[]={ static SensorProfileGl847 sensors[]={
{CIS_CANONLIDE100, 200, 2848, 60, 159, 85, 5136, 255, 410, 275, 203, NULL , 0x0a}, {CIS_CANONLIDE100, 200, 2848, 60, 159, 85, 5136, 255, 410, 275, 203, {} , 0x0a},
{CIS_CANONLIDE100, 300, 1424, 60, 159, 85, 5136, 255, 410, 275, 203, NULL , 0x0a}, {CIS_CANONLIDE100, 300, 1424, 60, 159, 85, 5136, 255, 410, 275, 203, {} , 0x0a},
{CIS_CANONLIDE100, 600, 1432, 60, 159, 85, 5136, 255, 410, 275, 203, NULL , 0x0a}, {CIS_CANONLIDE100, 600, 1432, 60, 159, 85, 5136, 255, 410, 275, 203, {} , 0x0a},
{CIS_CANONLIDE100, 1200, 2712, 60, 159, 85, 5136, 255, 746, 478, 353, order_01 , 0x08}, {CIS_CANONLIDE100, 1200, 2712, 60, 159, 85, 5136, 255, 746, 478, 353, {0, 1} , 0x08},
{CIS_CANONLIDE100, 2400, 5280, 60, 159, 85, 5136, 255, 1417, 909, 643, order_0213, 0x06}, {CIS_CANONLIDE100, 2400, 5280, 60, 159, 85, 5136, 255, 1417, 909, 643, {0, 2, 1, 3}, 0x06},
/* /*
{CIS_CANONLIDE200, 150, 2848, 240, 636, 340, 5144, 0, 255, 637, 637, 637}, {CIS_CANONLIDE200, 150, 2848, 240, 636, 340, 5144, 0, 255, 637, 637, 637},
{CIS_CANONLIDE200, 300, 1424, 240, 636, 340, 5144, 0, 255, 637, 637, 637}, {CIS_CANONLIDE200, 300, 1424, 240, 636, 340, 5144, 0, 255, 637, 637, 637},
*/ */
{CIS_CANONLIDE200, 200, 2848, 60, 159, 85, 5136, 255, 410, 275, 203, NULL , 0x0a}, {CIS_CANONLIDE200, 200, 2848, 60, 159, 85, 5136, 255, 410, 275, 203, {} , 0x0a},
{CIS_CANONLIDE200, 300, 1424, 60, 159, 85, 5136, 255, 410, 275, 203, NULL , 0x0a}, {CIS_CANONLIDE200, 300, 1424, 60, 159, 85, 5136, 255, 410, 275, 203, {} , 0x0a},
{CIS_CANONLIDE200, 600, 1432, 60, 159, 85, 5136, 255, 410, 275, 203, NULL , 0x0a}, {CIS_CANONLIDE200, 600, 1432, 60, 159, 85, 5136, 255, 410, 275, 203, {} , 0x0a},
{CIS_CANONLIDE200, 1200, 2712, 60, 159, 85, 5136, 255, 746, 478, 353, order_01 , 0x08}, {CIS_CANONLIDE200, 1200, 2712, 60, 159, 85, 5136, 255, 746, 478, 353, {0, 1} , 0x08},
{CIS_CANONLIDE200, 2400, 5280, 60, 159, 85, 5136, 255, 1417, 909, 643, order_0213, 0x06}, {CIS_CANONLIDE200, 2400, 5280, 60, 159, 85, 5136, 255, 1417, 909, 643, {0, 2, 1, 3}, 0x06},
{CIS_CANONLIDE200, 4800, 10416, 60, 159, 85, 5136, 255, 2692, 1728, 1221, order_0246, 0x04}, {CIS_CANONLIDE200, 4800, 10416, 60, 159, 85, 5136, 255, 2692, 1728, 1221, {0, 2, 4, 6, 1, 3, 5, 7}, 0x04},
/* LiDE 700F */ /* LiDE 700F */
{CIS_CANONLIDE700, 150, 2848, 135, 249, 85, 5187, 255, 465, 310, 239, NULL , 0x0c}, {CIS_CANONLIDE700, 150, 2848, 135, 249, 85, 5187, 255, 465, 310, 239, {} , 0x0c},
{CIS_CANONLIDE700, 300, 1424, 135, 249, 85, 5187, 255, 465, 310, 239, NULL , 0x0c}, {CIS_CANONLIDE700, 300, 1424, 135, 249, 85, 5187, 255, 465, 310, 239, {} , 0x0c},
{CIS_CANONLIDE700, 600, 1504, 135, 249, 85, 5187, 255, 465, 310, 239, NULL , 0x0c}, {CIS_CANONLIDE700, 600, 1504, 135, 249, 85, 5187, 255, 465, 310, 239, {} , 0x0c},
{CIS_CANONLIDE700, 1200, 2696, 135, 249, 85, 5187, 255, 1464, 844, 555, order_01 , 0x0a}, {CIS_CANONLIDE700, 1200, 2696, 135, 249, 85, 5187, 255, 1464, 844, 555, {0, 1} , 0x0a},
{CIS_CANONLIDE700, 2400, 10576, 135, 249, 85, 5187, 255, 2798, 1558, 972, new_order , 0x08}, {CIS_CANONLIDE700, 2400, 10576, 135, 249, 85, 5187, 255, 2798, 1558, 972, {0, 1, 2, 3}, 0x08},
{CIS_CANONLIDE700, 4800, 10576, 135, 249, 85, 5187, 255, 2798, 1558, 972, order_0145, 0x06}, {CIS_CANONLIDE700, 4800, 10576, 135, 249, 85, 5187, 255, 2798, 1558, 972, {0, 1, 4, 5, 2, 3, 6, 7}, 0x06},
}; };