Japanese
FAQMovie related
BackForward
FAQ/Movie related

Cinepak



I want to play an audio-only Cinepak from the middle.

Q)

  1. Is it possible to play Cinepack data from any position?
    If possible, how can I do it?

  2. Is it possible to do this with Cinepack data that only has sound (no image data)?

Please tell me about these two points.

A)

  1. Playing Cinepack data from any position is possible as long as it is in memory, there is no sound, and all keyframes are present.

  2. you can't.


In Cinepak, when you pause at the joint of a movie, the sound of the next movie is played.

Q)
If you use the CPK_Pause function to pause between Cinepack's split movies (just before the next movie starts), the audio of the next movie registered with CPK_EntryNext will play during the pause. (Looping) When you release the pause, the audio will be out of sync for a while.

A)
There are two problems.

First , since Ver1.10, the CPK_Pause function returns a return value, and if it cannot be paused correctly, it will output an error code.

Specification change of pause function CPK_Pause
Old specification: No return value.
New specification: Returns a Bool type return value.
TRUE :Command was accepted
FALSE :Command was not accepted

Returns FALSE if:

Be sure to check the error codes above.

Second , if you execute this CPK_Pause function at a change in the movie, the change cannot be determined within the function, so the same phenomenon may occur even if you perform the first check.
For details on the processing to be performed before executing the CPK_Pause function, please refer to " (11) About changing the next handle registration " in the Cinepak User's Manual.


About the pose during seamless brunch.

Q)
The currently playing movie is Movie1, and the next movie registered with CPK_EntryNext is Movie2.

When I pause with Movie2 registered, I call the CPK_Pause function for both Movie1 and Movie2, but if I pause while Movie1 is playing (before Movie2 is played), Movie1 returns TRUE. , and Movie2 has not been played yet, so it returns FALSE, but what kind of processing should I do to determine if the pause was successful?

A)
The CPK_Pause function should be used with caution when doing seamless branches. Before execution, be sure to use the status acquisition function (CPK_GetPlayStatus) to execute the CPK_Pause function only for what is currently being played. So don't run CPK_Pause on both as above.

If you execute CPK_EntryNext, check the transition period of the next handle of the CPK_EntryNext function, and do not execute the CPK_Pause function until you are sure that Movie2 is in the play state.


What is Cinepak error CPK_ERR_SAMPLE_ID?

Q)
The Cinepack error code CPK_ERR_SAMPLE_ID (0x00000401) is described in the manual as "movie identifier is abnormal", but what does this movie identifier mean?

Also, when playing CinePack, an error (error code 0x301) occurred that the initial value of "FLOP" was too small.What is "FLOP"? What can I do to make it bigger?

A)
This error code is output when the data loaded into the ring buffer is not Cinepak data.
This error is not output when data is sent from the CD-ROM to the ring buffer, but when the data is actually expanded.

In the case where this error code is output,

Such will be considered.

Please tell me about stereo/monaural settings.

Q)
How do I switch between stereo and monaural Cinepack playback?

A)
Please control the stereo/monaural switching of Cinepack playback on the sound driver side.

There is a function called CPK_SetPan, which corresponds to so-called left-right balance. Therefore, it does not make the sound of CinePack stereo/mono.


When doing a seamless branch, do you prepare as many buffers as there are movies?

Q)
When performing seamless branch playback of movies, do I need to prepare as many buffers as there are movies to play?

For example, when playing three movies A, B, and C seamlessly, can't A and C be shared in the same buffer?

A)
A buffer is just a buffer, so even if you use multiple movies, you don't have to prepare as many buffers as there are movies to play.
Therefore, if there is an unused buffer, it is possible to reuse it.


How to properly play Cinepak on PAL?

Q)
When you play a CinePack that normally plays in NTSC but in PAL, you may experience symptoms such as the sound cutting out momentarily or the sound and video being out of sync.
What should I do to play correctly on PAL?

