Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#80 closed defect (fixed)

Lucide exits when opening jpg file 32bit color

Reported by: guest Owned by: eros2
Priority: major Milestone:
Component: Lucide Core Version: 1.0 Beta 3
Keywords: Cc:

Description

I have tried both jpeg plugin and gbm and the effect is the same, lucide quits on loading the file.

I know that in gbm 32 bit jpeg files are not supported, but the should be some message.

Here is the trap from popuplog:

08-31-2006 09:29:04 SYS3175 PID 007f TID 0003 Slot 00c3 W:\PROGRAMS\LUCIDE\LUCIDE.EXE c0000005 1d7fc0cf P1=00000001 P2=00000012 P3=XXXXXXXX P4=XXXXXXXX EAX=00000000 EBX=0000000a ECX=00000012 EDX=00000012 ESI=ffffffff EDI=028b1e2c DS=0053 DSACC=f0f3 DSLIM=ffffffff ES=0053 ESACC=f0f3 ESLIM=ffffffff FS=150b FSACC=00f3 FSLIM=00000030 GS=0000 GSACC= GSLIM= CS:EIP=005b:1d7fc0cf CSACC=f0df CSLIM=ffffffff SS:ESP=0053:028b1d3c SSACC=f0f3 SSLIM=ffffffff EBP=00000012 FLG=00012286

LUGBM.DLL 0001:0000c0cf

jpeg plugin does not produce any entry in popuplog.

Attachments (1)

polje2a.jpg (13.0 KB) - added by guest 13 years ago.
I have downsized the image and it produce the same effect

Download all attachments as: .zip

Change History (16)

comment:1 Changed 13 years ago by eros2

Please, attach a sample jpg file that shows the problem.

Changed 13 years ago by guest

I have downsized the image and it produce the same effect

comment:2 Changed 13 years ago by Heiko

How did you create this?

32bit JPGs were not part of the standards as far as I know. There is an alpha patch for the IJG library 6b but until this has settled, I'll not put it into GBM.

Still, you're right, the plugin should not crash. Interesting thing is that not gbm.dll generates the error but the plugin itself. I'll have a look at it.

Heiko

comment:3 Changed 13 years ago by Marko Udvanc

I have received it, my guess is that somebody with some win program created it(PhotoShop?,...)

comment:4 Changed 13 years ago by Heiko

I have put a patched lugbm.dll 1.21 on my GBM homepage. Have a look at the download page under temporary patches.

This update is recommended to everyone. The crash happened if the user tried to open an unsupported or illegally encoded bitmap file. So it is not only related to your JPG, which btw will still not load ;) .

Heiko

comment:5 Changed 13 years ago by Marko Udvanc

I have tried the patch, now it reports an error with my images, as it should.

comment:6 Changed 13 years ago by eros2

I tried your file with lucide's jpeg plugin and it displays file without problem.

comment:7 Changed 13 years ago by Heiko

Are you sure you tried the right file?

I tried it as well with lujpeg.dll but Lucide simply closes without any entry in popuplog.os2. I attached the IBM VAC++ debugger to Lucide and there is no error. Lucide just ends normally.

IJG calls a registered longjmp function in case of an error, which of course needs to be registered via setjmp().

I grabbed a bit deeper into IJG lib. lujpeg.cpp uses the default error_exit handler "cinfo.err = jpeg_std_error( &jerr );" which does the following (see jerror:70):

METHODDEF(void) error_exit(j_common_ptr cinfo) {

/* Always display the message */ (*cinfo->err->output_message) (cinfo);

/* Let the memory manager delete any temp files before we die */ jpeg_destroy(cinfo);

exit(EXIT_FAILURE);

}

Now it's clear why Lucide simply closes normally, right?

Let's see how GBM handles the errors. Have a look at the file gbmjpg.c in the GBM source package:

dinfo.err->error_exit = my_error_exit; if ( (jrc = setjmp(err.setjmp_buffer)) != 0 ) {

/* If we get here, the JPEG code has signaled an error.

  • We need to clean up the JPEG object and return. */

jpeg_destroy_decompress(&dinfo); return jrc;

}

Hope that helps fixing lujpeg.cpp.

Heiko

comment:8 Changed 13 years ago by eros2

Well, error handler should be replaced...

But for me lucide with my lujpeg plugin shows polje2a.jpg without problem! Where I may found such jpegs to test more?

comment:9 Changed 13 years ago by Heiko

@eros2 Damn, you're right.

I had again a look at the downloaded file I tried. It was the HTML file behind the link above. Who the hell creates a link to a jpg that actually is a html file?

With the real jpg I also see no issues, not with lujpeg.dll nor lugbm.dll. The image renders fine with both.

@Marko Can you attach the original image? I guess due to the downsizing a different jpg file type has been created by Photoshop CS2 (that's what the EXIF info says).

Heiko

comment:10 Changed 13 years ago by eros2

  • Resolution set to fixed
  • Status changed from new to closed

(In [117]) Added custom libjpeg error handler into ljjpeg plugin (closes #80)

comment:11 Changed 13 years ago by Marko Udvanc

@Heiko

I would attach the full size image, but trac the file size limit is around 250kb and the image is 1Mb, I can send it to you by email.

comment:12 Changed 13 years ago by Heiko

Due to the size contraints for attachments, Marko sent me the image by mail. I have put it on my website. Get it via the following link:

http://heikon.home.tlink.de/test/polje2.jpg

I will keep it for this week.

I had a quick look at it. It's a CMYK-JPEG. There the 32bit come from. This will not load with most apps, also SeaMonkey? doesn't like it. If I have some time, I'll look into GBM again if I can add some rudimentory support for CMYK colorspace. There is already something like this for TIFF. But this depends on the capabilities of the IJG lib.

Heiko

comment:13 Changed 13 years ago by eros2

Heiko,

Is there exist some patch for IJG libjpeg to support this image? PMView can display it, btw...

comment:14 Changed 13 years ago by Heiko

I'm looking into this. If there is a way it is not done with a few lines of code. IJG does not support YCCK or CMYK to RGB color space conversions.

I tried yesterday to do it manually although this is very inaccurate. CMYKL cannot be exactly mapped to RGB color space. Usually you need a color management system for this. There is lcms but integrating this opens pandora's box. It would be a nightmare to deal with the color profiles in terms of user experience.

So far I haven't figured out in what data encoding the CMYK data is returned by IJG. IJG supports the color space conversion from YCCK (some Adobe special color space this image is encoded) to CMYK. Documentation is very rare about this. At least the data format doesn't seem to be CMYK (as for RGB, or BGR with the RGB index hack). I'll try decoding as multiple planes sequentially ordered.

Heiko

comment:15 Changed 13 years ago by Heiko

Good news :) . I found the right way.

All JPEGs 8bpp (gray) and 24bpp (RGB, YUV, YCCK, CMYK) can now be read (also the attached JPEG). Don't expect too much for YCCK and CMYK conversion as the algorithm is simple but it should give reasonable results for most images.

I'll make this available with the next GBM release. Then also 8bpp (gray) JPEGs can be written. At the moment GBM is work in progress, half within development of XPM2 codec. So it might take some time until the next release will be available. Stay tuned...

Heiko

Note: See TracTickets for help on using tickets.