Chapter V Video Real-time Data Representations


V.1  General

.1  Introduction


This chapter specifies the  CD-I video functions and  data formats.    The 
organisation of the chapter is as follows. The basic visual structure  and 
properties of images are  defined in section 2.  Section 3 specifies   how 
images are  encoded, including  encoding models  for the  various    image 
coding methods, and provisions for compatibility between 525 line and  625 
line display systems.

Section 4 specifies the  functions of the video  decoder, including    the 
formats of  images  in  memory,  decoding  models  and  display    control 
functions (the Display Control Program, V.4.5). Section 5  specifies   the 
CD-I visual effects, both the primary functions available via the  Display 
Control Program and higher level functions built on  these. Finally,   the 
formats on disc of images and display control  information are   specified 
in section 6.


In this chapter, the terms "path 0" and "path 1" are used  interchangeably 
with the terms  "plane A"  and "plane B".1.2   Bit &  Byte Ordering    and 
Reserved Conventions

Bit Ordering

In this specification, the graphical representation of all    multiple-bit 
quantities is such that the most significant bit is on the left and   the  
least significant bit is on the right.

Example for 8 bits:

    msb                   lsb
    _________________________
    _b7_b6_b5_b4_b3_b2_b1_b0_
    _________________________
    _________ 1 byte ________

where b = bit

Byte Ordering

Quantities which require more than 8 bits for  their represent-ation   are 
held in  more than  one byte  on disc.   For  all such  quantities,    the 
ordering of bytes on disc (as seen at  the interface to the disc   driver) 
is such that the Most Significant Byte is first and the Least   Signicant  
Byte is last.

Multiple-byte quantities  are  represented  graphically  such  that    the 
left-hand-most byte is most significant and the right-hand-most  byte   is 
least significant.

Example - 16 bit quantity:

           MSB                   LSB
_________________________________________________
_b15_      etc.         _        etc.        _b0_
_________________________________________________
_______ 1st byte ______________ 2nd byte ________

Where b = bit

Multiple-byte quantities in memory are represented such that  the   memory 
address of successive bytes increases from left to right.

Reserved


It should be  noted that  all bit fields  that are  reserved contain   the 
symbol _.  These fields are set to zero in the present document.1.3    The 
Video Encoding/Decoding Chain


Figure V.1

__________           DYUV
_Natural _  ________ RGB    Disc        ________  __________
_Images  ____      _ CLUT          Pixel_ Two  ____  Two   _
__________  _Encode_ RL    Form 2  Data _Image _  _ Real-  _
            _      _______ _ _ _ _ ______Stores_  _   time _____
__________  _      _       Form 1       _      _  _Decoders_
_Graphic ____      _       _ _ _ _      _      ____        _
_Images  _  ________       _     _      ________  __________
__________                 _     _          _         _
                           _     _          _ Control _
          Sequencing _______     _          _         _
          and control            _       _________________
          program                _       _    CD-RTOS    _
                                 _________     (UCM)     _
                                         _________________


The Video Encoding/Decoding Chain is shown in Figure  V.1 above.   Natural 
images and graphical images are encoded according to  one of a number   of 
specified methods (DYUV, RGB, Colour Lookup Table (CLUT)  and   Run-length 
(RL)), and the  resultant pixel  data stream is  placed in  Form 2   video 
sectors on  the CD-I  disc along  with Form  1  data sectors    containing 
program data for sequencing and visual effects, and image-related data.

In the player, the  program in conjunction with  the User    Communication 
Manager (UCM, see VII.2.3), loads the pixel data into an image store,  and 
controls its subsequent display via a real-time video decoder. There   are 
two image stores, each  with its own decoder,  to allow two    independent 
image planes.

UCM is specified in  VII.2.3.  The other parts  of the encoder/    decoder 
chain are specified in this chapter.

V.2  Visual Presentation /Image Structure


2.1  General

This section describes the structure of an image as seen by the viewer.

CD-I images are intended to be displayable on standard 525 line (NTSC)  or 
625 line (PAL/SECAM) televisions or monitors.

For 525 line  systems, slightly  different parameters are  specified   for 
monitors and TV sets.  This is in order to allow an optimized display  for 
monitors, while guaranteeing no loss of critical information at the  edges 
of the screen on a TV set.

No matter how the image is stored on  the disc, it is always   displayable 
via all decoders, whether 525 or 625 line.



2.2  Resolution

The displayed image is a rectangular array of  pixels, whose   dimensions, 
timing and  resolution are  optimized to  the target  525  and 625    line 
display systems taking into account the following requirements:

   -        the Base Case System (see Chapter VIII) has a display  screen 
      of normal 'consumer TV'  resolution.

   -        the aspect ratio  of pixels should be  close to unity,    for 
      use with graphical applications

   -        a  specified  'safety  area'  of  the  screen  should    have 
      guaranteed visibility under all circumstances

   -        it should  be possible  to display 525/625  line   compatible 
      images with minimum distortion (<10%)


2.2.1  Normal Resolution

The Normal Resolution full-screen display dimensions for 525 and 625  line 
systems are shown in Figure V.2.  We will  refer to these dimensions    as 
the horizontal and vertical display resolutions.

Figure V.2

____________________________________________________________
_                     _Number of pixels _ Number of pixels _
_      Display        _  horizontally   _    vertically    _
____________________________________________________________
_  525 line monitors  _      360        _       240        _
____________________________________________________________
_  525 line TVs       _      384        _       240        _
____________________________________________________________
_  625 line systems   _      384        _       280        _
____________________________________________________________

The horizontal resolution for 525 line monitors (360)  is less than   that 
for 625 line systems (384) in order to improve the 525 line pixel   aspect 
ratio (see  Figure  V.7) and  to  reduce aspect  ratio  distortion    when 
displaying 525/625 compatible images (Figure V.10).

Also, the horizontal resolution  for 525 line TVs  (384) is greater   than 
that for 525 line  monitors in order to  ensure that the  safety area   is 
always fully displayed under worst-case overscan conditions.

2.2.2  Derived Resolutions


Double Resolution is defined  with twice the horizontal  resolution,   and 
the same  vertical  resolution,  as  Normal  Resolution.   However,    the 
resolution of a Base Case display screen is  not sufficient to display   a 
single pixel with full quality in Double Resolution.   Therefore,   Double 
Resolution is  aimed  at improved  display  of graphical  images  in   the 
following two cases:

-   where Double Resolution  horizontal pixel pairs can  give   increased 
  positional accuracy compared with single Normal Resolution pixels.
    
-   where a single pixel's reduced display quality  in Double  Resolution 
  does not reduce the identifiability of the graphic object or  character 
  (e.g. Kanji) to an unacceptable level .

The display  of  normal and  double  resolution is  illustrated  by    the 
following examples:

      _________            _________           _________
      _   _____            _ _ _____           _ _ _ ___
      _________            _________           _________
      _   _____            _ _____ _           _ _ ___ _
      _________            _________           _________
      _____   _            _____ _ _           _ ___ _ _
      _________            _________           _________
  Normal Resolution    Double Resolution   Double Resolution
   (single pixels)       (pixel pairs)      (single pixels)



High Resolution is defined  with twice the resolution  both   horizontally 
and vertically as Normal  Resolution.  It is intended  for use with   high 
resolution display  screens so  is available  (with one  exception,    see 
V.4.4.9) as an extension only.  Where high resolution is available in  the 
Base Case, it  must be  used with restrictions  as specified  above    for 
double resolution, but applied in the vertical as well as the   horizontal 
direction.


*****************


These formats are derived from the Normal Resolution by multiplication  by 
the factors in the Figure V.3.


Figure V.3

          __________________________________________
          _             _  Horizontal  _ Vertical  _
          _ Resolution  _    Factor    _  Factor   _
          __________________________________________
          _  Normal     _      1       _     1     _
          __________________________________________
          _  Double     _      2       _     1     _
          __________________________________________
          _  High       _      2       _     2     _
          __________________________________________

Examples:

   - Double Resolution for 525 line monitors = 720 x 240 pixels
   - High Resolution for 625 line systems    = 768 x 560 pixels


2.3  Safety Area

In order to prevent the loss of vital information (e.g. text) the  concept 
of a 'Safety Area' is introduced.  The Safety Area, shown in Figure   V.4, 
is defined as  a reduced  area on the  screen surface,  where display   of 
information is guaranteed despite all tolerance values that can occur   in 
monitors and TV sets.

Figure V.4

         _____________________________
         _ ________________________  _____Full-Screen Display
         _ _  __________________  ________Screen Boundary
         _ _  _              _____________Safety Area
         _ _  _                _  _  _
         _ _  _                _  _  _
         _ _  _                _  _  _
         _ _  _                _  _  _
         _ _  _                _  _  _
         _ _  __________________  _  _
         _ ________________________  _
         _____________________________







The dimensions of  the Display  Safety Area, in  Normal Resolution,    are 
shown in Figure V.5.

Figure V.5

____________________________________________________________
_                     _Number of pixels _Number of pixels  _
_       Display       _  horizontally   _   vertically     _
____________________________________________________________
_  525 line systems   _      320        _       210        _
____________________________________________________________
_  625 line systems   _      320        _       250        _
____________________________________________________________

These figures must be multiplied by the factors  in Figure V.3 for   other 
resolutions.  For example, for 625 line systems and High Resolution,   the 
Safety Area is 640 x 500 pixels.







2.4  Recommended Display Timing

The full active line scan period (52.4 _s) is recommended for use in   525 
line systems. For 625 line systems, it is recommended that the  horizontal 
display period is compressed  to 50 _s. This  improves the aspect    ratio 
distortion of 525/625 line compatible images, while still  ensuring   that 
the whole  screen is  filled under  worst case  display  system   scanning 
tolerances.

Thus the recommended horizontal timings are shown in Figure V.6.




Figure V.6

                             _______________________________________
                             _       Time in _s        _ fpix (MHz)_
    _____________________________________________________________
    _       Display       _ Full Screen_ Safety Area_           _
    _____________________________________________________________
    _  525 line monitors  _    52.4    _    46.6    _    6.87   _
    _____________________________________________________________
    _  525 line TVs       _    52.4    _    43.7    _    7.32   _
    _____________________________________________________________
    _  625 line systems   _    50      _    41.7    _    7.68   _
    _____________________________________________________________


    fpix = Pixel clock frequency2.4.1  Pixel Aspect Ratios


For display of computer graphic images, a close approach to square  pixels 
is desirable. The pixel aspect ratios for 525 and 625 line systems,  using 
the recommended horizontal timings in Figure V.6, are computed as follows

   Aspect Ratio = Pixel Height / Pixel Width

                =  pixel clock frequency *  52.4 _s       3
                  ____________________________________  * _
                         Number of active lines           4

   where the number of active lines = 242.5 (525 lines)
                            = 287.5 (625 lines)

The pixel aspect ratios are shown in Figure V.7.


Figure V.7

             ____________________________________
             _                     _   Aspect   _
             _       Display       _   Ratio    _
             ____________________________________
             _  525 line monitors  _    1.11    _
             ____________________________________
             _  525 line TVs       _    1.19    _
             ____________________________________
             _  625 line systems   _    1.05    _
             ____________________________________






2.5  Image Sizes


Images may be encoded  and displayed which are  larger than   full-screen, 
either horizontally, vertically or both. In this case only a part of   the 
image is displayed  at any  time. This part  may be  positioned   anywhere 
within the image (with  some restrictions for some  coding methods,    see 
V.5.3)

Images with sizes smaller than full-screen may also be encoded.   However, 
if the width of an image is smaller  than the full-screen width, it    may 
not be displayed directly, but only as a partial update to an image  which 
has at least full-screen width (see V.5.4).  If the height of an image  is 
less than full-screen height, but it has width  greater than or equal   to 
full-screen width, it may be displayed as a subscreen (See V.2.7).


2.6  Planes

The displayed image may be formed by the  superimposition of a number   of 
component images,  which  are considered  to  be displayed  on  up  to   4 
separate planes placed one behind the other as shown in Figure V.8.

One or two image planes are defined, depending on the coding scheme   used 
for the images (see V.4.3).


Figure V.8

           _____________________
           _               ___________ Backdrop / External
         ____________________  _                  Video
         _                  _  _
         _             _______________ 1 or 2 Image Planes
         _     ___          _  _
         _     _______________________ Cursor Plane
         _                  ____
         _                  _
         ____________________


The Backdrop plane  may be  external video (extended  case only),  or    a 
constant color.  This color  must be  the same  over  the whole  of    any 
horizontal line, but may be different for different lines.

The cursor plane has dimensions less than those of the image planes,   but 
may be positioned at any coordinate over the  other planes. (If a   larger 
cursor is required,  it can  be generated by  software techniques  in   an 
image plane).

2.7  Subscreens


An image plane may  be split up into  an arbitrary number  of   horizontal 
strips or subscreens. Subscreens may be any height  from one line to   the 
height of the  screen. Different  planes may be  split into    differently 
sized subscreens.  An example of Subscreens is shown in Figure V.9.


Figure V.9


____________________
_                  _
_   Subscreen 1    _
_                  _
_                  _
____________________
_   Subscreen 2    _
____________________


Each subscreen  may contain  an image  of different  coding  type   and/or 
resolution.

     Example:    Subscreen 1  -  Normal Resolution natural image
                 Subscreen 2  -  Double Resolution text/graphics


V.3  Image Encoding

This section specifies the  way that images are  encoded, i.e. the   image 
coding techniques and algorithms  that are used. For  the details of   the 
coding formats on disc, see V.6.

3.1  Image Formats

3.1.1  525 and 625 Line Dedicated Formats

Two different image encoding  formats are specified, differing  in   size. 
These are:

 1.   a 525 line dedicated format comprising 360 x 240 pixels in   normal 
    resolution and corresponding to the 525 line monitor format.

 2.   a 625 line dedicated format comprising 384 x 280 pixels in   normal 
    resolution and corresponding to the 625 line format.

These formats are intended for use where distortion  in aspect ratio,   or 
direct coupling to  other equipment  using 525 or  625 line  formats   are 
important factors.  They have  zero aspect ratio distortion  on 525   line 
monitors and 625 line systems respectively.  For local markets, this  type 
of format gives simplicity in the authoring stage.

3.1.2  525/625 Line Compatible Format

For  non-local   and   international  markets,   a   minimal    distortion 
'Compatible' format is specified. Discs with images coded to this   format 
can be distributed worldwide with only small distortions in aspect   ratio 
( +/-3% for 525 line  monitors and 625 line  systems).  Experiments   have 
shown that distortions of up to +/-10% are typically not noticed when   no 
direct comparison to the original can be made.

The Compatible format has dimensions the same as for 625 line format,  but 
a horizontal  'stretch' or  pre-distortion of  the image  is  applied   to 
equalize the aspect ratio distortions for 525 line monitors and 625   line 
displays.  To achieve this,  the encoder horizontal timing  is   specified 
such that the pixel aspect ratio is the  geometric mean of that for    525 
line monitors and 625 line systems, (Figure V.7).

     Compatible aspect ratio = _(1.05 * 1.11)
                             = 1.08
This gives an aspect ratio distortion of +/-3.0%.
Figure V.10  shows the  aspect ratio  distortion for  each  format,   when 
displayed on the three target systems.


Figure V.10

           ____________________________________________________
           _             Display of Target System             _
_______________________________________________________________
_Format    _525 line monitors_525 line TVs  _625 line systems _
_______________________________________________________________
_525 line  _       0         _      +7      _       -6        _
_______________________________________________________________
_625 line  _      +6         _      +13     _        0        _
_______________________________________________________________
_Compatible_      +3.0       _      +10     _       -3.0      _
_______________________________________________________________

For a definition of the term 'Compatible', see V 3.1.4.

3.1.3  Other Image Formats

The image formats specified  above are supported by  all decoders,    with 
minimum application involvement.  However, images may also be encoded   to 
525 line TV format, i.e. 384 x 240.  See V.4.8 and Appendix V.2.

