Japanese
PROGRAMMER'S GUIDECD communication I/F (MPEG part)
Back | ■
CD communication I/F (MPEG part)

8. MPEG function specifications


Describe the function specifications of the MPEG communication interface.

(1) Format
In the figure, unused areas are represented by "-". The value of unused space is 0.

(2) Retention of MPEG status information (status and MPEG report)
The MPEG communication interface holds the status at the time of MPEG command issuance and the MPEG report. The initial value of the retained contents is all 0.
The functions that update the retention status/MPEG report are indicated by the following symbols.

    [SR]: Update status and MPEG report       ┐
    [S-]: Update only the status              ├────┐
    [--]: Do not update (do not issue command)┘    │
                                                   │
《Example of function title》                      ↓
┌──────────────┬─────────────────┬──────────────────┬────┐
│Title         │Function         │Function Name [SR]│No  │
│Function      │MPEG playback    │CDC_MpPlay        │20.7│
│specifications│                 │                  │    │
└──────────────┴─────────────────┴──────────────────┴────┘

However, nothing is updated in the event of an error (when the error code is other than CDC_ERR_OK).

(3) Function that generates WAIT
Functions that generate WAIT are indicated by the following symbols in the function list.
For WAIT, see " 6.4 REJECT and WAIT for MPEG commands ".

    [L]: LONG WAIT may occur        ┐
    [S]: SHORT WAIT may occur       ├──┐
    [LS] :LONG, SHORT WAIT may occur┘  │
                                       │
《Example of function list》           ↓
┌────────────────────┬─────────────────┬────┐
│Decoding method     │CDC_MpSetDec [LS]│20.8│
│setting             │                 │    │
└────────────────────┴─────────────────┴────┘

(5) Command end flag (in interrupt cause register)
If there is an associated command exit flag,
end flag
Describe it in the item field.

"example"
end flag
MPED flag

For details on the exclusive processing of command issuance, refer to "Table 3.5 Commands belonging to command end flag (MPEG part)" and the CD part manual.

(6) MPCM flag (in interrupt factor register)
Except for some functions, MPEG communication functions check the MPCM flag when issuing a command. If the command cannot be issued, error code CDC_ERR_MP_COMU is returned.
For details about the MPCM flag, refer to " 3.1.2 Operation Undefined Section ".

8.1 MPEG function list

A list of functions of the MPEG communication interface is shown in Table 8.1.

Table 8.1 List of MPEG communication interface functions
function function name number
MPEG decoder 20.0
Get current MPEG status information CDC_MpGetCurStat 20.1
Obtaining the previous MPEG status information CDC_MpGetLastStat 20.2
Obtaining MPEG interrupt factor CDC_MpGetInt 20.3
Setting MPEG interrupt mask CDC_MpSetIntMsk 20.4
Initializing MPEG decoder CDC_MpInit 20.5
Setting MPEG operation mode CDC_MpSetMode [S] 20.6
MPEG playback CDC_MpPlay [S] 20.7
Setting the decoding method CDC_MpSetDec [LS] 20.8
Sending decode synchronization signal CDC_MpOutDsync [LS] 20.9
Get video timecode CDC_MpGetTc [S] 20.10
Get audio timestamp CDC_MpGetPts 20.11
MPEG stream 21.0
Setting the MPEG decoder connection destination CDC_MpSetCon [LS] 21.1
Obtaining the MPEG decoder connection destination CDC_MpGetCon 21.2
Switching the MPEG decoder connection destination CDC_MpChgCon [LS] 21.3
MPEG stream settings CDC_MpSetStm [LS] 21.4
Obtain MPEG stream CDC_MpGetStm 21.5
Get stream image size CDC_MpGetPictSiz [S] 21.6
MPEG display screen 22.0
Displaying images CDC_MpDisp [S] 22.1
Setting the frame buffer window position CDC_MpSetWinFpos 22.2
Setting the frame buffer window magnification CDC_MpSetWinFrat 22.3
Setting the display window position CDC_MpSetWinDpos 22.4
Setting display window size CDC_MpSetWinDsiz 22.5
Setting the display window offset CDC_MpSetWinDofs 22.6
Border color settings CDC_MpSetBcolor 22.7
Setting the fade CDC_MpSetFade [S] 22.8
Screen special effect settings CDC_MpSetVeff [S] 22.9
MPEG frame buffer 23.0
Extracting image data CDC_MpGetImg [L] 23.1
Setting the image data window position CDC_MpSetImgPos 23.2
Setting the image data window size CDC_MpSetImgSiz 23.3
Loading from image data window CDC_MpReadImg 23.4
Export to image data window CDC_MpWriteImg 23.5
MPEG sector buffer 24.0
Reading sectors from MPEG sector buffer CDC_MpReadSct 24.1
Writing sectors to MPEG sector buffer CDC_MpWriteSct 24.2

8.2 MPEG function details

8.2.1 MPEG decoder

one
View
table
 Title

function specification

 Function

Get current MPEG status information

 Function Name [SR]

