ITU T.87 JPEG LS Standard and sample .jls SOS encoded streams have no escape sequence 0xFF 0x00

93 views Asked by At

ITU T.81 states the following:

B.1.1.2 Markers Markers serve to identify the various structural parts of the compressed data formats. Most markers start marker segments containing a related group of parameters; some markers stand alone. All markers are assigned two-byte codes: an X’FF’ byte followed by a byte which is not equal to 0 or X’FF’ (see Table B.1). Any marker may optionally be preceded by any number of fill bytes, which are bytes assigned code X’FF’. NOTE – Because of this special code-assignment structure, markers make it possible for a decoder to parse the compressed data and locate its various parts without having to decode other segments of image data. "

B.1.1.5 Entropy-coded data segments An entropy-coded data segment contains the output of an entropy-coding procedure. It consists of an integer number of bytes, whether the entropy-coding procedure used is Huffman or arithmetic.

NOTES

(1) Making entropy-coded segments an integer number of bytes is performed as follows: for Huffman coding, 1-bits are used, if necessary, to pad the end of the compressed data to complete the final byte of a segment. For arithmetic coding, byte alignment is performed in the procedure which terminates the entropy-coded segment (see D.1.8).

(2) In order to ensure that a marker does not occur within an entropy-coded segment, any X’FF’ byte generated by either a Huffman or arithmetic encoder, or an X’FF’ byte that was generated by the padding of 1-bits described in NOTE 1 above, is followed by a “stuffed” zero byte (see D.1.6 and F.1.2.3).

And in many other places where well known Stuff_0() function is also named.

Not sure where standard ITU T.87 stands in regard to the encoding escape sequence 0xFF 0x00 specified by standard ITU T.81:

  • Standard ITU T.87 it self that do not specify this but expects it. Where Standard test samples are incorrectly formed, clearly do not have encoding escape sequence 0xFF 0x00 in encoded streams. For example 0xFF 0x7F, 0xFF 0x2F, and other sequences can be found in encoded streams of .jsl test samples : namelly "T8C0E3.JLS". And no one saw it all these years;
  • Or if Standard ITU T.87 actually overrides the ITU T.81 regarding this rule for encoded streams and doesn't allow encoding of escape sequence;

In decoder we could make logic to detect decoder errors when 0xFF and !0x00 is to actually use that byte and not skip it if component is not fully decoded. But what if jls file do not have escape sequence and we encounter 0xFF 0x00 sequence should we skip 0x00 byte or not?

Would like some clarification on subject of standard ITU T.87 JPEG-LS encoding, and what is the correct procedure. Should we, or shouldn't we, encode escape sequnce 0xFF 0x00 in encoded streams?

1

There are 1 answers

0
SoLaR On BEST ANSWER

The answer : ITU T.87 - ANNEX A - point A1 Coding parameters and compressed image data - pass 3

Marker segments are inserted in the data stream as specified in Annex D. In order to provide for easy detection of marker segments, a single byte with the value X'FF' in a coded image data segment shall be followed with the insertion of a single bit '0'. This inserted bit shall occupy the most significant bit of the next byte. If the X'FF' byte is followed by a single bit '1', then the decoder shall treat the byte which follows as the second byte of a marker, and process it in accordance with Annex C. If a '0' bit was inserted by the encoder, the decoder shall discard the inserted bit, which does not form part of the data stream to be decoded.

NOTE 2 – This marker segment detection procedure differs from the one specified in CCITT Rec. T.81 | ISO/IEC 10918-1.

JPEG-LS T.87 overrides T.81 JPEG Standard for encoded data stream to have byte 0xFF followed by byte with value between 0x00 and 0x7F (inclusive).