12 bit byte format

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

12 bit byte format

Aaron Boxer
I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)

_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer


On Mon, Nov 21, 2016 at 2:07 PM, Aaron Boxer <[hidden email]> wrote:
I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)


Is this related to the fill order ?


 


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Kemp Watson-2
In reply to this post by Aaron Boxer
Do you have control of the original writing end of the data? If so, why not store as 16-bit? Vastly easier…

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. +1 (416) 970-7284


From: <[hidden email]> on behalf of Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:07 PM
To: TIFF mailing list <[hidden email]>
Subject: [Tiff] 12 bit byte format

I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)
_______________________________________________ Tiff mailing list: [hidden email] http://lists.maptools.org/mailman/listinfo/tiff http://www.remotesensing.org/libtiff/

_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer


On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]> wrote:
Do you have control of the original writing end of the data? If so, why not store as 16-bit? Vastly easier…

Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
But, when I read the data with tifflib, I get the format I mentioned earlier.
The strip is returned in 12 bit.



 

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: <[hidden email]> on behalf of Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:07 PM
To: TIFF mailing list <[hidden email]>
Subject: [Tiff] 12 bit byte format

I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)
_______________________________________________ Tiff mailing list: [hidden email] http://lists.maptools.org/mailman/listinfo/tiff http://www.remotesensing.org/libtiff/


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Kemp Watson-2
But then, aren’t you decompressing 16-bit images?

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. +1 (416) 970-7284


From: Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:25 PM
To: Watson Kemp <[hidden email]>
Cc: TIFF mailing list <[hidden email]>
Subject: Re: [Tiff] 12 bit byte format



On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]> wrote:
Do you have control of the original writing end of the data? If so, why not store as 16-bit? Vastly easier…

Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
But, when I read the data with tifflib, I get the format I mentioned earlier.
The strip is returned in 12 bit.



 

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: <[hidden email]> on behalf of Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:07 PM
To: TIFF mailing list <[hidden email]>
Subject: [Tiff] 12 bit byte format

I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)
_______________________________________________ Tiff mailing list: [hidden email]http://lists.maptools.org/mailman/listinfo/tiffhttp://www.remotesensing.org/libtiff/


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Bob Friesenhahn
In reply to this post by Aaron Boxer
On Mon, 21 Nov 2016, Aaron Boxer wrote:
>
> Is this related to the fill order ?

Fill order is about the ordering of bits in a byte.  If the fill order
is wrong, then there is no resemblance to original values.

My understanding is that 12-bits (and any other depth not matching a
stored "word" size) should always be stored in big-endian byte order.
16, 24, 32, and 64-bits would be stored in the indicated byte order.

If you are using libtiff, then you will find that libtiff swaps data
to native order for 16, 24, 32, and 64-bits, but otherwise not.

Bob
--
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer
In reply to this post by Kemp Watson-2
Yes, I guess so :)  I consider them 12 bit because bits per sample is 12.

On Mon, Nov 21, 2016 at 2:29 PM, Kemp Watson <[hidden email]> wrote:
But then, aren’t you decompressing 16-bit images?

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:25 PM
To: Watson Kemp <[hidden email]>
Cc: TIFF mailing list <[hidden email]>
Subject: Re: [Tiff] 12 bit byte format



On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]> wrote:
Do you have control of the original writing end of the data? If so, why not store as 16-bit? Vastly easier…

Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
But, when I read the data with tifflib, I get the format I mentioned earlier.
The strip is returned in 12 bit.



 

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: <[hidden email]> on behalf of Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:07 PM
To: TIFF mailing list <[hidden email]>
Subject: [Tiff] 12 bit byte format

I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)
_______________________________________________ Tiff mailing list: [hidden email]http://lists.maptools.org/mailman/listinfo/tiffhttp://www.remotesensing.org/libtiff/



_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Kemp Watson-2
In reply to this post by Aaron Boxer
I guess what I mean is, are you sure that you are truly storing 12-bit interleaved data, tagged as 12-bit? Or are you storing 16-bit data, tagged as 12-bit?

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. +1 (416) 970-7284


From: Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:25 PM
To: Watson Kemp <[hidden email]>
Cc: TIFF mailing list <[hidden email]>
Subject: Re: [Tiff] 12 bit byte format



On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]> wrote:
Do you have control of the original writing end of the data? If so, why not store as 16-bit? Vastly easier…

Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
But, when I read the data with tifflib, I get the format I mentioned earlier.
The strip is returned in 12 bit.



 

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: <[hidden email]> on behalf of Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:07 PM
To: TIFF mailing list <[hidden email]>
Subject: [Tiff] 12 bit byte format

I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)
_______________________________________________ Tiff mailing list: [hidden email]http://lists.maptools.org/mailman/listinfo/tiffhttp://www.remotesensing.org/libtiff/


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer
Actually, it looks like it is 12 bit interleaved.

I created them with graphics magick -

// batch convert tiff to 12 bit, no compression
 $ c=0; ls -rt | while read -r file; do ((++c));  gm convert "${file}" -define tiff:bits-per-sample=12 -compress none "${file}"; done