CDC_MpGetCurStat

 No

20.1

Format
Sint32 CDC_MpGetCurStat(CdcMpStat *mpstat)
input
none
output
mpstat: MPEG status information
function value
Returns an error code.
function
Get current MPEG status information.

one
View
table
 Title

function specification

 Function

Obtaining the previous MPEG status information

 Function Name [--]

CDC_MpGetLastStat

 No

20.2

Format
Sint32 CDC_MpGetLastStat(CdcMpStat *mpstat)
input
none
output
mpstat: MPEG status information
function value
Returns an error code.
function
Gets MPEG status information for the previous MPEG command.

one
View
table
 Title

function specification

 Function

Obtaining MPEG interrupt factor

 Function Name [S-]

CDC_MpGetInt

 No

20.3

Format
Sint32 CDC_MpGetInt(Sint32 *intreq)
input
none
output
intreq: Interrupt factor (lower 24 bits are valid)...See data specifications (Intreq)
function value
Returns an error code.
function
Get the interrupt factor of MPEG interrupt.
remarks
The MPEG interrupt factor is cleared to 0 by executing this function.

one
View
table
 Title

function specification

 Function

Setting MPEG interrupt mask

 Function Name [SR]

CDC_MpSetIntMsk

 No

20.4

Format
Sint32 CDC_MpSetIntMsk(Sint32 intmsk)
input
intmsk: Interrupt mask (lower 24 bits are valid)
output
none
function value
Returns an error code.
function
Set the interrupt mask for MPEG interrupts.
The meaning of each bit in the interrupt mask is the same as for MPEG interrupt factors.
remarks
Set the bits you want to mask to 0 and the others to 1.
When an interrupt factor unmasked by this function occurs, the MPST flag turns ON.

one
View
table
 Title

function specification

 Function

Initializing MPEG decoder

 Function Name [SR]

CDC_MpInit

 No

20.5

Format
Sint32 CDC_MpInit(Bool sw)
input
sw: MPEG system switch
output
none
function value
Returns an error code.
end flag
MPED flag (only cleared to 0)...Can be executed regardless of the MPED value
function
Initializes the MPEG system and controls starting and stopping the MPEG system.

(1) MPEG system switch
When the MPEG system is turned off, all other MPEG communication functions become REJECT until it is turned on.
The performance of the CD part is affected while the MPEG system is running. When using only the functions of the CD part, use this switch to stop the MPEG system.

constant name explanation
OFF Stop...Initial value
ON boot

remarks

  1. This function waits about 3ms internally and then issues the command, ignoring the MPED and MPCM flags.

  2. To determine whether initialization is complete, wait until 2 VSYNC or more have passed after executing this function and the MPED flag becomes 1.


one
View
table
 Title

function specification

 Function

Setting MPEG operation mode

 Function Name [SR]

CDC_MpSetMode

 No

20.6

Format
Sint32 CDC_MpSetMode(Sint32 actmod, Sint32 dectim, Sint32 out,Sint32 scnmod)
input
actmod: MPEG operation mode dectim: Decoding timing out: Image data output destination scnmod: Scanning mode (lower 8 bits are valid)
output
none
function value
Returns an error code.
function
Set the MPEG decoder operating mode.

(1) MPEG operation mode
Before switching to MPEG sector buffer mode, be sure to execute the CDC_MpInit function.
constant name explanation
CDC_MPACT_NMOV Video playback mode...Initial value
CDC_MPACT_NSTL Still image playback mode
CDC_MPACT_HMOV High-definition video playback mode (not supported)
CDC_MPACT_HSTL High-definition still image playback mode
CDC_MPACT_SBUF MPEG sector buffer mode
CDC_PARA_NOCHG Do not change settings

(2) Decoding timing
Specify the timing of the decode synchronization signal (DSYNC). Valid in video playback mode.
Host synchronization is valid when the MPEG playback mode of the CDC_MpPlay function is independent playback mode.
constant name explanation
CDC_MPDEC_VSYNC Decoding by VSYNC synchronization...Initial value
CDC_MPDEC_HOST Decoding with host synchronization
(Sends DSYNC according to instructions from host)
CDC_PARA_NOCHG Do not change settings

(3) Image data output destination
constant name explanation
CDC_MPOUT_VDP2 Output to VDP2...Initial value
CDC_MPOUT_HOST Output to host (extract from MPEG register)
CDC_PARA_NOCHG Do not change settings

(4) Scanning mode
bit 7 6 5 4 3 2 1 0
   ┌─┬─┬─┬─┬─┬─┬─┬─┐
   │ │−│−│−│−│−│ │ │ Initial value: 00H     Unchanged: CDC_PARA_NOCHG
   └┬┴─┴─┴─┴─┴─┴┬┴┬┘
    │           │ └─1: Non-interlace    0: Interlace
    │           └───1: PAL              0: NTSC
    └───────────────1: Do not change the settings   0: Change the settings

remarks

  1. Frame rate is automatically set.

  2. Execute this function when the MPEG/Video operating state is stopped.


