Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Formentar
iscan
level_D_16_bit.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File level_D_16_bit.patch of Package iscan
*** backend/epkowa.c.orig 2008-05-18 21:12:02.000000000 +0100 --- backend/epkowa.c 2008-05-18 21:12:14.000000000 +0100 *************** *** 1513,1516 **** --- 1513,1518 ---- static void color_correct (SANE_Byte * data, SANE_Int size, double *profile); + static void color_correct_16 (SANE_Byte * data, SANE_Int size, + double *profile); static void handle_mode (Epson_Scanner * s, SANE_Int optindex, *************** *** 4912,4952 **** { SANE_Int i, width; ! SANE_Byte *r_buf, *g_buf, *b_buf; double red, grn, blu; width = size / 3; ! ! for (i = 0; i < size / 3; i++) { ! r_buf = data; ! g_buf = data + 1; ! b_buf = data + 2; ! ! red = ! profile[0] * (*r_buf) + profile[1] * (*g_buf) + profile[2] * (*b_buf); ! grn = ! profile[3] * (*r_buf) + profile[4] * (*g_buf) + profile[5] * (*b_buf); ! blu = ! profile[6] * (*r_buf) + profile[7] * (*g_buf) + profile[8] * (*b_buf); ! ! if (255. < red) ! red = 255.; ! if (0 > red) ! red = 0.; ! if (255. < grn) ! grn = 255.; ! if (0 > grn) ! grn = 0.; ! if (255. < blu) ! blu = 255.; ! if (0 > blu) ! blu = 0.; ! ! *data++ = (unsigned char) (red); ! *data++ = (unsigned char) (grn); ! *data++ = (unsigned char) (blu); } } static void handle_depth_halftone (Epson_Scanner * s, SANE_Int optindex, --- 4914,4971 ---- { SANE_Int i, width; ! SANE_Byte r, g, b; double red, grn, blu; + DBG (5, "color_correct: begin\n"); width = size / 3; ! for (i = 0; i < width; i++) { ! r = data[0]; ! g = data[1]; ! b = data[2]; ! ! red = profile[0] * r + profile[1] * g + profile[2] * b; ! grn = profile[3] * r + profile[4] * g + profile[5] * b; ! blu = profile[6] * r + profile[7] * g + profile[8] * b; ! ! *data++ = red < 0 ? 0 : (red > 255 ? 255 : (unsigned char) red); ! *data++ = grn < 0 ? 0 : (grn > 255 ? 255 : (unsigned char) grn); ! *data++ = blu < 0 ? 0 : (blu > 255 ? 255 : (unsigned char) blu); ! } ! } ! ! static void ! color_correct_16 (SANE_Byte * data, SANE_Int size, double *profile) ! /* Performs the linear transformation of color space for data with ! * 16 bits per gun, under the assumption of little endian data. */ ! { ! SANE_Int i, j, width; ! int r, g, b, c; ! double *profilerow; ! ! DBG (5, "color_correct_16: begin\n"); ! width = size / 6; ! for (i = 0; i < width; i++) ! { ! r = data[1] << 8 | data[0]; ! g = data[3] << 8 | data[2]; ! b = data[5] << 8 | data[4]; ! ! profilerow = profile; ! for (j = 0; j < 3; j++, profilerow += 3) ! { ! /* The new value cannot possibly be outside the range of an int */ ! c = (int) (profilerow[0] * r + profilerow[1] * g + profilerow[2] * b); ! if (c < 0) ! c = 0; ! else if (c > 0xffff) ! c = 0xffff; ! *data++ = c & 0xff; ! *data++ = c >> 8; ! } } } + static void handle_depth_halftone (Epson_Scanner * s, SANE_Int optindex, *************** *** 7034,7038 **** cct[8] = SANE_UNFIX (s->val[OPT_CCT_9].w); ! color_correct (s->ptr, s->end - s->ptr, cct); } --- 7053,7060 ---- cct[8] = SANE_UNFIX (s->val[OPT_CCT_9].w); ! if (s->params.depth > 8) ! color_correct_16 (s->ptr, s->end - s->ptr, cct); ! else ! color_correct (s->ptr, s->end - s->ptr, cct); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor