Abstract:
A method is provided for parsing closed captioning data (or other types of like embedded data, such as extended service data) encoded according to one of at least three syntaxes. An encoded video signal is received which is hierarchically organized into picture sections of a picture layer. Each picture section contains an encoded picture and at least one corresponding user data section. A beginning of a sequence of bits of the user data section is identified within one of the picture sections. If the identified sequence of bits contains either undefined data or closed captioning data encoded according to either a specific first syntax or closed captioning data encoded according to a specific second syntax, but not closed captioning data encoded according to any other syntax, then the following steps are performed. A byte is extracted from a beginning of the sequence representing a user data length. A byte is also extracted following the user data length byte in the sequence, which represents a user data type. A determination is made whether or not the user data length byte equals a first predefined constant or a second predefined constant, indicating the presence of two closed captioning bytes according to the first and second syntaxes, respectively. If so, then a determination is made as to whether or not the user data type byte equals a third predefined constant. If both these determinations are made in the affirmative, then immediately following the user data type byte in the sequence, two closed captioning bytes are extracted for the corresponding picture. An apparatus for performing the method is also disclosed.

Description:
FIELD OF THE INVENTION 
     The present application pertains to decoding closed captioned text in an encoded video signal, such as an MPEG-2 encoded video signal. 
     BACKGROUND OF THE INVENTION 
     Closed captioning is an auxiliary data signal that is transmitted with a video signal indicating text that can be displayed on a display monitor. Closed captioning is most frequently used to provide a textual description of audible sounds (most notably, a transcript of spoken words) supplied with the video signal to aid hearing impaired viewers of video programs to experience an otherwise imperceptible audio portion of video programs. 
     Since 1992, all television sets in the United States measuring thirteen inches or more diagonally have been required to decode and to display closed captioning text on the television display screen. Furthermore, all broadcasting television equipment used in all television broadcast applications (i.e., satellite, cable television, and terrestrial broadcast) must carry the closed-captioning text end-to-end (whenever present). 
     The vertical blanking interval of a broadcast analog video signal can carry up two octets (bytes) of closed captioning or &#34;extended data service (&#34;EDS&#34; or XDS&#34;)of data per field. The first field of each frame is used for carrying closed captioning data bytes and the second field of each frame is used for carrying XDS data bytes. (While the invention is illustrated herein for closed-captioning data, it is equally applicable to XDS data.) As such, up 120 bytes of XDS data and closed captioning text may be broadcast each second (for NTSC standard video signals). 
     MPEG-1 and MPEG-2 are popular standards for encoding digital video signals. See ISO\IEC 13818-1,2,3 Information Technology--Generic Coding of Moving Pictures and Associated Audio: Systems, Video and Audio, Nov. 11, 1994 (&#34;MPEG-2&#34;)and ISO\IEC 11172-1,2,3 1993, Information Technology--Coding of Moving Pictures and Associated Audio for Digital Storage Media at up to about 1.5 Mbit/s-Parts 1,2,3: Systems, Video and Audio (&#34;MPEG-1&#34;). The MPEG standards specify syntaxes and semantics for formatting compressed video and audio and for decoding and recovering the video and audio for synchronized presentation. Video encoding includes dividing a picture (field or frame) into macroblocks or 16×16 arrays of luminance data and each chrominance block (or 8×8 array of data) that overlies each 16×16 array of luminance data. Some macroblocks are inter-picture motion compensated. The blocks of the motion compensated macroblocks, and the blocks of the non-motion compensated macroblocks, are then discrete cosine transformed, quantized, zig-zag (or alternate) scanned into a sequence, run-level encoded and then variable length encoded. 
     The MPEG-1 and MPEG-2 syntaxes specify a hierarchical organization for formatting a compressed video bitstream. Levels or layers in the hierarchy are provided for each of the following: a sequence of pictures, a group of pictures in the sequence, a picture in a group, a slice (or contiguous sequence of macroblocks) in a picture, a macroblock of a slice and a block of a macroblock. A header is provided for the sections of the bitstream corresponding to each of the sequence, group of pictures, and picture layers of the hierarchy. Other preliminary information similar to a header is inserted before the sections of each of the slice (e.g., slice --  start --  code) and macroblock (e.g., macroblock --  address --  increment and macroblock --  type) layers. Other (optional) sections may be inserted into the sequence sections of the sequence layer (e.g., sequence extension, sequence displayable extension, sequence scalable extension, and user data(0)), the group of pictures sections of the group of pictures layer (e.g., extension data (1) and user data (1)) or the picture sections of the picture layer (e.g., picture coding extension, quant matrix extension, picture displayable extension, picture temporal scalable extension, picture spatial scalable extension, copyright extension, and user data (2)). An example of a picture section includes a picture header, a user data(2) section and compressed data for one picture formatted into multiple slice, macroblock and block sections. 
     MPEG defines no manner for carrying closed-captioning data. As such, there are at least four different syntaxes for carrying closed captioning data in the user data (2) section of a picture section. One or more of the syntaxes can also be used for formatting XDS data, which is an infrequently used additional pair of bytes carried in the odd field of a frame. These syntaxes are set forth in Tables 1-4 below. Below, nextbits() is a function that examines a number of bits in a sequence, &#34;uimsbf&#34; means &#34;unsigned integer, most significant bit first&#34; and &#34;bslbf&#34; means &#34;bit string, leftmost bit 
     
                                           TABLE 1__________________________________________________________________________Syntax 1Field name      # of Bits Mnemonic__________________________________________________________________________picture.sub.-- user.sub.-- data() { user.sub.-- data.sub.-- start.sub.-- code           32 while (nextbits() != 0x000001) {  user.sub.-- data.sub.-- length           8         uimsbf  user.sub.-- data.sub.-- type           8         uimsbf  if (user.sub.-- data.sub.-- type == 0xff) {   next.sub.-- user.sub.-- data.sub.-- type           8         uimsbf  }  if (user.sub.-- data.sub.-- type == 0x09) {   cc.sub.-- data.sub.-- bytes           8*2       uimsbf  } else  if (user.sub.-- data.sub.-- type == 0x0a) {   eds.sub.-- data.sub.-- bytes           8*2       uimsbf  } else  if (user.sub.-- data.sub.-- type == 0x02 ∥  .sup. user.sub.-- data.sub.-- type == 0x04)   reserved     8*user.sub.-- data.sub.-- length-1                     uimsbf  else   reserved     8*user.sub.-- data.sub.-- length                     uimsbf }where: user.sub.-- data.sub.-- start.sub.-- code      is the start code sequence defined in MPEG indicating that a      user      data section follows. user.sub.-- data.sub.-- type      is an indication of the type of data stored in the field.      User.sub.-- data.sub.-- types specified by the constants 0x09      and 0x0a indicate      closed captioning data. Other types are defined but are not      discussed herein. user.sub.-- data.sub.-- length      is the number of data bytes following user.sub.-- data.sub.--      type before the      next user.sub.-- data.sub.-- length field, unless user.sub.--      data.sub.-- type is the constant      0x02 or the constant 0x03, in which case user.sub.-- data.sub.-      - length is the      number of data bytes following user.sub.-- data.sub.-- length      before the next      user.sub.-- data.sub.-- length field. cc.sub.-- data.sub.-- bytes      are two bytes of closed captioning data. eds.sub.-- data.sub.-- bytes      are two bytes of EDS data which are treated as closed      captioning      data herein.__________________________________________________________________________ 
    
     
                       TABLE 2______________________________________Syntax 2                            Mne-Field name        # of Bits      monic______________________________________picture.sub.-- user.sub.-- data() { user.sub.-- data.sub.-- start.sub.-- code             32 while (nextbits() != 0x000001) {  user.sub.-- data.sub.-- length             8              uimsbf  user.sub.-- data.sub.-- type             8              uimsbf  if (user.sub.-- data.sub.-- type == 0xff) {   next.sub.-- user.sub.-- data.sub.-- type             8              uimsbf  }  if (user.sub.-- data.sub.-- type == 0x09) {   cc.sub.-- data.sub.-- bytes             8*(user.sub.-- data.sub.-- length-1)                            uimsbf  } else  if (user.sub.-- data.sub.-- type == 0x0a) {   eds.sub.-- data.sub.-- bytes             8*(user.sub.-- data.sub.-- length-1)                            uimsbf  } else   reserved       8*(user.sub.-- data.sub.-- length-1)                            uimsbf }______________________________________ 
    
     
                                           TABLE 3__________________________________________________________________________Syntax 3Field name         # of Bits                   Mnemonic__________________________________________________________________________user.sub.-- data() { user.sub.-- data.sub.-- start.sub.-- code              32   bslbf ATSC.sub.-- identifier = `0x4741 3934`              32   bslbf user.sub.-- data.sub.-- type.sub.-- code              8    uimsbf if (user.sub.-- data.sub.-- type.sub.-- code == 0x03){  process.sub.-- em.sub.-- data.sub.-- flag              1    bslbf  process.sub.-- cc.sub.-- data.sub.-- flag              1    bslbf  additional.sub.-- data.sub.-- flag              1    bslbf  cc.sub.-- count  5    uimsbf  em.sub.-- data   8    bslbf  for (i=0; i&lt;cc.sub.-- count; i++){    marker.sub.-- bits=`11111`              5    bslbf    cc.sub.-- valid              1    bslbf    cc.sub.-- type 2    bslbf    cc.sub.-- data.sub.-- 1              8    bslbf    cc.sub.-- data.sub.-- 2              8    bslbf  }  marker.sub.-- bits=`1111 1111`              8    bslbf  if(additional.sub.-- data.sub.-- flag){   while {nextbits() != `0000   0000 0000 0000 0000 0001`){    additional.sub.-- user.sub.-- data              8   }  } }where: ATSC.sub.-- identifier       is a constant defined to be `0x4741 3934`. user.sub.-- data.sub.-- type.sub.-- code       is defined to be the constant 0x03. process.sub.-- em.sub.-- data.sub.-- flag       is a flag indicating the need to process emergency broadcast       message data. process.sub.-- cc.sub.-- data.sub.-- flag       is a flag indicating the need to process closed captioning       data. additional.sub.-- data.sub.-- flag       is a flag indicating the presence of additional data. cc.sub.-- count       is a counter indicating the number of pairs of closed       captioning bytes present. em.sub.-- data       is the emergency broadcast data. cc.sub.-- valid       is a flag indicating that there is valid closed captioning       data       in this user data section. cc.sub.-- type       denotes the type of closed captioning data present and       follows the convention set forth in EIA, Recommended       Practice for Advanced Television Closed Captioning, draft       July 1, 1994. `00` denotes closed captioning, `01` denotes       XDS, `10` denotes ATVCC Channel Packet Data and `11`       denotes ATVCC Channel Packet Start. Note that cc.sub.--       type&#39;s       `10` and `11` are defined for HDTV only. However, the       invention described herein can nevertheless parse such       information.cc.sub.-- data.sub.-- 1       are the closed captioning data bytes for this picture (and,cc.sub.-- data.sub.-- 2       when cc.sub.-- count&gt;1, the closed captioning data bytes for       other omitted, subsequent pictures).__________________________________________________________________________ 
    
     
                                           TABLE 4__________________________________________________________________________Syntax 4Field name         # of Bits                   Mnemonic__________________________________________________________________________picture.sub.-- user.sub.-- data() { user.sub.-- data.sub.-- start.sub.-- code              32   bslbf user.sub.-- data.sub.-- type.sub.-- code              8    uimsbf if (user.sub.-- data.sub.-- type.sub.-- code == 0x03){  reserved         7    bslbf  valid.sub.-- flag              1    bslbf  if(valid.sub.-- flag == 0x01){   cc.sub.-- count 5    uimsbf   for (i=0; i&lt;cc.sub.-- count; i++){    reserved       2    bslbf    cc.sub.-- type 2    bslbf    reserved       5    bslbf    cc.sub.-- data.sub.-- 1              8    bslbf    cc.sub.-- data.sub.-- 2              8    bslbf    `1` (marker bit)              1    bslbf   }  } } reserved          n    bslbf next.sub.-- start.sub.-- code()where: user.sub.-- data.sub.-- type.sub.-- code       is defined to be the constant `0x3`. valid.sub.-- flag       is a flag indicating when the closed captioning data is       valid.cc.sub.-- type       is `01` for closed captioning data and `10` for XDS data.next.sub.-- start.sub.-- code()       is the next MPEG compatible start code.__________________________________________________________________________ 
    
     For purposes of identifying closed captioning data, syntax 2 is very similar to syntax 1. The differences are as follows. In syntax 1, one or more data groups follow the user --  data --  start --  code, where each data group includes a user --  data --  length, a user --  data --  type and two closed captioning bytes. However, the user --  data --  length of each data group is always the constant 0x03 because the length of the one byte field user --  data --  type, which precedes each pair of closed captioning bytes, is added to the length of the closed captioning bytes. In syntax 2, data groups containing user --  data --  type&#39;s 0x09 and 0x0a can have either two or four closed captioning bytes. The first pair of bytes corresponds to the same picture (i.e., frame) containing the user data section in which the closed captioning bytes are found. The second pair of closed captioning bytes correspond to a subsequent picture which was contained in the original unencoded picture sequence but was omitted from the encoded video signal (e.g., because the subsequent frame was a repeat field, detected during an inverse telecine process of the encoding, or for some other reason). 
     Considering the different closed captioning methods employed, there is no guarantee that a decoder will be able to parse the closed captioning data. This makes it is difficult to manufacture interoperable encoding and decoding equipment. Furthermore, it is a non-trivial task to determine in real time which syntax has been used for encoding the closed captioning data at the time of decoding. 
     It is therefore an object of the present invention to overcome the disadvantages of the prior art. 
     SUMMARY OF THE INVENTION 
     This and other objects are achieved according to the present invention. According to one embodiment, a method is provided for parsing closed captioning (or extended data service) data encoded according to one of at least three syntaxes (e.g., four syntaxes). An encoded video signal is received which is hierarchically organized into picture sections of a picture layer. Each picture section contains an encoded picture and at least one corresponding user data section. A beginning of a sequence of bits of the user data section is identified within one of the picture sections. If the identified sequence of bits contains either undefined data or closed captioning data encoded according to either a specific first syntax or closed captioning data encoded according to a specific second syntax, but does not contain closed captioning data encoded according to any other syntax, then the following steps are performed. A byte is extracted from a beginning of the sequence representing a user data length. A byte is also extracted following the user data length byte in the sequence, which represents a user data type. A determination is made whether or not the user data length byte equals a first predefined constant or a second predefined constant, indicating the presence of two closed captioning bytes according to the first and second syntaxes, respectively. If so, then a determination is made as to whether or not the user data type byte equals a third predefined constant. If both these determinations are made in the affirmative, then immediately following the user data type byte in the sequence, two closed captioning bytes are extracted for the corresponding picture. 
     Illustratively, a determination can be made that closed captioning text, if present at all, must be formatted according to either the first or second syntax through process of elimination regarding the other permissible syntaxes. For example, prior to extracting the user data length byte, a determination can be made that the closed captioning data is encoded according to a specific third syntax if the first thirty-two bits of the sequence equals a fifth predefined constant. In addition, e.g., if this is untrue, a determination can be made that the subsequence contains closed captioning text encoded according to a specific fourth syntax if the first byte of the sequence of bits equals a sixth predefined constant and the next byte of the sequence of bits is different from both the first predefined constant and a seventh predefined constant. 
     The specific methodology according to the invention works because of certain discoveries regarding similarities and distinguishing features of the syntaxes, and regarding similar encoding habits of currently available encoders, which allows for a compact and simple deterministic parsing methodology. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     FIG. 1 shows a an encoding and decoding system according to an embodiment of the present invention. 
     FIG. 2 shows a re-encoding system according to an embodiment of the present invention. 
     FIGS. 3A-3B shows the method steps used to parse the closed caption data according to an embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The invention is illustrated below in an application where closed captioning text is encoded (i.e., formatted) according to one of four syntaxes and is embedded in a user data section of a picture section of an MPEG-2 encoded video signal. However, the present invention is applicable to a signal encoded according to one of multiple incompatible syntaxes which is embedded in a video signal encoded according to another standard. In particular, except where it is explicitly or implicitly used to refer to only closed captioning data, the term &#34;closed captioning data&#34; should be construed to mean other similar types of data embedded in video signals in a like fashion, most notably, XDS data. 
     FIG. 1 shows a system 100 according to an embodiment of the invention. The system 100 includes a video source 102, such as a video tape player/recorder, video camera, video editor, video magnetic or optical disk player/server, or the like. A video signal V outputted from the video source 102 is encoded by the video encoder 104. Illustratively, the video encoder 104 includes one or more suitably programmed DV Expert™ video encoder integrated circuits acting in concert, which are distributed by C-Cube Microsystems, Inc.™, a company located in Milpitas, Calif.. The video encoder 104 is shown as having three elements, namely, a video compressor 114, a closed captioning extractor 116 and a formatter 118. The video compressor 114 is for compressing the picture data of the video signal V (e.g., according to the MPEG-2 standard) to produce a compressed video signal V&#39;. The closed captioning extractor 116 is for extracting closed captioning data, XDS data, emergency broadcast data, or the like (collectively referred to herein as closed captioning data CC). The formatter 118 is for forming an encoded video signal according to the MPEG-2 syntax. Illustratively, the formatter 118 inserts the closed captioning data CC associated with each picture into a user data section of the picture section that also contains the compressed picture data for that corresponding picture. If the corresponding picture is omitted, the closed captioning data CC may be placed into the user data section of a preceding picture which is encoded and inserted into the encoded video signal. Note that even if no closed captioning data CC is present, the formatter 118 is still needed to format the parameters, flags and data of the compressed video signal V&#39; according to the syntax of the video encoding standard. 
     The encoded video signal is received by a transmitter or recorder 106, which may be a broadcast modulator, ATM SAR, magnetic or optical disk recorder, a video tape recorder or the like. The transmitter/recorder 106 transfers the encoded video signal to a storage/transmission medium 108 which can be the air, space, wires, optical fibers, a magnetic or optical disk, a magnetic tape or the like. 
     A receiver/player 110, which can be a tuner, a demodulator, an ATM SAR, a magnetic or optical disk player or the like receives or plays back the encoded video signal. The encoded video signal is fed to a video decoder 112 which decodes the video signal to produce a reconstructed video signal. The video decoder 112 may be implemented using one or more suitably programmed AViA™ video decoder integrated circuits, distributed by C-Cube Microsystems™, or one or more suitably programmed DV Expert™ video encoders. Depending on the resolution of the video signal, a single DV Expert™ video encoder may be used as both the video encoder 104 and the video decoder 112. 
     The video decoder 112 is shown as including three elements, namely, a parser 120, a video decompressor 122 and a graphics overlay generator 124. The parser 120 separates the compressed video signal V&#39; and the closed captioning data CC. Note that a parser 120 is needed in a video decoder whether or not closed captioning data is present to parse the compressed video data, parameters and flags in the encoded video signal. The video decompressor 122 decompresses the compressed video signal V&#39; outputted from the parser 120 to produce a reconstructed version of the video signal. In particular, if the video decompressor 122 detects a repeat --  first --  field --  flag then a copy of a corresponding, previously decoded picture (e.g., the first presented field of the frame reconstructed from encoded picture data of a picture section which also contains the repeat --  first --  field flag) is inserted into the sequence of outputted displayed pictures. The graphics overlay generator 124 converts the closed captioning data to text and overlays the closed caption data on the reconstructed video signal to produce an outputted video signal V&#34;.In so doing, the graphics overlay generator 124 may overlay text generated from (a second pair of) data bytes extracted from the user data section of one picture section on the (above-noted) repeated copy of the picture decoded from that same picture section and inserted into the sequence of decoded, displayed pictures in response to the repeat --  first --  field flag. Illustratively, the overlaying of closed captioning data can be suppressed at the option of the user. 
     The system 100 is simply an illustrative system in which the invention may be applied. In another system 200 shown in FIG. 2, a re-encoder 150, such as a suitably programmed DV Expert™ video encoder receives an already encoded video signal. Such a re-encoder 150 has a parser 120 and a formatter 118&#39;. The parser 120 of the re-encoder 150 simply separates the closed captioning CC data from the (user data section of the picture section of each encoded picture of the) encoded video signal V&#39;. The closed captioning data CC may have been encoded according to one of multiple incompatible syntaxes. The closed captioning data CC is provided to the formatter 118&#39; which encodes the closed captioning data only according to a single predetermined syntax. In so doing, an adjustment might need to be made to the number of bits of each picture, e.g., by adding or deleting stuffing data from each modified picture. As such, the re-encoder 150 receives a video signal with closed captioning data encoded according to any one of multiple syntaxes but outputs a video signal with closed captioning data encoded according to only a particular preselected syntax (which advantageously can be varied or changed). Such a reencoding system 200 may be useful in an application where it is known ahead of time that the decoder equipment 112 already deployed can only decode closed captioning data according to the single preselected syntax but not other syntaxes. 
     As mentioned above, closed captioning data may be encoded, i.e., formatted, according to one of multiple syntaxes. Illustratively, the parser 120 according to the invention can parse closed captioning data according to one of multiple incompatible syntaxes in a deterministic fashion. To understand why this is possible, consider the following heretofore undiscovered properties pertaining to the above-described (Tables 1-4), mutually incompatible closed captioning syntaxes: 
     (1) Syntaxes 1 and 2 have very similar formats but use distinctly different user --  data --  length values. Specifically, for closed captioning data, the only permissible user --  data --  length in syntax 1 is 0x03 and the only permissible user --  data --  length&#39;s in syntax 2 are 0x02 and 0x04; 
     (2) Syntaxes 1 and 2 use the same conventions for user --  data --  type identification of closed captioning data; 
     (3) When using syntaxes 1 and 2, all currently available program encoders insert the closed captioning data in the user data section in advance of any additional data contained therein; 
     (4) Syntax 3 has a unique ATSC --  identifier which can be used to distinguish data formatted according to syntax 3 over syntaxes 1, 2 and 4; and 
     (5) The user --  data --  type --  code of syntax 4 could be confused with the user --  data --  length of syntax 1 (they are both 0x03); however, the byte following this user --  data --  type --  code is always either `f` or `e` which cannot be confused with the user --  data --  type of syntax 1 as `f` and `e` are not permissible values for user --  data --  type in syntax 1. 
     Given these considerations, a parser can be constructed to evaluate the below noted syntax description of Table 5. The parser may be implemented using finite state automata. Preferably, however, the parser is implemented using a suitably programmed digital signal processor such as a AViA™ video decoder or a DV Expert™ video encoder. 
     
                                           TABLE 5__________________________________________________________________________Omnibus CC Parsing SyntaxField name        # of Bits  Mnemonic__________________________________________________________________________picture.sub.-- user.sub.-- data() { user.sub.-- data.sub.-- start.sub.-- code             32         bslbf if (nextbits() == `0x4741 3934`)  ATSC.sub.-- identifier             32         bslbf  user.sub.-- data.sub.-- type.sub.-- code             8          uimsbf  process.sub.-- em.sub.-- data.sub.-- flag             1          bslbf  process.sub.-- cc.sub.-- data.sub.-- flag             1          bslbf  additional.sub.-- data.sub.-- flag             1          bslbf  cc.sub.-- count 5          uimsbf  em.sub.-- data  8          bslbf  for (i=0; i&lt;cc.sub.-- count; i++) {    marker.sub.-- bits=`1111 1`             5          bslbf    cc.sub.-- valid             1          bslbf    cc.sub.-- type             2          bslbf    cc.sub.-- data.sub.-- 1             8          bslbf    cc.sub.-- data.sub.-- 2             8          bslbf  }  marker.sub.-- bits=`1111 1111`             8          bslbf  if (additional.sub.-- data.sub.-- flag) {   while (nextbits() != `0000   0000 0000 0000 0000 0001`){    additional.sub.-- user.sub.-- data             8   }  } } else if (nextbits()== 0x03){  if (nextbits() != 0x030a &amp;&amp;   nextbits() != 0x0309) {    user.sub.-- data.sub.-- type.sub.-- code             8          bslbf    reserved      7          bslbf    cc.sub.-- valid             1          bslbf    cc.sub.-- count             5          uimsbf    for (i=0; i&lt;cc.sub.-- count; i++) {reserved     2          bslbfcc.sub.-- type             2          bslbfreserved     5          bslbfcc.sub.-- data.sub.-- 1             8          bslbfcc.sub.-- data.sub.-- 2             8          bslbf`1` (marker bit)             1          bslbf    }    while (nextbits() != `0000    0000 0000 0000 0000 0001`) {reserved     8          bslbf    }  } } else{  user.sub.-- data.sub.-- length             8          uimsbf  user.sub.-- data.sub.-- type             8          uimsbf  syntax = unknown  if (user.sub.-- data.sub.-- type == 0x09 ∥  user.sub.-- data.sub.-- type == 0x0a) {   if (user.sub.-- data.sub.-- length == 0x03)    syntax = 1   else    syntax = 2  }  if ((user.sub.-- data.sub.-- length == 0x02 ∥user.sub.-- data.sub.-- length == 0x03) &amp;&amp;user.sub.-- data.sub.-- type == 0x09) {   cc.sub.-- data.sub.-- 1             8          bslbf   cc.sub.-- data.sub.-- 2             8          bslbf  }  else if (user.sub.-- data.sub.-- length == 0x04&amp;&amp; user.sub.-- data.sub.-- type == 0x09) {   cc.sub.-- data.sub.-- 1 (first frame)             8          bslbf   cc.sub.-- data.sub.-- 2 (first frame)             8          bslbf   cc.sub.-- data.sub.-- 1 (second frame)             8          bslbf   cc.sub.-- data.sub.-- 2 (second frame)             8          bslbf  }  else if (user.sub.-- data.sub.-- type == 0x02 ∥   user.sub.-- data.sub.-- type == 0x03) {   reserved       8*5        bslbf  } else {   if (syntax == unknown)    PROTOCOL ERROR   if (syntax == 1)    reserved      8*(user.sub.-- data.sub.-- length-1)                        bslbf   if (syntax == 2)    reserved      8*user.sub.-- data.sub.-- length                        bslbf  }  while(nextbits() != `0000 0000 0000   0000 0000 0001`) {   reserved       8          bslbf  } }where: ATSC.sub.-- identifier       is 0x4741 3934 from the ATSC specification. All other       values are illegal. user.sub.-- data.sub.-- type.sub.-- code       is 0x03 from the ATSC specification. All other values are       illegal. process.sub.-- em.sub.-- data.sub.-- flag       is ignored. Emergency broadcast messaging is not       supported via this syntax. process.sub.-- cc.sub.-- data.sub.-- flag       is ignored. If closed captioning data is non-zero, then       closed captioning data is processed. additional.sub.-- data.sub.-- flag       is ignored. If extra data follows the closed captioning data       within the user data section, it is ignored. cc.sub.-- count       specifies the number of closed captioning byte pairs that       follow. cc.sub.-- valid       is ignored. cc.sub.-- type       is `01` for closed captioning data and `10` for XDS data. cc.sub.-- data.sub.-- 1, cc.sub.-- data.sub.-- 2       are two closed captioning bytes associated with a picture.       For frame pictures that carry more than one pair, the first       pair is assumed to correspond to the encoded picture also       contained in the picture section in which these closed       captioning bytes are found and the second pair is assumed       to correspond to a subsequent, omitted picture. marker.sub.-- bits       are ignored. additional.sub.-- user.sub.-- data       is ignored.__________________________________________________________________________ 
    
     The above syntax diagram can be implemented in a processor or finite state automata as follows. The function nextbits() can be implemented as a comparison of a certain number of bits, at the beginning of the sequence of bits in the user data(2) section of the picture section, with a specified value. Such a comparison can be achieved using an appropriate comparator logic circuit or arithmetic logic unit (e.g., of a processor executing suitable software or firmware). The number of bits compared in the function equals the number of bits of the value with which the comparison is made. Each assignment statement can be implemented by extracting a specified number of bits (specified by the mnemonic column), i.e., setting a corresponding variable equal to that value and advancing a pointer, which points to the beginning of the parsed sequence of bits in the user data section, by the same number of bits. This can be accomplished, for example, with a shift register (or barrel shifter) that selects a desired window of bits in the sequence of bits of the user data section of the picture section and a register or memory which stores the selected window of bits. If the extracted sequence of bits are ignored or not used, the extraction may simply comprise the step of advancing the pointer by, or shifting out, the requisite number of bits and discarding the shifted out bits or bits bypassed in advancing the pointer. 
     The following is a brief description of an implementation of the syntax. First, the parser 120 identifies the user data (2) section (step S1) (referred to in the syntax as &#34;picture --  user --  data()&#34;). This can be achieved as follows. The parser 120 scans the received sequence of bits for the unique section start code prefix `0000 0000 0000 0000 0000 0001` followed by the start code value 0x00 for a picture. Then while scanning the picture section that follows, the parser 120 encounters another unique start code prefix followed by the start code value 0xB2 for a user data section. When this occurs, the parser 120 extracts the user --  data --  start --  code (the start code prefix and the start code value for the user data section) from the sequence. Next, the parser 120 determines whether the closed captioning data is encoded according to the above-noted third syntax (Table 3) by determining if the thirty-two bits at the beginning of the sequence (i.e., following the user --  data --  start --  code) is the value 0x4741 3934 (step S2). If not, then the parser 120 determines that the user data section does not contain data according to the third syntax and the parser 120 continues to parse as per the first else statement, namely, the statement &#34;else if (nextbits()=0x03){&#34;. 
     If the next thirty-two bits are the constant 0x4741 3934, then the parser 120 extracts (and discards) these thirty-two bits as the ATSC identifier (step S3). Next, the parser 120 extracts a subsequence of five bits representing the cc --  count which five bits are offset from the beginning of the sequence by eleven bits (corresponding to the extracted and discarded values user --  data --  type --  code, process --  em --  data --  flag (step S4), process --  cc --  data --  flag and additional --  data --  flag). The parser 120 identifies the first closed caption data, namely, cc --  data --  1, offset from the cc --  count by sixteen bits (corresponding to the extracted and discarded em --  data byte, the first set of eight marker --  bits, and the first cc --  valid bit and the extracted first cc --  type pair of bits). Next, for each iteration indicated by cc --  count, the parser 120 extracts two closed captioning bytes, namely, cc --  data --  1 and cc --  data --  2 (step S5). Note that the second pair of closed captioning data bytes is offset from the first pair of closed captioning data bytes by an offset of eight bits (corresponding to the extracted next occurrence of the marker bits, cc --  valid bit and cc --  type bits, the marker and cc --  valid bits being discarded). Then, the parser 120 may extract (and discard) another eight marker bits as well as each additional --  user --  data byte until the next MPEG-2 start code (i.e., 0000 0000 0000 0000 0000 0001) (step S6). 
     Assume now that the first thirty-two bits did not match the ATSC --  identifier constant. The parser 120 determines if the closed captioning data complies with the above-noted fourth syntax (Table 4) by determining if the next byte at the beginning of the sequence matches the value 0x03, but that the second byte does not match either the constant 0x0a or the constant 0x09 (step S7). Note that the patterns 0x030a and 0x0309 are two-byte patterns which may be found at the beginning of closed caption data encoded according to the first syntax (table 1). However, such two-byte patterns never occur at the beginning of closed captioning data encoded according to the third syntax because the value 0x03 is always followed by the value `0x ff` or `0fe` (by virtue of the seven reserved bits followed by the cc --  valid bit). If the next byte is 0x03 but the byte which follows the next byte is not 0x0a or 0x09 then the parser 120 extracts and discards the user --  data --  type --  code byte and extracts a five bit sequence representing the cc --  count offset from the beginning of the user --  data --  type --  code by eight bits (corresponding to the extracted and discarded reserved bits and cc --  valid bit (step S4)). The parser 120 identifies the first closed captioning byte cc --  data --  1 at an offset of nine bits from the cc --  count (corresponding to the extracted and discarded two reserved bits, the extracted two cc --  type bits and the extracted and discarded following five reserved bits). For each count of cc --  count, the parser extracts two closed captioning bytes, namely, cc --  data --  1 and cc --  data --  2 (step S5). Note that a successive pair of closed captioning bytes are separated from a previous pair of closed captioning bytes by an offset of ten bits (namely, the extracted and discarded marker bit, the extracted and discarded next two reserved bits, the extracted next two cc --  type bits and the extracted and discarded next five reserved bits). Afterward, the parser 120 extracts and discards each reserved byte until the next MPEG-2 start code (step S6). 
     If the closed captioning data is not encoded according to any of the other syntaxes previously described, then the parser 120 presumes that closed captioning data is encoded according to either the first syntax (table 1) or the second syntax (table 2) (if encoded according to any predefined syntax). Thus, the parser 120 extracts the next byte at the beginning of the sequence as the user --  data --  length and the parser 120 extracts the following byte as the user --  data --  type (step S8). The parser 120 then compares the user --  data --  type to the constants 0x0a and 0x09 (step S9). If the parser 120 detects that the user --  data --  type is equal to the constant 009 or the constant 0x0a then the parser 120 can determine, with certainty, which of the first and second syntaxes were used for formatting the closed captioning data. Specifically, the parser 120 can determine that the closed captioning data is encoded according to the first syntax (step S11) if the user --  data --  length is the constant 0x03 (step S10) and according the second syntax otherwise (step S12). 
     The parser 120 then determines if the user --  data --  length is the same as the constant 0x02 or the constant 0x03. If the parser 120 detects that the user --  data --  length is 0x02 or 0x03, then the parser 120 determines if the user --  data --  type is the same as 0x09 (step S13). If both comparisons result in a match, the parser 120 extracts a pair of closed captioning bytes cc --  data --  1 and cc --  data --  2 (step S14). 
     If a match cannot be found in either determination, the parser 120 determines if the user --  data --  length is the same as the constant 0x04 and if user --  data --  type is the same as the constant 0x09 (step S15). If so, then the parser 120 extracts two pairs of closed captioning data bytes, namely, cc --  data --  1 and cc --  data --  2 for this frame and cc --  data --  1 and cc --  data --  2 for the next frame (step S16). In this case, the &#34;next frame&#34; is an omitted picture, such as a repeat field. 
     On the other hand, if the user --  data --  length does not match 0x04 or the user --  data --  type does not match 0x09, the parser 120 determines if the user --  data --  type is the same as the constant 0x02 or the constant 0x03 (step S17). If so, then the parser 120 extracts five reserved bytes and discards them (step S18). 
     If not, then if the syntax is unknown the parser 120 signals an error (step S19). Otherwise, if the parser 120 had determined that the closed captioning data is encoded according to the first syntax but a combination of user --  data --  type and user --  data --  length other than those set forth above occurs (step S20), then the parser 120 simply extracts and discards the respective number of bytes indicated by the user --  data --  length less one (step S21). If the syntax was determined to be the second syntax, but a combination of user --  data --  type and user --  data --  length other than those set forth above occurs, the parser 120 simply extracts and discards a number of bytes indicated by user --  data --  length (step S22). Finally, the parser 120 extracts and discards each byte afterward until the next MPEG-2 start code (step S6). 
     The above discussion is merely illustrative of the invention. Those skilled in the art may devise numerous alternative embodiments without departing from the spirit and scope of the invention.