one
View
table
 Title

function specification

 Function

MPEG playback

 Function Name [SR]

CDC_MpPlay

 No

20.7

Format
Sint32 CDC_MpPlay(Sint32 plymod, Sint32 tmod_a, Sint32 tmod_v,Sint32 dec_v)
input
plymod :MPEG playback mode
tmod_a :MPEG/Audio transfer mode
tmod_v :MPEG/Video transfer mode
dec_v :MPEG/Video decoding switch
output
none
function value
Returns an error code.
function
Set audio and video synchronous playback, each transfer mode, and video decoding switch.

(1) MPEG playback mode
Synchronous playback mode is valid when the decoding timing of the CDC_MpSetMode function is VSYNC synchronized.
constant name explanation
CDC_MPPLY_SYNC Synchronous playback mode...Initial value
CDC_MPPLY_INDP Independent playback mode
CDC_PARA_NOCHG Do not change settings

(2) MPEG decoder transfer mode
In automatic transfer mode, when the required amount of data is stored in the CD buffer, transfer to the decoder is automatically started.
constant name explanation
CDC_MPTRN_AUTO Automatic transfer mode...Initial value
CDC_MPTRN_FORCE Forced transfer mode
CDC_PARA_NOCHG Do not change settings

(a) Video
Transfer mode explanation
automatic transfer When data of STD buffer size + 16KB is stored in the CD buffer,
Begins transfer to VBV buffer and decoding.
forced transfer Transfer/decode is started regardless of the state of the CD buffer.

(b) Audio
Transfer mode explanation
automatic transfer When two sectors worth of data are stored in the CD buffer, transfer/decoding is started.
When playing synchronously, decoding starts when the first picture of the video is displayed.
forced transfer Regardless of the CD buffer status or video status,
Start transfer/decoding.

(3) MPEG/Video decoding switch
Directly controls the MPEG/Video LSI decode switch.
Normally, be sure to specify CDC_PARA_NOCHG. (Do not change the settings.)
constant name explanation
OFF Stop decoding
ON Start decoding...Initial value
CDC_PARA_NOCHG Do not change settings...normally specified values

Note
The MPEG decoder begins decoding by connecting to a buffer partition. The start and end of decoding must not be controlled by executing this function.
When a connection is made using the CDC_MpSetCon function or a forced switch is performed using the CDC_MpChgCon function, decoding starts regardless of this switch. (Even if decoding is stopped.)
To forcefully terminate decoding, use the CDC_MpChgCon function.


one
View
table
 Title

function specification

 Function

Setting the decoding method

 Function Name [SR]

CDC_MpSetDec

 No

20.8

Format
Sint32 CDC_MpSetDec(Sint32 mute, Sint32 pautim, Sint32 frztim)
input
mute : MPEG/Audio mute (lower 8 bits are valid)
pautim : MPEG/Video pause timing (lower 16 bits are valid)
frztim : MPEG/Video freeze timing (lower 16 bits are valid)
output
none
function value
Returns an error code.
function
Set the decoding method of the MPEG decoder.

(1) MPEG/Audio mute
Regardless of whether you mute or not, be sure to set bit2 = 1 and set the value.
Since the initial value of this parameter is 0, bit2=0 if no change is specified (CDC_PARA_NOCHG). Therefore, be sure to explicitly specify a fixed value (CDC_MPMUT_DFL) at first.
bit 7 6 5 4 3 2 1 0
   ┌─┬─┬─┬─┬─┬─┬─┬─┐
   │ │−│−│−│−│ │ │ │ Initial value: 00H    Unchanged: CDC_PARA_NOCHG
   └┬┴─┴─┴─┴─┴┬┴┬┴┬┘
    │         │ │ └─CDC_MPMUT_R      1: Mute the right channel
    │         │ └───CDC_MPMUT_L      1: Mute the left channel
    │         └─────CDC_MPMUT_DFL    1: Fixed value (must be specified)
    └──────────────────1: Do not change the settings    0: Change the settings

(2) MPEG/Video pause timing
constant name explanation
0000H Pause (re-pause during pause: frame-by-frame advance)...Initial value
0001H Unpause
0002H~FFFEH Frame interval until re-pause (slow playback interval)
FFFFH Do not change settings (CDC_PARA_NOCHG)

(3) MPEG/Video freeze timing
constant name explanation
0000H Freeze (refreeze while frozen)...Initial value
0001H Unfreeze
0002H~FFFEH Frame interval until refreeze (strobe playback interval)
FFFFH Do not change settings (CDC_PARA_NOCHG)

remarks

  1. Pause/Freeze is disabled in still image playback mode. (Effective in video playback mode)

  2. If you set pause/freeze while the video is in the recovery process, it becomes WAIT.


one
View
table
 Title

function specification

 Function

Sending decode synchronization signal

 Function Name [SR]

CDC_MpOutDsync

 No

20.9

Format
Sint32 CDC_MpOutDsync(Sint32 fbn)
input
fbn: Frame bank number (0 to 3)...Valid in still image playback mode
output
none
function value
Returns an error code.
function
Sends decode synchronization signal (DSYNC). The host can control the decoding timing of each frame.

