canon_dr backend v52

add must_downsample and must_fully_buffer
merge-requests/1/head
m. allan noah 2015-11-04 13:49:02 -05:00
rodzic 01063a769d
commit 9dc7924529
2 zmienionych plików z 38 dodań i 4 usunięć

Wyświetl plik

@ -319,6 +319,7 @@
v52 2015-11-03, MAN
- set can_color=1 by default (recent models dont have 'C' in name)
- enable jpeg for DR-6080
- add must_downsample and must_fully_buffer
SANE FLOW DIAGRAM
@ -2241,7 +2242,7 @@ sane_get_option_descriptor (SANE_Handle handle, SANE_Int option)
if (i > 1){
opt->cap = SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT;
if (s->u.mode != MODE_COLOR && s->u.mode != MODE_GRAYSCALE){
if ( must_downsample(s) || s->s.mode < MODE_GRAYSCALE ){
opt->cap |= SANE_CAP_INACTIVE;
}
}
@ -4140,9 +4141,7 @@ sane_start (SANE_Handle handle)
* tell the user the size of the image. the sane
* API has no way to inform the frontend of this,
* so we block and buffer. yuck */
if( (s->swdeskew || s->swdespeck || s->swcrop)
&& s->s.format != SANE_FRAME_JPEG
){
if(must_fully_buffer(s)){
/* get image */
while(!s->s.eof[s->side] && !ret){
@ -5290,6 +5289,7 @@ copy_line(struct scanner *s, unsigned char * buff, int side)
switch (s->s.mode) {
case MODE_COLOR:
/*FIXME: add dropout color support for downsample*/
memcpy(line, buff, sbwidth);
break;
@ -8573,6 +8573,37 @@ rotateOnCenter (struct scanner *s, int side,
return 0;
}
/* certain options require the entire image to
* be collected from the scanner before we can
* tell the user the size of the image. */
static int
must_fully_buffer(struct scanner *s)
{
if(
(s->swdeskew || s->swdespeck || s->swcrop)
&& s->s.format != SANE_FRAME_JPEG
){
return 1;
}
return 0;
}
/* certain scanners require the mode of the
* image to be changed in software. */
static int
must_downsample(struct scanner *s)
{
if(s->s.mode != s->i.mode
&& s->compress != COMP_JPEG
){
return 1;
}
return 0;
}
/* Function to build a lookup table (LUT), often
used by scanners to implement brightness/contrast/gamma
or by backends to speed binarization/thresholding

Wyświetl plik

@ -564,6 +564,9 @@ static SANE_Status copy_simplex(struct scanner *s, unsigned char * buf, int len,
static SANE_Status copy_duplex(struct scanner *s, unsigned char * buf, int len);
static SANE_Status copy_line(struct scanner *s, unsigned char * buf, int side);
static int must_downsample (struct scanner *s);
static int must_fully_buffer (struct scanner *s);
static SANE_Status buffer_despeck(struct scanner *s, int side);
static SANE_Status buffer_deskew(struct scanner *s, int side);
static SANE_Status buffer_crop(struct scanner *s, int side);