Japanese
PROGRAMMER'S GUIDECD communication I/F (MPEG part)
BackForward
CD communication I/F (MPEG part)

4. MPEG decoder


4.1 MPEG/Video decoder

The structure of the MPEG/Video decoder is shown in Figure 4.1.

Figure 4.1 Structure of MPEG/Video decoder
Controllable items
《Transfer block》
・ Registering a stream to play
・ Registering the next stream to play
・ Stream data transfer
・ Force video switching
《Decode block》
・ Start decoding
・ Stop decoding
・ Clearing data in decoder buffer
《Display block》
・ Switching decoding timing
・ Setting and canceling video pauses
・ Setting and unfreezing videos
・ Switching output destination

4.1.1 Overview of MPEG/Video decoder operation
Figure 4.2 shows an overview of the operation of the MPEG/Video decoder.

Figure 4.2 Overview of MPEG/Video decoder operation

4.1.2 MPEG/Video decoding block
The decode block controls start/stop of decoding and erasure of the decoder buffer (VBV buffer and MPEG frame buffer).

(1) Start/stop decoding
You can directly control the decode switch of the MPEG/Video decoder.
If you instruct to stop decoding while decoding a certain video stream, decoding of the picture being processed is completed, and decoding is stopped when the decoder detects the next picture start code.

  1. Stream A decoding in progress

  2.  VBV buffer         MPEG frame buffer
    ┌─────┬─┬──┐ ┌───────┐ ┌─┬──┬───┬───┐
    │     │ │  │→│Decoder│→│ │  │   │   │
    └─────┴─┴──┘ └───────┘ └─┴──┴───┴───┘
    Not    ↑ ↑
    decoded│ Decoded
           │
           Start next picture
    

  3. Decoding stop instruction
      VBV buffer        MPEG frame buffer
    ┌────┬────┐ ┌───────┐ ┌─┬──┬───┬───┐
    │    │    │→│Decoder│→│ │  │   │   │
    └────┴────┘ └───────┘ └─┴──┴───┴───┘
               ↑         ↑
               Start     Decoding of the picture 
               next      being processed is completed
               picture
    

(2) Stream switching and decoder buffer clearing
When switching streams, the data of the previously decoded stream remains in the decoder buffer below. This data needs to be erased.

VBV buffer
The undecoded portion of the picture currently being processed and the subsequent data that has been prefetched remain.

MPEG frame buffer
The decoded portion of the picture currently being processed and the already decoded picture data remain.

(3) Clearing VBV buffer
Wait for the picture start code, clear the VBV buffer, and switch to another stream.
Continuing from the decoded picture in the MPEG frame buffer, pictures in the subsequent stream can be smoothly played back.
If the VBV buffer is immediately erased without waiting for the picture start code, there is a risk that the picture being decoded in the MPEG frame buffer will not be able to complete its processing, resulting in a decoding error.

(4) Clearing MPEG frame buffer
If you simply erase the VBV buffer and switch to another stream, the decoded picture in the MPEG frame buffer will be displayed first. As a result, a three-frame delay occurs in stream switching.
To avoid this delay, the decoded data in the MPEG frame buffer can be cleared at the same time as the VBV buffer.

4.1.3 MPEG/Video display block
The display block controls the output of image data decoded in the decode block.
In the following explanation, re-pause is an operation in which the pause switch is open, waits for a certain decoding timing, closes the switch, and opens the switch at the next decoding timing. The same goes for refreeze and freeze switch.

(1) Function of display block
The display block has the following functions.

  1. Switching decoding timing

  2. Specifies the timing of the decode synchronization signal. You can specify whether decoding is performed using VSYNC synchronization or host synchronization.

  3. Setting and canceling video pauses

  4. Set the pose of the video by opening the pause switch. During pause, image data does not flow beyond the pause switch, so the image is not updated. Unpause the video by closing the pause switch.
    Additionally, slow playback is possible by specifying the re-pause interval.

  5. Setting and unfreezing videos

  6. Set the video to freeze by opening the freeze switch. During freezing, the image data is discarded from the freeze switch, so the image is not updated. Unfreeze the video by closing the freeze switch.
    You can also perform strobe playback by specifying the refreeze interval.

  7. Switching output destination

  8. Switch the output destination of image data. VDP2 and host can be set as output destinations.

(2) Display block state transition
The display block has the following states.

Table 4.1 Display block status
situation
 switch status
explanation
Pause Freeze
1
 Normal playback
closed closed Playing normally.
2
 Pause
Open closed The video has stopped.
The image data stops at the pause switch.
3
 Freeze
closed Open The video has stopped.
Image data is discarded from the freeze switch.
4
 Pause
&
Freeze
Open Open The video has stopped.
The image data stops at the pause switch.
Even after canceling the pause, the video freezes and does not resume playing.

Figure 4.3 shows the state transition diagram of the display block of the MPEG/Video decoder.

Figure 4.3 State transition diagram of MPEG/Video display block

4.2 MPEG/Audio decoder

The MPEG/Audio decoder takes sectors from the specified buffer partition and decodes them. The decoded data is sent to the sound block (SCSP) via a serial line.
Figure 4.4 shows the structure of the MPEG/Audio decoder.

Figure 4.4 Structure of MPEG/Audio decoder
Controllable items
《Transfer block》
・ Registering a stream to play
・ Registering the next stream to play
・ Stream data transfer
・ Switching streams
・ Setting stream number and channel number
《Decode block》
・ Start decoding
・ Stop decoding
・ mute audio
Note 1 : The processing target sector area within the CD buffer section is used for the decoder buffer.

4.2.1 MPEG/Audio decoding block functions
The audio decoding block has the following functions.

(1) Mute audio
The following settings can be made for the MPEG audio decoder.

  1. Mute LR channel

  2. Mute left and right independently.

  3. Automatic mute when stream input starts

  4. When a stream is input to the audio decoder, the data of the first three audio frames (approximately 100 msec) is muted.

4.2.2 Playing multiple channels
When performing multilingual playback, allocate MPEG audio data to each channel number.
Once a channel is set for playback, only the data for that channel is sent to the decoder. Data from other channels is discarded as the playback channel is transferred, so even if you switch to another channel, you can instantly play audio in sync with the video.
Figure 4.5 shows an example of multilingual playback.

Figure 4.5 Multilingual playback

Buffer section
┌────────┬────────┬────────┬────────┬────────┬────────┬────────┐        ┌────────┐
|  CN=3  |  CN=2  |  CN=1  |  CN=3  |  CN=2  |  CN=1  |  CN=3  |  CN=1  |Decoder |
│ French │English │Japanese│ French │English │Japanese│ French │   →    │        │
└────────┴────────┴────────┴────────┴────────┴────────┴────────┘        └────────┘
An example of playing Japanese on channel number 1 (CN=1) is shown.
French and English audio data are discarded as Japanese data is played back.

BackForward
PROGRAMMER'S GUIDECD communication I/F (MPEG part)
Copyright SEGA ENTERPRISES, LTD., 1997