From 58912f68c2489bcee787599837447e0d64dfd61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 24 May 2017 21:03:56 +0200 Subject: New upstream version 1.0.27 --- sanei/sanei_magic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sanei/sanei_magic.c') diff --git a/sanei/sanei_magic.c b/sanei/sanei_magic.c index 167d7dd..bfd56cc 100644 --- a/sanei/sanei_magic.c +++ b/sanei/sanei_magic.c @@ -710,7 +710,7 @@ sanei_magic_rotate (SANE_Parameters * params, SANE_Byte * buffer, DBG(10,"sanei_magic_rotate: finish\n"); - return 0; + return ret; } SANE_Status -- cgit v1.2.3 From 1687222e1b9e74c89cafbb5910e72d8ec7bfd40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 31 Jul 2019 16:59:49 +0200 Subject: New upstream version 1.0.28 --- sanei/sanei_magic.c | 103 ++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 52 deletions(-) (limited to 'sanei/sanei_magic.c') diff --git a/sanei/sanei_magic.c b/sanei/sanei_magic.c index bfd56cc..3e71946 100644 --- a/sanei/sanei_magic.c +++ b/sanei/sanei_magic.c @@ -123,17 +123,17 @@ sanei_magic_despeck (SANE_Parameters * params, SANE_Byte * buffer, /* convert darkest pixel into a brighter threshold */ thresh = (thresh + 255*3 + 255*3)/3; - + /*loop over rows and columns around window */ for(k=-1; kformat == SANE_FRAME_GRAY && params->depth == 1){ for(i=bw; i> (7-(j+l)%8) & 1; if(hits) @@ -631,7 +631,7 @@ sanei_magic_rotate (SANE_Parameters * params, SANE_Byte * buffer, goto cleanup; } - if(params->format == SANE_FRAME_RGB || + if(params->format == SANE_FRAME_RGB || (params->format == SANE_FRAME_GRAY && params->depth == 8) ){ @@ -642,19 +642,19 @@ sanei_magic_rotate (SANE_Parameters * params, SANE_Byte * buffer, for (i=0; i= pwidth) continue; - + sourceY = centerY + (int)(-shiftY * slopeCos + shiftX * slopeSin); if (sourceY < 0 || sourceY >= height) continue; - + for (k=0; k= pwidth) continue; - + sourceY = centerY + (int)(-shiftY * slopeCos + shiftX * slopeSin); if (sourceY < 0 || sourceY >= height) continue; @@ -689,7 +689,7 @@ sanei_magic_rotate (SANE_Parameters * params, SANE_Byte * buffer, outbuf[i*bwidth + j/8] &= ~(1 << (7-(j%8))); /* fill in new bit */ - outbuf[i*bwidth + j/8] |= + outbuf[i*bwidth + j/8] |= ((buffer[sourceY*bwidth + sourceX/8] >> (7-(sourceX%8))) & 1) << (7-(j%8)); } @@ -726,7 +726,7 @@ sanei_magic_isBlank (SANE_Parameters * params, SANE_Byte * buffer, /*convert thresh from percent (0-100) to 0-1 range*/ thresh /= 100; - if(params->format == SANE_FRAME_RGB || + if(params->format == SANE_FRAME_RGB || (params->format == SANE_FRAME_GRAY && params->depth == 8) ){ @@ -783,7 +783,7 @@ sanei_magic_isBlank (SANE_Parameters * params, SANE_Byte * buffer, /* Divide the image into 1/2 inch squares, skipping a 1/4 inch * margin on all sides. If all squares are under the user's density, - * signal our caller to skip the image entirely, by returning + * signal our caller to skip the image entirely, by returning * SANE_STATUS_NO_DOCS */ SANE_Status sanei_magic_isBlank2 (SANE_Parameters * params, SANE_Byte * buffer, @@ -813,12 +813,12 @@ sanei_magic_isBlank2 (SANE_Parameters * params, SANE_Byte * buffer, for(yb=0; ybbytes_per_line + (xquarter + xb*xhalf) * Bpp; @@ -826,7 +826,7 @@ sanei_magic_isBlank2 (SANE_Parameters * params, SANE_Byte * buffer, /*count darkness of pix in this row*/ int rowsum = 0; - + for(x=0; xbytes_per_line + (xquarter + xb*xhalf) / 8; @@ -860,7 +860,7 @@ sanei_magic_isBlank2 (SANE_Parameters * params, SANE_Byte * buffer, /*count darkness of pix in this row*/ int rowsum = 0; - + for(x=0; x> (7-(x%8)) & 1; } @@ -898,7 +898,7 @@ sanei_magic_findTurn(SANE_Parameters * params, SANE_Byte * buffer, DBG(10,"sanei_magic_findTurn: start\n"); - if(params->format == SANE_FRAME_RGB || + if(params->format == SANE_FRAME_RGB || (params->format == SANE_FRAME_GRAY && params->depth == 8) ){ @@ -1125,7 +1125,7 @@ sanei_magic_turn(SANE_Parameters * params, SANE_Byte * buffer, } /*turn color & gray image*/ - if(params->format == SANE_FRAME_RGB || + if(params->format == SANE_FRAME_RGB || (params->format == SANE_FRAME_GRAY && params->depth == 8) ){ @@ -1282,7 +1282,7 @@ getTopEdge(int width, int height, int resolution, double topSlope = 0; int topOffset = 0; int topDensity = 0; - + int i,j; int pass = 0; @@ -1436,7 +1436,7 @@ getLine (int height, int width, int * buff, /* find central value of this 'bucket' */ slopeCenter[j] = ( - (double)j*(maxSlope-minSlope)/slopes+minSlope + (double)j*(maxSlope-minSlope)/slopes+minSlope + (double)(j+1)*(maxSlope-minSlope)/slopes+minSlope )/2; @@ -1525,7 +1525,7 @@ getLine (int height, int width, int * buff, maxDensity = lines[i][j]; } } - + DBG(15,"getLine: maxDensity %d\n",maxDensity); *finSlope = 0; @@ -1544,20 +1544,20 @@ getLine (int height, int width, int * buff, } } } - + if(0){ fprintf(stderr,"offsetCenter: "); for(j=0;j -1){ int byi = bot[i] - (slope * i); @@ -1677,7 +1677,7 @@ getLeftEdge (int width, int height, int * top, int * bot, /* Loop thru the image and look for first color change in each column. * Return a malloc'd array. Caller is responsible for freeing. */ -int * +int * sanei_magic_getTransY ( SANE_Parameters * params, int dpi, SANE_Byte * buffer, int top) { @@ -1715,7 +1715,7 @@ sanei_magic_getTransY ( /* load the buff array with y value for first color change from edge * gray/color uses a different algo from binary/halftone */ - if(params->format == SANE_FRAME_RGB || + if(params->format == SANE_FRAME_RGB || (params->format == SANE_FRAME_GRAY && params->depth == 8) ){ @@ -1734,10 +1734,10 @@ sanei_magic_getTransY ( } near *= winLen; far = near; - + /* move windows, check delta */ for(j=firstLine+direction; j!=lastLine; j+=direction){ - + int farLine = j-winLen*2*direction; int nearLine = j-winLen*direction; @@ -1770,10 +1770,10 @@ sanei_magic_getTransY ( int near = 0; for(i=0; i> (7-(i%8)) & 1; - + /* move */ for(j=firstLine+direction; j!=lastLine; j+=direction){ if((buffer[(j*width+i)/8] >> (7-(i%8)) & 1) != near){ @@ -1809,7 +1809,7 @@ sanei_magic_getTransY ( /* Loop thru the image height and look for first color change in each row. * Return a malloc'd array. Caller is responsible for freeing. */ -int * +int * sanei_magic_getTransX ( SANE_Parameters * params, int dpi, SANE_Byte * buffer, int left) { @@ -1848,7 +1848,7 @@ sanei_magic_getTransX ( /* load the buff array with x value for first color change from edge * gray/color uses a different algo from binary/halftone */ - if(params->format == SANE_FRAME_RGB || + if(params->format == SANE_FRAME_RGB || (params->format == SANE_FRAME_GRAY && params->depth == 8) ){ @@ -1867,10 +1867,10 @@ sanei_magic_getTransX ( } near *= winLen; far = near; - + /* move windows, check delta */ for(j=firstCol+direction; j!=lastCol; j+=direction){ - + int farCol = j-winLen*2*direction; int nearCol = j-winLen*direction; @@ -1888,7 +1888,7 @@ sanei_magic_getTransX ( near -= buffer[i*bwidth + nearCol*depth + k]; near += buffer[i*bwidth + j*depth + k]; } - + if(abs(near - far) > 50*winLen*depth - near*40/255){ buff[i] = j; break; @@ -1902,10 +1902,10 @@ sanei_magic_getTransX ( int near = 0; for(i=0; i> (7-(firstCol%8)) & 1; - + /* move */ for(j=firstCol+direction; j!=lastCol; j+=direction){ if((buffer[i*bwidth + j/8] >> (7-(j%8)) & 1) != near){ @@ -1938,4 +1938,3 @@ sanei_magic_getTransX ( return buff; } - -- cgit v1.2.3