(1) Frame bank number
In the still image playback mode, the frame bank number (0 to 3) to be decoded can be specified.
Frame bank numbers are invalid in video playback mode.

(2) Sending timing of decode synchronization signal
The DSYNC transmission timing must be spaced at an interval of at least one frame's decoding time (2VSYNC). Normally, it is necessary to obtain synchronization timing using VSYNC, audio playback amount, etc.

Note
Specification limitations regarding picture start code (PSC) detection
For video streams with picture period M≦3, PSC detection and DSYNC transmission can be synchronized except for the last 3 frames of the stream. In other words, PSC detection can be used as the DSYNC transmission timing.
(PSC detection is notified by video interrupt bit8 of the MPEG interrupt factor flag.)
However, in the case of the last three frames of the stream and M≧4, there is no one-to-one correspondence between PSC detection and DSYNC transmission. In this case, PSC detection cannot be used and it is necessary to obtain synchronization timing using the method (2) above.

remarks

one
View
table
 Title

function specification

 Function

Get video timecode

 Function Name [S-]

CDC_MpGetTc

 No

20.10

Format
Sint32 CDC_MpGetTc(Sint32 *bnk, Sint32 *pictyp, Sint32 *tr, CdcMpTc *mptc)
input
none
output
bnk :Currently displayed frame bank number (0 to 3)
pictyp :Picture type
tr : Temporal reference (lower 8 bits are valid)
mptc : Time code
function value
Returns an error code.
function
Get the timecode and temporal reference of the currently displayed frame.
In the still image playback state, this indicates a frame that is waiting to be decoded or is being decoded.

(1) Picture type
This is the same as the picture information in MPEG status information. (Initial value: 0)
constant name explanation
CDC_MPPICT_I I picture
CDC_MPPICT_P P picture
CDC_MPPICT_B B picture
CDC_MPPICT_D D picture

(2) Temporal reference
Returns the temporal reference (lower 8 bits) of the currently displayed picture.

(3) Time code
Returns the timecode of the currently displayed picture. (This is not the timecode at the beginning of the GOP layer in the stream.)


one
View
table
 Title

function specification

 Function

Get audio timestamp

 Function Name [S-]

CDC_MpGetPts

 No

20.11

Format
Sint32 CDC_MpGetPts(Sint32 *pts_a)
input
none
output
pts: MPEG/Audio timestamp
function value
Returns an error code.
function
Get the audio timestamp (PTS: Presentation Time Stamp).

(1) MPEG/Audio timestamp
The timestamp value is the value obtained by extracting the lower 32 bits of the 33-bit PTS (90KHz).
This value is the most recent value just before entering decoding. When MPEG/Audio is not operating, the previous value is retained.


8.2.2 MPEG Stream


one
View
table
 Title

function specification

 Function

Setting the MPEG decoder connection destination

 Function Name [SR]

CDC_MpSetCon

 No

21.1

Format
Sint32 CDC_MpSetCon(Sint32 next, CdcMpCon *mpcon_a, CdcMpCon *mpcon_v)
input
next :Next stream flag
mpcon_a : MPEG/Audio connection destination parameter
mpcon_v :MPEG/Video connection destination parameter
output
none
function value
Returns an error code.
function
Set and register the MPEG decoder connection destination (buffer partition and other parameters).
Specifying CDC_NUL_SEL for the buffer partition number cancels the connection destination settings.

(1) Next stream flag
constant name explanation
CDC_MPSTF_CUR Setting the current connection destination (first stream)
CDC_MPSTF_NEXT Registering the next connection destination (next stream)

remarks
Cancellation (disconnection) of a connection destination depends on the MPEG operating state. In particular, it is necessary to use the CDC_MpChgCon function to disconnect (forcefully terminate) the current connection destination during playback.
For details, refer to the data specification (CdcMpCon).


one
View
table
 Title

function specification

 Function

Obtaining the MPEG decoder connection destination

 Function Name [S-]

CDC_MpGetCon

 No

21.2

Format
Sint32 CDC_MpGetCon(Sint32 next, CdcMpCon *mpcon_a, CdcMpCon *mpcon_v)
input
next: next stream flag
output
mpcon_a : MPEG/Audio connection destination parameter
mpcon_v :MPEG/Video connection destination parameter
function value
Returns an error code.
function
Get the MPEG decoder connection destination (buffer partition and other parameters).
If not connected (unregistered), return CDC_NUL_SEL for the buffer partition number.

(1) Next stream flag
constant name explanation
CDC_MPSTF_CUR Obtaining the current connection destination (first stream)
CDC_MPSTF_NEXT Obtaining the next connection destination (next stream)


one
View
table
 Title

function specification

 Function

Switching the MPEG decoder connection destination

 Function Name [SR]

CDC_MpChgCon

 No

21.3

