HomeForumsWhat's newResources 
 
 
Official Cinepak Sample Code (Currently only SBL)
TrekkiesUnite118 - Sep 20, 2021
 TrekkiesUnite118 Sep 20, 2021
I've been playing with sample code in Sega's official Cinepak libraries and I figured as I get them compiling, running, and the comments roughly translated with DeepL I'd share the examples here. This way if people want to incorporate FMV into their projects they have some examples to work with. Currently I've only played with the SBL samples, but there are SGL samples as well included in the official Movie Tools disc.For encoding Cinepak Files please see the guide I...

The first one here is the Cinepak Demo 6. This one is probably the easiest to understand and work with. It plays a 24-bit RGB video on VDP2 with PCM audio playback. The program will auto-adjust to account for different resolutions, frame rates, and audio settings. This program doesn't use the more complicated Stream Library and just plays an individual file from the data track. However it doesn't load it into RAM but instead plays it off the disc. So you're not limited to whatever can fit into RAM.

In order to use it with SBL, you'll need to do the following:
  1. Unzip the CINEPAK.zip file.
  2. Copy the contained CINEPAK folder into your SBL directory.
  3. Update your Make files and linker scripts to include the cinepak library in your build (Look at the included Makefile, SAMPLE.CFG, and SMPSLC1.SHC files for what to do.)
  4. You will need to use the official sound driver and the BOOTSND.MAP file. The correct versions are included in the cd directory of the demo along with a sample Cinepak File and the compiled 0.bin file.
For step 3 I am not really a master of C Make files or Project setups so some of that may or may not be required, but it's what I did to get it to build.

It may be possible to get this working with other sound drivers and with out the BOOTSND.MAP file, with significant modifications of the source code. I just don't know enough about SBL to know what would need swapped out.

I have also included a built ISO for an example of what the compiled code does.

 CheoChessman Sep 21, 2021
The tools we needed

 TrekkiesUnite118 Sep 25, 2021
One bit I forgot to mention in the previous demo. It is set to only use the Master CPU and the Slave CPU is disabled. If you want to use the 2nd CPU you can uncomment this line of code:

Code:
  
/* Define this when you want the Cinepac library to use a slave CPU. */
/* #define DUAL_CPU */

 TrekkiesUnite118 Nov 3, 2021
Here's another demo, this one is Demo 4 which will decode and play a Cinepak Video to a VDP1 Distorted Sprite. Color Conversion from 24-bit to 15-bit RGB is handled by the playback library so you don't have to worry about encoding videos differently, however at fullscreen the color reduction is noticeable. So if you intend to do full screen FMV on VDP1, you may want to take 15-bit RGB into consideration when you prepare yoru video for encoding.

That said if you were to render this as a texture it would probably look pretty good.

 Frogbull Dec 2, 2023

https://youtube.com/z961XY5eDO4


Cinepak playback is now possible with SGL

 TrekkiesUnite118 Dec 2, 2023
Oh did you get the SGL samples working? I've been meaning to go through those but never had an SGL environment set up to test them.

 Frogbull Dec 2, 2023

TrekkiesUnite118 said:

Yes sir


Big kudos to you for the SBL sample, your documentation and your Cinepak encoding tutorial, it helped a lot

 TrekkiesUnite118 Dec 2, 2023
Now we just need to reverse engineer the ADX version and we can have premium Cinepak Quality.

 Frogbull Dec 2, 2023

TrekkiesUnite118 said:

How much Bitrate can you save with ADX?

 TrekkiesUnite118 Dec 2, 2023

Frogbull said:

ADX has about a 4:1 compression ratio. So for example if you did uncompressed 44100Hz 16-bit Stereo PCM, that would need about 176KB/s of your bitrate. If you did that same quality at ADX it would be about 44KB/s of bitrate give or take a KB. Generally I do Mono 16-bit 22050Hz audio with 250-275KB/s for video quality when encoding stuff for fun and tests. I could have 44100Hz Stereo audio in that same bitrate budget with ADX. With ADX at Mono 22050 Hz it would take only about 11-12KB/s vs the ~44KB/s it takes uncompressed.