Skip to main content

JPEG native codec

3 replies [Last post]
simboss1
Offline
Joined: 2005-08-08

Hi list,
I am using the native JPEG writer to write out images in a j2ee application (hence I am working in a multithreaded environment).

I noticed that, using the native codec, sometimes, randmoly, colors get messed up. Therefore the question is, is the native jpeg codec thread safe?

Thx,
Simone.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
James Cheng

Hi Simone,

> I noticed that, using the native codec, sometimes, randmoly, colors get
> messed up. Therefore the question is, is the native jpeg codec thread safe?

It's supposed to be thread safe as Brian mentioned. But it's possible that
a native library was built improperly so it is not thread safe. If you are
running on Windows, please make sure to use the latest 1.1 release from:

https://jai-imageio.dev.java.net/binary-builds.html

The .dll's in previous builds were built with /MD instead of /MT.

If you do see a problem with the 1.1 release, please file an issue at:

https://jai-imageio-core.dev.java.net/issues/reports.cgi

with a self-contained test case. We'll investigate it accordingly.

Thanks,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Simone Giannecchini

Well, I am using a separate writer on each thread so I am not doing
anything that should considered harmful for the writer contract.

I tweaked the code so that I avoid using the native codec and
everything seems to work just fine.

I will try to provide an isolated test case but it is not going to be
an easy task.

Simone.

On 11/7/06, James Cheng wrote:
> Hi Simone,
>
> > I noticed that, using the native codec, sometimes, randmoly, colors get
> > messed up. Therefore the question is, is the native jpeg codec thread safe?
>
> It's supposed to be thread safe as Brian mentioned. But it's possible that
> a native library was built improperly so it is not thread safe. If you are
> running on Windows, please make sure to use the latest 1.1 release from:
>
> https://jai-imageio.dev.java.net/binary-builds.html
>
> The .dll's in previous builds were built with /MD instead of /MT.
>
> If you do see a problem with the 1.1 release, please file an issue at:
>
> https://jai-imageio-core.dev.java.net/issues/reports.cgi
>
> with a self-contained test case. We'll investigate it accordingly.
>
> Thanks,
> -James
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

--
-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions

http://www.geo-solutions.it

-------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

Brian Burkhalter

As to thread safety please note:

"A particular instance of an ImageReader or ImageWriter is not required to
support re-entrant (simultaneous) calls to its methods (with the exception of
the abort method that requests current read or writes to halt). However, it
must be possible for multiple instances of the same plug-in class to operate
simultaneously."

http://java.sun.com/javase/6/docs/technotes/guides/imageio/spec/goals.fm...

That said, unless you've proven that the random color problem is due to
threading issues that does not explain your problem.

Brian

On Tue, 7 Nov 2006, jai-imageio@javadesktop.org wrote:

> Hi list,
> I am using the native JPEG writer to write out images in a j2ee application (hence I am working in a multithreaded environment).
>
> I noticed that, using the native codec, sometimes, randmoly, colors get messed up. Therefore the question is, is the native jpeg codec thread safe?
>
>
> Thx,
> Simone.
> [Message sent by forum member 'simboss1' (simboss1)]
>
> http://forums.java.net/jive/thread.jspa?messageID=171326
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net