kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Remove uses of calib_channels
rodzic
9ddc64826c
commit
26eec0ba57
|
@ -64,7 +64,6 @@ struct Genesys_Calibration_Cache
|
|||
Genesys_Sensor sensor;
|
||||
|
||||
ScanSession session;
|
||||
size_t calib_channels = 0;
|
||||
size_t average_size = 0;
|
||||
std::vector<std::uint16_t> white_average_data;
|
||||
std::vector<std::uint16_t> dark_average_data;
|
||||
|
@ -76,7 +75,6 @@ struct Genesys_Calibration_Cache
|
|||
frontend == other.frontend &&
|
||||
sensor == other.sensor &&
|
||||
session == other.session &&
|
||||
calib_channels == other.calib_channels &&
|
||||
average_size == other.average_size &&
|
||||
white_average_data == other.white_average_data &&
|
||||
dark_average_data == other.dark_average_data;
|
||||
|
@ -95,7 +93,6 @@ void serialize(Stream& str, Genesys_Calibration_Cache& x)
|
|||
serialize(str, x.sensor);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.session);
|
||||
serialize(str, x.calib_channels);
|
||||
serialize(str, x.average_size);
|
||||
serialize_newline(str);
|
||||
serialize(str, x.white_average_data);
|
||||
|
|
|
@ -240,7 +240,6 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Device& dev)
|
|||
<< static_cast<unsigned>(dev.control[5]) << '\n' << std::dec
|
||||
<< " average_size: " << dev.average_size << '\n'
|
||||
<< " calib_lines: " << dev.calib_lines << '\n'
|
||||
<< " calib_channels: " << dev.calib_channels << '\n'
|
||||
<< " calib_total_bytes_to_read: " << dev.calib_total_bytes_to_read << '\n'
|
||||
<< " calib_session: " << format_indent_braced_list(4, dev.calib_session) << '\n'
|
||||
<< " gamma_override_tables[0].size(): " << dev.gamma_override_tables[0].size() << '\n'
|
||||
|
|
|
@ -271,7 +271,6 @@ struct Genesys_Device
|
|||
size_t average_size = 0;
|
||||
// number of lines used during shading calibration
|
||||
size_t calib_lines = 0;
|
||||
size_t calib_channels = 0;
|
||||
// bytes to read from USB when calibrating. If 0, this is not set
|
||||
size_t calib_total_bytes_to_read = 0;
|
||||
|
||||
|
|
|
@ -1667,14 +1667,13 @@ static void genesys_shading_calibration_impl(Genesys_Device* dev, const Genesys_
|
|||
|
||||
size_t size;
|
||||
uint32_t pixels_per_line;
|
||||
uint8_t channels;
|
||||
|
||||
if (dev->model->asic_type == AsicType::GL843) {
|
||||
pixels_per_line = dev->calib_session.output_pixels;
|
||||
} else {
|
||||
pixels_per_line = dev->calib_session.params.pixels;
|
||||
}
|
||||
channels = dev->calib_channels;
|
||||
unsigned channels = dev->calib_session.params.channels;
|
||||
|
||||
unsigned out_pixels_per_line = pixels_per_line + dev->calib_session.params.startx;
|
||||
|
||||
|
@ -1792,7 +1791,6 @@ static void genesys_dummy_dark_shading(Genesys_Device* dev, const Genesys_Sensor
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
uint32_t pixels_per_line;
|
||||
uint8_t channels;
|
||||
uint32_t skip, xend;
|
||||
int dummy1, dummy2, dummy3; /* dummy black average per channel */
|
||||
|
||||
|
@ -1802,7 +1800,7 @@ static void genesys_dummy_dark_shading(Genesys_Device* dev, const Genesys_Sensor
|
|||
pixels_per_line = dev->calib_session.params.pixels;
|
||||
}
|
||||
|
||||
channels = dev->calib_channels;
|
||||
unsigned channels = dev->calib_session.params.channels;
|
||||
|
||||
unsigned out_pixels_per_line = pixels_per_line + dev->calib_session.params.startx;
|
||||
|
||||
|
@ -1921,7 +1919,6 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
|
|||
|
||||
size_t size;
|
||||
uint32_t pixels_per_line;
|
||||
uint8_t channels;
|
||||
unsigned int x;
|
||||
uint32_t dark, white, dark_sum, white_sum, dark_count, white_count, col,
|
||||
dif;
|
||||
|
@ -1932,7 +1929,7 @@ static void genesys_dark_white_shading_calibration(Genesys_Device* dev,
|
|||
pixels_per_line = dev->calib_session.params.pixels;
|
||||
}
|
||||
|
||||
channels = dev->calib_channels;
|
||||
unsigned channels = dev->calib_session.params.channels;
|
||||
|
||||
unsigned out_pixels_per_line = pixels_per_line + dev->calib_session.params.startx;
|
||||
|
||||
|
@ -2539,7 +2536,6 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
|
|||
}
|
||||
|
||||
uint32_t pixels_per_line;
|
||||
uint8_t channels;
|
||||
int o;
|
||||
unsigned int length; /**> number of shading calibration data words */
|
||||
unsigned int factor;
|
||||
|
@ -2551,7 +2547,7 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
|
|||
pixels_per_line = dev->calib_session.params.pixels + dev->calib_session.params.startx;
|
||||
}
|
||||
|
||||
channels = dev->calib_channels;
|
||||
unsigned channels = dev->calib_session.params.channels;
|
||||
|
||||
/* we always build data for three channels, even for gray
|
||||
* we make the shading data such that each color channel data line is contiguous
|
||||
|
@ -2592,6 +2588,11 @@ static void genesys_send_shading_coefficient(Genesys_Device* dev, const Genesys_
|
|||
// contains 16bit words in little endian
|
||||
std::vector<uint8_t> shading_data(length, 0);
|
||||
|
||||
if (!dev->calib_session.computed) {
|
||||
genesys_send_offset_and_shading(dev, sensor, shading_data.data(), length);
|
||||
return;
|
||||
}
|
||||
|
||||
/* TARGET/(Wn-Dn) = white gain -> ~1.xxx then it is multiplied by 0x2000
|
||||
or 0x4000 to give an integer
|
||||
Wn = white average for column n
|
||||
|
@ -2846,7 +2847,6 @@ genesys_restore_calibration(Genesys_Device * dev, Genesys_Sensor& sensor)
|
|||
|
||||
dev->calib_session = cache.session;
|
||||
dev->average_size = cache.average_size;
|
||||
dev->calib_channels = cache.calib_channels;
|
||||
|
||||
dev->dark_average_data = cache.dark_average_data;
|
||||
dev->white_average_data = cache.white_average_data;
|
||||
|
@ -2901,7 +2901,6 @@ static void genesys_save_calibration(Genesys_Device* dev, const Genesys_Sensor&
|
|||
found_cache_it->sensor = sensor;
|
||||
|
||||
found_cache_it->session = dev->calib_session;
|
||||
found_cache_it->calib_channels = dev->calib_channels;
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
gettimeofday(&time, nullptr);
|
||||
|
@ -4709,7 +4708,7 @@ static void probe_genesys_devices()
|
|||
of Genesys_Calibration_Cache as is.
|
||||
*/
|
||||
static const char* CALIBRATION_IDENT = "sane_genesys";
|
||||
static const int CALIBRATION_VERSION = 24;
|
||||
static const int CALIBRATION_VERSION = 25;
|
||||
|
||||
bool read_calibration(std::istream& str, Genesys_Device::Calibration& calibration,
|
||||
const std::string& path)
|
||||
|
|
|
@ -1178,7 +1178,7 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
DBG_HELPER(dbg);
|
||||
int move, resolution, dpihw, factor;
|
||||
|
||||
dev->calib_channels = 3;
|
||||
unsigned channels = 3;
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
dpihw = sensor.get_register_hwdpi(dev->settings.xres);
|
||||
if(dpihw>=2400)
|
||||
|
@ -1192,8 +1192,7 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
resolution /= ccd_size_divisor;
|
||||
dev->calib_lines /= ccd_size_divisor; // reducing just because we reduced the resolution
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution,
|
||||
dev->calib_channels,
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
|
||||
dev->settings.scan_method);
|
||||
dev->calib_total_bytes_to_read = 0;
|
||||
factor = calib_sensor.optical_res / resolution;
|
||||
|
@ -1214,7 +1213,7 @@ void CommandSetGl124::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
session.params.pixels = calib_sensor.sensor_pixels / factor;
|
||||
session.params.lines = dev->calib_lines;
|
||||
session.params.depth = 16;
|
||||
session.params.channels = dev->calib_channels;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_method = dev->settings.scan_method;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = ColorFilter::RED;
|
||||
|
|
|
@ -1708,12 +1708,6 @@ void CommandSetGl646::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
dev->calib_session = setup_for_scan(dev, calib_sensor, &dev->reg, settings,
|
||||
true, false, false, false);
|
||||
|
||||
/* used when sending shading calibration data */
|
||||
dev->calib_channels = dev->session.params.channels;
|
||||
if (!dev->model->is_cis) {
|
||||
dev->calib_channels = 3;
|
||||
}
|
||||
|
||||
/* no shading */
|
||||
dev->reg.find_reg(0x01).value &= ~REG_0x01_DVDSET;
|
||||
dev->reg.find_reg(0x02).value |= REG_0x02_ACDCDIS; /* ease backtracking */
|
||||
|
|
|
@ -2455,13 +2455,13 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
starty = 70;
|
||||
}
|
||||
|
||||
dev->calib_channels = 3;
|
||||
unsigned channels = 3;
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
|
||||
unsigned resolution = sensor.get_logical_hwdpi(dev->settings.xres);
|
||||
unsigned factor = sensor.optical_res / resolution;
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->calib_channels,
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
|
||||
dev->settings.scan_method);
|
||||
|
||||
ScanSession session;
|
||||
|
@ -2472,7 +2472,7 @@ void CommandSetGl841::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
session.params.pixels = calib_sensor.sensor_pixels / factor;
|
||||
session.params.lines = dev->calib_lines;
|
||||
session.params.depth = 16;
|
||||
session.params.channels = dev->calib_channels;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_method = dev->settings.scan_method;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
|
|
|
@ -1698,7 +1698,6 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
DBG_HELPER(dbg);
|
||||
int move, resolution, dpihw, factor;
|
||||
|
||||
dev->calib_channels = 3;
|
||||
|
||||
if (dev->settings.scan_method == ScanMethod::TRANSPARENCY ||
|
||||
dev->settings.scan_method == ScanMethod::TRANSPARENCY_INFRARED)
|
||||
|
@ -1712,7 +1711,8 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
factor=sensor.optical_res/dpihw;
|
||||
resolution=dpihw;
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, dev->calib_channels,
|
||||
unsigned channels = 3;
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
|
||||
dev->settings.scan_method);
|
||||
|
||||
unsigned calib_pixels = 0;
|
||||
|
@ -1760,7 +1760,7 @@ void CommandSetGl843::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
session.params.pixels = calib_pixels;
|
||||
session.params.lines = dev->calib_lines;
|
||||
session.params.depth = 16;
|
||||
session.params.channels = dev->calib_channels;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_method = dev->settings.scan_method;
|
||||
session.params.scan_mode = dev->settings.scan_mode;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
|
|
|
@ -958,12 +958,10 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
DBG_HELPER(dbg);
|
||||
float move;
|
||||
|
||||
dev->calib_channels = 3;
|
||||
|
||||
unsigned channels = 3;
|
||||
unsigned resolution = sensor.get_register_hwdpi(dev->settings.xres);
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution,
|
||||
dev->calib_channels,
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
|
||||
dev->settings.scan_method);
|
||||
dev->calib_total_bytes_to_read = 0;
|
||||
dev->calib_lines = dev->model->shading_lines;
|
||||
|
@ -991,7 +989,7 @@ void CommandSetGl846::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
session.params.pixels = calib_pixels;
|
||||
session.params.lines = dev->calib_lines;
|
||||
session.params.depth = 16;
|
||||
session.params.channels = dev->calib_channels;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_method = dev->settings.scan_method;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
|
|
|
@ -965,12 +965,11 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
{
|
||||
DBG_HELPER(dbg);
|
||||
|
||||
dev->calib_channels = 3;
|
||||
unsigned channels = 3;
|
||||
|
||||
unsigned resolution = sensor.get_register_hwdpi(dev->settings.xres);
|
||||
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution,
|
||||
dev->calib_channels,
|
||||
const auto& calib_sensor = sanei_genesys_find_sensor(dev, resolution, channels,
|
||||
dev->settings.scan_method);
|
||||
|
||||
dev->calib_total_bytes_to_read = 0;
|
||||
|
@ -992,7 +991,7 @@ void CommandSetGl847::init_regs_for_shading(Genesys_Device* dev, const Genesys_S
|
|||
session.params.pixels = calib_pixels;
|
||||
session.params.lines = dev->calib_lines;
|
||||
session.params.depth = 16;
|
||||
session.params.channels = dev->calib_channels;
|
||||
session.params.channels = channels;
|
||||
session.params.scan_method = dev->settings.scan_method;
|
||||
session.params.scan_mode = ScanColorMode::COLOR_SINGLE_PASS;
|
||||
session.params.color_filter = dev->settings.color_filter;
|
||||
|
|
|
@ -104,7 +104,6 @@ Genesys_Calibration_Cache create_fake_calibration_entry()
|
|||
sensor.gamma = {1.0, 1.0, 1.0};
|
||||
calib.sensor = sensor;
|
||||
|
||||
calib.calib_channels = 3;
|
||||
calib.average_size = 7;
|
||||
calib.white_average_data = { 8, 7, 6, 5, 4, 3, 2 };
|
||||
calib.dark_average_data = { 6, 5, 4, 3, 2, 18, 12 };
|
||||
|
|
Ładowanie…
Reference in New Issue