t024484 Posted October 24, 2011 Share #21 Posted October 24, 2011 Advertisement (gone after registration) Leica compresses the 12 bit pixel information that is contained in a 16 bit word into 8 bits . This is done by multiplying the content with the number 16 and then by taking the square root and rounding to an integer. By doing this, the content is compressed into a 8 bit word, which effectively halves the size of the Image File from 36 Mb to 18 Mb. Recovering the information is the opposite proces: taking the square, divide by 16 and round to an integer. This is not a lossless proces since the original 4096 steps (12 bits) are reduced to 256 steps (8bits). After decompression there are still 256 steps left of the original possible 4096 steps. The number 3408 for instance becomes INT(SQRT (3408*16)) = 234 after compression. Decompression (in PS, LR, or ...) gives INT(234*234 / 16) = 3422. 3407 down to 3379 all become compressed to 233, and after decompression 3393. So one step down in the original pixel value from 3408 to 3407 , becomes a large step of 3422 - 3393 = 27 when using DNG compression. From 3407 to 3379 results all in the same (de)compressed value, until the next big step at 3378 and so on. Is a field where Millions of values are restricted by this compression mechanism, it is as if noise was added to the original signal. The sqrt compression was used because another noise generator, being photon noise is also sqrt related to the pixel value. That is why the "noise" generated with this way of compressing, just adds roughly 0.1 stop noise over the whole range from Black to White and only at SO 160. As mentioned before this is detectable with a computer but not by the human eye. As from ISO 640, the generated compression noise completey vanishes within other noise sources that are getting larger and larger. So it is not as bad as it seems, that is why Leica offers this way of compression. On the other hand as kdriceman brings foreward, why should you compress when memorycards have plenty of storage and you can keep the information in its original form. Hans Link to post Share on other sites More sharing options...
Advertisement Posted October 24, 2011 Posted October 24, 2011 Hi t024484, Take a look here DNG Compression, Any Difference in Quality?. I'm sure you'll find what you were looking for!
SJP Posted October 24, 2011 Share #22 Posted October 24, 2011 Also, one might add that the human eye is distinctly non-linear (as is the human ear) so that it makes sense to have more info in the dark side of the image than in the light side, in agreement with Leica's horrible compression algorithm. Maybe they do know what they are doing. Also on the M9 (don't have one) I would happily use the compressed DNG files, if only to save me a factor 2 in storage & transfer rate. Link to post Share on other sites More sharing options...
pop Posted October 24, 2011 Share #23 Posted October 24, 2011 multiplying the content with the number 16 and then by taking the square root and rounding to an integer. That's a relief. There's not much of a chance that you will notice any difference in real life pictures. You'd have to contrive a case to show a difference. Link to post Share on other sites More sharing options...
pop Posted October 24, 2011 Share #24 Posted October 24, 2011 Is RLE not lossless? Yes, RLE is indeed lossless. I was using my pronouns carelessly. Link to post Share on other sites More sharing options...
k-hawinkler Posted October 25, 2011 Share #25 Posted October 25, 2011 Why not get an uncompressed image from the M9 and then compress lossless in Photoshop? K-H. Link to post Share on other sites More sharing options...
t024484 Posted October 25, 2011 Share #26 Posted October 25, 2011 Why not get an uncompressed image from the M9 and then compress lossless in Photoshop? K-H. The point of compressing within the camera is to get twice as much images on the memory card. Just before someone mentions this, Leica is using 14 bit convertors, but the sensor has only a dynamic range of just below 72 dB, which corresponds to 12 bits. The two least significant bits are not containing any information but noise. In my previous posting I mentioned 4096 available pixel values before compressing, which also corresponds to 12 bits. But because of the used 14 bits, the multiplication / division factor that Leica uses is in fact 4 and not 16. What remains is that 4096 available levels before compression are projected on just 256 levels, staying 256 levels after decompression, clearly showing the point that information gets lost in the conversion process. Hans Link to post Share on other sites More sharing options...
jaapv Posted October 25, 2011 Share #27 Posted October 25, 2011 Advertisement (gone after registration) Hans, where does the LUT Leica uses come into this? Leica compresses the 12 bit pixel information that is contained in a 16 bit word into 8 bits .This is done by multiplying the content with the number 16 and then by taking the square root and rounding to an integer. By doing this, the content is compressed into a 8 bit word, which effectively halves the size of the Image File from 36 Mb to 18 Mb. Recovering the information is the opposite proces: taking the square, divide by 16 and round to an integer. This is not a lossless proces since the original 4096 steps (12 bits) are reduced to 256 steps (8bits). After decompression there are still 256 steps left of the original possible 4096 steps. The number 3408 for instance becomes INT(SQRT (3408*16)) = 234 after compression. Decompression (in PS, LR, or ...) gives INT(234*234 / 16) = 3422. 3407 down to 3379 all become compressed to 233, and after decompression 3393. So one step down in the original pixel value from 3408 to 3407 , becomes a large step of 3422 - 3393 = 27 when using DNG compression. From 3407 to 3379 results all in the same (de)compressed value, until the next big step at 3378 and so on. Is a field where Millions of values are restricted by this compression mechanism, it is as if noise was added to the original signal. The sqrt compression was used because another noise generator, being photon noise is also sqrt related to the pixel value. That is why the "noise" generated with this way of compressing, just adds roughly 0.1 stop noise over the whole range from Black to White and only at SO 160. As mentioned before this is detectable with a computer but not by the human eye. As from ISO 640, the generated compression noise completey vanishes within other noise sources that are getting larger and larger. So it is not as bad as it seems, that is why Leica offers this way of compression. On the other hand as kdriceman brings foreward, why should you compress when memorycards have plenty of storage and you can keep the information in its original form. Hans Link to post Share on other sites More sharing options...
pico Posted October 25, 2011 Share #28 Posted October 25, 2011 Okay, then perhaps we can look at this way: where a number of consecutive pixels are registering identical 16-bit words, for example an area of pure black in a coal mine yields 256 consecutive identical pixels:rolleyes:, then rather than record three separate, identical 16-bit words for each register (RGB) the compression algorithm can identify that they're all the same and in place of 255x3 produce an instruction that says "the next 255x3 words are the same as the first word". This will remove data but not information. Pete. That's called Run Length Encoding, (RLE) which is a lossless compression method once popular way to store fixed-disc information (early Windows OS) when drives were small. It is the worst, least efficient means to compress continuous tone color images such as photographs. Link to post Share on other sites More sharing options...
pico Posted October 25, 2011 Share #29 Posted October 25, 2011 DNG compressed is almost certainly lossless JPEG. OK, it's off to the HEX editor. Link to post Share on other sites More sharing options...
k-hawinkler Posted October 25, 2011 Share #30 Posted October 25, 2011 The point of compressing within the camera is to get twice as much images on the memory card. Just before someone mentions this, Leica is using 14 bit convertors, but the sensor has only a dynamic range of just below 72 dB, which corresponds to 12 bits. The two least significant bits are not containing any information but noise. In my previous posting I mentioned 4096 available pixel values before compressing, which also corresponds to 12 bits. But because of the used 14 bits, the multiplication / division factor that Leica uses is in fact 4 and not 16. What remains is that 4096 available levels before compression are projected on just 256 levels, staying 256 levels after decompression, clearly showing the point that information gets lost in the conversion process. Hans Well, I prefer compressed because my M9 seems to be a bit faster storing images on the memory card that way. I have plenty of storage capacity on my cards. So that's not a concern for me. K-H. Link to post Share on other sites More sharing options...
farnz Posted October 25, 2011 Share #31 Posted October 25, 2011 That's called Run Length Encoding, (RLE) which is a lossless compression method once popular way to store fixed-disc information (early Windows OS) when drives were small. It is the worst, least efficient means to compress continuous tone color images such as photographs. Rip, Accepted. I was merely illustrating how data can be discarded without losing information. Pete. Link to post Share on other sites More sharing options...
sandymc Posted October 25, 2011 Share #32 Posted October 25, 2011 Hans, where does the LUT Leica uses come into this? It comes into play in two places: Firstly, square roots are computationally expensive. A LUT is a lot faster, so the M8/M9 firmware probably use a LUT internally rather than computation to do the compression. Secondly, the reverse LUT (8-bit to 14-bit) is embedded in the DNG file. DNG files are built to be able to convert the image without the raw converter having to know anything about the how the M8/M9 does its compression other than the information in the file. So a pre-M8 version of Lightroom could (and did) convert a M8 DNG. Sandy Link to post Share on other sites More sharing options...
kdriceman Posted October 25, 2011 Share #33 Posted October 25, 2011 Well, I prefer compressed because my M9 seems to be a bit faster storing images on the memory card that way.I have plenty of storage capacity on my cards. So that's not a concern for me. K-H. K-H Have you timed it? I put a stopwatch on my M9 and timed write times with various compression settings and, although it's been awhile and i don't remember the actual results, I remember being surprised that even writing JPEGs, it was only marginally faster.. But, faster is faster, so if you lose nothing IQ wise, why not? But for me, I'm still going uncompressed because I'm not convinced there is not potential for something lost in the compression process. Link to post Share on other sites More sharing options...
larryk34 Posted October 26, 2011 Share #34 Posted October 26, 2011 It sounds a bit odd, but it seems to me that editing stored files is more important in the long run than compressing them or not. By editing, I mean deleting the 50%-70% of all the images that I take every time and only keeping a still wide range of images that I might use someday. I find it hard to take the time to do this. I have a new 2 terabyte external hard disk, but I can already see a problem with it if I don't start deleting useless files soon. I keep only uncompressed files because I've never heard any good argument to compress them except to save storage space. Deleting 100% of a file is better than compressing it down to 20%-50% or whatever a compressed file is. Otherwise, just use jpg's. Link to post Share on other sites More sharing options...
pico Posted October 26, 2011 Share #35 Posted October 26, 2011 It sounds a bit odd, but it seems to me that editing stored files is more important in the long run than compressing them or not. By editing, I mean deleting the 50%-70% of all the images that I take every time and only keeping a still wide range of images that I might use someday. I find it hard to take the time to do this. I have a new 2 terabyte external hard disk, but I can already see a problem with it if I don't start deleting useless files soon. You gotta do some arithmetic. 2 tera will hold more images than you can keep track of. Link to post Share on other sites More sharing options...
k-hawinkler Posted October 26, 2011 Share #36 Posted October 26, 2011 K-H Have you timed it? I put a stopwatch on my M9 and timed write times with various compression settings and, although it's been awhile and i don't remember the actual results, I remember being surprised that even writing JPEGs, it was only marginally faster.. But, faster is faster, so if you lose nothing IQ wise, why not? But for me, I'm still going uncompressed because I'm not convinced there is not potential for something lost in the compression process. Yes. There have been a number of threads in the past in which folks timed I believe a burst of 7 shots or so for different scenarios. I certainly can tell the difference and my M9 seemed to behave as it should. K-H. Link to post Share on other sites More sharing options...
01af Posted October 26, 2011 Share #37 Posted October 26, 2011 I think I found an example where compressed DNG makes a difference for the worse. See the image of dancers at a prom night below, taken with a Summilux-M 35 mm Asph on M9 at ISO 2500/35° in compressed DNG format. The lighting was low and colourful, and white balance is a nightmare. Processing the image in Adobe Camera Raw 6.5, shifting Tint towards green gives better overall colour balance but awful skin tones. Shifting it towards magenta improves the lady's skin tones but plays havoc with the gent's face and shirt (which by the way is white, not pink or something). The shift towards magenta does not appear gradually in the skin but as sharp-edged blotches while some parts of the skin hardly assume any shift towards magenta at all. I suppose this is an artifact of the reduced bit depth in combination with low light, high ISO, and crummy light colour. I cannot reproduce this behaviour in images taken in uncompressed DNG format. Still, this is just some evidence, not a final proof of a possible weakness of compressed DNG, as I don't have uncompressed shots of the very same scene to compare. I can only compare this to uncompressed shots of similar scenes under similar lighting. Furthermore, not all compressed DNG shots show this strange behaviour; only a few do. See the crops below, with Tint set to -70, -40, and -20 (lower tint values mean more green; higher mean more magenta; the full-frame image has Tint at -40). All the other settings, including Temperature, Exposure, Brightness, Contrast, etc. are the same for all three crops. First, the full frame: Welcome, dear visitor! As registered member you'd see an image here… Simply register for free here – We are always happy to welcome new members! Leica M9; Summilux-M 35 mm 1:1.4 Asph; ISO 2500/35°, f/1.4, 1/60 s. A crop at 50 % view from the image above. Temperature 2400 K, Tint -70: A crop at 50 % view from the image above. Temperature 2400 K, Tint -40 (same as the full frame above): A crop at 50 % view from the image above. Temperature 2400 K, Tint -20: Note the colours of the skins of the lady's arm and the gent's face. Link to post Share on other sites Simply register for free here – We are always happy to welcome new members! Leica M9; Summilux-M 35 mm 1:1.4 Asph; ISO 2500/35°, f/1.4, 1/60 s. A crop at 50 % view from the image above. Temperature 2400 K, Tint -70: A crop at 50 % view from the image above. Temperature 2400 K, Tint -40 (same as the full frame above): A crop at 50 % view from the image above. Temperature 2400 K, Tint -20: Note the colours of the skins of the lady's arm and the gent's face. ' data-webShareUrl='https://www.l-camera-forum.com/topic/164619-dng-compression-any-difference-in-quality/?do=findComment&comment=1826709'>More sharing options...
vanhulsenbeek Posted October 26, 2011 Share #38 Posted October 26, 2011 With all due respect, this example makes no point for me without comparison with the results of an uncompressed file. Link to post Share on other sites More sharing options...
pop Posted October 26, 2011 Share #39 Posted October 26, 2011 @431: As far as I can tell your sample has nothing to do with any artifacts due to the compression of the DNG file. The error in any of the three color channels after compressing and decompressing apparently remains comfortably below 1% of the original value. Even the worst case (deviations in the color channels with opposite signs) would not give color casts as strong as shown in your image. I think we see the results of unevenly applied additive mixing of colored lights which in turn is the result of the spatial distribution of colored spot lights. Link to post Share on other sites More sharing options...
t024484 Posted October 26, 2011 Share #40 Posted October 26, 2011 Hans, where does the LUT Leica uses come into this? Jaap, The 2 LUT's for compression / decompression where both in the firmware supplied for the M8 and easy to find and to manipulate for experiments. Since I cannot find either of both LUT's in the M9 firmware, they are either encrypted within the firmware or permanently transferred to some internal memory. Within with the compressed M9/M8 DNG file it is easy to locate the decompress LUT. Hans Link to post Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.