The aspect ratio pre-distortion  employed for the Compatible  format   may 
also be  applied to  the 525  line format  to  improve the  aspect   ratio 
distortion when viewed on a 625 line decoder.


In this case, the  pre-distortion required is a  3% horizontal   'squeeze' 
rather than a  'stretch', corresponding  to a 3%  decrease in    effective 
encoding pixel clock  frequency.  The  aspect ratio distortions  of   this 
format on the three  target systems are the  same as for  the   Compatible 
format.3.1.4  Meaning of 'Compatibility'

It is mandatory that all CD-I discs 'work' on all CD-I decoders. By   this 
is meant:

- all essential information is presented to the user

-   the user has access to all functions of the application on disc.

This capability is the responsibility of the application, with some   help 
from the decoder hardware  and system software (see  e.g. Appendix   V.2). 
The main implication of this for images is  that their safety areas   must 
be fully visible  on all  decoders.  In this  sense, all  images   however 
encoded, are 'compatible'.

However, this specification reserves  the term 'Compatible' to  apply   to 
the 'Compatible  format'  specified in  V.3.1.2.   This format  has    the 
additional virtues  of  both  minimum  aspect  ratio distortion  on    all 
decoders, and of being 'full screen height' on all decoders.

3.2  Encoder Timing and Image Sizes

The horizontal dimensions and timing for encoding of the three main  image 
formats in Normal Resolution are as shown in Figure V.12.

Figure V.12

           _________________________________________________
           _  Full Screen   _   Safety Area   _ fenc (MHz) _
____________________________________________________________
_ Format   _No.of _ Time in _No.of  _ Time in _            _
_          _Pixels_   _s    _pixels _    _s   _            _
____________________________________________________________
_ 525 line _ 360  _  52.4   _ 320   _  46.6   _   6.87     _
____________________________________________________________
_ 625 line _ 384  _  50.0   _ 320   _  41.7   _   7.68     _
____________________________________________________________
_Compatible_ 384  _  48.6   _ 320   _  40.5   _   7.90     _
____________________________________________________________

fenc = pixel encoding clock frequency.

The pixel numbers must  be multiplied by the  factors in Figure  V.3   for 
other resolutions.  These encoder  timings may represent actual    encoder 
clock frequencies  or effective  clock frequencies  achieved by    digital 
filtering and subsampling.

The vertical dimensions on  disc of full-screen images  and their   safety 
areas for the three formats, are shown in Figure V.13.


Figure V.13

_______________________________________________
         _ Format     _  Full Screen _   Safety Area   _
         _______________________________________________
         _ 525 line   _     240      _       210       _
         _______________________________________________
         _ 625 line   _     280      _       210       _
         _______________________________________________
         _ Compatible _     280      _       210       _
         _______________________________________________

Note that the height of the safety area of all three encoding formats   is 
210 lines, to ensure  visibility in the case  of display on  a 525    line 
decoder.

All images are coded on disc to their  individual dimensions (e.g. a   525 
line full image is coded as 360 x 240 pixel codes on disc; see V.6.4.1).

3.3  Image Coding Methods


A number of different image coding methods are specified, each   optimized 
to a different image type (natural image, computer graphics, text etc.)

The image  coding  and compression  schemes  take into  account  what   is 
possible in consumer products, e.g. the decoders do not require  excessive 
computing power. For ease of implementation, binary values  are used   for 
the width of the necessary data streams.

Natural (photographic) images  may be  encoded by a  differential   method 
(DYUV) which takes  advantage of  the statistical properties  of   natural 
pictures, plus the properties of the human eye, to achieve compression  by 
a factor  of 3.  An extension  of this  coding  scheme (DYUV  + QHY)    is 
available for high resolution natural images in the  Extended Case;   this 
achieves compression of typically 9 - 10.

Computer Graphics and  bit-mapped text  may be encoded  as absolute    RGB 
components (RGB555) or by use of a restricted number of colors   contained 
in a Color Lookup Table (CLUT)

Cartoon Style Images may  be compressed using one-dimensional    runlength 
(RL) coding. The high  degree of compression achieved,  typically 8 -   12 
greater than CLUT coding alone, allows full screen animation of   suitable 
material.

For the allowed resolutions of each coding method see V.4.4.9.



3.4  Natural Images: DYUV

Digitized natural  images  typically  have  a  high correlation    between 
adjacent pixel  values.   Encoding  the  differences  between   successive 
pixels, instead  of coding  the pixel  values themselves,  results  in   a 
significant improvement in efficiency. This is known as delta coding.

A further improvement can  be obtained by exploiting  the fact that    the 
human eye  is  less  sensitive  to  spatial colour  variations  than    to 
intensity variations.  This  makes it  possible to code  the   chrominance 
components (U & V)  of an image with  less bandwidth than  the   luminance 
component (Y).

The combined coding scheme is called DELTA-YUV or  DYUV.   The   principal 
parameters selected are:

- One dimensional prediction.
- The bandwidth for U and V is 0.5 the bandwidth for Y.
- A non-uniform 16 level fixed quantizer is used.




3.4.1  DYUV Encoding Model


The coding scheme  is shown  in Figure V.14.   A general  description   is 
given below.

RGB signals from a suitable analogue source are  digitized at a   sampling 
rate in accordance with one of the standards given in V.3.2, to give  high 
resolution eight bit pcm RGB source images. The  RGB images are   matrixed 
to  give  YUV   images  which   are  then  sub-sampled   vertically    and 
horizontally.

Prior to  sub-sampling it  is necessary  to filter  the  images with    an 
appropriate two dimensional antialiasing  filter.  The sub-sampled Y,    U 
and V images  are separately  coded as four  bit delta  images which   are 
subsequently combined for storage on the disk.

The final encoded  image has  8 bits/pixel, or  16 bits  per pixel   pair, 
which is  the basic  indivisible encoding  unit.  For  disc  and   decoder 
formats see V.6.5.1 and V.4.4.2 respectively.





3.4.1.1  Matrixing and Normalisation


Matrixing of the RGB signals to YUV follows standard video practice.   The 
defining equations are:

    Y = 0.299 * R + 0.587 * G + 0.114 * B
    U = 0.564 * ( B - Y )
    V = 0.713 * ( R - Y )

The normalizing factors  are chosen  such that if  the range  of the   RGB 
signals is 0...1 then the range of the Y signal is 0...1 and the range  of 
the U and V signals is -0.5...+0.5

In order  to  allow a  safety  margin to  guard  against  overshoot    and 
undershoot resulting from  filtering, the  ranges of the  Yc, Uc  and   Vc 
binary components, which are coded as eight bit values, are restricted  in 
accordance with CCIR recommendation 601.1 such that the  range of the   Yc 
signal is 16 (black)  to 235 (peak white).  The range of  the Uc and    Vc 
signals is from  16 to  240 with an  offset of  128.  These  values    are 
summarised in Appendix V.1.

The equations for the coded and normalized values of Y, U and V are  given 
by:

    Yc = 219 * Y + 16
    Uc = 224 * U + 128
    Vc = 224 * V + 128

The matrixing and  normalization of  the YUV values  is thus    completely 
defined by the following encoding equations :

          Yc =  65.5 * R + 128.5 * G +  25.0 * B +  16
          Uc = -37.8 * R -  74.2 * G + 112.0 * B + 128
          Vc = 112.0 * R -  93.8 * G -  18.2 * B + 128

Figure V.14 shows the encoding scheme for DYUV images

Figure V.14

                   ___________________
                   _  Analogue RGB   _
                   _ source picture  _
                   ___________________
                       RGB  _  analogue
                   ___________________
                   _ analogue filter _
                   ___________________
                       RGB  _  analogue
                   ___________________
                   _   digitizer     _
                   ___________________
                       RGB  _ (High Resolution)
                   ___________________
                   _   RGB to YUV    _
                   _     matrix      _
                   ___________________
         Y____________    U _      ____________V
   _______________   _______________   ________________
   _   filter    _   _   filter    _   _   filter     _
   _______________   _______________   ________________
         Y_               U _               V _
   _______________   _______________   ________________
   _  subsample  _   _  subsample  _   _  subsample   _
   _ H = 2, V = 2_   _ H = 4, V = 2_   _ H = 4, V = 2 _*
   _______________   _______________   ________________
        Y _    Normal     U _   Resolution  V _
   _______________   _______________   ________________
   _ DPCM encoder_   _ DPCM encoder_   _ DPCM encoder _
   _______________   _______________   ________________
          ____________Y  _U _     _V___________
                  _____________________
                  _   code for disc   _
                  _____________________
                     ________________
                     _  CD-I disc   _
                     ________________

* H and V are Horizontal and Vertical subsampling factors



3.4.1.2  Filtering and Sub-sampling


It is assumed that source images have been digitized at High   Resolution. 
In order  to  code  images  at  Normal Resolution  it  is  necessary    to 
sub-sample the source image.  Sub-sampling is by a  factor of two in   the 
vertical direction both for the Y image and  the UV images.  The Y   image 
is sub-sampled  by  a  factor  2  horizontally and  the  UV  images    are 
sub-sampled horizontally by a factor 4.

The sub-sampling  phase relationships  in the  horizontal direction    are 
shown in Figure V.15.


Figure V.15

_________________________________________________________________
_High Res pixel nr.  _  0  1  2  3  4  5  6  7  8  9  10 11 12.._  _Normal 
Res pixel nr._  0     1     2     3     4     5     6 .._
_                    _                                          _
_Luminance           _  Y     Y     Y     Y     Y     Y     Y .._
_                    _                                          _
_Chrominance         _  UV          UV          UV          UV.._
_                    _                                          _
_Pixel pair          _|---- 0 ----|---- 1 ----|---- 2 ----|...  _
_________________________________________________________________

nr. = number

Vertical subsampling is the same for Y, U and V components and is on  even 
line numbers i.e. line numbers 0, 2, 4, ... etc.


In order to  reduce the  effects of signal  aliasing it  is necessary   to 
filter the Y, U and V images prior  to sub-sampling.  It is    recommended 
that digital filtering by means of FIR (Finite Impulse Response)   filters 
is used, or some  equivalent method that does  not adversely affect    the 
relative phases of the images.  The CCIR signal levels (see Appendix  V.1) 
allow some degree of overshoot or undershoot, resulting  from   filtering, 
but it is the responsibility of the filtering apparatus to constrain   the 
magnitude of  the  filtered  and  subsampled  images within  the    bounds 
0...255.





3.4.1.3  Delta Coding


The components Y,  U and  V are separately  coded using  identical   delta 
coding algorithms.  Coding  is by  delta  pcm using  a  one    dimensional 
horizontal scheme.

For each component, the 4 bit transmitted code  cn for the nth pixel    is 
the encoded quantized difference  between the true value  Vn for the   nth 
pixel and the prediction value Pn for the nth pixel.  The quantizing   and 
coding table is defined in Figure V.16.  Let Qf() denote quantization   of 
difference values and coding  according to that table  and Qf-1()   denote 
decoding of code values to quantized difference values according to   this 
table.

    1) cn = Qf( Vn - Pn )

The prediction  value Pn  is equal  to the  decoded  value Fn-1  for   the 
previous pixel.

    2) Pn = Fn-1

The decoded value Fn is calculated as the sum of the prediction value   Pn 
and the decoded quantized difference value.  The sum is performed   modulo 
256.

    3) Fn = Pn + Qf-1( cn )

          = Fn-1 + Qf-1( cn )

The initial prediction value of P for each line is defined   independently 
and transmitted separately as an absolute 8 bit value Pabs

    4) P0 = Pabs

Data compression is achieved by using a non-uniform quantizer. A 16  level 
quantizer is used and so 4 bits per sample are transmitted. The scheme  is 
non-adaptive and thus the  quantizer is fixed as  shown below. The    same 
quantizer is used for luminance and both chrominance signals.


Because of the modulo 256 arithmetic that is employed, each output   value 
is capable of  representing a  positive or, by  means of  wraparound,    a 
negative quantized difference.



Figure V.16