A)
This phenomenon occurs because Cinepak's data transfer is not on time.
As a method to do it on the program side

  1. Increase the number of CPK_Tasks.

  2. (For PAL, the number of V-Blanks has decreased from 1/60 to 1/50, so simply increase it.)

  3. Execute in a mode that uses the Slave CPU, which is compatible with Cinepak library Ver. 1.10.

  4. (Cinepak library may malfunction if your application uses Slave CPU.)

There are two possibilities.
In the case of this problem, there is a possibility that it can be cleared by taking action in (1). In fact, when changing from 1/60 to 1/50 (from NTSC to PAL), the same symptoms as yours occur due to the timing difference.

As a countermeasure by changing the program, it is possible to change the graphics transfer timing and transfer method.

For other cases, it is possible to correct the data for PAL, and possible correction methods include dropping frames or changing key frames (30 to 25, etc.).


When should I register a movie when doing a seamless brunch?

Q)
I have a question about seamless branch playback of movies.
In the sample (smpcpk5.c), two movies are played consecutively, but when playing three or more movies, when should I register the third movie [CPK_EntryNext()]? ?

      >    /* Start movie */
      >    CPK_Start( cpk[0] );
      >    
      >    /* Register the next movie to play */
      >    for ( i = 1 ; i< FILE_MAX ; i++ )
      >    {
      >        CPK_EntryNext( cpk[i] );
      >    }

It seems that this is not the case, so if you want to register when the second movie starts playing, would it be possible to detect the end of the first movie and then issue CPK_EntryNext?

A)
I think there is no problem with the above method.
If you are going to enter three or more movies one after another, it would be effective to prepare two ring buffers and switch between them.


What points should I be careful about when handling errors?

Q)
What points should I be careful about when handling errors?

A)
If an error occurs in the file system or stream system during movie playback, movie playback cannot be continued.
In this case, delete the movie handle and close the file. After that, please perform other processing such as playing the movie again.

Be sure to set each error processing function GFS_SetErrFunc, STM_SetErrFunc, and CPK_SetErrFunc to detect errors. It also improves debugging efficiency.


Are there any precautions when using SCU-DMA for data transfer?

Q)
Are there any precautions when using SCU-DMA to transfer data from the CD block to the ring buffer?

A)
When using SCU-DMA to transfer data from the CD block to the ring buffer, peripheral information may not be obtained correctly.
In this case, it can be improved by setting the maximum number of transferred sectors (default value 20) to a smaller value, but if you set the value smaller, you will need to call the task function frequently enough to compensate for the smaller setting.

[Processing example]
CPK_SetTrModeCd(cpk, CPK_TRMODE_SCU); /* Transfer using SCU-DMA */
CPK_SetLoadNum(cpk, 10); /* Maximum value of one transfer amount [sector]*/

Also, since the bus used during SCU-DMA transfer is occupied, SH2 will be in a wait state from the moment it tries to access the CPU bus.
Please avoid using SCU-DMA as much as possible.


Please tell me about the relationship between frame size and Cinepak compression method.

Q)
Please tell me about the relationship between frame size and Cinepak compression method.

A)
Cinepak performs compression processing by dividing one frame into 1 to 3 parts depending on the frame size (area).

Before and after the splitting conditions, the internal compression efficiency and image quality become discontinuous, and the following trends are thought to occur.

If it is smaller than the splitting condition and close to the splitting condition:
Poor image quality (compression rate is slightly better)

If it is larger than the split condition and close to the split condition:
Good image quality (compression rate is a little bad)

The exact dividing conditions are unknown, but the ranges we have confirmed are shown below.

Area [pixel] Number of frame divisions (number of tiles)
96000 = 480×200 or more 3
95744 = 352×272 or less
59904 = 208×288 or more
2
57344 = 256×224 or less 1
(Do not split)
* The CinePack library supports splitting into two or less .


What is the most efficient way to perform image decompression processing?

Q)
What is the most efficient way to perform image decompression processing?

A)
It is more efficient to output image decompression processing to WORK RAM-H than directly to VRAM, so task functions operate faster this way.
If you output the data to WORK RAM-H and then transfer it to VRAM using SCU-DMA, the processing time will be shorter even if you add the transfer time.


