Skip to content

Commit 41a6a0a

Browse files
Add CFA (Bayer) support
1 parent e4f649c commit 41a6a0a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ffv1.md

+24
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ In JPEG2000-RCT, the coding order would be left to right and then top to bottom,
391391

392392
Y[1,1] Y[2,1] Cb[1,1] Cb[2,1] Cr[1,1] Cr[2,1] Y[1,2] Y[2,2] Cb[1,2] Cb[2,2] Cr[1,2] Cr[2,2]
393393

394+
### Color Filter Array
395+
396+
(TODO)
397+
394398
## Coding of the Sample Difference
395399

396400
Instead of coding the n+1 bits of the Sample Difference with Huffman or Range coding (or n+2 bits, in the case of RCT), only the n (or n+1) least significant bits are used, since this is sufficient to recover the original sample. In the equation below, the term "bits" represents bits_per_raw_sample+1 for RCT or bits_per_raw_sample otherwise:
@@ -714,6 +718,10 @@ Parameters( ) { |
714718
for (i = 1; i < 256; i++) |
715719
state_transition_delta[ i ] | sr
716720
colorspace_type | ur
721+
if (colorspace_type == 2) { |
722+
for( i = 0; i < 4; i++ ) { |
723+
cfa_pattern [ i ] | ur
724+
} |
717725
if (version >= 1) |
718726
bits_per_raw_sample | ur
719727
chroma_planes | br
@@ -808,10 +816,26 @@ If state_transition_delta is not present in the FFV1 bitstream, all Range coder
808816
|-------|:--------------------------------|:--------------------------------|:--------------------------------|
809817
| 0 | YCbCr | No Pixel transformation | plane then line |
810818
| 1 | RGB | JPEG2000-RCT | line then plane |
819+
| 2 | Color Filter Array | JPEG2000-RCT + G difference | line then plane |
811820
| Other | reserved for future use | reserved for future use | reserved for future use |
812821

813822
Restrictions:
814823
If `colorspace_type` is 1, then `chroma_planes` MUST be 1, `log2_h_chroma_subsample` MUST be 0, and `log2_v_chroma_subsample` MUST be 0.
824+
If `colorspace_type` is 2, then `chroma_planes` MUST be 1, `log2_h_chroma_subsample` MUST be 0, and `log2_v_chroma_subsample` MUST be 0, transparency MUST be 1.
825+
826+
### cfa_pattern
827+
828+
`cfa_pattern` indicates the actual color filter array geometric pattern of the image sensor used to capture the single sensor color image.
829+
The pattern is provided per line top to bottom, and for each line left to right.
830+
831+
|value | color |
832+
|-------|:--------------------------------|
833+
|0 | red |
834+
|1 | green |
835+
|2 | blue |
836+
837+
Restrictions:
838+
At least 1 component of each color must be present.
815839

816840
### chroma_planes
817841

0 commit comments

Comments
 (0)