exiftool / exiftool

ExifTool meta information reader/writer

Home Page:https://exiftool.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NEF compression 6 is wrong?

kmilos opened this issue · comments

The Nikon Z 6_2 samples at raw.pixls.us make me think this is a regular "Packed 12 bits" compression as well rather than the "Uncompressed (reduced to 12 bit)" description.

The uncompressed would still have 2xWxH bytes in StripByteCounts, whereas here we have approx. 12/8xWxH (seems there is a tiny overhead for 128-bit memory word alignment). This also matches w/ the compression 10 ("Packed 14 bits") for the same camera (approx. 14/8xWxH in StripByteCounts).

I'm not an expert on compression schemes, but the name for this NEFCompression value was suggested by the author of LibRaw, who is an expert on decoding these. Also, a value of 9 is already called "Packed 12 bits".

Looking at https://github.com/LibRaw/LibRaw/blob/master/src/metadata/tiff.cpp I think this falls under either "packed" or "packed padded" case, but certainly not "uncompressed"...

@LibRaw Please comment.

Also, a value of 9 is already called "Packed 12 bits".

Yes, but value 6 and value 10 are more similar in nature of the packing (both "padded" in libraw parlance?). So there needs to be some cleanup for sure regarding values 6, 9 and 10.

Ok, let's walk through the Z 6_2 and D6 example then, which seems to have 6 modes, all available on raw.pixls.us:

NEFCompression Nikon menu ExifTool
3 Lossless compressed / 14-bit Lossless
4 Compressed / 14-bit Lossy (type 2)
10 Uncompressed / 14-bit Packed 14 bits
3 Lossless compressed / 12-bit Lossless
4 Compressed / 12-bit Lossy (type 2)
6 Uncompressed / 12-bit Uncompressed (reduced to 12 bit)

Something doesn't quite add up there in terms of description/terminology for modes 6 and 10 - is it camera setting, or is it codec description?

If you two can agree on the terminology, I'm happy to change the descriptions to whatever you decide.

  • Phil

Iliah, thanks for the suggestion, but I don't quite understand. I don't have a full set of samples for all compression schemes, and I don't really understand the details of these schemes because I don't deal with image processing, so what I need are specific descriptions to use for each compression scheme.

ExifTool just (correctly) reads e.g. "compression scheme 34713 (Nikon) present, value 6" from the metadata (TIFF/Exif compression tag 0x103 followed by Nikon makernote tag 0x93), and that's pretty much it.

Any translation to human readable form is an arbitrary dictionary which I feel is inconsistent.

I really would like to give some human-readable hint about the meaning of the NEFCompression value. Perhaps something like this removes the ambiguity?:

1 => 'Mode 1 (lossy)',
2 => 'Mode 2 (uncompressed)',
3 => 'Mode 3 (lossless)',
4 => 'Mode 4 (lossy)',
5 => 'Mode 5 (striped packed 12 bits)',
6 => 'Mode 6 (packed 12 bits)',
7 => 'Mode 7 (unpacked 12 bits)',
8 => 'Mode 8 (small)',
9 => 'Mode 9 (packed 12 bits)',
10 => 'Mode 10 (packed 14 bits)',
13 => 'Mode 13 (high efficiency)',
14 => 'Mode 14 (high efficiency*)',
  • Phil