Format
Sint32 CDC_MpChgCon(Sint32 chg_a, Sint32 chg_v, Sint32 clr_a, Sint32 clr_v)
input
chg_a : MPEG/Audio connection switching flag
chg_v :MPEG/Video connection switching flag
clr_a :MPEG/Audio clearing method
clr_v :MPEG/Video clearing method
output
none
function value
Returns an error code.
function
Forcibly switch the MPEG decoder connection destination. Or forcibly disconnect the connection destination.
To forcefully terminate MPEG playback, specify detach with this function.

(1) MPEG decoder connection switching flag
To specify switching, the stream to be played next must be registered in advance using the CDC_MpSetCon function.
When switching is specified, the clear method is valid. After the clearing process is completed, the connection destination will be switched.
constant name explanation
CDC_MPCOF_ABT Disconnect (forced termination)
CDC_MPCOF_CHG Forced switch
CDC_PARA_NOCHG Do not change settings

(2) MPEG/Audio clear method
constant name explanation
CDC_MPCLA_OFF Do not clear (1 sector worth of data is transferred)
CDC_MPCLA_ON Clear one sector buffer immediately

(3) MPEG/Video clear method
constant name explanation
CDC_MPCLV_FRM Instantly clear VBV and WBC (display waiting MPEG frame buffer)
CDC_MPCLV_VBV Clear VBV at next I or P picture start

remarks
This function can be executed only when the MPEG operating state is playing.
To disconnect the connection destination in other states, the CDC_MpSetCon function must be used.


one
View
table
 Title

function specification

 Function

MPEG stream settings

 Function Name [SR]

CDC_MpSetStm

 No

21.4

Format
Sint32 CDC_MpSetStm(Sint32 next, CdcMpStm *mpstm_a, CdcMpStm *mpstm_v)
input
next :Next stream flag
mpstm_a :MPEG/Audio stream parameters
mpstm_v :MPEG/Video stream parameters
output
none
function value
Returns an error code.
function
Set the stream number (stream ID) and channel number to be decoded.

(1) Next stream flag
constant name explanation
CDC_MPSTF_CUR Setting the current stream (first stream)
CDC_MPSTF_NEXT Registering the next stream (next stream)

remarks
If the MPEG operating state is being switched, it will be WAIT.

one
View
table
 Title

function specification

 Function

Obtain MPEG stream

 Function Name [S-]

CDC_MpGetStm

 No

21.5

Format
Sint32 CDC_MpGetStm(Sint32 next, CdcMpStm *mpstm_a, CdcMpStm *mpstm_v)
input
next: next stream flag
output
mpstm_a :MPEG/Audio stream parameters
mpstm_v :MPEG/Video stream parameters
function value
Returns an error code.
function
Obtain the stream number (stream ID) and channel number to be decoded.

(1) Next stream flag
constant name explanation
CDC_MPSTF_CUR Get current stream (first stream)
CDC_MPSTF_NEXT Obtaining the next stream (next stream)


one
View
table
 Title

function specification

 Function

Get stream image size

 Function Name [S-]

CDC_MpGetPictSiz

 No

21.6

Format
Sint32 CDC_MpGetPictSiz(Sint32 *siz_h, Sint32 *siz_v)
input
none
output
siz_h :Horizontal image size (in pixels)
siz_v :Vertical image size (in pixels)
function value
Returns an error code.
function
Get the image size in the video stream. The initial value is 0 for both.

8.2.3 MPEG display screen


one
View
table
 Title

function specification

 Function

Displaying images

 Function Name [SR]

CDC_MpDisp

 No

22.1

Format
Sint32 CDC_MpDisp(Bool dspsw, Sint32 fbn)
input
dspsw :Display switch (display ON/OFF to VDP2)
fbn :Frame bank number (0 to 3)...Valid in still image playback mode
output
none
function value
Returns an error code.
function
Display the image according to the display switch.

(1) Display switch
constant name explanation
OFF Do not display on VDP2...Initial value
ON Display on VDP2

(2) Frame bank number
In the still image playback mode, the frame bank number (0 to 3) to be decoded can be specified.
Frame bank numbers are invalid in video playback mode.


one
View
table
 Title

function specification

 Function

Setting the frame buffer window position

 Function Name [SR]

CDC_MpSetWinFpos

 No

22.2

Format
Sint32 CDC_MpSetWinFpos(Bool chgflg, Sint32 fpx, Sint32 fpy)
input
chgflg : Setting change flag (OFF: Register the setting value, ON: Change the setting to the registered value)
fpx : Upper left X coordinate of frame buffer window
fpy : Upper left Y coordinate of the frame buffer window
output
none
function value
Returns an error code.
function
Sets the frame buffer window position in pixels.

(1) Top left coordinates of the frame buffer window
The initial value is 0 for both fpx and fpy.
If CDC_PARA_NOCHG is set for fpx and fpy, the previous values will be retained.
Coordinate Normal output mode High definition output mode
NTSC fpx 0-351 (CDC_MPNT_NPX) 0-703 (CDC_MPNT_HPX)
fpy 0-239 (CDC_MPNT_NPY) 0-479 (CDC_MPNT_HPY)
PAL fpx 0 to 351 (CDC_MPPL_NPX) 0-703 (CDC_MPPL_HPX)
fpy 0 to 287 (CDC_MPPL_NPY) 0 to 575 (CDC_MPPL_HPY)

