Skip to content

Commit

Permalink
Add CFA (Bayer) support
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeMartinez committed Oct 8, 2018
1 parent e4f649c commit 41a6a0a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ffv1.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ In JPEG2000-RCT, the coding order would be left to right and then top to bottom,

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]

### Color Filter Array

(TODO)

## Coding of the Sample Difference

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:
Expand Down Expand Up @@ -714,6 +718,10 @@ Parameters( ) { |
for (i = 1; i < 256; i++) |
state_transition_delta[ i ] | sr
colorspace_type | ur
if (colorspace_type == 2) { |
for( i = 0; i < 4; i++ ) { |
cfa_pattern [ i ] | ur
} |
if (version >= 1) |
bits_per_raw_sample | ur
chroma_planes | br
Expand Down Expand Up @@ -808,10 +816,26 @@ If state_transition_delta is not present in the FFV1 bitstream, all Range coder
|-------|:--------------------------------|:--------------------------------|:--------------------------------|
| 0 | YCbCr | No Pixel transformation | plane then line |
| 1 | RGB | JPEG2000-RCT | line then plane |
| 2 | Color Filter Array | JPEG2000-RCT + G difference | line then plane |
| Other | reserved for future use | reserved for future use | reserved for future use |

Restrictions:
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.
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.

### cfa_pattern

`cfa_pattern` indicates the actual color filter array geometric pattern of the image sensor used to capture the single sensor color image.
The pattern is provided per line top to bottom, and for each line left to right.

|value | color |
|-------|:--------------------------------|
|0 | red |
|1 | green |
|2 | blue |

Restrictions:
At least 1 component of each color must be present.

### chroma_planes

Expand Down

0 comments on commit 41a6a0a

Please sign in to comment.