kopia lustrzana https://gitlab.com/sane-project/backends
genesys: Add support for unstaggering in X direction
rodzic
95d7196fca
commit
5f0abce90f
|
@ -944,6 +944,7 @@ void compute_session(const Genesys_Device* dev, ScanSession& s, const Genesys_Se
|
||||||
s.output_startx = static_cast<unsigned>(
|
s.output_startx = static_cast<unsigned>(
|
||||||
static_cast<int>(s.params.startx) + sensor.output_pixel_offset);
|
static_cast<int>(s.params.startx) + sensor.output_pixel_offset);
|
||||||
|
|
||||||
|
s.stagger_x = sensor.stagger_x;
|
||||||
s.stagger_y = sensor.stagger_y;
|
s.stagger_y = sensor.stagger_y;
|
||||||
|
|
||||||
s.num_staggered_lines = 0;
|
s.num_staggered_lines = 0;
|
||||||
|
@ -1235,13 +1236,25 @@ void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!session.stagger_x.empty()) {
|
||||||
|
// FIXME: the image will be scaled to requested pixel count without regard to the reduction
|
||||||
|
// of image size in this step.
|
||||||
|
dev->pipeline.push_node<ImagePipelineNodePixelShiftColumns>(session.stagger_x.shifts());
|
||||||
|
|
||||||
|
if (dbg_log_image_data()) {
|
||||||
|
dev->pipeline.push_node<ImagePipelineNodeDebug>("gl_pipeline_" +
|
||||||
|
std::to_string(s_pipeline_index) +
|
||||||
|
"_7_after_x_unstagger.pnm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (session.num_staggered_lines > 0) {
|
if (session.num_staggered_lines > 0) {
|
||||||
dev->pipeline.push_node<ImagePipelineNodePixelShiftLines>(session.stagger_y.shifts());
|
dev->pipeline.push_node<ImagePipelineNodePixelShiftLines>(session.stagger_y.shifts());
|
||||||
|
|
||||||
if (dbg_log_image_data()) {
|
if (dbg_log_image_data()) {
|
||||||
dev->pipeline.push_node<ImagePipelineNodeDebug>("gl_pipeline_" +
|
dev->pipeline.push_node<ImagePipelineNodeDebug>("gl_pipeline_" +
|
||||||
std::to_string(s_pipeline_index) +
|
std::to_string(s_pipeline_index) +
|
||||||
"_7_after_unstagger.pnm");
|
"_8_after_y_unstagger.pnm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1257,11 +1270,11 @@ void build_image_pipeline(Genesys_Device* dev, const ScanSession& session)
|
||||||
if (dbg_log_image_data()) {
|
if (dbg_log_image_data()) {
|
||||||
dev->pipeline.push_node<ImagePipelineNodeDebug>("gl_pipeline_" +
|
dev->pipeline.push_node<ImagePipelineNodeDebug>("gl_pipeline_" +
|
||||||
std::to_string(s_pipeline_index) +
|
std::to_string(s_pipeline_index) +
|
||||||
"_8_after_calibrate.pnm");
|
"_9_after_calibrate.pnm");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session.output_pixels != session.params.get_requested_pixels()) {
|
if (dev->pipeline.get_output_width() != session.params.get_requested_pixels()) {
|
||||||
dev->pipeline.push_node<ImagePipelineNodeScaleRows>(session.params.get_requested_pixels());
|
dev->pipeline.push_node<ImagePipelineNodeScaleRows>(session.params.get_requested_pixels());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,8 @@ std::ostream& operator<<(std::ostream& out, const Genesys_Sensor& sensor)
|
||||||
<< " segment_size: " << sensor.segment_size << '\n'
|
<< " segment_size: " << sensor.segment_size << '\n'
|
||||||
<< " segment_order: "
|
<< " segment_order: "
|
||||||
<< format_indent_braced_list(4, format_vector_unsigned(4, sensor.segment_order)) << '\n'
|
<< format_indent_braced_list(4, format_vector_unsigned(4, sensor.segment_order)) << '\n'
|
||||||
<< " stagger_y: " << format_indent_braced_list(4, sensor.stagger_y) << '\n'
|
<< " stagger_x: " << sensor.stagger_x << '\n'
|
||||||
|
<< " stagger_y: " << sensor.stagger_y << '\n'
|
||||||
<< " use_host_side_calib: " << sensor.use_host_side_calib << '\n'
|
<< " use_host_side_calib: " << sensor.use_host_side_calib << '\n'
|
||||||
<< " custom_regs: " << format_indent_braced_list(4, sensor.custom_regs) << '\n'
|
<< " custom_regs: " << format_indent_braced_list(4, sensor.custom_regs) << '\n'
|
||||||
<< " custom_fe_regs: " << format_indent_braced_list(4, sensor.custom_fe_regs) << '\n'
|
<< " custom_fe_regs: " << format_indent_braced_list(4, sensor.custom_fe_regs) << '\n'
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
return *std::max_element(shifts_.begin(), shifts_.end());
|
return *std::max_element(shifts_.begin(), shifts_.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool empty() const { return shifts_.empty(); }
|
||||||
const std::vector<std::size_t>& shifts() const { return shifts_; }
|
const std::vector<std::size_t>& shifts() const { return shifts_; }
|
||||||
|
|
||||||
bool operator==(const StaggerConfig& other) const
|
bool operator==(const StaggerConfig& other) const
|
||||||
|
@ -316,8 +317,12 @@ struct Genesys_Sensor {
|
||||||
// only on gl843
|
// only on gl843
|
||||||
std::vector<unsigned> segment_order;
|
std::vector<unsigned> segment_order;
|
||||||
|
|
||||||
// some CCDs use two arrays of pixels for double resolution. On such CCDs when scanning at
|
// some CCDs use multiple arrays of pixels for double or quadruple resolution. This can result
|
||||||
// high-enough resolution, every other pixel column is shifted
|
// in the following effects on the output:
|
||||||
|
// - every n-th column may be shifted in a vertical direction.
|
||||||
|
// - the columns themselves may be reordered in arbitrary order and may require shifting
|
||||||
|
// in X direction.
|
||||||
|
StaggerConfig stagger_x;
|
||||||
StaggerConfig stagger_y;
|
StaggerConfig stagger_y;
|
||||||
|
|
||||||
// True if calibration should be performed on host-side
|
// True if calibration should be performed on host-side
|
||||||
|
@ -376,6 +381,7 @@ struct Genesys_Sensor {
|
||||||
exposure_lperiod == other.exposure_lperiod &&
|
exposure_lperiod == other.exposure_lperiod &&
|
||||||
segment_size == other.segment_size &&
|
segment_size == other.segment_size &&
|
||||||
segment_order == other.segment_order &&
|
segment_order == other.segment_order &&
|
||||||
|
stagger_x == other.stagger_x &&
|
||||||
stagger_y == other.stagger_y &&
|
stagger_y == other.stagger_y &&
|
||||||
use_host_side_calib == other.use_host_side_calib &&
|
use_host_side_calib == other.use_host_side_calib &&
|
||||||
custom_regs == other.custom_regs &&
|
custom_regs == other.custom_regs &&
|
||||||
|
@ -410,6 +416,8 @@ void serialize(Stream& str, Genesys_Sensor& x)
|
||||||
serialize_newline(str);
|
serialize_newline(str);
|
||||||
serialize(str, x.segment_order);
|
serialize(str, x.segment_order);
|
||||||
serialize_newline(str);
|
serialize_newline(str);
|
||||||
|
serialize(str, x.stagger_x);
|
||||||
|
serialize_newline(str);
|
||||||
serialize(str, x.stagger_y);
|
serialize(str, x.stagger_y);
|
||||||
serialize_newline(str);
|
serialize_newline(str);
|
||||||
serialize(str, x.use_host_side_calib);
|
serialize(str, x.use_host_side_calib);
|
||||||
|
|
|
@ -117,6 +117,7 @@ bool ScanSession::operator==(const ScanSession& other) const
|
||||||
color_shift_lines_r == other.color_shift_lines_r &&
|
color_shift_lines_r == other.color_shift_lines_r &&
|
||||||
color_shift_lines_g == other.color_shift_lines_g &&
|
color_shift_lines_g == other.color_shift_lines_g &&
|
||||||
color_shift_lines_b == other.color_shift_lines_b &&
|
color_shift_lines_b == other.color_shift_lines_b &&
|
||||||
|
stagger_x == other.stagger_x &&
|
||||||
stagger_y == other.stagger_y &&
|
stagger_y == other.stagger_y &&
|
||||||
segment_count == other.segment_count &&
|
segment_count == other.segment_count &&
|
||||||
pixel_startx == other.pixel_startx &&
|
pixel_startx == other.pixel_startx &&
|
||||||
|
@ -154,6 +155,7 @@ std::ostream& operator<<(std::ostream& out, const ScanSession& session)
|
||||||
<< " color_shift_lines_b: " << session.color_shift_lines_b << '\n'
|
<< " color_shift_lines_b: " << session.color_shift_lines_b << '\n'
|
||||||
<< " max_color_shift_lines: " << session.max_color_shift_lines << '\n'
|
<< " max_color_shift_lines: " << session.max_color_shift_lines << '\n'
|
||||||
<< " enable_ledadd: " << session.enable_ledadd << '\n'
|
<< " enable_ledadd: " << session.enable_ledadd << '\n'
|
||||||
|
<< " stagger_x: " << session.stagger_x << '\n'
|
||||||
<< " stagger_y: " << session.stagger_y << '\n'
|
<< " stagger_y: " << session.stagger_y << '\n'
|
||||||
<< " segment_count: " << session.segment_count << '\n'
|
<< " segment_count: " << session.segment_count << '\n'
|
||||||
<< " pixel_startx: " << session.pixel_startx << '\n'
|
<< " pixel_startx: " << session.pixel_startx << '\n'
|
||||||
|
|
|
@ -276,6 +276,8 @@ struct ScanSession {
|
||||||
// actual line shift of the blue color
|
// actual line shift of the blue color
|
||||||
unsigned color_shift_lines_b = 0;
|
unsigned color_shift_lines_b = 0;
|
||||||
|
|
||||||
|
// The shifts that need to be applied to the output pixels in x direction.
|
||||||
|
StaggerConfig stagger_x;
|
||||||
// The shifts that need to be applied to the output pixels in y direction.
|
// The shifts that need to be applied to the output pixels in y direction.
|
||||||
StaggerConfig stagger_y;
|
StaggerConfig stagger_y;
|
||||||
|
|
||||||
|
@ -365,6 +367,7 @@ void serialize(Stream& str, ScanSession& x)
|
||||||
serialize(str, x.color_shift_lines_r);
|
serialize(str, x.color_shift_lines_r);
|
||||||
serialize(str, x.color_shift_lines_g);
|
serialize(str, x.color_shift_lines_g);
|
||||||
serialize(str, x.color_shift_lines_b);
|
serialize(str, x.color_shift_lines_b);
|
||||||
|
serialize(str, x.stagger_x);
|
||||||
serialize(str, x.stagger_y);
|
serialize(str, x.stagger_y);
|
||||||
serialize(str, x.segment_count);
|
serialize(str, x.segment_count);
|
||||||
serialize(str, x.pixel_startx);
|
serialize(str, x.pixel_startx);
|
||||||
|
|
Ładowanie…
Reference in New Issue