one
View
table
 Title

function specification

 Function

Setting the frame buffer window magnification

 Function Name [SR]

CDC_MpSetWinFrat

 No

22.3

Format
Sint32 CDC_MpSetWinFrat(Bool chgflg, Sint32 frx, Sint32 fry)
input
chgflg : Setting change flag (OFF: Register the setting value, ON: Change the setting to the registered value)
frx : X-direction expansion rate of frame buffer window (lower 16 bits are valid)
fry : Y-direction expansion rate of frame buffer window (lower 16 bits are valid)
output
none
function value
Returns an error code.
function
Sets the frame buffer window magnification.

(1) Enlargement ratio in each direction of the frame buffer window
The initial value is 01H (enlargement rate = 1) for both frx and fry.
If CDC_PARA_NOCHG is specified for frx and fry, the previous values will be retained.
bit 15  13  11  9   7   5   3   1 
      14  12  10  8   6   4   2   0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │C│ │←────────A────────→│D│←─B─→│
   └┬┴┬┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴┬┴─┴─┴─┘
    │ │          ↑          │   ↑ 
    │ │ Enlargement ratio   │ Correction factor
    │ │                     │
    │ │                     └─Correction coefficient polarity
    │ │
    │ └────────────Keep previous value  1: Do not change settings  0: Change
    └──────────────Reduction flag       1: Reduce                  0: Enlarge

Each bit of A, B, C, and D is set so that the following relationship is satisfied.
However, A< 1024,B> Set to 0.

C D Expansion rate
Expansion
Big
0 0 A+2-1/B
0 1 A+1+1/B
shrinkage
small
1 0 1/(A+1-1/B)
1 1 1/(A+1/B)

one
View
table
 Title

function specification

 Function

Setting the display window position

 Function Name [SR]

CDC_MpSetWinDpos

 No

22.4

Format
Sint32 CDC_MpSetWinDpos(Bool chgflg, Sint32 dpx, Sint32 dpy)
input
chgflg : Setting change flag (OFF: Register the setting value, ON: Change the setting to the registered value)
dpx : Upper left X coordinate of display window
dpy : Upper left Y coordinate of display window
output
none
function value
Returns an error code.
function
Sets the display window position in pixels.

(1) Upper left coordinates of the display window
The initial value is 0 for both dpx and dpy.
If CDC_PARA_NOCHG is set for dpx and dpy, the previous values will be retained.
Coordinate Normal output mode High definition output mode
NTSC dpx 0-351 (CDC_MPNT_NPX) 0-703 (CDC_MPNT_HPX)
dpy 0-239 (CDC_MPNT_NPY) 0-479 (CDC_MPNT_HPY)
PAL dpx 0 to 351 (CDC_MPPL_NPX) 0-703 (CDC_MPPL_HPX)
dpy 0 to 287 (CDC_MPPL_NPY) 0-575 (CDC_MPPL_HPY)

one
View
table
 Title

function specification

 Function

Setting display window size

 Function Name [SR]

CDC_MpSetWinDsiz

 No

22.5

Format
Sint32 CDC_MpSetWinDsiz(Bool chgflg, Sint32 dsx, Sint32 dsy)
input
chgflg : Setting change flag (OFF: Register the setting value, ON: Change the setting to the registered value)
dsx : Display window size in X direction
dsy : Display window size in Y direction
output
none
function value
Returns an error code.
function
Sets the display window size in pixels.

(1) Display window size
The initial values are dsx=352, dsy=240 regardless of NTSC/PAL, normal/high definition.
If CDC_PARA_NOCHG is set for dsx and dsy, the previous values will be retained.
Coordinate Normal output mode High definition output mode
NTSC dsx 0-352 (CDC_MPNT_NSX) 0 to 704 (CDC_MPNT_HSX)
dsy 0-240 (CDC_MPNT_NSY) 0~480 (CDC_MPNT_HSY)
PAL dsx 0-352 (CDC_MPPL_NSX) 0 to 704 (CDC_MPPL_HSX)
dsy 0-288 (CDC_MPPL_NSY) 0 to 576 (CDC_MPPL_HSY)

one
View
table
 Title

function specification

 Function

Setting the display window offset

 Function Name [SR]

CDC_MpSetWinDofs

 No

22.6

Format
Sint32 CDC_MpSetWinDofs(Bool chgflg, Sint32 dox, Sint32 doy)
input
chgflg : Setting change flag (OFF: Register the setting value, ON: Change the setting to the registered value)
dox : Display window X direction offset
doy : Display window Y-direction offset
output
none
function value
Returns an error code.
function
Sets the display window offset in units of bright spots. (Not in pixel units.)

