genesys: Remove low-level support for 1-bit depth scans

merge-requests/212/head
Povilas Kanapickas 2019-10-01 18:11:52 +03:00
rodzic 0180c4c5d8
commit eb2f836481
11 zmienionych plików z 12 dodań i 57 usunięć

Wyświetl plik

@ -47,15 +47,6 @@
#include "conv.h"
#include "sane/sanei_magic.h"
void genesys_reverse_bits(uint8_t* src_data, uint8_t* dst_data, size_t bytes)
{
DBG_HELPER(dbg);
size_t i;
for(i = 0; i < bytes; i++) {
*dst_data++ = ~ *src_data++;
}
}
/**
* uses the threshold/threshold_curve to control software binarization
* This code was taken from the epjistsu backend by m. allan noah

Wyświetl plik

@ -48,8 +48,6 @@
#include "sensor.h"
#include "genesys.h"
void genesys_reverse_bits(uint8_t* src_data, uint8_t* dst_data, size_t bytes);
void binarize_line(Genesys_Device* dev, std::uint8_t* src, std::uint8_t* dst, int width);
void genesys_gray_lineart(Genesys_Device* dev,

Wyświetl plik

@ -3321,15 +3321,8 @@ Problems with the first approach:
bytes = *len;
work_buffer_src = src_buffer->get_read_pos();
if (dev->session.pipeline_needs_reverse) {
genesys_reverse_bits(work_buffer_src, destination, bytes);
*len = bytes;
}
else
{
memcpy (destination, work_buffer_src, bytes);
*len = bytes;
}
std::memcpy(destination, work_buffer_src, bytes);
*len = bytes;
/* avoid signaling some extra data because we have treated a full block
* on the last block */

Wyświetl plik

@ -802,12 +802,7 @@ static void gl124_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
/* monochrome / color scan */
r = sanei_genesys_get_address (reg, REG04);
switch (session.params.depth)
{
case 1:
r->value &= ~REG04_BITSET;
r->value |= REG04_LINEART;
break;
switch (session.params.depth) {
case 8:
r->value &= ~(REG04_LINEART | REG04_BITSET);
break;

Wyświetl plik

@ -404,10 +404,6 @@ static void gl646_setup_registers(Genesys_Device* dev,
/* R04 */
/* monochrome / color scan */
switch (session.params.depth) {
case 1:
regs->find_reg(0x04).value &= ~REG04_BITSET;
regs->find_reg(0x04).value |= REG04_LINEART;
break;
case 8:
regs->find_reg(0x04).value &= ~(REG04_LINEART | REG04_BITSET);
break;

Wyświetl plik

@ -1442,10 +1442,6 @@ static void gl841_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
/* monochrome / color scan */
r = sanei_genesys_get_address (reg, 0x04);
switch (session.params.depth) {
case 1:
r->value &= ~REG04_BITSET;
r->value |= REG04_LINEART;
break;
case 8:
r->value &= ~(REG04_LINEART | REG04_BITSET);
break;

Wyświetl plik

@ -1123,12 +1123,7 @@ static void gl843_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
/* monochrome / color scan */
r = sanei_genesys_get_address (reg, REG04);
switch (session.params.depth)
{
case 1:
r->value &= ~REG04_BITSET;
r->value |= REG04_LINEART;
break;
switch (session.params.depth) {
case 8:
r->value &= ~(REG04_LINEART | REG04_BITSET);
break;

Wyświetl plik

@ -668,12 +668,7 @@ static void gl846_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
/* monochrome / color scan */
r = sanei_genesys_get_address (reg, REG04);
switch (session.params.depth)
{
case 1:
r->value &= ~REG04_BITSET;
r->value |= REG04_LINEART;
break;
switch (session.params.depth) {
case 8:
r->value &= ~(REG04_LINEART | REG04_BITSET);
break;

Wyświetl plik

@ -678,12 +678,7 @@ static void gl847_init_optical_regs_scan(Genesys_Device* dev, const Genesys_Sens
/* monochrome / color scan */
r = sanei_genesys_get_address (reg, REG04);
switch (session.params.depth)
{
case 1:
r->value &= ~REG04_BITSET;
r->value |= REG04_LINEART;
break;
switch (session.params.depth) {
case 8:
r->value &= ~(REG04_LINEART | REG04_BITSET);
break;

Wyświetl plik

@ -1330,7 +1330,6 @@ void compute_session_pipeline(const Genesys_Device* dev, ScanSession& s)
}
s.pipeline_needs_ccd = s.max_color_shift_lines + s.num_staggered_lines > 0;
s.pipeline_needs_shrink = dev->settings.requested_pixels != s.output_pixels;
s.pipeline_needs_reverse = depth == 1;
}
void compute_session_pixel_offsets(const Genesys_Device* dev, ScanSession& s,
@ -1447,6 +1446,10 @@ void compute_session(Genesys_Device* dev, ScanSession& s, const Genesys_Sensor&
(void) dev;
s.params.assert_valid();
if (s.params.depth != 8 && s.params.depth != 16) {
throw SaneException("Unsupported depth setting %d", s.params.depth);
}
unsigned ccd_pixels_per_system_pixel = sensor.ccd_pixels_per_system_pixel();
// compute optical and output resolutions
@ -2558,11 +2561,10 @@ void debug_dump(unsigned level, const ScanSession& session)
DBG(level, " buffer_size_read : %zu\n", session.buffer_size_lines);
DBG(level, " buffer_size_shrink : %zu\n", session.buffer_size_shrink);
DBG(level, " buffer_size_out : %zu\n", session.buffer_size_out);
DBG(level, " filters:%s%s%s%s\n",
DBG(level, " filters:%s%s%s\n",
session.pipeline_needs_reorder ? " reorder" : "",
session.pipeline_needs_ccd ? " ccd" : "",
session.pipeline_needs_shrink ? " shrink" : "",
session.pipeline_needs_reverse ? " reverse" : "");
session.pipeline_needs_shrink ? " shrink" : "");
debug_dump(level, session.params);
}

Wyświetl plik

@ -296,7 +296,6 @@ struct ScanSession {
bool pipeline_needs_reorder = false;
bool pipeline_needs_ccd = false;
bool pipeline_needs_shrink = false;
bool pipeline_needs_reverse = false;
void assert_computed() const
{