On Mon, Nov 21, 2016 at 2:32 PM, Kemp Watson <[hidden email]> wrote:
I guess what I mean is, are you sure that you are truly storing 12-bit interleaved data, tagged as 12-bit? Or are you storing 16-bit data, tagged as 12-bit?

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:25 PM
To: Watson Kemp <[hidden email]>
Cc: TIFF mailing list <[hidden email]>
Subject: Re: [Tiff] 12 bit byte format



On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]> wrote:
Do you have control of the original writing end of the data? If so, why not store as 16-bit? Vastly easier…

Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
But, when I read the data with tifflib, I get the format I mentioned earlier.
The strip is returned in 12 bit.



 

W. Kemp Watson


Objective Pathology Services Limited
www.objectivepathology.com
tel. <a href="tel:%2B1%20%28416%29%20970-7284" value="+14169707284" target="_blank">+1 (416) 970-7284


From: <[hidden email]> on behalf of Aaron Boxer <[hidden email]>
Date: Monday, November 21, 2016 at 2:07 PM
To: TIFF mailing list <[hidden email]>
Subject: [Tiff] 12 bit byte format

I am decompressing 12 bit RGB images, on little endian system.

Each channel is stored in 3 nibbles: for example red is stored as

0xR2 R1 R0

where R2 is the largest address, R0 is the smallest.

When reading a strip, the nibbles are stored in the memory buffer as follows, in order of increasing memory address:
(brackets indicate bytes)

Lowest address .... (R1 R2) (G2 R0) (G0 G1) (B1 B2)  (R2 B0) (R1 R0) ....

Is it possible for libtiff to store the nibbles as follows:

R0 R1 R2 G0 G1 G2 B0 B1 B2  ............

(sorry for the non-standard notation here)
_______________________________________________ Tiff mailing list: [hidden email]http://lists.maptools.org/mailman/listinfo/tiffhttp://www.remotesensing.org/libtiff/



_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer
In reply to this post by Bob Friesenhahn


On Mon, Nov 21, 2016 at 2:31 PM, Bob Friesenhahn <[hidden email]> wrote:
On Mon, 21 Nov 2016, Aaron Boxer wrote:

Is this related to the fill order ?

Fill order is about the ordering of bits in a byte.  If the fill order is wrong, then there is no resemblance to original values.

My understanding is that 12-bits (and any other depth not matching a stored "word" size) should always be stored in big-endian byte order. 16, 24, 32, and 64-bits would be stored in the indicated byte order.

If you are using libtiff, then you will find that libtiff swaps data to native order for 16, 24, 32, and 64-bits, but otherwise not.

Thanks. I guess I don't want to mess with fill order.
 


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer


On Mon, Nov 21, 2016 at 2:36 PM, Aaron Boxer <[hidden email]> wrote:


On Mon, Nov 21, 2016 at 2:31 PM, Bob Friesenhahn <[hidden email]> wrote:
On Mon, 21 Nov 2016, Aaron Boxer wrote:

Is this related to the fill order ?

Fill order is about the ordering of bits in a byte.  If the fill order is wrong, then there is no resemblance to original values.

My understanding is that 12-bits (and any other depth not matching a stored "word" size) should always be stored in big-endian byte order. 16, 24, 32, and 64-bits would be stored in the indicated byte order.

If you are using libtiff, then you will find that libtiff swaps data to native order for 16, 24, 32, and 64-bits, but otherwise not.

So, I guess in my case, libtiff just returns the bits as they are stored in the file. Is it possible for graphics magick to store 12 bit RGB tiff in absolute increasing address
i.e. R0 R1 R2 G0 G1 G2 .....


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Bob Friesenhahn
In reply to this post by Aaron Boxer
On Mon, 21 Nov 2016, Aaron Boxer wrote:

> On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]>
> wrote:
>
>> Do you have control of the original writing end of the data? If so, why
>> not store as 16-bit? Vastly easier…
>>
>
> Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
> But, when I read the data with tifflib, I get the format I mentioned
> earlier.
> The strip is returned in 12 bit.
If the data is stored in 16-bits but the depth is indicated as
12-bits, then that would be a pretty serious encoding error.

What "tag" is indicating that 12-bits are used?

Does GraphicsMagick properly read this file (12 bits in 16-bit samples
would be dim, but not scrambled)?

Bob
--
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer
TIFFTAG_BITSPERSAMPLE equals 12
TIFFTAG_SAMPLESPERPIXEL equals 3

I guess there is no standard format for 12 bit, in terms of bits on disk.

On Mon, Nov 21, 2016 at 2:43 PM, Bob Friesenhahn <[hidden email]> wrote:
On Mon, 21 Nov 2016, Aaron Boxer wrote:

On Mon, Nov 21, 2016 at 2:21 PM, Kemp Watson <[hidden email]>
wrote:

Do you have control of the original writing end of the data? If so, why
not store as 16-bit? Vastly easier…


Thanks. The data is stored in 16 bit, with tag indicating 12 bits used.
But, when I read the data with tifflib, I get the format I mentioned
earlier.
The strip is returned in 12 bit.

