Code Comments
Programming Forum and web based access to our favorite programming groups.Hi there, I'm just newbie on this, and probably things aren`t as easy as it seemed to be, but I would like to know HOW can us assure that some compression process made is actually a lossless process in the JPEG images in the hole sense of the words. Thats is, is just a "visually lossless" result as someone has told to me, and, in that case, how can someone assure that any image has no visual lost. Or there is really "mathematically lossless" results and then the original image and the compressed&decompressed one should be identical bit-to-bit. Thats really important for me 'cause I need to check if my compression results are really in a lossless manner. Thanks for advanced, and sorry for the annoyances. see ya, Carmelo
Post Follow-up to this messageHi,
> I'm just newbie on this, and probably things aren`t as easy as it
> seemed to be, but I would like to know HOW can us assure that some
> compression process made is actually a lossless process in the JPEG
> images in the hole sense of the words. Thats is, is just a "visually
> lossless" result as someone has told to me, and, in that case, how can
> someone assure that any image has no visual lost. Or there is really
> "mathematically lossless" results and then the original image and the
> compressed&decompressed one should be identical bit-to-bit. Thats
> really important for me 'cause I need to check if my compression
> results are really in a lossless manner.
"Visually lossless" is possibly a slang invented by marketing
directors. Otherwise, you need to specify the loss quantitatively,
i.e. measure it.
Concerning a suitable measure, here's the simplest possible:
Compute the sum of the square error between the original image and
the compressed/recompressed as this:
MSE = \sum_{x,y \in image} (original(x,y) - reconstructed(x,y))^2
Then normalize by the size of the image to get the average error per
pixel, and normalize again by the dynamical range of the image, i.e.
255^2 for an 8bpp image:
mse = MSE / (width * height * 255^2)
Ten times the logarithm of the inverse of this is called the "PSNR"
(Peak signal to noise ratio) and the simplest, but widely accepted
noise/quality measure:
PSNR = 10 * log_10 1/mse
Two kinds of image compressions are available, lossy and lossless. Lossy
introduces errors but tries to minimize the visual error (e.g. by trying
to minimise the PSNR and ignoring that the two things differ), lossless
does not introduce *any* error, i.e. the PSNR is infinite = mse is zero =
mathematical precise reconstruction. There are also lossless image
compression methods (PNG, JPEG-LS) similar to lossy ones (JPEG,JPEG2000).
So long,
Thomas
Post Follow-up to this message"Carmelo" <carmelo8888@yahoo.com> wrote in message news:78636542.0409100559.58fbc05d@posting.google.com... > Hi there, > > I'm just newbie on this, and probably things aren`t as easy as it > seemed to be, but I would like to know HOW can us assure that some > compression process made is actually a lossless process in the JPEG > images in the hole sense of the words. Thats is, is just a "visually > lossless" result as someone has told to me, and, in that case, how can > someone assure that any image has no visual lost. Or there is really > "mathematically lossless" results and then the original image and the > compressed&decompressed one should be identical bit-to-bit. Thats > really important for me 'cause I need to check if my compression > results are really in a lossless manner. > > Thanks for advanced, and sorry for the annoyances. > lossy jpeg is intended to be "visually lossless", but is still lossy in the mathematical sense. lossless jpeg would be mathematically lossless, otherwise it couldn't be called lossless (even if only rarely does a value not match exactly, it would still be lossy, eg since mismatch is still a possibility). however, someone who knows more would likely be a better authority on this.
Post Follow-up to this messageThere is a special lossless mode in the original JPEG definition, although it is not very widely in use, and it is also patented. This lossless method looks a bit like wavelets already since it stores plane gradients first and then encodes the differences to these (IIRC). Kind regards, Nils Haeck PS JPeg2000 has a lossless mode as well. "cr88192" <cr88192@remove.hotmail.com> wrote in message news:GLi0d.1231$qT2.792@news.flashnewsgroups.com... > > "Carmelo" <carmelo8888@yahoo.com> wrote in message > news:78636542.0409100559.58fbc05d@posting.google.com... > lossy jpeg is intended to be "visually lossless", but is still lossy in the > mathematical sense. > > lossless jpeg would be mathematically lossless, otherwise it couldn't be > called lossless (even if only rarely does a value not match exactly, it > would still be lossy, eg since mismatch is still a possibility). > > however, someone who knows more would likely be a better authority on this. > > >
Post Follow-up to this message"Nils" <nospam@chello.nl> wrote in message news:o3L0d.13099$zh.10365@amsnews02.chello.com... > There is a special lossless mode in the original JPEG definition, although > it is not very widely in use, and it is also patented. > > This lossless method looks a bit like wavelets already since it stores plane > gradients first and then encodes the differences to these (IIRC). > > Kind regards, > > Nils Haeck > > PS JPeg2000 has a lossless mode as well. > The patents only apply to the arithmetic encoding. You can use Huffman encoding just as in the lossy modes. Moreover, there are no gradients encoded. Only the differences from the values predicted by the chosen model (seven different models) are encoded. Carsten Hansen
Post Follow-up to this message"Nils" <nospam@chello.nl> wrote in message news:o3L0d.13099$zh.10365@amsnews02.chello.com... > There is a special lossless mode in the original JPEG definition, although > it is not very widely in use, and it is also patented. > > This lossless method looks a bit like wavelets already since it stores > plane > gradients first and then encodes the differences to these (IIRC). > > Kind regards, > > Nils Haeck > > PS JPeg2000 has a lossless mode as well. > yes, however when many think of jpeg, they typically think of the lossy version (actually it annoys me sometimes that many people seem to think that "all" graphics/audio/video compression is lossy, instead of just most). I was trying to distinguish them, but this meaning may have been lost. of course, I am also kind of a newb to compression though (eg: I have not written that many styles of compressor, and less that actually work). more often I just seem to end up relying on things like zlib and jpeglib (or altering an existing arith coder to work, eg, as I couldn't get mine to work). this is since the workings of the algos are hard to understand sometimes and harder to get working. of course, this does hurt my confidence some. > "cr88192" <cr88192@remove.hotmail.com> wrote in message > news:GLi0d.1231$qT2.792@news.flashnewsgroups.com... > the > this. > >
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.