JPEG lossless transformation format and arithmetic coding

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

simon
Posts: 74
Joined: Wed Aug 23, 2006 4:51 pm

JPEG lossless transformation format and arithmetic coding

Post by simon »

Hi

I would like ask two questions about JPEG coding

(1) I noticed a "strange" behaviour of JPEG lossless transformations. This procedure is assumed not to recode the JPEG blocks but just to keep the desired ones (cropping) or change their order (rotation) to be lossless. Actually, it is lossless (so it does the job properly ;-) but strangly the resultant image seems to be systematically coded in Huffman optimized / non progressive format, whatever the initial format of the image and whatever the format specified in option (huffman optimized or not, progressive or not), which involves some (lossless) recoding of the blocks. Why don't use the initial format, or at least the format specified in the writing option ?

(2) Why not implementing the arithemetic coding for JPG (as provided by the Independent JPEG group) ? in the past there were patents on this but they all have expired so that a few viewers are already able to read/write arithmetic jpg files.

Thanks
Simon
User avatar
xnview
Author of XnView
Posts: 42537
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: JPEG lossless transformation format and arithmetic codin

Post by xnview »

simon wrote: (1) I noticed a "strange" behaviour of JPEG lossless transformations. This procedure is assumed not to recode the JPEG blocks but just to keep the desired ones (cropping) or change their order (rotation) to be lossless. Actually, it is lossless (so it does the job properly ;-) but strangly the resultant image seems to be systematically coded in Huffman optimized / non progressive format, whatever the initial format of the image and whatever the format specified in option (huffman optimized or not, progressive or not), which involves some (lossless) recoding of the blocks. Why don't use the initial format, or at least the format specified in the writing option ?
yes right, huffman is optimized
(2) Why not implementing the arithemetic coding for JPG (as provided by the Independent JPEG group) ? in the past there were patents on this but they all have expired so that a few viewers are already able to read/write arithmetic jpg files.
Arithmetic coding is not yet supported...
Pierre.
rapik
Posts: 1
Joined: Sun Feb 01, 2015 12:01 pm

Re: JPEG lossless transformation format and arithmetic codin

Post by rapik »

I find it disturbing, that "lossless" transformation does some optimization to the file. Even if it will not lost any information. Files, I've tested get 10% smaller. Windows Explorer changes one byte when rotating a JPEG image. That's exactly what one would expect from a "lossless" transformation. XnView does a lot with the file and still calls it "lossless".
User avatar
Karl02
Posts: 134
Joined: Mon Sep 03, 2007 1:00 pm
Location: Germany

Re: JPEG lossless transformation format and arithmetic codin

Post by Karl02 »

1) XnView should use the JPEG options that are selected in the settings.

2) Arithmetic coding is supported in the IJG library since version 7 (2009-06-27). The current version is 9a (2014-01-19).
Overview: http://sylvana.net/jpegcrop/
Changelog: See file change.log here: http://sylvana.net/jpeg-bin/jpg9aexe.zip
List of applications: http://sylvana.net/jpegcrop/losslessapps.html
jpegcrop demo program: http://sylvana.net/jpegcrop/jpegcrop.zip

3) @rapik: Some file changes are usually not a problem if they are lossless. However, you could use the lossless rotate method that only changes the EXIF orientation tag. Unfortunately, this doesn't work currently in XnView. See my suggestions for improvement here: http://newsgroup.xnview.com/viewtopic.p ... 26#p126126
-- Karl
User avatar
XnTriq
Moderator & Librarian
Posts: 6259
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: JPEG lossless transformation format and arithmetic codin

Post by XnTriq »

I'd like to request an option to prevent XnView from optimizing the Huffman tables during lossless transformations.