______________________________________________________________
_   Input Difference        _   Code   _  Output Difference  _
______________________________________________________________
_   0       _               _    0     _        0            _
_ 1.... 2   _ - (254...255) _    1     _        1            _
_ 3.... 6   _ - (250...253) _    2     _        4            _
_ 7....12   _ - (244...249  _    3     _        9            _
_ 13....21  _ - (235...243) _    4     _        16           _
_ 22....35  _ - (221...234) _    5     _        27           _
_ 36....61  _ - (195...220) _    6     _        44           _
_ 62....99  _ - (157...194) _    7     _        79           _
_ 100...156 _ - (100...156) _    8     _        128          _
_ 157...194 _ - ( 62....99) _    9     _        177          _
_ 195...220 _ - ( 36....61) _    10    _        212          _
_ 221...234 _ - ( 22....35) _    11    _        229          _
_ 235...243 _ - ( 13....21) _    12    _        240          _
_ 244...249 _ - (  7....12) _    13    _        247          _
_ 250...253 _ - (  3.....6) _    14    _        252          _
_ 254...255 _ - (  1.....2) _    15    _        255          _
______________________________________________________________

Overflow:  It is  essential that  the process of  quantization does    not 
result in inadvertent overflow or underflow (wraparound) of  the   decoded 
output as a result of errors intrinsic in the quantization process.    The 
coding apparatus  must  be  responsible  for  checking  as  the     coding 
progresses that the true sum of the prediction  value plus the   quantized 
difference value is not outside the limits 0..255.  In the event of  these 
limits being exceeded,  an adjacent  quantized difference value  must   be 
substituted which will not cause overflow or underflow.




**** EXTENSION ****

3.5  High Resolution Natural Images DYUV+QHY


In the Extended Case, High Resolution natural images may be encoded.

The DYUV method  described in  V.3.4.1 may be  used for  High   Resolution 
natural  images  by  doubling  the  horizontal  and  vertical     sampling 
frequencies.  This method gives the highest quality images.  However   the 
size of the encoded image is four times that for Normal Resolution.    For 
compatibility, the  image must,  typically, be  accompanied by  a   Normal 
Resolution image (see V.6.4.4). In this case the  total size on disc   and 
the loading time are both five times that for Normal Resolution.

The Quantized High  Y (QHY)  coding scheme described  here allows    these 
storage and loading times to be substantially decreased, while   providing 
subjective quality close to that of full High Resolution DYUV.



3.5.1  The Coding Scheme


The elements of the method are as follows (see Figure V.17).

The source image is  digitized at High Resolution,  matrixed to YUV,   and 
filtered horizontally and vertically to give a Normal  Resolution   image, 
which is DYUV coded as described in V.3.4.1. The sub-sampling phases   are 
as described there.

The Y component of the DYUV coded Normal  Resolution image is decoded   by 
the  standard  method  and   expanded  by  means  of   a  2    dimensional 
interpolation filter.  This  gives an  image having the  same number    of 
picture elements  as  a  High  Resolution  image but  only  the    spatial 
resolution of the Normal Resolution image.

The interpolated Normal Resolution Y image is subtracted  pixel by   pixel 
from the original High Resolution Y image to  give a Y difference   image, 
representing both the high frequency component of the  luminance and   the 
DPCM quantization  errors.  This  difference image  tends to  have   large 
values only  near  sharp  edges  in  the source  image;  its    favourable 
statistics enable it to be very efficiently coded.

The difference values are  quantized and the resulting  quantized   values 
are runlength coded  to give  an auxiliary set  of image  data, the    QHY 
(Quantized High Y) data.

To display a High  Resolution DYUV+QHY image the  DYUV Normal   Resolution 
image is decoded and  interpolated to give a  filtered Y image   identical 
with that derived  by the  encoder.  The runlength  coded QHY  image    is 
decoded to  give  a High  Resolution  Y difference  image.   Adding    the 
difference image to  the filtered  image gives rise  to a  restored   High 
Resolution Y image that has good visual fidelity to the original source  Y 
image.

Apart from interpolation,  it is  not necessary to  process the  U and   V 
data, as the normal resolution U and V images are already of  sufficiently 
high bandwidth.



Figure V.17

                    High Resolution RGB source image
                                    _
                     _____________________________
                     _     Matrix RGB to YUV     _
                     _____________________________
        __________________ Y High Resolution _U,V
        _        ___________________ ___________________
        _        _Filter, subsample_ _Filter, subsample_
        _        ___________________ ___________________
        _               Y_ Normal Resolution _U,V
        _        ___________________ ___________________
        _        _  DPCM Encoder   _ _  DPCM Encoder   _
        _        ___________________ ___________________
        _           ______________     _______
        _           _DY        DY_     _DU,DV
        _  ___________________ ___________
        _  _ DPCM Y Decoder  _ _ combine _
        _  ___________________ ___________
        _           _Y              _
        _ ______________________    _
        _ _Interpolation filter_    _
        _ ______________________    _
        _ High Res Y_               _
      _________________             _
      _  Difference   _             _
      _________________             _
      _________________             _
      _3 bit Quantize ____          _
      _________________  _          _
      _________________  _          _
      _Runlength code _  _          _
      _________________  _          _
             _           _          _
             _           _          _
             _           _          _
            QHY     Quantization   DYUV
                      Levels



3.5.2  Encoding the QHY Data


The two-dimensional interpolation filter used in the encoder and   decoder 
has the coefficients shown  below in Figure V.18.   This filter   performs 
simple linear  interpolation both  horizontally and  vertically.  It    is 
separable  in  the  two   dimensions  and  is  designed   to  be    simply 
implementable.

Figure V.18

______________________
_ 0.25   0.5   0.25  _
_ 0.5    1.0   0.5   _
_ 0.25   0.5   0.25  _
______________________

The filtered  High Resolution  image is  constructed by  inserting   zeros 
between  the  Normal  Resolution   pixel  values  both  vertically     and 
horizontally, then by filtering with a 2-dimensional FIR (Finite   Impulse 
Response) filter with coefficients shown in Figure V.18.

The Y  difference values  are coded  with a  3-bit  (8 level)    quantizer 
(defined below) to give  the QHY codes. These  codes are then    runlength 
coded as pairs of three-bit values to give  the QHY data. The    runlength 
coding format is the same as for run-coded  3-bit CLUT (RL3) images    and 
makes use of the first 8 entries of CLUT bank 2 (see V.4.4.7).  Disc   and 
decoder formats are described in V.6.5.1.2 and V.4.4.3 respectively.


3.5.3  QHY Quantization Levels


The quantization levels are  transmitted to the decoder  along with    the 
image (see Figure V.27). Therefore they may be chosen so as to best  match 
particular images , or  parts of images. Alternatively,  a fixed set    of 
levels may be used which is optimized for a range of source material.  The 
choice of the  threshold range  for the zero  quantization level  has    a 
particularly important effect on the degree of data compression that   may 
be achieved. With typical source material and threshold levels,  runlength 
compression results in an order of magnitude compression of the QHY data.

  A typical set of quantization levels with their associated code values 
    are shown in Figure V.19.  In this example, QHY code 7 is used for 
  run-coded text that is added to the high resolution image in areas of 
uniform brightness.Figure V.19*



  ______________________________________________________________
  _ Difference value _   Quantization  _  Coded value   _ QHY  _
  _                  _     levels      _                _ code _
  _                  _       Q         _      QL        _      _
  ______________________________________________________________
  _    -6 .... 6     _       0         _      128       _  0   _
  _     7 .... 12    _       8         _      132       _  1   _
  _    13 .... 20    _       16        _      136       _  2   _
  _    21 .... 255   _       24        _      140       _  3   _
  _    -7 ....-12    _      -8         _      124       _  4   _
  _   -13 ....-20    _      -16        _      120       _  5   _
  _   -21 ....-255   _      -24        _      116       _  6   _
  _       Text       _       140       _      198       _  7   _
  ______________________________________________________________


* NOTE: These levels are shown for the purpose of illustration,  and   may 
be varied to  optimise the  encoding of individual  images or  parts    of 
images.

Quantization levels may take  any even value in  the range -256    ...254. 
Each level is coded as a single byte in offset binary form. If the   level 
has a value Q, the coded value QL is given by

     QL = Q / 2 + 128

The coded values QL are coded on disc  in the same way as that used    for 
CLUT values. For disc  and decoder formats see  V.6.5.1.2 and    V.4.4.3.4 
respectively.



***********


3.6  Graphics and Text

3.6.1  General


There are two  fundamentally different  methods of creating  graphics   or 
text on the screen.

-     Downloading  from  disc the  complete  resultant image.  This    is 
   described in this chapter and is mainly used for real-time or  complex 
   graphic images.

-        Creating  from  a more  compact  representation which  can   be 
    interpreted by system  software. This  is the preferred  method   for 
    text and is used for simple graphic images.   The methods   specified 
    for CD-I are given in VI.3.1 (text) and VII.2.3.2.9 (UCM).

For the direct downloading  of graphic images, both  direct absolute   RGB 
coding and indirect CLUT (Color Lookup Table) coding are available.


3.6.2  Absolute RGB

Images can  be coded  in R,  G, B  to  an accuracy  of 5  bits for    each 
component, plus a remaining bit reserved for overlay information.
For each color component, the encoding law is:

    C = (219 * CA + 16)/8, rounded to the nearest integer

  where   C  = A color component (one of R,G,B)
         CA =The corresponding analog component, in the range 0 to 1
    C = 2 therefore represents the black level.
  
For disc and decoder formats see V.6.5.2 and V.4.4.4 respect- tively.


3.6.3  Color Lookup Table

This technique allows selection of a given number  of colors from a   much 
larger palette. The set of colors to be used for the image is loaded  into 
a Color Lookup Table (CLUT) in the decoder.

Each pixel is then coded with the position  in the CLUT of the color   for 
that pixel.
The colors in the CLUT may be chosen  from a palette of 224 colors,   i.e. 
R, G and B are each defined at 8-bit accuracy.

The CD-I system uses the following CLUT sizes

_________________________________________________________________
_ Mechanism _   Colors      _   Available path     _ Purpose    _
_________________________________________________________________
_ 8-bit     _ 256 colors    _ path 0 only          _ CLUT8      _
_ 7-bit     _ 128 colors    _ path 0 and/or path 1 _ CLUT7, RL7 _
_ Dual 7-bit_ 128 x 2 colors_ path 0 only          _ CLUT7, RL7 _
_ 4-bit     _  16 colors    _ path 0 and/or path 1 _ CLUT4      _
_ 3-bit     _   8 colors    _ path 0 and/or path 1 _ RL3        _
_________________________________________________________________ 

The available number of colors may be expanded by dynamic loading of   new 
colors on a line by line basis.

For disc and decoder formats see V.6.5.3 and V.4.4.5 respect- ively.

3.7  Runlength Coding


Images may be runlength coded, with either 7 bits or 3 bits of color.  The 
high degree of  data compression  may be used  for animation  of   cartoon 
style images.




3.7.1  Run-coded 7-bit CLUT (RL7)


Single pixels are coded as single bytes, giving  the CLUT code for    that 
pixel. A run of pixels of the same color is coded as two bytes, the   CLUT 
code and the length of the run (from 2 to 255). A length of zero is   used 
to indicate that the run extends until the  end of the current line.   All 
lines must be terminated with this code as  an end marker. The coding   is 
strictly on a line  basis, so that there  is no wraparound  to the    next 
line.
This scheme ensures that the compression ratio is never less than 1.    It 
is typically of the order of 10 for cartoon style images.

RL7 may be used with a single 7-bit  CLUT or with dual 7-bit CLUTs    (see 
V.5.5.3).

Dynamic CLUT updates (see V.5.5.2) may be used to increase the number   of 
colors in a run-coded image.




3.7.2  Run-coded 3-bit CLUT (RL3)


The same coding scheme is used as for 7 bit runlength coding, except  that 
the pixels are coded in pairs, one byte holding two 3-bit CLUT codes.  The 
runlength specifies the number of times the pixel pair is repeated.

For disc and decoder formats see V.6.5.4 and V.4.4.6 respect- ively.


 V.4  The Video Decoder

4.1  General Description


The following functional block diagrams show the operation  of the   video 
decoder.  Figure V.20  shows the  high-level functions, and  the   Figures 
V.21 to V.24 show the operation of each block in more detail.

The diagrams  are  intended  as  a  decoder model.   They  indicate    the 
functions performed, and may, but need not, represent the actual  hardware 
implementation in any particular decoder.

Figure V.20

Video Decoder Model

              ___________                         External
              _Display  ___                         _  Video
            ___Control 0___                         _
  ________    ___________       ___________     _________
  _Image _8/4 _______ 8/4       _Real-time_Plane_       _
___Store ______     _____________         ___A___       _
_ _  0   _    _     _   Path 0  _ Decoder _     _       _
_ ________    _     _           ___________     _Overlay_ Analog
_             _Comb-_                       RGB _   &   ___ RGB
_             _ iner_                           _ Mixer _  Video
_ ________    _     _           ___________     _       _
_ _Image _8/4 _     _ 8/4/16    _Real-time_Plane_       _
___Store ______     _____________         ___B___       _
_ _  1   _    _______   Path 1  _ Decoder _     _       _
_ ________    ___________       ___________     _________
_           ___Display  ___
_             _Control 1___
_             ___________
Video data from
disc or program

Image data for display is held in two image stores.  Video data is  loaded 
into one or both stores from disc or program.  Each image store   provides 
a real-time data stream at display scan rate from the image data that   it 
holds.  This data stream is 8 or 4 bits wide, depending on the  resolution 
required.  In  the  Base Case,  only  4 bits  are  available  at    Double 
Resolution, and 8 at Normal Resolution.


The decoder contains  two display  paths, and the  two data  streams   are 
normally used  independently  by these  paths.  However two  8-bit    data 
streams may be combined to form one 16-bit stream in path 1.

Display paths  0 &  1 are  decoded to  RGB  image planes  A &  B by    two 
real-time decoders one of which is shown in Figure V.21.


Figure V.21

Real-Time Decoder

                          CLUT shared with
                            other path
                            ___________
      (path 0 only)__ 8     _   256   _
                    7/4     _  entry  _
                   ____________  CLUT   _______
                 _          ___________     _
                 _          ___________     _
                 _   8      _  DYUV   _     _
 Display ____________________         ________A or B___ RGB
 Path            _          _ Decoder _     _
                 _          ___________     _
                 _  16                      _
                 _          ___________     _
                 ____________ RGB 555 _______
                 _          ___________     _
                 _         (path 1 only)    _
                 _          ___________     _
                 _   4      _   QHY   _     _
                 ____________ Decoder _______
                            ___________
                 (path 1 only; Extended Case)
   
The image planes  may be  overlayed in any  order on  the screen   (Figure 
V.22).  Portions of the planes may be made  transparent, in order to   see 
the plane(s)  behind  them;  this  may  be done  by  several    mechanisms 
including color keying.  Alternatively the planes may be  mixed, that   is 
their contents summed.


  The contribution factor of each plane to the final displayed image is 
   adjustable via an Image Contribution Factor.  This may be used with 
either overlay or mixing.  Finally, the cursor is overlayed on top of the 
     image, and the backdrop (or, as an extension, external video) is 
displayed wherever both image planes are transparent.Figure V.22

Overlay and Mixer





                                              External Video
     Backdrop/                       (extended case only)
              _________   _______   _________        _
              _       _   _Pixel_   _       _        _
A _____________       _____Hold _____       _        _
        _     _ Plane _   _______   _       _        _    Analog
Planes  _     _       _   Mosaics   _ Mixer _____________ RGB
        _     _Overlay_   _______   _       _        _    Video
B _____________       _____Pixel_____       _        _
   _    _     _       _   _Hold _   _       _        _
   _    _     _________   _______   _________        _
_______________________             _________ _______________
_Color Key & __Overlay_             _  ICF  _ _Cursor Memory_
_Transparency__Control_             _       _ _& Position   _
_______________________             _________ _______________
                  _______ Mattes ________


ICF = Image Contribution Factors

Display control  is  performed by  means  of a  display  control   program 
associated with each  path, which  includes display line  start   pointers 
(see V.4.5).

A number of visual effects facilities are provided,  such as mosaics   and 
mattes.  These are specified in V.5.


Figure V.23

Image Store


                                 ________________
          ______________         _   Mosaic -   _
          _   Image    _  8/4  ___ Pixel Repeat ___ 8/4
Video  ____            _________ ________________ ______ Display
Data in   _   Memory   _       _ ________________ _      data
          ______________       ___  Runlength   ___
          ______________         _   Decoder    _
          _  Image     _         _(see V.4.4.6) _
          _  Pointer   _         ________________
          ______________
                _
                _
    Display Line Start Pointer


Figure V.24

Display Control


                                                          To Image Store
                                                          _
                                             Display Line _
                                             Start Pointer_
   _________________                                      _
   _    Control    _   Control Program line pointer       _
   _Program Pointer______________________________________ _
   _________________                    ______________  _ _
           _                            _            _  _ _
           _                            _  Control   ____ _
   _________________                    _ Functions  ______
   _Display Control______________________            ____
   _    Program    _                    _(see V.4.5) ____
   _________________                    ______________

4.2  Display Scanning


The video decoder scan  timing is such as  to drive a  standard 525   line 
(typically 60Hz) or 625  line (typically 50Hz) television  display,   with 
two fields per frame.  For overlay over external video, the display   must 
be capable of interlace.

If any other form of display system is used, it must simulate this  timing 
from the point of view of the decoder.


*** EXTENSION ***

In the extended case,  High Resolution images may  be displayed with   two 
interlaced fields per frame,  or line sequentially. Note,  however,   that 
the order of execution of commands in the  Display Control Program   (DCP) 
(see V.4.6) will be  different in these two  cases.  Applications   should 
take this into account, and construct DCPs whose effects are   independent 
of this order.

****************





4.3  Planes and Paths


The two  path  organization and  the  allowed data  stream    combinations 
described in V.4.1  imply the  following possible combinations  of   image 
planes as shown in Figure V.25.


Figure V.25

                B __________          B __________
               A__________ _            _        _
                _        _ _            _        _
                _        _ _            _        _
                _        _ _            _        _
                _        ___            __________
                __________
           4 or 8 bits per plane          16 bits

Although the A plane is shown 'in front of' the B plane, the order of  the 
planes may be set arbitrarily.

The cursor and backdrop planes are of course  also present, as shown    in 
Figure V.8.


4.4  Image Representation and Decoding

4.4.1  General

4.4.1.1  Representations in Memory


Each horizontal line of pixels is represented in  memory by a   contiguous 
sequence of  pixel codes  at increasing  memory addresses  from  left   to 
right. However,  consecutive  lines  of  an  image are  not    necessarily 
contiguous in memory.

In the case of RGB555 images which require combined data streams from  the 
two image stores, each pixel code is split into two halves, each of  which 
is arranged in such a contiguous sequence.

Notation: In this section, pixels are numbered consecutively from left  to 
right as displayed. For bit and byte ordering conventions see V.1.2.




4.4.1.2  RGB Levels


All images, encoded by  whatever method, are decoded  (in terms of    this 
model) to a uniform  8-bit linear representation of  the Red, Green    and 
Blue color components.   For each  component, black level  is at  16   and 
nominal peak (white) level is at 235.

The analog output is given by:

        CA =(C-16)/219
where   CA = An analog component (one of R,G,B)
    C = The corresponding digital component.

As the range of C is from 0-255, the range of CA is -0.073 to 1.091.

  


4.4.2  DYUV

4.4.2.1 Representation in Memory


Each pixel pair (pixels i & i+1) is coded as two bytes as follows:

_________________________________________________
_  _Ui(3-0) _  _Yi(3-0) _ _Vi(3-0)  _ _Yi+1(3-0)_
_________________________________________________
15       12   11      8   7       4   3         0

where i must be even.  The pixel pair starts at an even X coordinate   and 
at an even memory address.

_Y = 4 bit luminance difference code.
_U,_V = 4 bit chrominance difference codes.











4.4.2.2  Decoding Model


The process of decoding  DYUV coded images is  as shown in  Figure   V.26. 
The composite data in memory is separated into  its delta pcm coded Y,   U 
and V components.   Each of  the three components  is decoded  by a   DPCM 
decoder to give an eight bit pcm image.  Due to the subsampling the U  and 
V images are only half resolution horizontally.  It is thus necessary   to 
interpolate the  missing values.  The normal  resolution Y  image  Yc   is 
matrixed with the interpolated  Uc and Vc images  to give the  eight   bit 
digital RGB signals R'G'B'.


Figure V.26

                ___________________________
                _      data from disk     _
                ___________________________
        _______________       _      ________________
        _  _Y                 _ _U                  _ _V
_________________     __________________    __________________
_ Delta decoder _     _ Delta decoder  _    _ Delta decoder  _
_________________     __________________    __________________
        _                     _                     _
        _             __________________    __________________
        _             _  Interpolate   _    _  Interpolate   _
        _             __________________    __________________
        ______________        _        ______________
                     _ Yc     _ Uc     _ Vc
                 ____________________________
                 _    Matrix YUV to RGB     _
                 ____________________________
                              _ R'G'B'
                              _


Delta decoding

For each component Y, U and V, the same decoding scheme is used. For  each 
picture element along a horizontal line the decoded value Fn is   obtained 
from the coded value cn by adding the decoded difference value Qf-1( cn  ) 
to the prediction  value Pn.  The prediction value  Pn is  equal to    the 
previous decoded value Fn-1,  except for the first  element of the   line, 
where the  prediction  value is  set  equal to  the  separately    defined 
absolute value Pabs.

    Fn = Fn-1 + Qf-1( cn )  if n > 0

       F0 = Pabs + Qf-1( c0 )

The notation used above is the same as that defined in V.3.4.1.

The same  quantization  table (Figure  V.16)  is used  for  defining   the 
decoding function Qf-1() as is used for encoding.

Addition is by modulo 256 arithmetic.


Interpolation of U and V

The values of U and V obtained from  the delta decoder are at only    half 
the horizontal resolution of the Y values, and  so must be   interpolated. 
Care must be taken  to ensure that the  inter-polation filter, which   may 
perform  simple  linear  interpolation,  preserves  the  encoding    phase 
relationships of V.3.4.1.2.


Matrixing of YUV to RGB

The Y value and the interpolated U and V values are matrixed to give   RGB 
values.  The matrix equations are given below.

If the decoded  values of  YUV are Yc  Uc Vc  the values  must first    be 
de-normalised.

   U' = ( Uc - 128 ) * 1.733
   V' = ( Vc - 128 ) * 1.371
then

   B' = Yc + ( Uc - 128 ) * 1.733
   R' = Yc + ( Vc - 128 ) * 1.371
   G' = ( Yc - 0.299 * R' - 0.114 * B') / 0.587

NOTE:   The decoded values R'G'B' will have nominal  black levels of   16. 
Total excursions are in the range 0...255.




4.4.2.3  DYUV Absolute Start Values


The initial values of Y, U & V  for each line (Pabs in the above  equation 
for delta coding), are transmitted separately to the  decoder and   loaded 
via the display control program (V.4.5.1).

**** EXTENSION ****

4.4.3  High Resolution DYUV+QHY

4.4.3.1  Representation in Memory

The DYUV component is held in memory in the Normal Resolution format.

The QHY format is the same as for run-coded 3-bit CLUT.

Pixel pair:             _________________________
                        _0 _Hi(2-0)_1 _Hi+1(2-0)_
                        _________________________
                         7  6     4 3          0

Run of pixel pairs:
_________________________________________________
_1 _Hi(2-0)_0 _Hi+1(2-0)_         Li(7-0)       _
_________________________________________________
15  14   12 11 10     8   7                     0

i = even
H = 3 bit QHY code
L = 8 bit run length = Number of pixel pairs in run.
where 2 _ L _ 255 and L = 1 is forbidden.

L = 0 means 'Continue this run to the end of the line'.

Every displayed line must finish with a zero-length  run (L=0). This   run 
must start no later  than the last-but-one pixel-pair  to be    displayed, 
i.e. it must  start no  later than pixel-pair  383 for  a   625/compatible 
image, or  pixel-pair 359  for a  525 line  image.  This means  that   the 
displayed line must have at least two identical pairs of QHY codes at  its 
right hand end.

4.4.3.2  Decoding Model

The process of decoding the QHY High Resolution  mode is shown in   Figure 
V.27.  The  DYUV  Normal Resolution  image  is decoded  as  described   in 
V.4.4.2.2 so as to give Normal Resolution Y, U  and V components.    These 
are expanded by the interpolation filter of Figure V.18 to give   filtered 
High Resolution components Yf, Uf and Vf which are then matrixed to   give 
filtered High Resolution components Rf, Gf and Bf.

The runlength encoded QHY data is decoded using the table of  quantization 
values transmitted with  the image  so as to  give  the  High   Resolution 
difference data.
An indirect method of summing the QHY data  with the filtered Y data    is 
used.  Instead of  decoding the  QHY codes to  a single  Yqh    difference 
value, equivalent RGB  difference values  Rqh, Bqh and  Gqh are    derived 
which are summed with Rf, Gf and Bf  to give a restored High    Resolution 
image Rh,Gh,Bh.  This operation  is equivalent to summing  the value   Yqh 
with the filtered value Yf prior to matrixing, provided that

Rqh = Gqh = Bqh = Yqh

The RGB difference values are given by

   Rqh=(QLred-128)*2   Gqh=(QLgreen-128)*2   Bqh=(QLblue-128)*2


Figure V.27

              QHY     Quantization Levels     DYUV
                    (QLred, QLgreen, QLblue)
               _           _                   _
               _           _                   _
     ____________________  _             ________________
     _Runlength decoder _  _             _ DPCM decoders_
     ____________________  _             ________________
               _           _                   _Y,U,V
     _________________________       ________________________
     _Decode quantizer codes _       _ Interpolation filter _
     _________________________       ________________________
   Rqh,Gqh,Bqh _High Resolution       Yf,Uf,Vf _High Resolution
               _                               _
               _                               _
                 _                               _
               _                     ________________________
               _                     _      YUV to RGB      _
               _                     _        matrix        _
               _                     ________________________
               ____________   __________________
                       ____________  Rf,Gf,Bf High Resolution
                       _  Adder   _
                       ____________
                            _
                  Rh,Gh,Bh  High Resolution





4.4.3.3  Use of QHY for High Resolution Graphics

Because of the manner  in which the QHY  data is added  to the DYUV   data 
after matrixing to RGB it is possible to optionally use the QHY data   for 
encoding high resolution graphics, simultaneously with its use  for   high 
resolution natural  pictures.   One or  more  of the  QHY  codes  may   be 
assigned in the decoder to levels which when  decoded and added to   fixed 
DYUV decoded levels result in appropriate graphics colours.

For this application the QHY decoder  may be  set to give bipolar   output 
values which are not equivalent to a matrixed Yqh value i.e. the Rqh   Bqh 
and Gqh  values  are not  equal.   Use of  this  facility  enables    high 
resolution natural images to be combined with computer generated  graphics 
and text in a single subscreen.

4.4.3.4  Loading QHY Quantization Levels

QHY quantization  levels  are loaded  via  the Display  Control    Program 
(V.4.5.1).  The decoder uses the lowest 8 entries of CLUT bank 2 to   hold 
these levels.  The QHY bank (bank 2) of the CLUT must be selected   before 
loading.  The instructions are:

Load QHY quantization level 0 - 7

            __________________________________________________
parameter = _ QLred(7 - 0) _ QLgreen(7 - 0)  _ QLblue(7 - 0) _
            __________________________________________________
        bit 23           16 15              8 7              0

For normal QHY, QLred  = QLgreen = QLblue  = QL (see  V.3.5.3), but    for 
special graphics applications the values may differ.

These instructions  are  identical  to  the  first  8  Load  CLUT    color 
instructions for bank 2 (see Figure V.33).

Set QHY bank:

            ___________________________________________________
parameter = _                  _                     _  %1 0  _
            ___________________________________________________
         bit 23                                     2  1     0


This instruction  is identical  to the  Set CLUT  bank  instruction   (see 
Figure V.33) for bank 2.

                        ***************

4.4.4  Absolute RGB


The 16 bit word representing each pixel is  split into two halves,   upper 
and lower, the first in image store 0 and the second in image store 1.

Upper:           _________________________________________
                 _ Ti _         Ri(4-0)        _ Gi(4-3) _
                 _________________________________________
                   7                                  0

Lower:           _________________________________________
                 _    Gi(2-0)   _        Bi(4-0)         _
                 _________________________________________
                   7                                  0


R, G and B are 5 bit absolute values of Red, Green and Blue  respectively. 
Each component  is  decoded  to  the  standard  form  of  V.4.4.1.2     by 
multiplying by 8.  A value of 2 represents black level.

T is the Transparency bit (see V.5.7)


4.4.5  CLUT

4.4.5.1  8-bit CLUT


The representation in memory is:

                        _________________________
                        _        Ci(7-0)        _
                        _________________________
                         7                     0
C = 8 bit CLUT address.



4.4.5.2  7 bit CLUT


The representation in memory is:

                        _________________________
                        _0 _      Ci(6-0)       _
                        _________________________
                         7   6                 0
C = 7 bit CLUT address.




4.4.5.3  4 bit CLUT


The basic unit is the pixel pair.  The representation in memory is:

                        _________________________
                        _  Ci(3-0)  _ Ci+1(3-0) _
                        _________________________
                         7        4   3        0

where C = 4 bit CLUT address and i must be even.
Each byte represents a pixel pair starting at an even X coordinate.




4.4.6  Runlength Coded CLUT


Run-coded images  are  stored in  memory  in compressed  form,  and    are 
expanded to CLUT codes by a runlength decoder associated with each   image 
store (see Figure V.23).  There is no linear  relationship between   pixel 
number and memory address. Lines of an image  are of variable length    in 
memory. The memory representations are given below.








4.4.6.1  Run-length coded 7-bit CLUT


Single pixels are encoded as one byte, and  a run of pixels of the    same 
color as two bytes.

                        _________________________
Single pixel:           _0 _      Ci(6-0)       _
                        _________________________
                         7   6                 0

Pixel run:
_________________________________________________
_1 _     Ci(6-0)        _        Li(7-0)        _
_________________________________________________
 15  14                8  7                    0

C = 7 bit CLUT address,
L = 8 bit run length = Number of pixels in run
where 2 _ L _ 255 and L = 1 is forbidden.
L = 0 means 'Continue this run to the end of the line'.

Every displayed line must finish with a zero-length  run (L=0). This   run 
must start no later than the last-pixel-but-one to be displayed, i.e.   it 
must start no later than pixel 383 for  a 625/compatible image, or   pixel 
359 for a 525 line image.  This means  that the displayed line must   have 
at least two identical pixels at its right hand end.


4.4.6.2  Run-length coded 3-bit CLUT


The same basic memory representation is used as for 7-bit CLUT, but   with 
a different interpretation of the pixel code byte.  The 3-bit CLUT   codes 
are converted to 4  bit CLUT codes by  appending a zero  msb before   they 
address the CLUT.

                        _________________________
Pixel pair:             _0 _Ci(2-0)_1 _Ci+1(2-0)_
                        _________________________
                         7  6     4  3  2      0







Run of pixel pairs:
_________________________________________________
_1 _Ci(2-0)_0 _Ci+1(2-0)_         Li(7-0)       _
_________________________________________________
 15 14   12 11 10      8  7                    0

i = even
C = 3 bit CLUT address,
L = 8 bit run length = Number of pixel pairs in run
where 2 _ L _ 255 and L = 1 is forbidden.
L = 0 means 'Continue this run to the end of the line'.

Every displayed line must finish with a zero-length  run (L=0). This   run 
must start no later  than the last-but-one pixel-pair  to be    displayed, 
i.e. it must  start no  later than pixel-pair  383 for  a   625/compatible 
image, or  pixel-pair 359  for a  525 line  image.  This means  that   the 
displayed line must have at least two identical pixel-pairs at its   right 
hand end.

4.4.7  CLUT Organization

The CLUT has 256  entries.  In order to  facilitate sharing of  the   CLUT 
between the two paths the CLUT is divided  into four banks of 64   entries 
each, Bank 0 to Bank 3.  The CLUT usage by the various planes is shown  in 
Figure V.28.

Figure V.28

                   8-bit CLUT   7-bit  CLUT  4-bit  CLUT    3-bit   CLUT* 
_____________ __________  __________  __________   __________
   _        63 _    255         127
   _ CLUT      _     .           .
   _ Bank 3  0 _     .        Path 1
   _____________     .        Plane B or __________
   _        63 _     .        Path 0+    15           _________
   _ CLUT      _     .        Plane A       Plane B   7 Plane B
   _ Bank 2  0 _  Path 0         0        0           0
   _____________  Plane A    __________  __________   __________
   _        63 _     .          127
   _ CLUT      _     .           .
   _ Bank 1  0 _     .           .
   _____________     .        Path 0     __________
   _        63 _     .        Plane A    15           _________
   _ CLUT      _     .           .          Plane A   7 Plane A
   _ Bank 0  0 _     0           0        0           0
   _____________ __________  __________  __________   _________
* Used for 3-bit run length.
+ May be used in path 0 for dual 7-bit CLUT
4.4.8  Allowed Image Coding Combinations


The allowed image coding combinations are determined by:

(1)     The bits/pixel for each plane. These are  specified in the   basic 
     decoding model.

(2) The way the CLUT is shared between display paths.

(3)     The  data  rate available  in  each path.   This  determines   the 
     allowed resolutions.

The basic set of allowed combinations, from (1) above, is:

Plane A   : Off, DYUV, CLUT 4, CLUT 7, CLUT 8, RL3, RL7.

Plane B   : Off, DYUV, CLUT 4, CLUT 7, RL3, RL7, RGB555, QHY.

(Note: RL3 is a special case of CLUT 4, with the most significant bit  set 
to 0 by the decoder before CLUT lookup)


Restrictions

(1)       RGB555 uses both  image data streams, so  it can only  be  used 
      with plane A turned off.

(2)      CLUT 8 uses the whole CLUT, so it may only be used with plane  B 
      set to DYUV or turned off.

   The same restriction applies to CLUT 7 and RL 7 used with dual   7-bit 
   CLUTs.

(3)      QHY is defined only for the extended case, and must be used with 
      Normal Resolution DYUV in plane A.






4.4.9  Allowed Image Coding Resolutions

The specified resolutions of each coding type are shown in Figure V.29.


Figure V.29

               ___________________________________________
               _    Normal   _   Double    _    High     _
__________________________________________________________
_  CLUT 4      _      -      _      B      _      B      _
__________________________________________________________
_  CLUT 7      _      B      _      -      _      E      _
__________________________________________________________
_  CLUT 8      _      B      _      -      _      E      _
__________________________________________________________
_  RGB 555     _      B      _      -      _      -      _
__________________________________________________________
_  RL3         _      -      _      B      _      B      _
__________________________________________________________
_  RL7         _      B      _      -      _      E      _
__________________________________________________________
_  DYUV        _      B      _      -      _      E      _
__________________________________________________________
_  QHY         _      -      _      -      _      E      _
__________________________________________________________

B = Specified image coding for Base Case
E = Specified image coding for Extended Case
- = Unspecified image coding

It  should  be  noted  that  application-specific  coded  data   can    be 
transformed by 'software manipulation' to produce an image conforming   to 
one of the above  specified coding types.  This  is allowed within    this 
specification (see V.6.3.1).

Note also  that, by  use of  the interlace  (see  V.5.14), the    vertical 
resolution of  all Normal  and Double  resolution image  formats  may   be 
doubled.  In the case of Double resolution formats,  i.e. CLUT4 and   RL3, 
the result is High resolution.

4.5  Display Control Facilities


Most display control is performed by means of  a display control   program 
(DCP) associated with each path (see Figure V.24).

UCM functions (see VII.2.3.4) are provided to access the DCP's.



4.5.1  Display Control Program


A detailed specification of  the DCP is given  in VII.2.3.2 and  a   short 
description is given here.

A display control program consists of a Field  Control Table (FCT) and   a 
Line Control  Table  (LCT).   The  FCT  is a  one-dimensional  array    of 
instructions, which are carried out before the start of each field.    The 
LCT is a  two dimensional  array of instructions,  each row  of which   is 
associated with a display line. Successive rows of  the table   correspond 
to successive display  lines. The  control actions corresponding  to   the 
entries in a row are carried out  between  the end of the previous    line 
and the start of the line with which the row is associated.

The LCT control mechanism allows display parameters and visual effects  to 
be redefined on a line by line basis.

Each instruction consists of  a one byte control  code followed by   three 
bytes of parameters. The available instructions are shown  in the   tables 
given in Figures V.31, V.32 and V.33 and their respective parameters   are 
detailed in the sections listed under 'more details'.   All the codes   in 
these tables may be used in either the  FCT or the LCT unless    otherwise 
stated.   All codes not in these tables are reserved.

The Display Control Programs in the two paths operate in conjunction.  The 
functions specific to each  path are controlled only  by that path.   Most 
global control functions  are only  available in path  0, but  some    are 
available in both paths.

Display parameters loaded by a DCP instruction on  a particular line   are 
retained on following display lines, until over-written by  a   subsequent 
instruction on  a  later  line.   However,  display parameters  are    not 
guaranteed to be retained from field to field. They are un-defined at  the 
start of a field, and must be loaded afresh for each field.

                Figure V.31


    Control program instructions available for path 0 only

______________________________________________________________
_Code_            Action                      _ More details _
______________________________________________________________
_$C0 _Select image coding methods             _ V 4.6.1      _
______________________________________________________________
_$C1 _Load transparency control information   _ V 5.7.3      _
______________________________________________________________
_$C2 _Load plane order                        _ V 5.7.1      _
______________________________________________________________
_$C4 _Load transparent color for plane A      _ V 5.7.2.2    _
______________________________________________________________
_$C7 _Load mask color for plane A             _ V 5.7.2.2    _
______________________________________________________________
_$CA _Load DYUV start value for plane A       _ V 4.6.2      _
______________________________________________________________
_$D8 _Load backdrop color                     _ V 5.13       _
______________________________________________________________
_$D9 _Load mosaic pixel hold factor for A     _ V 5.11.1.1   _
______________________________________________________________
_$DB _Load image contribution factor for A    _ V 5.9        _
______________________________________________________________


Figure V.32


     Control program instructions available for path 1 only

_______________________________________________________________
_Code_            Action                       _ More details _
_______________________________________________________________
_$C6 _ Load transparent color for plane B      _ V 5.7.2.2    _
_______________________________________________________________
_$C9 _ Load mask color for plane B             _ V 5.7.2.2    _
_______________________________________________________________
_$CB _ Load DYUV start value for plane B       _ V 4.6.2      _
_______________________________________________________________
_$DA _ Load mosaic pixel hold factor for B     _ V 5.11.1.1   _
_______________________________________________________________
_$DC _ Load image contribution factor for B    _ V 5.9        _
_______________________________________________________________

Figure V.33

Control program instructions available for both paths

_________________________________________________________________
_Code   _           Action                       _ More details _
_________________________________________________________________
_$10    _No operation                           *_      -       _
_________________________________________________________________     _$20   
_Load control table line start pointer  *_ Note 1       _
_________________________________________________________________     _$40   
_Load display line start pointer        *_ V 4.5.2.2    _
_________________________________________________________________
_$60    _Signal when scan reaches this line     *_ V 5.6        _
_________________________________________________________________
_$78    _Load display parameters                *_ V 4.6.1      _
_________________________________________________________________
_$80-$BF_Load CLUT color 0-63 (of current bank)  _ V 5.5        _
_________________________________________________________________
_$C3    _Set CLUT bank                          *_ V 5.5        _
_________________________________________________________________
_$DO-$D7_Load matte register 0-7                 _ V 5.10.3     _
_________________________________________________________________
_$80-$87_Load QHY level 0-7                      _ V 4.4.3.4    _
_________________________________________________________________
_$C3    _Set QHY bank                            _ V 4.4.3.4    _
_________________________________________________________________
* = This action may be set independently in each path.

Note

(1)   This instruction may  only be written by  means of the  UCM   calls 
    DC_LLnk and DC_FLnk.  It is the responsibility of the application  to 
    insure that  space is  left in  the LCT  or  FCT by  means of    this 
    mechanism before executing the DC_LLnk or DC_FLnk commands.

  The video driver will place this instruction in the last column of  the 
  LCT when using the DC_LLnk command.  In the case of DC_FLnk, the  video 
  driver will place this  instruction beyond the end  of the  application 
  FCT.







4.5.2   Line Pointer Tables


4.5.2.1  Image Line Pointer Table

Each line of an image as stored in image memory may start at an  arbitrary 
address within the available image memory. It is not necessary for   lines 
to be contiguous  in memory.  A table of  line start  addresses, or   line 
pointer table, may be  maintained for each image  (associated with    each 
drawmap, see VII.2.3).

This table  may be  used for  example for  line  repeat (for  e.g.   error 
concealment), or for partial updates of run-coded images.


4.5.2.2  Display Line Start Pointers

The mechanism for displaying an image is the  Display Line Start   Pointer 
instruction in the DCP.  These instructions may go  into the FCT or    any 
line in  the  LCT,  however  there  must be  one  (and  only  one)    DLSP 
instruction in the combined area of the FCT and the first line of the  LCT 
linked to by the FCT.  There is no restriction on the number or  placement 
of DLSP instructions outside of this combined area.

If there is no display line start pointer for a line, the line will  start 
at a memory address directly after the end of the previous line.

The display  line start  pointers may  be derived  from  the image    line 
pointer table(s) of the  image(s) being displayed on  that path.   Offsets 
are added for image positioning, and effects such as vertical mosaics  and 
subscreens may be produced.

The display  line  start  pointer  is  inserted  into  the  DCP  by    the 
instruction given below.

Load display line start pointer:

              ___________________________________
Parameter  =  _   Display Line Start Pointer    _
              ___________________________________
              23                                0

If the value of the display line start  pointer is zero a 'no   operation' 
instruction will be substituted for the 'load display line start  pointer' 
instruction.


4.6  Display Control Functions


A few basic display control functions are detailed in this section.  Those 
concerned with visual effects are treated in V.5.


4.6.1  Selecting Image Coding Methods

The image coding methods decoded by the video  decoder are chosen by   the 
two following DCP instructions.

Select Image Coding Methods:

             __________________________________________________
parameter  = _ __CS_  _  _NM_EV_  _   _ 1_ CM1 _  _  _ 1_ CM0 _
             __________________________________________________
        bit   23 22 21 20 19 18 17  13 12 11  8 7   5  4 3   0

where
   CS  = CLUT select for dual 7-bit CLUTs
      0 = Banks 0 and 1
      1 = Banks 2 and 3

      CM0 = Coding Method for path 0

   CM1 = Coding Method for path 1

        ________________________________________________________
        _Values_ CM0                      _ CM1                _
        ________________________________________________________
        _ 0000 _ OFF                      _ OFF                _
        _ 0001 _ CLUT8                    _ RGB555             _
        _ 0011 _ CLUT7 or RL7(Single CLUT)_ CLUT7 or RL7       _
        _ 0100 _ CLUT7 or RL7(Dual CLUT)  _      -             _
        _ 0101 _ DYUV                     _ DYUV               _
        _ 1011 _ CLUT4 or RL3             _ CLUT4 or RL3       _
         _ 1111 _        -                 _ QHY (Extended case)_
         ________________________________________________________
        Values are in binary notation
   All other values are reserved.

   NM  = Number of Mattes
      0 = 1 matte
       1 = 2 mattes

   EV  =External Video Enable
      0 = Disable
      1 = Enable
Load Display Parameters:

            ____________________________________________________
parameter = _        _       _ 1 _BP(1-0)_ _ _PRF(1-0)_RMS(1-0)_
            ____________________________________________________
         bit 23            11 10  9     8 7 4 3      2 1      0
where
      RMS = Runlength or Mosaic (Pixel Repeat) Select

   where 00 = Normal
     01 = Normal
     10 = Runlength
     11 = Mosaic
    
      PRF = Pixel Repeat Factor for Mosaics

        where 00 = times 2
     01 = times 4
     10 = times 8
     11 = times 16

      BP  = Bits/Pixel from the Image Store

        where 00=8 bits/pixel, Normal Resolution.
              01=4 bits/pixel,Double or High (*) Resolution.
     10 = 8 bits/pixel, High (*) Resolution
     11 = Reserved
      * = Extended Case only.

Note: parameter values are given in binary notation.

Only those combinations of CM0, CM1, BP and  RMS that are defined    image 
combinations according to the CD-I specification are allowed. All   others 
are reserved.  The allowed  combinations are  shown in  Figure  V.34   and 
V.4.4.8.














 Figure V.34

               ___________________________________________
               _  CM0 or CM1, BP, RMS (Binary Values)    _
               ___________________________________________
               _    Normal   _   Double    _    High     _
__________________________________________________________
_  CLUT 4      _      -      _ 1011,01,00  _ 1011,01,00  _
__________________________________________________________
_  CLUT 7      _+0011,00,00  _      -      _+0011,10,00  _
__________________________________________________________
_  CLUT 8      _ 0001,00,00  _      -      _ 0001,10,00  _
__________________________________________________________
_  RGB 555     _ 0001,00,00  _      -      _      -      _
__________________________________________________________
_  RL3         _      -      _ 1011,01,10  _ 1011,01,10  _
__________________________________________________________
_  RL7         _+0011,00,10  _      -      _+0011,10,10  _
__________________________________________________________
_  DYUV        _ 0101,00,00  _      -      _ 0101,10,00  _
__________________________________________________________
_  QHY         _      -      _      -      _ 1111,01,00  _
__________________________________________________________


   + For dual 7-bit CLUT, 0011 must be replaced by 0100

Each entry in this table is in the form CM0 (or CM1), BP, RMS. Note  that, 
for CLUT and RGB coding methods, RMS may  also be set to %11, to    select 
mosaic pixel repeat.

It should  be  noted  that  applications  specific  coded  data  can    be 
transformed by 'software manipulation' to produce an image of one of   the 
above specified coding types.  This is allowed within this   specification 
(see V.6.3.1).










4.6.2  Loading DYUV Start Values


The Absolute YUV starting values for a line  of the displayed part of   an 
image are loaded by the two DCP instructions one for plane A and one   for 
plane B.


Load DYUV Start Value (for plane A or plane B):

            ____________________________________________________
parameter = _    Y (7-0)     _      U (7-0)   _     V (7-0)    _
            ____________________________________________________
         bit 23            16 15             8 7              0

where
      Y = Absolute Y start value
      U = Absolute U start value
      V = Absolute V start value

If, on a particular line, this instruction is absent, the value given   by 
the last Load DYUV Start Value instruction is used by the decoder.

  

  4.7  Error Concealment

4.7.1  General


As video pixel data is coded on disc in Form 2 sectors, there is no  extra 
layer of error correction  for video beyond the  CIRC (see II.4.6).    The 
option is therefore available of using Error Concealment, (a general  term 
for any method of masking the, in this  case, visual effect of errors   in 
an image).  Error  concealment is  made possible by  the high  degree   of 
spatial correlation in most images, especially natural images.

The Form 2 error detection mechanism is capable of signalling that  errors 
have been detected in specified 8-bit bytes or 16-bit words (depending  on 
the implementation) of a  video data stream. The  player can thus   detect 
which lines  of an  image are  in error,  and  carry out  an   appropriate 
concealment strategy.


4.7.2  Odd/Even Line Separation

When error concealment is to be used, the even and odd lines of an   image 
are coded on disc  in separate sectors, and  are physically separated   by 
interleaving so  as to  minimize the  chance of  an  error occurring    in 
adjacent lines (see V.6.4.3).  In the decoder, the odd and even lines  are 
loaded into two areas in memory, as shown in the figure below.


                    Figure V.35

                 ____________________
              E1 ____________________
              E2 ______ Even ________
              E3 ______ Lines _______
              .  ____________________
              .  ____________________
                 ____________________
              O1 ____________________
              O2 ______ Odd _________
              03 ______ Lines _______
              .  ____________________
              .  ____________________




The Create Drawmap Function (DM_Creat) of the UCM (see VII.2.3.4.1)   must 
be called with the line interleave parameter set to 1 in order to set   up 
the line pointer table for the image correctly.  If error concealment   is 
not to be used, the interleave parameter is  set to 0, and the lines    of 
the image are consecutive on disc and in memory.



4.7.3Concealment Techniques


The concealment strategy chosen will depend on the  time available.    The 
longer an image is to be displayed, the  more noticeable errors are,   and 
the more time is available for concealment.  Some  simple techniques   are 
defined here.

(1)Natural Images (DYUV)
  When  an  error  is  detected,  the  line  containing   the  error   is 
  substituted by the previous line.  The contents may  be copied  across, 
  or the line start  pointer in the DCP  for the line  in error may    be 
  substituted by that of  the previous line.  If  the first line  is   in 
  error the next line is taken.

(2)CLUT or RGB555 Images
  When an  error is  detected, the  pixel in  error  is replaced  by  the 
  adjacent pixel in the  previous line.  If the  pixel is in  the   first 
  line then the corresponding pixel of the next line is taken.

(3)Runlength Images
  When  an  error  is  detected,  the  line  containing   the  error   is 
  substituted by the previous  line.  The lines will  probably not   have 
  the same length in memory, so direct copying is undesirable.  The  line 
  start pointer  in DCP  may be  used to  achieve  the same  effect,   as 
  defined above for natural images.  If the first  line is in error  then 
  the next line is taken.


Error concealment of DYUV images

Any line of a DYUV image that is  replaced according to the above   method 
must also have its absolute YUV start value copied from that of the   line 
that is replacing it.
e of a DYUV  image that is replaced  according to the  above method   must 
also have its absolute YUV start value copied from that of the line   that 
is replacing it.



4.8  525/625 Line Image Interchange

All CD-I images may  be displayed on any  decoder.  To enable  this,   the 
video decoder is capable  of changing the dimensions  of the   full-screen 
display area (while leaving the pixel clock frequency the same)  according 
to the state of a flag called 'Compatibility  Mode'.  This can take    the 
values 0 and 1, and is set by  the UCM function DC_SetCmp.  The value    0 
corresponds to the display dimensions specified in V.2.2.

The dimensions of  the full-screen  display in the  two cases,  and    the 
offsets in pixels of the top left corner of the display for Mode = 1  from 
that for Mode = 0, are given in Figure V.35a below. Dimensions are   given 
as width followed by  height.  A positive offset  indicates   displacement 
downwards or to the right.


Figure V.35a


_________________________________________________________________
_Compatibility Mode_ 525 Monitor _ 525 line TV _ 625 line system_
_________________________________________________________________
_        0         _  360 x 240  _  384 x 240  _   384 x 280    _
_________________________________________________________________
_        1         _  384 x 240  _  360 x 240  _   360 x 240    _
_   _____________________________________________________________
_   _ Vert. offset _     0       _     0       _     +20        _
_   _____________________________________________________________
_   _Horiz. offset _   -12       _   +12       _     +12        _
_________________________________________________________________

The vertical offsets are mandatory.  The horizontal offsets are  strongly  
recommended, to ensure visibility of the safety area.  The actual   offset 
is returned by DC_SetCmp: it is needed by the application in order to   be 
able to set the pointer offset.

In the case of 525 TVs and 625 line systems, the Mode 1 display does   not 
necessarily extend  beyond  the  screen  boundary  - however,  the    term 
'full-screen display' is retained for consistent usage.

In the case of 525 monitors, the Mode 1 full-screen display width is  such 
that the extreme edges may not actually be  displayed. However, the   full 
width is read from memory for each line.

See Appendix V.2  for guidelines  on how the  application may  use    this 
facility to achieve the  goal of correctly displaying  all images on   all 
decoders.

V.5  Visual Effects

5.1  General

A number of  visual effects  are possible with  the CD-I  system,    which 
control or affect the way that images are displayed and combined.    These 
effects are defined in this section.

The basic visual  effects facilities  available via the  Display   Control 
Program and accessed via  the UCM (see VII.2.3.2.4)  are detailed.    High 
level functions based on these are also described.

The effects specified  in this  section are not  an exhaustive  set.    An 
unlimited number  of  further  application-specific  effects,  based    on 
software manipulation  of the  image, or  on use  of  the basic    effects 
facilities described here, are also possible.

Timing and synchronization of  video information is not  covered in   this 
chapter, except for synchronization to display scanning. Refer to  Chapter 
VII (CD-RTOS) for details on these topics.


5.2 Cut

The most basic effect in film and video editing is called 'Cut'.
'Cut' causes an image to appear, usually to replace a previous image.

'Cut' may be achieved either by enabling an image for display on a   given 
plane, or by re-ordering the planes to bring an image to the front.

5.3  Scroll

5.3.1  Image Positioning

Images larger than the full-screen dimensions may be  encoded and   loaded 
by the player.  It  is possible to position  the displayed part  of   such 
images at any coordinate X,Y relative to the image top left corner.


Figure V.36


0,0______________________
   _X,Y_____________    _
   _   _ Displayed _    _
   _   _           _    _
   _   _  Image    _    _
   _   _           _    _
   _   _____________    _
   _                    _
   _ Image (larger than _
   _     full screen)   _
   ______________________


For DYUV  coded  images, it  is  necessary to  reload  the  absolute   YUV 
starting values for each line whenever an image is re-positioned.    These 
may be calculated from the old values and  the image contents.  For   DYUV 
images, X must be a multiple of two pixels.

For runlength  coded  images the  horizontal  position must  be  at    the 
left-hand edge, i.e. X = 0.  The same applies to high-resolution  DYUV+QHY 
images, as the QHY component is run-coded.   (However,  applications   may 
arbitrarily position  run-coded and  QHY images  by manipulation  of   the 
codes).


5.3.2  Scroll

Scroll is  the repeated  re-positioning of  a displayed  image  within   a 
larger image.  Motion may  be vertical, horizontal, or  a combination   of 
the two.  A wide  range of scrolling effects  may be achieved  by use   of 
image re-positioning.


For a scroll  which is  constrained to be  within the  boundaries of    an 
image, larger than screen size, but which is  small enough to be held   in 
decoder memory at one  time, the simple re-positioning  mechanism is   all 
that is required.

However, if the illusion of scroll over a  very large image is   required, 
such as panoramic scan of a landscape, or vertical scroll of a   multipage 
document, the technique used in the figure below must be used.

A Scroll  Image  is defined  in  memory, larger  than  full-screen.    The 
displayed image is repeatedly re-positioned within the larger image,   and 
when it reaches the edge it is broken into two parts at opposite ends   of 
the Scroll  Image  (see  Figure  V.37).   The  line  pointer  table     is 
manipulated to form the two parts into one displayed image on the  screen. 
Partial updates are progressively performed to write new  information   to 
the image in the direction of scroll.

A similar technique can be used in the horizontal direction.


                       Figure V.37


               _________________________ ___
               _   Partial Update 2    _ _ _
 Scroll        _________________________ _ _
 Image    ______                       _   _
 Memory        _________________________   _
               _                       _   _
               _                       _   _ Scroll
               _      Displayed        _   _ Direction
               _                       _   _
               _        Image          _   _
               _                       _   _
               _                       _   _
               _                       _   _
               _________________________ _ _
               _   Partial Update 1    _ _ _
               _________________________ ___

                 Vertical Scroll Mechanism




5.3.2.1  Scroll of DYUV Images

When a DYUV image is moved horizontally, new  absolute start values   must 
be loaded into the  DCP for each line.   These may be  calculated by   the 
application from the old values and the image contents.

This method will suffice for slow scroll speeds, but for high speeds   the 
start values must  be loaded  from disc.  Horizontal  scroll must  be   by 
multiples of two pixels.


5.3.2.2  Scroll of Runlength Images

Because of the properties of runlength coded images, horizontal  scrolling 
is possible only by application-specific manipulation of the    run-codes. 
Vertical scroll is possible, in the same way as for other coding types.

The same comments apply to DYUV+QHY encoded High Resolution images.

Scrolling effects may also be achieved for runlength animation by  loading 
from  disc  successive  images  representing  a  scene  with    increasing 
displacement.




























5.4  Partial Update

It is  possible  to  encode  and  load images  which  are  smaller    than 
full-screen. These small images cannot be displayed directly, but only  by 
copying them  over a  part of  an image  large  enough to  display.   Such 
alterations to an image are known as Partial Updates.

One of the main uses for Partial Updates is to create visual motion in   a 
limited area of the  screen by repeatedly updating  that area.    Visually 
attractive piece-by-piece transitions from one image to another may   also 
be achieved.


Figure V.38

               ____________________________
               _   _____________          _
               _   _Rectangular_          _
               _   _           _          _
               _   _  Update   _          _
               _   _           _          _
               _   _____________          _
               _                ________  _
               _   Irregular   __     __  _
               _              __     __   _
               _    Update   __     __    _
               _            __     __     _
               _            ________      _
               ____________________________

Two types of partial  updates are available, for  rectangular areas    and 
irregular areas.

5.4.1  Rectangular Updates

A rectangular area is coded as a normal image, of reduced size.
It is then copied  in to the displayed  image at the  desired   coordinate 
(see UCM, VII.2.3).










5.4.2  Irregular Updates


The shape of an Irregular Update is coded as a Y starting value then an  X 
position and length for  each successive line of  the update.  The   pixel 
data itself is packed in line order with no gaps between lines.  The   UCM 
function that performs an irregular update is DM_IrWr (see VII.2.3.4.1).


5.4.3  Partial Update of DYUV Images

As DYUV pictures are differentially coded, it is necessary to begin   each 
line of  a Partial  Update with  a 'transition  area'.  This is  a   short 
sequence of  DYUV  codes which  have  been pre-calculated  to  make    the 
transition from the YUV  values in the surrounding  image just   preceding 
the update to those at the left edge of the update proper.



          __T__________________________T__  T = Transition
                                                Area
           ______ Partial Update ________

Each line  of  a Partial  Update  must similarly  be  terminated  with   a 
transition area.  Both transition  areas must form part  of the    Partial 
Update as coded on disc.

If the Partial Update includes the beginning of any lines in the   display 
screen, then the absolute  starting value for those  lines must also    be 
loaded from disc.

For High  Resolution DYUV+QHY  images, the  QHY component  is   run-length 
coded, and  therefore Partial  Updates of  this component  must  use   the 
techniques described below for runlength images.












5.4.4  Partial Update of Runlength Images

Because of  the  properties  of  runlength  coding, Partial  Updates    of 
runlength coded images are  only specified for Rectangular  Updates   with 
the full width of the image.  However, arbitrary  Partial Updates may   be 
carried out by application-specific manipulation of the run-codes  or   by 
prearranging the run lengths on disc, to accommodate the Partial Updates.

A runlength update generally will not have the  same length (in bytes   of 
code) as the  part of  the image it  is replacing.   To avoid   constantly 
moving the part of the image below the update, the line pointer table  may 
be used to provide room for the largest update, and to join up the   parts 
of the image.





5.5  CLUT Update


CLUT values are loaded via the Display Control Program (V.4.5.1).   Colors 
are loaded on a bank basis, i.e. the correct bank must be selected  before 
loading.  The instructions are given below.

Load CLUT color (0 - 63 of current bank):

            ____________________________________________________
parameter = _  Red (7-0)     _  Green (7-0)   _  Blue (7-0)    _
            ____________________________________________________
         bit 23            16 15             8 7              0
and

Set CLUT bank :

            ____________________________________________________
parameter = _                       _               _Bank (1-0)_
            ____________________________________________________
         bit 23                                    2  1       0

The Red, Green and Blue components are directly in the form to which   all 
images are decoded, i.e.  they have black level  at 16 and  nominal   peak 
level at 235 (see V.4.4.1.2).

The ability to load the CLUT banks depends  upon the active Image   Coding 
Method (V.4.6.1) in the DCPs.  In general, CLUT banks 0 and 1 must  always 
be loaded from path 0.  When path 0 is set to CLUT 8, banks 2 and 3   must 
be loaded from path 0.  Also, when path 0 is set to CLUT 7 or RL7 and  the 
CLUT Select bit is set to path 1 (dual 7-bit CLUT), banks 2 and 3 must  be 
loaded from path 0.

When path 1 is set to CLUT 4,  CLUT 7, RL3 or RL7 banks 2  and 3 may    be 
loaded from path 1.  If path 1 is  not set to one of these modes,     then 
banks 2 and 3 may be loaded from either path 0 or 1.


5.5.1  CLUT Animation

For CLUT coded images, the 256 values in  the CLUT control the colors   of 
the entire image.  Therefore, some simple animation effects are   possible 
simply by redefining some or all of the  CLUT contents as a function    of 
time.

5.5.2  Dynamic CLUT Update


By reloading  CLUT colors  on successive  lines of  the  display, it    is 
possible to use more colors in an image than the number of entries in  the 
CLUT.

The required CLUT loading commands are placed in the appropriate lines  of 
the Line Control Table.

It is of  course possible  to use this  effect in  conjunction with   CLUT 
animation.


5.5.3  Dual 7- bit CLUTs

The 7-bit CLUT coding methods, that is CLUT 7 and RL 7, may be used   with 
dual 7-bit CLUTs.  This function, available in path 0 only, allows  either 
the lower or upper half of the CLUT to be used for display, selectable  on 
a line by line basis.

Dual 7-bit  CLUT operation  is selected  via the  CM0  field of  the   DCP 
instruction 'Select Image Coding  Methods' (see V.4.6.1). Which  half   of 
the CLUT to  use for  display is selected  by the  CS field  of the   same 
instruction.

Dual 7-bit CLUTs may be used e.g. to  increase the number of colors in   a 
runlength coded image, or  to provide two different  sets of colors    for 
split-screen operation.


As the dual 7-bit CLUT function allocates both CLUTs to path 0, it  cannot 
be  used  simultaneously  with  CLUT  or  RL  coding   in  path    1.5.6   
Synchronization to Display Scanning


If an object is repeatedly being drawn on  the screen, erased, and    then 
drawn at a new position, such as in some computer graphic applications,  a 
flicker effect is  frequently seen.   This is caused  by the  object   not 
being fully re-written at the time it is scanned for display.

This effect should be avoided by synchronizing the re-writing of   objects 
to the field scan,  so that erasure and  re-writing takes place    between 
successive scans of the object.

It is also necessary  to synchronize Partial Updates  to field scan,   for 
similar reasons.

A function is provided  to generate a video  interrupt when a   particular 
scan line (chosen by  the application) has been  reached by the    display 
scanning mechanism.  The Display Control Program instruction used by  this 
function is:

Signal when scan reaches this line

            __________________________________________
parameter : _                  _                     _
            __________________________________________
         bit 23                                     0

5.7  Overlay


The image planes may be overlayed in any  order, and parts of images   may 
be made transparent in order to see the contents of planes behind them.




5.7.1  Plane Order


The visual order of planes A and B is set by means of the Display  Control 
Program instruction.

Load Plane Order:

            ____________________________________________________
parameter = _                   _                  _   Order   _
             ____________________________________________________
         bit 23                                   3 2         0
where

           Order Plane order
      % 000      A in front of B
      % 001      B in front of A
      All other values are reserved


In all cases, the cursor plane is 'in front of' the image planes, and  the 
backdrop plane is behind them.


5.7.2  Transparency Mechanisms


Three mechanisms  are defined  to control  transparency between    planes. 
These are given below.


5.7.2.1  Transparency Bit


In the case of absolute RGB coding (RGB555)  the most significant bit   of 
every pixel is used for transparency control.


5.7.2.2  Color Key


A CLUT (not RGB555 or DYUV) image may be compared on an RGB basis,   pixel 
by pixel, to a color key value K.   The result of the comparison    (Color 
Key = TRUE or FALSE), may be used to affect the image transparency.

In order to  allow matching  for a range  of colors,  the result  of   the 
comparison may be masked on a bit by  bit basis with a mask color M.     A 
pixel of color P has color key value TRUE if and only if

      [P(i) = K(i)] or [M(i) = 1]

for all bit positions i = 2 - 7 of each color component (R,G,B).

Note that only the most significant 6 bits  of each color component    are 
used.

The color key and  mask colors may be  set separately for  the two   image 
planes.  They are set by the Display Control Program instructions.    Both 
the transparent and  mask color  must be set  when using  the color    key 
mechanism.

Load Transparent Color (of Plane A or B):

            ____________________________________________________
parameter = _  Red (7-0)     _  Green (7-0)   _  Blue (7-0)    _
             ____________________________________________________
         bit 23                                               0

and

Load Mask Color (of Plane A or B):

            ____________________________________________________
parameter = _  Red (7-0)     _  Green (7-0)   _  Blue (7-0)    _
            ____________________________________________________
         bit 23                                               0


5.7.2.3  Transparency via Mattes

The transparency of an image plane may be linked to the state of a   matte 
flag (see V.5.10).



5.7.3  Transparency Control


The three  transparency  mechanisms  described  above  may  be    selected 
individually or in combination,  for each of the  two image planes.    The 
selection is made via the Display Control Program instruction.

Load Transparency Control Information:

            ____________________________________________________
parameter = _Mix_      _     _ TB (3-0) _     _     _ TA (3-0) _
             ____________________________________________________
         bit 23  22           11       8 7         4 3        0
where
      Mix = Disable mixing (V.5.9.1).
        0 = mix
       1 = no mix

      TA,  TB   =   Select  transparency   mechanisms   for  planes     A 
and B individually.

      TA, TB*  Pixel transparent if

       0000    Always (plane disabled)
       0001    Color key = TRUE
       0010    Transparent bit = 1
       0011    Matte Flag 0 = TRUE
       0100    Matte Flag 1 = TRUE
       0101    Matte Flag 0 = TRUE or Color Key = TRUE
       0110    Matte Flag 1 = TRUE or Color Key = TRUE
       0111    Reserved
       1000    Never (no transparent area)
       1001    Color Key = FALSE
       1010    Transparent bit = 0
       1011    Matte Flag 0 = FALSE
       1100    Matte Flag 1 = FALSE
       1101    Matte Flag 0 = FALSE or Color Key = FALSE
       1110    Matte Flag 1 = FALSE or Color Key = FALSE
       1111    Reserved


* Binary values5.8  Wipes


A wipe is the  replacement of one image  by another during  a period    of 
time, by the motion of a boundary separating the visible parts of the  two 
images.  The images may  both be stationary during  this process or    may 
move, for example, with the boundary thus, scrolling in or out.




5.8.1  Two-plane Wipes


The chief  mechanism  for achieving  two-plane  wipes is  that  of   matte 
definition.  By linking the  transparency of the overlaying  plane to    a 
matte flag, and re-defining  the matte boundary as  a function of    time, 
wiping effects of arbitrary complexity can be obtained.

The mechanism for matte definition is described in V.5.10.

A scrolling wipe may be obtained e.g. by  scrolling an image at the   same 
time as updating the matte definition.




5.8.2  Single-plane Wipes


A wiping effect  can be  obtained in a  single image  plane by  means   of 
Partial Updates.  Wipes of DYUV coded images done this way will not   have 
such clearly defined edges as two-plane wipes, due to the transition  area 
between images.

5.9  Image Contribution Factors

Each path has  associated with  it an Image  Contribution Factor,    which 
determines the contribution of its associated image to the final  display. 
This factor is applied after decoding to RGB.

For each pixel, the resultant color components are given by:

C = ICF * (C'-16) + 16

where ICF  = Image Contribution Factor (between 0 and 1)
        C= One of the color components, R G or B.
      C' = The corresponding component after decoding.

Note that this equation preserves the black level of 16.

ICF's may be used with overlay, or with mixing (see V.5.9.1).

The image contribution factors may be loaded by  use of the two    Display 
Control Program instructions, one for plane A and one for plane B.

Load Image Contribution Factor (for plane A or B):

            ____________________________________________________
parameter = _                   _                 _ ICF'(5-0)  _
             ____________________________________________________
         bit 23                                    5          0

where
     ICF' = 63 * ICF to the nearest integer between 0 and 63.
     i.e. ICF' = 63 gives an image contribution factor of 1.

These instructions  allow  the ICF's  to  be changed  line  by  line   and 
continue for  subsequent  lines  unless  changed  by a  new  Load    Image 
Contribution Factor  instruction.   The  ICFs  may  also be  changed    at 
arbitrary points on a line by use of the matte mechanism (V.5.10).

5.9.1 Image Mixing

As an alternative to overlay, the images on planes A and B may be   mixed, 
that is their components summed.

When mixing is enabled, the color components of each pixel are given by:
       C = C(A) + C(B) - 16

where  C        = one of the color components, R, G or B
      C(A), C(B) = the corresponding components of planes A and              
B, after application of image contribution factors.

The black level offset of 16 is preserved by this summation.

The result of the mixing function, for each color component, is  prevented 
from overflow or underflow by clipping to 255 and 0 respectively.

To enable/disable  mixing,  The  Display  Control  Table  command    'Load 
Transparency Control Information' is used (see section V.5.7.3).

Transparency, (see V.5.7.2), may  be used with mixing,  but in this   case 
transparent areas of an  image simply give no  contribution to the   final 
display - that is they are equivalent to black areas.


5.9.2  Fades and Dissolves


A fade is a gradual decrease or increase  of the brightness of an   image. 
A dissolve is the simultaneous fade down of one image and the fade up   of 
a second image mixed with the first.

Dissolves and fades are  the result of repeated  definition of the   Image 
Contribution  Factors   as   a  function   of   time.   The     transition 
characteristics (transition rate, transition law, etc.) are under  program 
control.

Global dissolves and fades are produced using the Load ICF commands   (see 
V.5.9.1).  Local dissolves and fades are produced by  means of the   matte 
commands, which may be used to change the ICF's at arbitrary points  along 
a line (see V.5.10.2).
5.10  Mattes


A matte is any connected area of the display.  It may be simply  connected 
(i.e. without holes) or multiply connected (with holes).  A matte is  used 
to control the transparency of one or more image planes (V.5.7.3).   There 
may be multiple mattes on the screen at  any one time, and some of   these 
may overlap.

The  matte  mechanism  is  also  used  for  dynamic   control  of    Image 
Contribution Factors.




5.10.1  Matte Mechanism


The operation of the  matte mechanism in a  decoder may be  explained   in 
terms of the following model.

There are two matte flags in a decoder, MF0 and MF1, which may be set   to 
TRUE and reset to FALSE at arbitrary positions  on the display.  A   matte 
flag is TRUE to indicate the inside of a matte, and FALSE to indicate  the 
outside of a matte.   Each matte flag may  be used to  indicate   multiple 
non-overlapping mattes.  On the other hand, mattes indicated by  different 
flags may overlap.

Figure V.39 shows an example of overlapping and non-overlapping mattes.

In this figure, mattes 0a and 0b are indicated by flag MF0 and matte 1  is 
indicated by flag MF1.



Figure V.39


____________________________
_     ______               _
_    __    __              _
_   __  0a  __             _
_   _    _____________     _
_   __   _  __       _     _
_    __  _ __  1     _     _
_     ______         _     _
_        _____________     _
_        _______           _
_       __ 0b  __          _
_       __     __          _
_        _______           _
____________________________

Setting and  resetting of  the matte  flags is  performed  via  N    matte 
control registers, MCR0 to  MCR(N-1) (in the Base  Case, N=8).  Each    of 
these registers may hold  a matte control command,  which consists of    a 
position (distance from the left hand side of  the screen) at which    the 
command is to be implemented, an operation code, and some parameters.

The matte flags are  automatically reset to FALSE  at the start  of   each 
line.

The commands  contained  in  the  registers  are carried  out  on    every 
horizontal image scan line.  As each scan line progresses, at each   pixel 
position the  lowest-numbered register  whose command  has not  yet   been 
implemented is examined for  a position match, and  if a match  is   found 
that command is implemented.

By means of the  NM (Number of Mattes)  bit in the  'Select Image   Coding 
Methods' command (V.4.6.1), the N registers may be divided into two   sets 
of N/2 registers.  The  two halves operate simultaneously,  each in    the 
manner described above, allowing the two matte flags to be changed at  the 
same position.




5.10.2  Matte Commands

The matte commands contained in the matte control registers allow  setting 
and resetting of the  matte flags MF0 and  MF1, and also   (independently) 
the dynamic setting of  Image Contribution Factors (ICF's)  for the    two 
paths.

An ICF may be  changed either at the  same position as  a matte flag    is 
changed, or independently.  The format of Matte Commands is given below.

Matte Command

            ________________________________________________
            _Op(3-0)_  _  _MF_ ICF (5-0) _ XPosition (9-0) _
            ________________________________________________
        bit  23   20 19 17 16 15       10 9                0

where
        XPosition = Distance from left hand edge of display, in     Double 
                      Resolution
       ICF = Image Contribution Factor
       MF  = Matte Flag to be changed*
              0 = MF0
        1 = MF1
       Op  = Operation code

Operation Code           Action
(Binary values)
    0000         Disregard all commands in higher registers
    0100         Change ICF for path 0
    0110         Change ICF for path 1
    1000 Reset a matte flag to FALSE
    1001    Set a matte flag to TRUE
    1100    Reset a matte flag to FALSE and change ICF of  path 0
    1101   Set a matte flag to TRUE and change ICF of path 0
    1110   Reset a matte flag to FALSE and change ICF of path 1
    1111   Set a matte flag to TRUE and change ICF of path 1

* The MF bit is only used when the  NM (Number of Mattes) bit in       the 
'Select Image  Coding  Methods' command  (V.4.6.1)  is set  to  0     (one 
matte).  The values of MF must be the same (i.e. 0 or 1) for every   matte 
register.


  When NM = 1 (two mattes), matte registers  MCRO to MCR3 correspond   to 
  matte flag 0 and MCR4 to MCR7 correspond to matte flag 1.  The MF   bit 
  is ignored.


5.10.3  Loading the Matte Control Registers


The contents of the Matte Control Registers remain the same from line   to 
line unless loaded via the Display Control Program.  The DCP  instructions 
to load new commands into these registers (one for each register) are

Load Matte Control Register (0-7):

            ____________________________________________________
parameter = _              Matte Command as above              _
             ____________________________________________________
         bit 23                                               0



Note:     If  one   or  more   Matte  Control  Registers   are   accessed  
      simultaneously from path 0 and path 1, the  access via path 0   has 
      priority over path 1  (access via path 1  will be   ignored).5.11   
      Mosaics


The mosaic functions allow  images to be viewed  at reduced    resolution, 
either purely as a visual effect, or to allow animation of larger   screen 
areas, or to magnify an image in order to see its detailed structure.




5.11.1  Basic Facilities


The three basic facilities that may be used to create mosaic effects   are 
Pixel Hold,  Pixel  Repeat, Line  Hold/Repeat  via the  Display    Control 
Program.  These facilities are  shown in Figures V.23  and V.24 but    for 
clarity they are shown again in the Figure V.40 below.


Figure V.40


___________    __________      __________    _________
_  Image  _    _ Pixel  _      _        _RGB _ Pixel _
_         ______        ________Decoder ______       _____Mixer
_  Store  _    _ Repeat _      _        _    _ Hold  _
___________    __________      __________    _________
     _
     _
_____________
_Line Start _
_Pointers   _
_____________
     _
___________
_ Display _
_ Control _
_ Program _
___________


5.11.1.1  Pixel Hold


The Pixel Hold function operates after the pixel codes have been   decoded 
to RGB.  Every Nth pixel RGB value is  held for that pixel and the    next 
N-1 pixels, where N is the Pixel Hold  Factor. As an example, for N =   3, 
and where Pi = the RGB value of pixel i,

                  ______________________________________________
before Pixel Hold:_P0 _P1 _P2 _P3 _P4 _P5 _P6 _P7 _P8 _P9 _.  ._
                  ______________________________________________
                  ______________________________________________
after  Pixel Hold:_P0  P0  P0 _P3  P3  P3 _P6  P6  P6 _P9  .  ._
                  ______________________________________________

The Pixel Hold function causes a 'Granulation' effect  in the   horizontal 
direction, i.e.  the  resolution  is  lowered  without  the  image    size 
changing.  As Pixel Hold operates after decoding, it can be used for   all 
images however they are coded, either by DYUV, CLUT, RGB or RL.

The Pixel Hold Factor can be any value 2 to 255 and is loaded by means  of 
the DCP instruction given below.

Load Mosaic Pixel Hold Factor (for plane A or B):

            ____________________________________________________
parameter = _En _             _               _  Factor (7-0)  _
             ____________________________________________________
         bit 23  22                            7              0
where
      En = Pixel Hold Enable
     0 = Mosaic off
     1 = Mosaic on

   Factor = Number of pixel periods that the pixels are held
      %00000000 = Reserved
     %00000001 = Normal usage
     %00000010 to %11111111 = Mosaic effect

The pixel hold factor is effective at both  Normal Resolution and   Double 
or High Resolution.




5.11.1.2  Pixel Repeat


The Pixel  Repeat  function repeats  codes  from the  image  memory,    as 
distinct from holding onto decoded color values.  Each  pixel code Pi   is 
repeated N times, where N is the Pixel  Repeat Factor, and then the   next 
pixel code Pi+1 is read from the memory.  As an example, for N = 2,
                    ____________________________________________
before Pixel Repeat:_P0 _P1 _P2 _P3 _P4 _P5 _P6 _P7 _P8 _P9 _. _
                    ____________________________________________
                    ____________________________________________
after  Pixel Repeat:_P0  P0 _P1  P1 _P2  P2 _P3  P3 _P4  P4 _. _
                    ____________________________________________

Pixel Repeat  causes an  image magnification  effect in  the    horizontal 
direction.  It is defined only for RGB555 and CLUT image coding types  and 
not for DYUV and RL.

For CLUT 4, the unit that is repeated is the pixel pair.

The Pixel Repeat Factor is loaded via the  DCP instruction 'Load   display 
parameters' (V.4.6.1).  In the Base Case it is limited to the numbers   2, 
4, 8 and 16 only.

Note that when Pixel  Repeat is applied to  a display line,  the   default 
starting point for  the next  line is, as  usual, the  pixel   immediately 
following the last displayed pixel on that line.


5.11.1.3  Line Hold / Repeat

In the vertical direction, mosaic effects are produced by repeating  lines 
using the Display Line Start Pointers in the DCP. Line Repeat is  produced 
by repeating line Lj by a factor M, then displaying line Lj+1M times   and 
so on.  Line Hold is effected by repeating  Lj M times, then    displaying 
line Lj+M M times, etc.

Vertical repeat factors are  of course independent of  horizontal   repeat 
factors, and may take  any value.  Under application  control, they    may 
also vary as a function of vertical position.


5.11.2  Effects

Among the effects  that can  be produced by  the application  using    the 
mosaic facilities described above are granulation, magnification or  zoom, 
and low resolution images.



5.11.2.1 Granulation


Granulation is an  effect whereby  the resolution of  the image    changes 
without its size altering.  It is produced by a combination of Pixel  Hold 
and Line Hold functions.

A typical use of granulation is to mask  the loading of a new image   from 
disc.  While the image  is loading, the current  image is    progressively 
granulated by increasing the  hold factors from 1  upwards.  A 'Cut'   can 
then be performed to  the new image, which  is initially displayed    with 
high factors and is progressively 'de-granulated' by reducing the  factors 
to 1.

The following example of granulation uses pixel and  line hold values   of 
3.

   ______________________     ________________________________
   _A _B _C _D _E _F _G _     _         _         _          _
   ______________________     _         _         _          _
   _H _I _J _K _L _M _N _     _    A    _    D    _    G     _
   ______________________     _         _         _          _
   _O _P _Q _R _S _T _U _______         _         _          _
   ______________________     ________________________________
   _V _W _X _Y _Z _a _b _     _         _         _          _
   ______________________     _         _         _          _
   _c _d _e _f _g _h _i _     _    V    _    Y    _    b     _
   ______________________     _         _         _          _
   _j _k _l _m _n _o _p _     _         _         _          _
   ______________________     ________________________________



5.11.2.2  Magnification / Zoom


The pixel and  line repeat  functions may be  used to  produce an    image 
magnification effect, e.g. for examining details of the structure of   the 
image. This is restricted to RGB555 and CLUT images.

An example is shown  in Figure V.41 below,  with horizontal and   vertical 
repeat factors of 2.


Figure V.41



   ______________________            ______________________
   _P _Q _R _  _  _  _  _            _      _      _      _
   ______________________            _  P   _  Q   _  R   _
   _S _T _U _  _  _  _  _            _      _      _      _
   ______________________            ______________________
   _V _W _X _  _  _  _  _            _      _      _      _
   ___________________________________  S   _  T   _  U   _
   _  _  _  _  _  _  _  _            _      _      _      _
   ______________________            ______________________
   _  _  _  _  _  _  _  _            _      _      _      _
   ______________________            _  V   _  W   _  X   _
   _  _  _  _  _  _  _  _            _      _      _      _
   ______________________            ______________________

Note that the displayed  image will be cut  off at the  right and   bottom 
edges of the  full (or  reduced) screen.  This  may result  in   magnified 
pixels not being completely displayed.


5.11.2.3  Reduced Resolution


The magnification effect produced by pixel and line repeat may be used  to 
produce a low  resolution image,  allowing fast update  from disc  of    a 
larger than normal screen area.  This is an  alternative to animation   by 
run-length compression, which may  be chosen for specific    applications. 
Techniques to improve the quality of a reduced resolution image depend  on 
the implementation.

5.12  Cursor

The cursor plane is closest to the viewer,  and is of dimensions 16 x   16 
pixels.

The cursor plane  may be  enabled or disabled.   It is  a single    color. 
Pixels in the cursor plane are one bit deep.  If a pixel is set to 0    it 
is transparent and if it is set to 1 it appears in the programmed   color. 
The cursor may be  made to blink with  programmable on and  off   periods. 
The blink type  may be  'on/off' or 'normal  color/complementary   color'. 
The cursor  color  is defined  by  the intensity,  red,  green  and   blue 
components.  For the Base Case, one bit per component is available  giving 
the colors specified in V.5.13.

The cursor plane  may be  positioned at any  coordinate over  the    other 
planes.  The default cursor origin is always the top-left hand corner   of 
the full-screen image.  This is true whether the  'display   compatibility 
mode' is zero or one.  See V.4.8.

The cursor origin may be altered at any time by the application to be  any 
position on or off of the display

The cursor co-ordinates  are specified  in UCM in  High Resolution    (see 
VII.2.3.4.2).  However, in the Base Case, the positional accuracy of   the 
cursor is only to Double Resolution.  The resolution of the cursor  bitmap 
itself may be set to Normal or Double Resolution for the Base Case  System 
and also High Resolution for an Extended System.

The size  of  the cursor  plane  is limited.   However,  if  a    specific 
application requires a larger  cursor, it may generate  one itself in   an 
image plane  by software  techniques.  The  cursor control  commands   are 
specified in VII.2.3.








5.13  Backdrop


The backdrop is visible  wherever all the enabled  image planes and    the 
cursor are transparent.   The backdrop  may be chosen  to be  a   constant 
color (per line and per display path), or  (in the extended case) to    be 
synchronized external  video  (see  V.4.6.1  for  selection of    external 
video).

The backdrop Color may  be set by means  of the Display  Control   Program 
instruction given below.

Load Backdrop Color:

            ____________________________________________________
parameter = _                  _                   _Color(3-0) _
             ____________________________________________________
         bit 23                                     3         0

where

      Color = Backdrop color.


The RGB  components  of  the  backdrop  color, as  a  fraction  of    full 
intensity, are given by

  B  = Color (0) * K
  G  = Color (1) * K
  R  = Color (2) * K

Where K = 0.5 when Color (3) = 0 and K = 1 when Color (3) = 1.

Thus, in descriptive terms, the backdrop colors are as follows:

        Backdrop Color (Binary values)

       0000    Black         1000    Black
       0001    Half-brightness Blue         1001    Blue
       0010    Half-brightness Green        1010    Green
       0011    Half-brightness Cyan         1011    Cyan
       0100    Half-brightness Red          1100    Red
       0101    Half-brightness Magenta      1101    Magenta
       0110    Half-brightness Yellow       1110    Yellow
       0111    Half-brightness White        1111    White

5.14  Interlace


Display interlace may be  turned on or off,  by use of  the UCM   function 
DC_Intl.

Whether the information is displayed on odd or even fields is the same  or 
different depends  on  whether  a  normal/double  resolution or  a    high 
resolution FCT/LCT pair are executed (by DC_Exec).

For normal  and  double resolution  images,  a normal/double    resolution 
FCT/LCT is used.   Interlace may  be turned on  or off,  with the   normal 
recommended state being 'off'.  If interlace is turned on, an   interlaced 
normal  or  double  resolution  display  will  result,  with   the    same 
information displayed on odd and even fields.

For high resolution images, a high resolution FCT/LCT  pair is used,   and 
interlace must be turned on.

Another combination  is  also  possible,  that  is the  use  of  a    high 
resolution FCT/LCT  with  a normal  or  double resolution  image    coding 
method.  By this means,  the vertical resolution of  such images may    be 
doubled.  In the case of double resolution (CLUT4 and RL3) the result   is 
high resolution.



 V.6  On-disc Coding Formats

6.1  General

This section  defines the  on-disc coding  structure for  visual   images. 
Video data can be  contained in real time  records together with   control 
data (including DCP instructions)  and, if appropriate, audio  data.    It 
can also be contained in non-real time files and loaded independently   by 
the application.

6.2  Video Data Sequences

A video data sequence (VDSQ) is the basic unit of image data on the  disc. 
It typically contains the pixel data for an image or a Partial Update   to 
an image.  A VDSQ is loaded to a drawmap.

Each video data  sequence consists  of a packed  sequence of  video   data 
elements (VDEs).

Video Data Sequence:
_______________________________//_____________
_   VDE   _   VDE     _  VDE  //  _  VDE     _
_____________________________//_______________

A VDE typically represents  a pixel, or some  subdivision or   indivisible 
multiple of a  pixel.  Elements  within a segment  are all  of the    same 
structure, as identified by  the Video Coding Information  Byte of    each 
sector (see V.6.3).

6.2.1  Packing of VDSQ's

The Video Data Elements comprising a VDSQ are packed into (the data   part 
of) one or more  sectors with no gaps  between elements. However,    Video 
Data Sequences are not packed.  Each VDSQ must
start at the  beginning of  a sector, and  is contained  in an    integral 
number of sectors.



6.3  Video Coding Information Byte


6.3.1 Format


Details of the coding method and resolution of  each video data   sequence 
are contained in the  Video Coding Information Byte  in the subheader   of 
each sector of the sequence.  The format of this byte is given below.


 ____________________________________________________
 _ ASCF _ EOLF _ Resolution  _       Coding         _
 ____________________________________________________
bit 7      6       5     4      3     2     1     0

where


ASCF = Application Specific Coding Flag

0      The coding conforms to the specification of this chapter
1            The coding is  Application-Specific i.e. to be   interpreted 
      by application software


EOLF = Even/Odd Lines Flag

0      Even
1      Odd

If error concealment is to be used, this flag indicates whether
the sector contains even or odd lines of the image.  If error  concealment 
is not to be used, this bit is set to zero.









Resolution (Binary values)

00    Normal
01    Double
10    Reserved
11    High

Coding (Binary values)

0000    CLUT4           1000     QHY
0001    CLUT7           1001     Reserved
0010    CLUT8           1010     Reserved
0011    RL3             1011     Reserved
0100    RL7             1100     Reserved
0101    DYUV            1101     Reserved
0110    RGB555 (lower)  1110     Reserved
0111    RGB555 (upper)  1111     Reserved

6.3.2 Example of Application Specific Coding

As an example of the use of the  ASCF (Application Specific Coding   Flag) 
in the Video  Coding Information  Byte, the Content  Developer can    code 
monochrome natural images on disc as follows.

Monochrome natural  images  may  be  encoded  using  the  DYUV    encoding 
technique, but with a Y component only (U = V = 0).  The U and V    values 
need not  be  transmitted, thus  the  data on  disc  need  have only     4 
bits/pixel rather than 8.  The storage space on disc is thus halved.

The on-disc format can be as follows:

Video Data Element:
    ________________________
    __Yi(3-0) _ _Yi+1(3-0) _
    ________________________
bit 7        4 3           0

where i must be even and _Y = 4 bit luminance difference code.

The VDE represents a pixel pair starting at an even X coordinate.

The ASCF bit for all such video sectors  is set to 1, the EOLF bit     and 
Resolution bits may be  used according to V.6.3.1  as necessary and    the 
Coding nibble (half-byte) may be arbitrarily set according to the  meaning 
associated to it by the Content Developer.

In the decoder,  the image  data is loaded  to a  buffer (this  can be   a 
secondary drawmap) and each VDE is expanded in  real-time by   application 
software to the form below in image memory.

    ______________________________________________
    _    0   _ _Yi(3-0)   _   0    _  _Yi+1(3-0) _
    ______________________________________________
bit  15    12 11         8 7      4 3           0

This expansion can conveniently be done by a  table look-up method,   with 
one 16 bit entry for each of the 256 possible VDEs.


6.4  Image Formats

6.4.1  General

In this section, the  term "image" is used  to mean an  entire image,    a 
Rectangular Partial Update or an Irregular Partial Update.

In general, the  video data  elements of an  image are  identical to   the 
pixel codes in decoder memory, as given in V.4.4.

For all image coding  methods except RGB555, an  image is represented   on 
disc by a single VDSQ.

The order of elements in a VDSQ representing an image follows the   normal 
physical display scanning sequence, i.e. the elements are ordered in  rows 
from top to bottom  of the image, and  within each row  are ordered   from 
left to right.  Each row must consist of an integral number of   longwords 
except for run length coded rows which must only be an integral number  of 
bytes.  Rows follow each other with no gaps  or padding between, in    all 
formats.

For information on  image sizes  when coding to  525 line,  625 line   and 
525/625 compatible formats, see V.3.2.


6.4.2  RGB555 Images

For RGB555,  the  data  for  an  image is  loaded  in  two  parts,    each 
corresponding to one of the two Image Stores.  The two parts are
formed from  the  lower  (least  significant)  halves  and  upper    (most 
significant) halves of each pixel code.




Example:
                              _____________________________
     RGB555 Image format =    _ Lower VDSQ  _ Upper VDSQ  _
                              _____________________________

The two VDSQ's may be in either order and must each begin at the start  of 
a new sector.

6.4.3  Error Concealment

In order to support  error concealment by line  repeat, as described    in 
V.4.7, an image may  be coded in two  parts, one consisting  of the   even 
lines of the image, and the other the  odd lines.  Each part is made    to 
occupy an integral number of sectors by, if necessary, filling the  unused 
bytes of its final sector with zeros.  The  sectors of the two parts   are 
then interleaved on disc to form the VDSQ for the image.

Adjacent odd and even lines are physically separated  on disc by   spacing 
the ith odd sector from the ith even sector by n physical sectors, where

                  2 _ n _ n max (r)
      
nmax is a linear function of radial position on the disc.  For the   inner 
track it is 7 and for the outer track it is 18.

This distance is chosen to minimise the chance  that an even/odd pair   of 
lines each have an error from the same physical disturbance (e.g. a   hard 
error, a fingerprint, a scratch or dirt) on the disc.

The Grouping Factor for even and odd video sectors must be fixed for   one 
VDSQ, i.e. if  the Grouping  Factor for a  VDSQ is  m, the  even and   odd 
sectors must be  in alternate  groups of m  in the  sector stream    after 
removing any audio, data or empty sectors in the stream.

In the case of RGB555 coding, the image  is split into four parts   (lower 
even, upper even, lower odd, upper odd).  The lower parts and upper  parts 
are separately grouped as defined above.

As an example,  if there  is no file  interleaving or  audio sectors,    a 
possible layout is:

Sector:     E1 E2 E3 O1 O2 O3 E4 E5 E6 O4 O5 O6 E7 E8 E9
Even        _________         _________         ________
Odd                  _________         _________

The even and odd sectors are directed to two separate memory areas in  the 
decoder by placing their destination addresses in the Play Control   Lists 
(see VII.2.2.3.2, SS_Play).  For  the above example, where  the   Grouping 
Factor is 3, the Play Control Lists must be set up so that sectors E1   to 
E3 are directed to the PCL buffer 1,  sectors O1 to O3 to PCL buffer     2 
etc.

The decoder can then make use of e.g. line repeat, as described in  V.4.7, 
to conceal lines found to be in error.


**** EXTENSION ****

6.4.4  High Resolution Images

High  Resolution   images  may   be  displayed   either  interlaced     or 
line-sequential.  The  image  on disc  should  comprise the  even    lines 
followed by the odd lines.  The organization is identical to that used  to 
support error concealment.

6.4.4.1  DYUV + QHY

For High Resolution images coded according the QHY  method of V.3.5,   the 
image on disc consists of the Normal Resolution component accompanied   by 
the QHY component.

                          ____________ _____
High Res. image on disc = _  DYUV    _ _QHY_
                          ____________ _____

Note that the QHY component is divided into  two parts, one for the   even 
and the other for the odd lines.

6.4.4.2 Compatibility with the Base Case

In the Extended  Case, it  is the responsibility  of the  application   to 
ensure backward compatibility with  the Base Case.  In  the case of   High 
Resolution images, this may be achieved in many cases by accompanying  the 
High Resolution image on  disc, independent of the  coding used, with    a 
suitable image  of Base  Case, i.e.  Normal or  Double,  resolution   (see 
Chapter V.4.4.9).

The application, when running on a Base Case  player, can load the    Base 
Case resolution image instead of the High Resolution image.

For DYUV +  QHY images,  the application, when  running on  a Base    Case 
player, can discard the  QHY image and load  only the DYUV  image.    This 
will achieve  compatibility  for  the  case  of  a  natural  image.     If 
information vital to the application is lost, it is the responsibility  of 
the application to present this information in some other form on a   Base 
Case player.


****************

6.5  Pixel Data Formats


The disc formats of  all the defined coding  methods for pixel  data   are 
given in this section.

The index 'i' represents the pixel number along a horizontal line,
starting at zero (except  for runlength coding, where  it represents   run 
number).



6.5.1  Natural Images


6.5.1.1  DYUV


The defined resolutions are Normal (Base Case) and High (Extended Case).
Video Data Element:
    _________________________________________________
    _  _Ui(3-0) _  _Yi(3-0) _  _Vi(3-0) _ _Yi+1(3-0)_
    _________________________________________________
bit  15      12  11       8   7       4   3        0


where i must be even,
_Y = 4 bit luminance difference code, and
_U,_V = 4 bit chrominance difference codes.

The VDE represents a pixel pair starting at an even X coordinate.


6.5.1.2  QHY


The only defined resolution is High (for the Extended Case only).
The Video Data Elements are of variable length.

                        _________________________
Pixel pair:             _0 _Hi(2-0)_1 _Hi+1(2-0)_
                        _________________________
                    bit  7  6     4  3  2      0

Run of pixel code pairs:
    _________________________________________________                  _1  
_Hi(2-0)_0 _Hi+1(2-0)_         Li(7-0)       _
    _________________________________________________
bit  15 14   12 11 10     8  7                     0


H = 3 bit QHY code.
L = 8 bit run length = Number of QHY codes in run
where 2 _ L _ 255 and
L = 1 is forbidden.

L = 0 means 'Continue this run to the end of the line'.
All lines must finish with this code for L, i.e a zero runlength.



6.5.2  RGB555


The only resolution available is Normal Resolution.

There are two types of VDE's and VDSQ's, upper and lower (see V.6.4.2).

Video Data Elements:

                        __________________________
              Upper =   _Ti_   Ri(4-0)   _Gi(4-3)_
                        __________________________
                     bit 7   6         2   1   0

                        __________________________
              Lower =   _ Gi(2-0) _   Bi(4-0)    _
                        __________________________
                     bit 7       5  4           0

R,G,B = 5 bit Red, Green and Blue absolute values.
T = Transparency bit.



6.5.3  Color Lookup Table


6.5.3.1  8-bit CLUT


The defined resolutions are Normal (Base Case) and High (Extended Case).

Video Data Element:     __________________________
                        _       Ci(7-0)          _
                        __________________________
                    bit  7                      0

C = 8-bit CLUT address.









6.5.3.2  7-bit CLUT


The defined resolutions are Normal (Base Case) and  High (Extended Case).
Video Data Element:     __________________________
                        _ 0 _      Ci (6-0)      _
                        __________________________
                     bit  7    6                0

C = 7-bit CLUT address




6.5.3.3  4-bit CLUT

The defined resolutions are  Double (Base Case) and  High (Base Case    in 
Interlace Mode).


Video Data Element:     _________________________
                        _  Ci(3-0)  _ Ci+1(3-0) _
                        _________________________
                     bit  7        4  3        0

C = 4-bit CLUT address.

where i must be  even.  The VDE represents  a pixel pair  starting at   an 
even X coordinate.









6.5.4  Run Length Encoded Images

6.5.4.1  Run-coded 7-bit CLUT


The defined resolutions are Normal (Base Case) and High (Extended Case).


The Video Data Elements are of variable length.
                        _________________________
Single pixel:           _0 _      Ci(6-0)       _
                        _________________________
                    bit  7   6                 0

Pixel run:
    _________________________________________________
    _1 _     Ci(6-0)        _        Li(7-0)        _
    _________________________________________________
bit  15 14                 8 7                     0

C = 7-bit CLUT address.
L = 8 bit run length = Number of pixels in run
where 2 _ L _ 255 and
L = 1 is forbidden.

L = 0 means 'Continue this run to the end of the line'.
All lines must finish with this code for L, i.e a zero runlength.


6.5.4.2  Run-coded 3-bit CLUT


The defined resolutions are  Double (Base Case) and  High (Base Case    in 
Interlace Mode).

The Video Data Elements are of variable length.

                        _________________________
Pixel pair:             _0 _Ci(2-0)_1 _Ci+1(2-0)_
                        _________________________
                    bit  7  6     4  3  2      0

Run of pixel pairs:
    _________________________________________________
    _1 _Ci(2-0)_0 _Ci+1(2-0)_         Li(7-0)       _
    _________________________________________________
bit  15 14   12 11 10     8  7                     0

i = even
C = 3 bit CLUT address.
L = 8 bit run length = Number of pixel pairs in run
where 2 _ L _ 255 and
L = 1 is forbidden.

L = 0 means 'Continue this run to the end of the line'.
All lines must finish with this code for L, i.e a zero runlength.



