Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.1:Update
xzgv
xzgv-cmyk-ycc-fix.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xzgv-cmyk-ycc-fix.diff of Package xzgv
diff -Nur ../xzgv-0.8.dist/src/readjpeg.c ./src/readjpeg.c --- ../xzgv-0.8.dist/src/readjpeg.c 2006-03-27 23:30:07.000000000 +0200 +++ ./src/readjpeg.c 2006-03-27 23:54:41.000000000 +0200 @@ -178,11 +178,13 @@ static int have_image; static int width,height; static unsigned char *image; +static int cmyk; unsigned char *ptr,*ptr2; int chkw,chkh; int f,rec; static int greyscale; /* static to satisfy gcc -Wall */ +cmyk=0; greyscale=0; lineptrs=NULL; @@ -224,6 +226,15 @@ greyscale=1; } +if(cinfo.jpeg_color_space==JCS_CMYK) + cmyk=1; + +if(cinfo.jpeg_color_space==JCS_YCCK) + { + cmyk=1; + cinfo.out_color_space=JCS_CMYK; + } + *wp=width=cinfo.image_width; *hp=height=cinfo.image_height; @@ -267,10 +278,10 @@ if ((width <= 0) || (height <=0 ) || (width > (SIZE_T_MAX/height)) || - ((width * height) > SIZE_T_MAX/3)) + ((width * (height+cmyk)) > SIZE_T_MAX/3)) longjmp(jerr.setjmp_buffer,1); -if((*imagep=image=malloc(width*height*3))==NULL) +if((*imagep=image=malloc(width*(height+cmyk)*3))==NULL) longjmp(jerr.setjmp_buffer,1); jpeg_start_decompress(&cinfo); @@ -287,12 +298,33 @@ for(f=0;f<height;f++,ptr+=width*3) lineptrs[f]=ptr; -rec=cinfo.rec_outbuf_height; -while(cinfo.output_scanline<height) +if(!cmyk) { - f=height-cinfo.output_scanline; - jpeg_read_scanlines(&cinfo,lineptrs+cinfo.output_scanline, - f>rec?rec:f); + rec=cinfo.rec_outbuf_height; + while(cinfo.output_scanline<height) + { + f=height-cinfo.output_scanline; + jpeg_read_scanlines(&cinfo,lineptrs+cinfo.output_scanline, + f>rec?rec:f); + } + } +else /* cmyk output */ + { + int tmp; + + ptr=image; + while(cinfo.output_scanline<height) + { + jpeg_read_scanlines(&cinfo,&ptr,1); + ptr2=ptr; + for(f=0;f<width;f++,ptr+=3,ptr2+=4) + { + tmp=ptr2[3]; + ptr[0]=(tmp*ptr2[0])/255; + ptr[1]=(tmp*ptr2[1])/255; + ptr[2]=(tmp*ptr2[2])/255; + } + } } free(lineptrs);
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