Magic Lantern Forum

Developing Magic Lantern => Feature Requests => Topic started by: COMMANDES on June 14, 2017, 11:20:14 AM

Title: Custom-sized lossless Jpeg sequence
Post by: COMMANDES on June 14, 2017, 11:20:14 AM
Not so long ago, it became possible to access the intra-camera compression algorithm.

Is it possible to create a module to save small (up to 2k or 1080p) Jpeg compressed losslessly as a sequencing of files in separate folders or in a single file (like MLV) with a frame rate of at least 24p?
I'm not talking about a full-size matrix reading, but if you get out of variable raw-buffers receive lossless jpeg — that would be cool.
Title: Re: Custom-sized lossless Jpeg sequence
Post by: dmilligan on June 14, 2017, 03:03:22 PM
Already done -> https://builds.magiclantern.fm/experiments.html
Title: Re: Custom-sized lossless Jpeg sequence
Post by: COMMANDES on June 14, 2017, 05:03:25 PM
You mean compressed RAW?

14bit raw sometimes too expensive.

I think that the lossless jpeg (obtained from 14 bits) will look better than 8-10bit raw. In addition, jpeg will be faster in terms of post-processing on any devices.
Title: Re: Custom-sized lossless Jpeg sequence
Post by: dmilligan on June 15, 2017, 02:40:04 AM
I think you have a misunderstanding about what lossless JPEG means.

"Lossless" compression algorithms compress data in such a way that the original data can be reconstructed exactly, bit for bit. "Lossy" compression algorithms compress data in such a way that the original data cannot be recontructed exactly, but you can come close and the differences are optimized to be things that aren't very noticeable based on human perception. They are two very different beasts.

JPEG is not a file format nor is it a particular compression algorithm or codec. It is a group of people who design compression algorithms and standards. It's a bit confusing that this group of people gave their name "JPEG" to a particular lossy compression algorithm they standardized. This particular algorithm based on the discrete cosine transform is what most people know as "JPEG". This group has also standardized other compression algorithms, including a "lossless" compression algorithm.

The lossless compression algorithm created by the JPEG people is very different and has nothing to do with the well known lossy JPEG algorithm, other than the being created by the same folks.

The lossless compression algorithm the cameras use to compress CR2 raw data is the lossless JPEG algorithm. That is the compression algorithm referred to in your quote that we recently discovered how to use. It has been implemented to losslessly compress raw video.

I think what you are actually asking about is not lossless JPEG, but the traditional lossy JPEG. There is also a lossy JPEG hardware in the camera (JPCORE), but we don't know how to use it well enough at the moment to implement what you are asking. Search the forum for MJPEG.
Title: Re: Custom-sized lossless Jpeg sequence
Post by: COMMANDES on June 16, 2017, 09:00:48 PM
Sorry for my possible incompetence, but I was referring to the lossless compression of the image processed by the camera. If lossless compression is not possible to implement in *.jpeg container - ok

Perhaps a quality compression with losses from the buffer greater than in the standard video recording mode will be better.
Title: Re: Custom-sized lossless Jpeg sequence
Post by: g3gg0 on June 16, 2017, 09:46:47 PM
lossless: .CR2, .MLV
lossy: .JPG, .MOV
Title: Re: Custom-sized lossless Jpeg sequence
Post by: COMMANDES on June 16, 2017, 09:57:22 PM
Ok. I understood you.

Thank you for your attention to the topic