I am currently working on an OpenCL decoder for lossless JPEGs (DNG, CR2, etc.). The standard imposes very few restrictions on how components can be laid out (alternating against planar ones), which interfere with fairly inflexible OpenCL kernels.
In particular, the concept of component identifiers seems unnecessarily complicated, so I wonder if I understood correctly:
The SOF3 header (beginning of frame 3, non-differential Huffman coding, lossless (sequential)) contains some information about each component. It:
i (implicit): component indexC_i: Component IDH_i/ V_i: horizontal / vertical sampling ratioTq_i: Costing table assignment selector
Each frame may consist of several scans containing encoded image data for at least one color component. Each SOS header (start of scan) announces which components (components) will be part of a particular scan. For each component, one of the previously declared identifiers ( C_i) is used as a backlink ( Cs_j, scan component selector). There are very few restrictions in the standard (B.2.3 header header syntax):
Rule 1:
Each Cs_jmust match one of the values C_ispecified in the frame header, and the ordering in the scan header must match the order in the frame header. If Ns> 1, the order of the alternating components in the MCU is Cs_1first, Cs_2second, etc.
2:
Cs_j Cs_1 Cs_j-1.
:
- 1 (, R | G | B , B | G | R ). , ( ) -B, scan-G, scan-R, scan-R, scan-G, scan-B?
- ? R | G | B, , scan-R | B, scan_G?
- Why are the components in the scan referenced by their identifier (
C_i) and not their indexes ( i) in the frame header? Are there any restrictions on identifiers that go beyond uniqueness, or are they really valid for declaring R: C_0 = 255, G: C_1 = 3, B: C_2 = 250?
source
share