(1) Display window offset
Both the initial value and setting range are independent of NTSC/PAL, normal/high definition.
If CDC_PARA_NOCHG is set for dox and doy, the previous values will be retained.
offset initial value Setting range remarks
dox 150 18~704 When dox≦17, border color is displayed on the entire surface.
doy 38 8~480 When do≦7, border color is displayed on the entire surface.

remarks
For PAL, dox=150 and doy=45 are recommended as standard values for setting in the center of the screen.


one
View
table
 Title

function specification

 Function

Border color settings

 Function Name [SR]

CDC_MpSetBcolor

 No

22.7

Format
Sint32 CDC_MpSetBcolor(Sint32 bcolor)
input
bcolor: Border color (lower 16 bits are valid)
output
none
function value
Returns an error code.
function
Set the color data (RGB555 format) for the border color.

(1) Border color
Initial value: 8000H (border color output)
bit 15  13  11  9   7   5   3   1 
      14  12  10  8   6   4   2   0
   ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
   │ │←─B Data→│←─G Data→│←─R Data→│
   └┬┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
    │
    └──Transparent bit 1: Output border color   0: Do not output (transparent state)

remarks
It only works when outputting images to VDP2.
If the output destination is the host (MPEG register), border color is not output.


one
View
table
 Title

function specification

 Function

Setting the fade

 Function Name [SR]

CDC_MpSetFade

 No

22.8

Format
Sint32 CDC_MpSetFade(Sint32 gain_y, Sint32 gain_c)
input
gain_y : Luminance signal gain (-8 to 7, initial value: 0)
gain_c : Color difference signal gain (-8 to 7, initial value: 0)
output
none
function value
Returns an error code.
function
The level of the luminance/color difference signal is changed in 1/8 steps.
Used for fade in and fade out.

(1) Luminance/color difference signal gain
The setting value range is -8 to 7, and the initial value is 0. Specifying a value outside this range will result in a REJECT.
The gain settings and actual magnification are shown below.
 Gain setting value
 -8
 -7
 -6
 -5
 -4
 -3
 -2
 -1
 0
 +1
 +2
 +3
 +4
 +5
 +6
 +7
 Magnification
0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 1 9/8 10/8 10/8 12/8 12/8 2 2

one
View
table
 Title

function specification

 Function

Screen special effect settings

 Function Name [SR]

CDC_MpSetVeff

 No

22.9

Format
Sint32 CDC_MpSetVeff(CdcMpVeff *mpvef)
input
mpvef: Screen special effect parameters
output
none
function value
Returns an error code.
function
Set screen special effects.

8.2.4 MPEG Frame Buffer


one
View
table
 Title

function specification

 Function

Extracting image data

 Function Name [S-]

CDC_MpGetImg

 No

23.1

Format
Sint32 CDC_MpGetImg(Sint32 *dwnum)
input
none
output
dwnum: Number of words to transfer image data
function value
Returns an error code.
function
Extract the image data in the display window to the host.
It does not work if the image data output destination is VDP2. Be sure to set the output destination to the host.
remarks

  1. After executing the function, we need to transfer and retrieve the data from the MPEG register.

  2. The horizontal size dsx usually needs to be set to 5 or more (10 or more for high definition).

  3. In high-definition still image mode, the sizes dsx and dsy must be set to integral multiples of 2.

  4. Before executing, turn on the display switch of CDC_MpDisp function.

  5. Please execute after the MPEG report output ready flag becomes 1.

  6. During image data transfer, it is desirable to freeze the display window or otherwise fix it.


one
View
table
 Title

function specification

 Function

Setting the image data window position

 Function Name [SR]

CDC_MpSetImgPos

 No

23.2

Format
Sint32 CDC_MpSetImgPos(Sint32 fbn, Sint32 ipx, Sint32 ipy)
input
fbn :Frame bank number (0 to 3)
ipx : Upper left X coordinate of image data window
ipy : Upper left Y coordinate of the image data window
output
none
function value
Returns an error code.
function
Sets the position of the image data window in pixels for the specified frame bank.

(1) Upper left coordinates of the image data window
The initial value is 0 for both ipx and ipy.
The specified value is rounded down to 2 pixels.
Coordinate Normal output mode High definition output mode
NTSC ipx 0-351 (CDC_MPNT_NPX) 0-703 (CDC_MPNT_HPX)
ipy 0-239 (CDC_MPNT_NPY) 0-479 (CDC_MPNT_HPY)
PAL ipx 0-351 (CDC_MPPL_NPX) 0-703 (CDC_MPPL_HPX)
ipy 0-287 (CDC_MPPL_NPY) 0-575 (CDC_MPPL_HPY)

one
View
table
 Title

function specification

 Function

Setting the image data window size

 Function Name [SR]

CDC_MpSetImgSiz

 No

23.3

Format
Sint32 CDC_MpSetImgSiz(Sint32 fbn, Sint32 isx, Sint32 isy)
input
fbn :Frame bank number (0 to 3)
isx : Image data window size in X direction
isy : Y-direction size of image data window
output
none
function value
Returns an error code.
function
Sets the size of the image data window in pixels for the specified frame bank.

