MediaInfoLib icon indicating copy to clipboard operation
MediaInfoLib copied to clipboard

Lossless JPEG detected as Lossy

Open MarcusJohnson91 opened this issue 5 years ago • 5 comments

Using the latest version of the Mac version of MediaInfo from the app store.

You can see the results in this Image

Lossless JPEGs use the following Start of Frame (SOF) markers: SOF3, SOF7, SOF11, SOF15 aka 0xFFC3, 0xFFC7, 0xFFCB, 0xFFCF, respectively.

the sof marker number is the only way to truly tell if an image is lossy or lossless.

the image that was misdetected as lossy can be found here

MarcusJohnson91 avatar May 04 '20 05:05 MarcusJohnson91

This one uses SOF3. And it is recognized, just not propagated: https://github.com/MediaArea/MediaInfoLib/blob/2f3998512ec3cc6f55c0905eb993bfce95a9a3b2/Source/MediaInfo/Image/File_Jpeg.cpp#L643

SOF3, SOF7, SOF11, SOF15

Last time I checked it should not be zeroes, but Os (Start of). Sigh. https://www.itu.int/rec/T-REC-T.81 and https://www.w3.org/Graphics/JPEG/itu-t81.pdf

SOF3 is Lossless (sequential), Huffman coding

SOF11: Lossless (sequential), arithmetic coding

SOF7: differential lossless process frame marker, Huffman coding

SOF15: differential lossless process frame marker, arithmetic coding

ValZapod avatar Mar 21 '21 19:03 ValZapod

Thanks, I fix that when I have some free time.

JeromeMartinez avatar Mar 21 '21 20:03 JeromeMartinez

I can give a pull. 0 --> O in two files and add those new markers. Wait a second.

ValZapod avatar Mar 21 '21 20:03 ValZapod

I can give a pull

go :)

JeromeMartinez avatar Mar 21 '21 20:03 JeromeMartinez

BTW, the image is reported as not conformant by reference implementation. Here is my compile with VS 2022. https://github.com/thorfdbg/libjpeg/issues/61#issuecomment-1034869582

reading a JPEG file failed - error -1038 - invalid stream, found invalid huffman code in entropy coded segment

ValZapod avatar Feb 11 '22 15:02 ValZapod