I want to make an uncompressed movie.

Q)
I would like to display an uncompressed movie.

A)

(1) Conditions for using uncompressed mode
Use this when you want to reduce the image size and frame rate and give priority to image quality.

15-bit color movies are not supported. Although it supports 32K color display of 24-bit data, this means that high-quality data will be wasted.

Convert an uncompressed QuickTime Movie with MovieToSaturn_J. There are no functions added for playing uncompressed movies.
Since the file header is interpreted and processed, it can be played using exactly the same procedure. However, the ring buffer must be larger than when compressed.

(2) Ring buffer size
Ring buffers must be allocated to meet the following conditions:

ring ≧ header + sound + frame

ring :Ring buffer size
header: File header size (converted to sector size boundary rounded up)
sound: Size of 0.5 seconds of sound
frame :1 frame uncompressed size

(3) Video performance
Based on the data transfer rate from the CD, the video performance will be as shown below.

Audio conditions Limit video performance
 44kHz, 16bit stereo
320×224[dot] 0.60[fps]
 22kHz, 8bit monaural
320×224[dot] 1.32[fps]
 video only movie
320×224[dot] 1.42[fps]
 video only movie
160×112[dot] 5.71[fps]


Please tell me about the execution history output for debugging.

Q)
Please tell me about the execution history output for debugging.

A)
Outputting the execution history of the CinePack library's main processes can be useful in determining the cause of malfunctions such as unsmooth playback. You can check whether tasks are being called regularly, whether data supply is delayed, and whether frames are being dropped.

It will be easier to analyze the history if you create a simpler execution history after checking the reproducibility of malfunctions.
Note that this function outputs results to the SIMM area. Therefore, it will not work with CartDev + DevSaturn without SIMM.
In that case, you will need to separately purchase a buffer card that supports SIMM.

[Internal processing of Cinepack library that outputs history]
When an error occurs
When calling a task function
Ring buffer data supply and consumption
When display request flag is turned on/off
Frame drop processing PCM start/stop

[Output specification]

  1. When using the production program as is

  2. Break after processing CPK_Init. Check the address of the CpkdSys type structure cpkd_sys in the map file created during linking, and use the debugger command to set the value of cpkd_sys.mode to 0x00000001.

    Example. Operation from command line of E7000/EVA board

    :m 060XXXXX 1;l

    The output address will be 0x04000000 to 0x047fffff.
    (SW2-5 of the Programming Box< SIMMCART> Please turn off. )

  3. When creating a program for debugging output

  4. Set CPKD_SetMode(ON) after CPK_Init. CPKD_SetPrintAddr allows you to set the output address. Using CPKD_PrintStr and CPKD_PrintData, it is possible to add and output the execution history of application-side processing.

    When additionally outputting, please make the output size an integral multiple of 164 bytes to make history information easier to read.

[Check output information]
Display the output address as a dump using the debugger command. Saving the displayed content as a text file and viewing it with a text editor makes it easier to analyze the operation.

Example. E7000/EVA board operation from command line

:> hist.txt [RET]
:d 04000000 04001000;l [RET]
:> - [RET]

[Format of output information]
--------+--------------------------------------------+
ADDRESS : 0 1  2 3   4 5  6 7   8 9  A B   C D  E F  :
--------+--------------------------------------------+
04000000: AAAA_AAAA  ---- ----  ---- ----  ---- ---- :
04000010: "Err "     ---- VVVV  ---- ----  EEEE_EEEE :Error 
04000020: "Task"     PPPP VVVV  HHHH_HHHH  CCCC_CCCC :start of CPK_MeTask
04000030: "RWri"     WWWW VVVV  HHHH_HHHH  DDDD_DDDD :WRIte Ringbuffer
04000040: "RRea"     RRRR VVVV  HHHH_HHHH  DDDD_DDDD :REAd Ringbuffer
04000050: "DOn "     FFFF VVVV  LLLL_LLLL  TTTT_TTTT :set Disp flag On
04000060: "DOff"     FFFF VVVV  HHHH_HHHH  TTTT_TTTT :set Disp flag Off
04000070: "PcmS"     MODE VVVV  HHHH_HHHH  ADDR SIZE :PCM Start
04000080: "PcmE"     MODE VVVV  HHHH_HHHH  ---- ---- :PCM Stop
04000090: "LosF"     FFFF VVVV  LFLF_LFLF  SSSS_SSSS :LOse Frame
                              :
                              :