(1) Image data window size
The initial value is 0 for both isx and isy.
The specified value is rounded down to 2 pixels.
Coordinate Normal output mode High definition output mode
NTSC isx 0-352 (CDC_MPNT_NSX) 0 to 704 (CDC_MPNT_HSX)
isy 0-240 (CDC_MPNT_NSY) 0~480 (CDC_MPNT_HSY)
PAL isx 0-352 (CDC_MPPL_NSX) 0 to 704 (CDC_MPPL_HSX)
isy 0-288 (CDC_MPPL_NSY) 0 to 576 (CDC_MPPL_HSY)

one
View
table
 Title

function specification

 Function

Loading from image data window

 Function Name [SR]

CDC_MpReadImg

 No

23.4

Format
Sint32 CDC_MpReadImg(Sint32 srcfbn, Sint32 fln_y, Sint32 fln_cr, Sint32 fln_cb)
input
srcfbn : Reading source frame bank number (0 to 3)
fln_y : Aperture number for brightness data (Y)
fln_cr : Aperture number for color difference data (Cr)
fln_cb : Aperture number for color difference data (Cb)
output
none
function value
Returns an error code.
end flag
MPED flag
function
Read image data (YCC) from the image data window in the frame bank through the aperture into the buffer compartment.
remarks

  1. This function is valid only in still image playback mode.

  2. Depending on the screen size, the amount of data may exceed the CD buffer capacity.
    In such a case, process the data while retrieving it to the host side.

  3. This function does not terminate even if the CD buffer becomes full. (MPED does not become 1.)
    To cancel processing midway, execute the CDC_MpInit function (or soft reset using the CDC_CdInit function).


one
View
table
 Title

function specification

 Function

Export to image data window

 Function Name [SR]

CDC_MpWriteImg

 No

23.5

Format
Sint32 CDC_MpWriteImg(Sint32 bn_y, Sint32 bn_cr, Sint32 bn_cb,Sint32 dstfbn, Bool clrmod)
input
bn_y : Buffer section number for brightness data (Y)
bn_cr :Buffer section number for color difference data (Cr)
bn_cb :Buffer section number for color difference data (Cb)
dstfbn : Destination frame bank number (0 to 3)
clrmod : Erase mode of sectors in buffer partition
output
none
function value
Returns an error code.
end flag
MPED flag
function
Writes image data (YCC) from the buffer compartment to the image data window in the frame bank.

(1) Erase mode
constant name explanation
OFF Keep (do not erase) sectors in the buffer partition
ON Erase sectors within the buffer partition

remarks

  1. This function is valid only in still image playback mode.

  2. This function does not terminate even if the data in the buffer section becomes empty. (MPED does not become 1.) To cancel processing midway, execute the CDC_MpInit function (or soft reset using the CDC_CdInit function).


8.2.5 MPEG sector buffer

To use this function, be sure to execute the CDC_MpInit function and then switch to MPEG sector buffer mode with the CDC_MpSetMode function. The initial value in the MPEG sector buffer is undefined.
one
View
table
 Title

function specification

 Function

Reading sectors from MPEG sector buffer

 Function Name [SR]

CDC_MpReadSct

 No

24.1

Format
Sint32 CDC_MpReadSct(Sint32 srcmsp, Sint32 snum, Sint32 dstfln)
input
srcmsp : Source MPEG sector position
snum : Number of sectors
dstfln : Aperture number
output
none
function value
Returns an error code.
end flag
MPED flag
function
Read sector data from the MPEG sector buffer into the buffer section through the aperture.
The sector range to read is specified by the MPEG sector position and number of sectors.

remarks

  1. Depending on the number of designated sectors, the amount of data may exceed the CD buffer capacity.
    In such a case, process the data while retrieving it to the host side.

  2. This function does not terminate even if the CD buffer becomes full. (MPED does not become 1.)
    To cancel processing midway, execute the CDC_MpInit function (or soft reset using the CDC_CdInit function).


one
View
table
 Title

function specification

 Function

Writing sectors to MPEG sector buffer

 Function Name [SR]

CDC_MpWriteSct

 No

24.2

Format
Sint32 CDC_MpWriteSct(Sint32 srcbn, Sint32 sp, Sint32 snum, Sint32 dstmsp)
input
srcbn :Buffer section number
sp : Sector position (CDC_SPOS_END: indicates the last sector of the partition)
snum : Number of sectors (CDC_SNUM_END: Indicates the number of sectors from sp to the end of the partition)
dstmsp : Destination MPEG sector position
output
none
function value
Returns an error code.
end flag
MPED flag
function
Write sector data from the buffer section to the MPEG sector buffer.
The sector range to be written is specified by the sector position and number of sectors.
remarks

  1. On writing, sectors of the buffer partition are erased.

  2. This function does not terminate even if the data in the buffer section becomes empty. (MPED does not become 1.)
    To cancel processing midway, execute the CDC_MpInit function (or soft reset using the CDC_CdInit function).


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