You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ffv1.md
+46-9Lines changed: 46 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,8 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
45
45
46
46
`RGB`: A reference to the method of storing the value of a `Pixel` by using three numeric values that represent Red, Green, and Blue.
47
47
48
+
`RGGB Color Filter Array`: A reference to the method of storing the value of a `Pixel` by using four numeric values that represent Red, Green, Blue, and Green Difference.
49
+
48
50
`YCbCr`: A reference to the method of storing the value of a `Pixel` by using three numeric values that represent the luma of the `Pixel` (Y) and the chrominance of the `Pixel` (Cb and Cr). YCbCr word is used for historical reasons and currently references any color space relying on 1 luma `Sample` and 2 chrominance `Samples` e.g. YCbCr, YCgCo or ICtCp. Exact meaning of the three numeric values is unspecified.
49
51
50
52
`TBA`: To Be Announced. Used in reference to the development of future iterations of the FFV1 specification.
@@ -294,7 +296,7 @@ Background: in first implementations of FFV1 bitstream, the index for Cb and Cr
294
296
295
297
## Color spaces
296
298
297
-
FFV1 supports two color spaces: YCbCr and RGB. Both color spaces allow an optional Alpha `Plane` that can be used to code transparency data.
299
+
FFV1 supports several color spaces. They allow an optional Alpha `Plane` that can be used to code transparency data.
298
300
299
301
The FFV1 bitstream interleaves data in an order determined by the color space. In YCbCr for each `Plane`, each `Line` is coded from top to bottom and for each `Line`, each `Sample` is coded from left to right. In JPEG2000-RCT for each `Line` from top to bottom, each `Plane` is coded and for each `Plane`, each `Sample` is encoded from left to right.
300
302
@@ -395,6 +397,10 @@ In JPEG2000-RCT, the coding order would be left to right and then top to bottom,
Instead of coding the n+1 bits of the Sample Difference with Huffman or Range coding (or n+2 bits, in the case of JPEG2000-RCT), only the n (or n+1, in the case of JPEG2000-RCT) 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 JPEG2000-RCT or bits_per_raw_sample otherwise:
@@ -745,6 +751,10 @@ Parameters( ) { |
745
751
} |
746
752
ec | ur
747
753
intra | ur
754
+
if (colorspace_type == 2) { |
755
+
for ( i = 0; i < 4; i++ ) { |
756
+
cfa_pattern [ i ] | ur
757
+
} |
748
758
} |
749
759
} |
750
760
```
@@ -810,16 +820,42 @@ If state_transition_delta is not present in the FFV1 bitstream, all Range coder
810
820
811
821
### colorspace_type
812
822
813
-
`colorspace_type` specifies the color space losslessly encoded, the Pixel transformation used by the encoder, as well as interleave method.
823
+
`colorspace_type` specifies the color space encoded, the pixel transformation used by the encoder, the extra plane content, as well as interleave method.
814
824
815
-
|value | color space losslessly encoded | transformation | interleave method |
| 2 | RGGB Color Filter Array | JPEG2000-RCT | Transparency |`Line` then `Plane`|
830
+
| Other | reserved for future use | reserved for future use | reserved for future use | reserved for future use |
820
831
821
832
Restrictions:
822
833
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.
834
+
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.
835
+
836
+
### cfa_pattern
837
+
838
+
`cfa_pattern` indicates the actual color filter array geometric pattern of the image sensor used to capture the single sensor color image.
839
+
The pattern has a fixed size of 4 values (fixed width of 2, fixed height of 2) and is provided per line top to bottom, and for each line left to right.
840
+
841
+
|value | color |
842
+
|-------|:--------------------------------|
843
+
|0 | red |
844
+
|1 | green |
845
+
|2 | blue |
846
+
847
+
Restrictions:
848
+
At least 1 component of each color MUST be present.
849
+
850
+
As an example, a typical pattern is 0112, which implies:
851
+
852
+
```
853
+
+---+---+
854
+
| R | G |
855
+
+---+---+
856
+
| G | B |
857
+
+---+---+
858
+
```
823
859
824
860
### chroma_planes
825
861
@@ -1161,7 +1197,8 @@ SliceContent( ) { |
1161
1197
for( p = 0; p < primary_color_count; p++ ) |
1162
1198
for( y = 0; y < plane_pixel_height[ p ]; y++ ) |
1163
1199
Line( p, y ) |
1164
-
} else if (colorspace_type == 1) { |
1200
+
} else if (colorspace_type == 1 |
1201
+
|| colorspace_type == 2) { |
1165
1202
for( y = 0; y < slice_pixel_height; y++ ) |
1166
1203
for( p = 0; p < primary_color_count; p++ ) |
1167
1204
Line( p, y ) |
@@ -1171,7 +1208,7 @@ SliceContent( ) { |
1171
1208
1172
1209
### primary_color_count
1173
1210
1174
-
`primary_color_count` is defined as `1 + ( chroma_planes ? 2 : 0 ) + ( alpha_plane ? 1 : 0 )`.
0 commit comments