[Description of output information]

AAAA_AAAA :
Current history information output address.

---- VVVV:
Vbl counter. Know the approximate time.

EEEE_EEEE :
Error code.

PPPP ---- :
Play status [-1, 0, 1, 2, 3, 4, 5].

HHHH_HHHH:
Cinepack handle.

CCCC_CCCC:
Cinepac task call counter.

DDDD_DDDD :
Remaining amount of data in the ring buffer [byte]. Find out if there is a supply disruption.

WWWW ---- :
Write size to ring buffer [sector].

RRRR ---- :
Read size from ring buffer [byte].

FFFF ---- :
Frame number.

LLLL_LLLL:
delay time. (Current time - frame display time)

TTTT_TTTT:
Frame time. (Frame display time + frame display duration)

LFLF_LFLF:
Frame drop counter.

SSSS_SSSS:
sample counter.

MODE ---- :
0x80##:Stereo, 0x10##:8bit, 0x##03:PCM stream playback number 3
(In case of PCM Stop, only the PCM stream playback number is displayed)

ADDR ----:
PCM buffer start address (4bit right shift value)

SIZE ----:
PCM buffer size [sample/ch]


The value shown in the playback time field of the movie playback information is different from the original playback time.

Q)
The number shown in the playback time field of the movie object's playback information is different from the original playback time. Could I ask the reason.

A)
QuickTime manages movie time in units called TimeScale, which are smaller than timecodes. Accuracy up to 1/600th of a second can be managed.

Commercial applications typically use a maximum accuracy of 1/600 second.
Author Editor also handles videos assuming a TimeScale of 600.
However, depending on the application such as Adobe Premiere, the TimeScale is not necessarily fixed at 600.

Therefore, if the resulting movie does not have a TimeScale of 600, the playback time (called DurationTime in QuickTime) will look different.
(However, this does not affect playback in any way.)

An example is shown below.

Example: If you create a 30 second Cinepak movie
TimeScale TimeCode DurationTime
1. 600 00:00:30:00 18000 normal movie
2. 30 00:00:30:00 900 Movie with TimeScale of 30
3. 20 00:00:30:00 600 Movie with TimeScale of 20
* Note that TimeScale and DurationTime are consistent, just because the units of time management are different, so the above three movies are all genuine movies with no apparent difference! !
When AuthorEditor loads a movie with a TimeScale of 30, the playback time is calculated as follows by referring to the number 900 pointed to by DurationTime.

900÷600=1.5

Therefore, the playback time, which is originally 30 seconds, may be mistaken for 1.5 seconds.

【countermeasure】
To determine the TimeScale of a movie, use Dumpster (included in the QuickTime Developer's Kit).
Launch Dumpster and open the desired movie.
Among the numbers that can be referenced here, if TimeScale shows a value other than 600, correct it to 600 (there are multiple locations, so correct them all).

Furthermore, modify Duration, Track Dur, and sampDur so that they are consistent with the TimeScale changes. (Modify all of these if there are multiple ones.) When you have finished making corrections, save and exit.

【postscript】
We are currently investigating and don't really know what determines the movie TimeScale value. What we currently know is that when creating Cinepak movies using Adobe Premiere, TimeScale is often a value other than 600.

As far as I have checked, other compression tools (MovieConverter, ConvertToMovie, Movie Conversion, MovieShop, CoSA AfterEffects, etc.) always show a value of 600.

Therefore, unless you absolutely have to use Premiere, the best way to avoid this problem is to use another compression tool.


BackForward
FAQMovie related
Copyright SEGA ENTERPRISES, LTD. 1997