[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ULE-01 : last byte(s) precision



Revised text for next rev. of ULE.

Here is some new text suggested for the procedure for Encapsulation
processing.  This text is based on the long and frustrating thread on "last
byte precision". 

We finally concluded the biggest problem was not with the algorithm, but
with the structure of the document.  I've worker with Hilmar and Alain to
re-order the text from ULE-01 Section 5, and suggest we group all the
paragraphs on encapsulation into one section (see below). If this seems
good, we can group all the Receiver paragraphs similarly and insert a new
section on the Receiver, and then close this thread.

Best wishes,

Gorry

----- 

SNDU Encapsulation

When an Encapsulator has not previously sent a TS Packet for a specific TS
Logical Channel, or after an idle period, it starts to send a SNDU in the
first available TS Packet. This first TS Packet generated MUST carry a PUSI
value of 1. It MUST also carry a Payload Pointer value of zero indicating
the SNDU starts in the first available byte of the TS Packet payload.

The Encapsulation MUST ensure that all TS Packets set the MPEG-2 Continuity
Counter carried in the TS Packet header.  This value MUST be incremented by
one for each TS Packet sent using a TS Logical Channel.

If an Encapsulator decides NOT to immediately send another SNDU, it MUST
transmit an End Indicator directly after the end of the SNDU. This procedure
is known as Padding (figure 10). It informs the Receiver that there are no
more SNDUs in this TS Packet payload. The End Indicator is followed by zero
or more unused bytes until the end of the TS Packet payload. The unused
bytes MUST be set to the value of 0xFF, following current practice in MPEG-2
[ISO-DSMCC]. The padding procedure trades decreased efficiency against
improved latency.

+-------------+
| SubNetwork  |
|      DU 3   |
+-------------+ 
     \        \
       \        \
        \        \
 +------+--------+--------+----------+
 |MPEG-2| End of | 0xFFFF |  Unused  |
 |Header| SNDU 3 |       |  Bytes   |
 +------+--------+--------+----------+

 PUSI=0           End
                  Indicator

Figure 10: A TS Packet carrying the end of SNDU 3, followed by an End
Indicator.

If more packets are waiting at an Encapsulator, and a TS Packet has
sufficient space remaining in the payload, it can follow the encapsulated
SNDU with another SNDU using the next available byte of the TS Packet
payload (see 5.2). This is called Packing (figure 11).

  +------------------+       +------------------+
  |   Subnetwork     |       |   Subnetwork     |
  |      DU 1        |       |      DU 2        |
  +------------------+       +------------------+
             \        \     /          /\
              \        \   /          /  \
                \        \ /          /    \?
 +------+--------+--------+----------+
 |MPEG-2| Payload| end of | start of |
 |Header| Pointer| SNDU 1 | SNDU 2   |
 +------+--------+--------+----------+
            |             ^
 PUSI=1     |             |
           +--------------+

Figure 11: A TS Packet with the end of SNDU 1, followed by SNDU 2.

Procedure for Padding and Packing

Five possible actions may occur when an Encapsulator has completed
encapsulation of an SNDU:

(i) If the TS Packet has no remaining space, the Encapsulator transmits this
TS Packet. It starts transmission of the next SNDU in a new TS Packet. (The
standard rules require the header of this new TS Packet to carry a PUSI
value of 1, and a Payload Pointer value of 0x00.)

(ii) If the TS Packet carrying the final part of a SNDU has one byte of
unused payload, the Encapsulator MUST place the value 0xFF in this final
byte, and transmit the TS Packet. This rule provides a simple mechanism to
resolve the complex behaviour that may arise when the TS Packet has no PUSI
set:  To send another SNDU in the current TS Packet, would otherwise require
the addition of a Payload Pointer that would consume the last remaining byte
of TS Packet payload.  The behaviour follows similar practice for other
MPEG-2 payload types [ISO-DSMCC]. The Encapsulator MUST start transmission
of the next SNDU in a new TS Packet. (The standard rules require the header
of this new TS Packet to carry a PUSI value of 1 and a Payload Pointer value
of 0x00.)

(iii) If the TS Packet carrying the final part of a SNDU has exactly two
bytes of unused payload, and the PUSI was NOT already set, the Encapsulator
MUST place the value 0xFFFF in this final two bytes, providing an End
Indicator, and transmit the TS Packet. This rule prevents fragmentation of
the SNDU Length Field over two TS Packets. The Encapsulator MUST start
transmission of the next SNDU in a new TS Packet. (The standard rules
require the header of this new TS Packet to carry a PUSI value of 1 and a
Payload Pointer value of 0x00.)

(iv) If the TS Packet has more than two bytes of unused payload, the
Encapsulator MAY transmit this partially full TS Packet but MUST first place
the value 0xFF in all remaining unused bytes (i.e. setting an End Indicator
followed by padding). The Encapsulator MUST start transmission of the next
SNDU in a new TS Packet. (The standard rules require the header of this new
TS Packet to carry a PUSI value of 1 and a Payload Pointer value of 0x00.)

(v) If at least two bytes are available for Payload data in the TS Packet
payload (i.e. three bytes if the PUSI was NOT previously set, and two bytes
if it was previously set), the Encapsulator MAY encapsulate further queued
PDUs, by starting the next SNDU in the next available byte of the current TS
Packet Payload. The PUSI MUST be set.  When the Encapsulator packs further
SNDUs into a TS Packet where the PUSI NOT already set, this requires the
PUSI to be updated (set to 1) and an 8-bit Payload Pointer MUST be inserted
in the first byte directly following the TS Packet header. The value MUST be
set to the position of the byte following the end of the first SNDU in the
TS Packet payload. If no further PDUs are available, an Encapsulator MAY
wait for additional PDUs to fill the incomplete TS Packet. The maximum
period of time an Encapsulator can wait MUST be bounded and SHOULD be
configurable by the user. If no additional PDUs are received after this
period of time, it MUST insert an End Indicator instead (using rule iv).

Use of the Packing method by an Encapsulation Gateway is optional, and may
be determined on a per-session, per-packet, or per-SNDU basis.

When a SNDU is less than the size of a TS Packet payload, a TS Packet may be
formed that carries a PUSI value of one and also an End Indicator.