If the data is stored in 16-bits but the depth is indicated as 12-bits, then that would be a pretty serious encoding error.

What "tag" is indicating that 12-bits are used?

Does GraphicsMagick properly read this file (12 bits in 16-bit samples would be dim, but not scrambled)?


Bob
--
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Bob Friesenhahn
On Mon, 21 Nov 2016, Aaron Boxer wrote:

> TIFFTAG_BITSPERSAMPLE equals 12
> TIFFTAG_SAMPLESPERPIXEL equals 3
>
> I guess there is no standard format for 12 bit, in terms of bits on disk.

The above seems to be the standard to me.

Since you are likely doing DCI related things, the 12-bits in 16-bits
issue comes up because the original sample scans were done this way
(on a Filmlight) because TIFF decoders for 12-bits were rare and
because they did not trust that DPX readers would support 12-bits.
Because of this, the original JPEG 2000 encoders targeting DCI were
implemented for this form of input.

Bob
--
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Kemp Watson-2
If it helps, there¹s a world of difference between ³used² bits and
³encoded/stored² bits. The software and files don¹t care about ³used² bitsŠ

If data is stored raw, there¹s an impact on file size; but if LZW or other
compression, storing 12 used bits in a 16-bit field won¹t effect file size
noticeably.

W. Kemp Watson

[hidden email]




Objective Pathology Services Limited
www.objectivepathology.com
tel. +1 (416) 970-7284








On 2016-11-21, 2:54 PM, "Bob Friesenhahn" <[hidden email]
on behalf of [hidden email]> wrote:

>On Mon, 21 Nov 2016, Aaron Boxer wrote:
>
>> TIFFTAG_BITSPERSAMPLE equals 12
>> TIFFTAG_SAMPLESPERPIXEL equals 3
>>
>> I guess there is no standard format for 12 bit, in terms of bits on
>>disk.
>
>The above seems to be the standard to me.
>
>Since you are likely doing DCI related things, the 12-bits in 16-bits
>issue comes up because the original sample scans were done this way
>(on a Filmlight) because TIFF decoders for 12-bits were rare and
>because they did not trust that DPX readers would support 12-bits.
>Because of this, the original JPEG 2000 encoders targeting DCI were
>implemented for this form of input.
>
>Bob
>--
>Bob Friesenhahn
>[hidden email], http://www.simplesystems.org/users/bfriesen/
>GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
>_______________________________________________
>Tiff mailing list: [hidden email]
>http://lists.maptools.org/mailman/listinfo/tiff
>http://www.remotesensing.org/libtiff/


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer
In reply to this post by Bob Friesenhahn


On Mon, Nov 21, 2016 at 2:54 PM, Bob Friesenhahn <[hidden email]> wrote:
On Mon, 21 Nov 2016, Aaron Boxer wrote:

TIFFTAG_BITSPERSAMPLE equals 12
TIFFTAG_SAMPLESPERPIXEL equals 3

I guess there is no standard format for 12 bit, in terms of bits on disk.

The above seems to be the standard to me.

Since you are likely doing DCI related things, the 12-bits in 16-bits issue comes up because the original sample scans were done this way (on a Filmlight) because TIFF decoders for 12-bits were rare and because they did not trust that DPX readers would support 12-bits. Because of this, the original JPEG 2000 encoders targeting DCI were implemented for this form of input.

Cool, didn't know that.
 


_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 12 bit byte format

Aaron Boxer
In reply to this post by Kemp Watson-2


On Mon, Nov 21, 2016 at 3:28 PM, Kemp Watson <[hidden email]> wrote:
If it helps, there¹s a world of difference between ³used² bits and
³encoded/stored² bits. The software and files don¹t care about ³used² bitsŠ

If data is stored raw, there¹s an impact on file size; but if LZW or other
compression, storing 12 used bits in a 16-bit field won¹t effect file size
noticeably.

Thanks, yes, I am looking primarily at uncompressed data, so 12 bits helps a lot.






On 2016-11-21, 2:54 PM, "Bob Friesenhahn" <[hidden email]
on behalf of [hidden email]> wrote:

>On Mon, 21 Nov 2016, Aaron Boxer wrote:
>
>> TIFFTAG_BITSPERSAMPLE equals 12
>> TIFFTAG_SAMPLESPERPIXEL equals 3
>>
>> I guess there is no standard format for 12 bit, in terms of bits on
>>disk.
>
>The above seems to be the standard to me.
>
>Since you are likely doing DCI related things, the 12-bits in 16-bits
>issue comes up because the original sample scans were done this way
>(on a Filmlight) because TIFF decoders for 12-bits were rare and
>because they did not trust that DPX readers would support 12-bits.
>Because of this, the original JPEG 2000 encoders targeting DCI were
>implemented for this form of input.
>
>Bob
>--
>Bob Friesenhahn
>[hidden email], http://www.simplesystems.org/users/bfriesen/
>GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
>_______________________________________________
>Tiff mailing list: [hidden email]
>http://lists.maptools.org/mailman/listinfo/tiff
>http://www.remotesensing.org/libtiff/




_______________________________________________
Tiff mailing list: [hidden email]
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Loading...