JPEG Codec¶
Version: 1.0
URI: https://awslabs.github.io/osml-imagery-io/codecs/jpeg
Codec type: array-to-bytes
Decodes JPEG DCT streams into NumPy arrays. Handles interleave conversion and color space transformation, producing band-sequential output regardless of the input interleave mode.
This codec is format-agnostic — it decodes any valid JPEG stream regardless of the source container format.
Document Conventions¶
The key words “MUST”, “MUST NOT”, “SHOULD”, and “MAY” in this document are to be interpreted as described in RFC 2119.
Codec Identifier¶
The value of the name member in the codec metadata MUST be
https://awslabs.github.io/osml-imagery-io/codecs/jpeg.
Encoded Representation¶
The encoded representation MUST be a valid JPEG interchange format (JFIF) byte
sequence conforming to ITU-T T.81. The stream begins with an SOI marker (0xFFD8)
and ends with an EOI marker (0xFFD9).
The JPEG data MAY use 8-bit or 12-bit sample precision as indicated by the
bits_per_pixel configuration parameter.
Configuration Parameters¶
Field |
Type |
Required |
Description |
|---|---|---|---|
|
|
Yes |
Bits per pixel: |
|
|
Yes |
Number of bands ( |
|
|
Yes |
Block width in pixels. |
|
|
Yes |
Block height in pixels. |
|
|
Yes |
Interleave mode: |
|
|
Yes |
JPEG color space: |
Algorithm¶
Decoding¶
Decode the JPEG stream using the specified
color_spaceandbits_per_pixel.Convert the decoded pixels from the input
imodeto band-sequential (BSQ) format.Return an array with shape
(num_bands, block_height, block_width)anduint8dtype (oruint16for 12-bit).
Encoding¶
Encoding is not currently specified. See Implementation Notes.
Example Configuration¶
{
"name": "https://awslabs.github.io/osml-imagery-io/codecs/jpeg",
"configuration": {
"bits_per_pixel": 8,
"num_bands": 3,
"block_width": 256,
"block_height": 256,
"imode": "P",
"color_space": "YCbCr601"
}
}
References¶
ITU-T T.81 — Digital compression and coding of continuous-tone still images (JPEG)
RFC 2119 — Key words for use in RFCs to Indicate Requirement Levels
Implementation Notes¶
aws.osml.io.zarr_codecs.JpegCodec — see API Reference.
Only the decode path is implemented. Calling encode() raises NotImplementedError.