Sonic and Sega Retro Message Board: Demystifying Cinepak For Sega - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

Demystifying Cinepak For Sega For now, a small preview of my research

#16 User is offline Bgvanbur 

Posted 10 September 2011 - 07:46 PM

  • Posts: 128
  • Joined: 02-November 10
  • Gender:Male
  • Location:USA
  • Project:a disassembly, some small Sega CD projects

View PostICEknight, on 10 September 2011 - 03:21 PM, said:

So Mega-CD FMVs could have looked 72% better than they did? Those lazy devs...

Not really. Each unused palette only wastes 32 bytes. Since they used a fixed number of palettes, a frame with less palettes would just mean that frame didn't need as many palettes as other frames. This wouldn't really affect FMV quality.

The real deficiency is the lack of reusing tiles from previous frames. (For example if I reencode the Star Wars Chess cinepak files, I get around 50% reduction in size by reusing tiles since it has most of the outer tiles not changing.) For movies like this, this huge amount of extra bandwidth could have been used for better color quality, better framerate, or better video size.

#17 User is offline Bgvanbur 

Posted 06 November 2011 - 03:17 PM

  • Posts: 128
  • Joined: 02-November 10
  • Gender:Male
  • Location:USA
  • Project:a disassembly, some small Sega CD projects
I am releasing the source for several Cinepak demos. All the source files are inside the ISO itself. I build these on Linux using PERL, ffmpeg, and SCDTools (mentioned in more detail below). The convert.sh script is used to convert the original movie into a Sega CD ISO with the Cinepak demo. The SCDMAKE.CFG file controls how SCDMAKE will make the ISO. MAINPLAY.BIN and SUBPLAY.BIN are the Cinepak code for the MAIN and SUB CPUs respectively. IP.ASM and SP.ASM are the intial MAIN and SUB programs respectively.

SCDTools is a suite of scripts I made that are located at Sourceforge. My scdasm script wraps my favorite 68k assembler for easy calling and not wondering about all the various options that typically get passed. My scdwav2pcm script converts 8-bit PCM wave audio files to the sega pcm format. My scdimg2tile generates Sega VDP tile data/maps from images, determines Sega palettes for a set of images, and can perform a few dithering methods (such as 2x2 ordered dithering and 4x2 ordered dithering that is really handy for Cinepak). My scdcinepakencodeframe script can encode a frame's tile data into the compressed Cinepak tile data. My scdcinepakencode script encodes an entire Cinepak file from palette files, cinepak compressed data, and pcm data. My scdmake script makes the Sega CD ISO (controls all the Sega fields, the PVD fields, supports Joliet, supports directories, and supports making an include file detailing file starts and sizes to make easy file usage in the SUB code). My scdmoviedecode will decode Cinepak movie files and some Sonic CD movie files (it decodes it into a format easy to use for scdcinepakencodeframe and scdcinepakencode. My scdwrite script is how I make Sega CD ISOs on Linux.

And now the links for the Cinepak demos with the source:
BADAPPLESRC.ZIP: Bad apple video, uses greyscale and the video is mostly monochrome and a lot of tile reuse and I did not use any dithering.
GMITMSRC.ZIP: Glenn Miller - In the mood, it is live action and has very little tile reuse, uses 4x2 ordered dithering.
NYANCATSRC.ZIP: The initial Cinepak demo I made, has a custom encoding script to allow non-uniform frame durations and allows for looping the 12 frames.
X6ATNEWSRC.ZIP: The Star Wars Chess movie of AT vs C3PO, decoded and reencoded with my cinepak encoder (and since it support tile reuse the resulting file is much smaller than the original).

I still am working on cleaning up my Cinepak disassemblies for public release.

#18 User is offline Bgvanbur 

Posted 29 January 2012 - 08:51 PM

  • Posts: 128
  • Joined: 02-November 10
  • Gender:Male
  • Location:USA
  • Project:a disassembly, some small Sega CD projects
Finally releasing the source to the MAINPLAY and SUBPLAY Cinepak for Sega modules.

CINEPAKSRC.ZIP

It has MAINPLAY.ASM and SUBPLAY.ASM, the source for both Cinepak modules that supports multiple revisions using preprocessor directives. I have also included assembly sources for each revision for those who cannot use or cannot be bothered to use gpp. The MAINPLAY.ASM is very well documented and properly assembles to the original binary for all but one revision. The SUBPLAY is also very well documented except for a few places, and properly assembles to the original binary for over half of the revisions (there is more complex variations in the revisions for SUBPLAY).

It also has all the original binaries I extracted from various Cinepak for Sega games (note: some Cinepak games I was unable to easily determine the Cinepak module locations).

It also has DEMYST.PFT, a document that documents the Cinepak for Sega format, some of the revision information, some of the problems with it, how to use the modules, and a brief section about a few games (don't really feel like finishing this section of the document).

I doubt I will work on Cinepak for Sega disassembly or research much more beyond this. Though I intend to make use of it in any homebrew games I make.
This post has been edited by Bgvanbur: 29 January 2012 - 08:54 PM

#19 User is offline Chilly Willy 

Posted 29 January 2012 - 10:54 PM

  • Posts: 746
  • Joined: 10-April 09
  • Gender:Male
  • Project:Doom 32X
Fantastic! Thank you for your efforts, and for releasing the code.
:)

#20 User is offline Trunks 

Posted 06 February 2012 - 07:57 PM

  • AGAIN TRY
  • Posts: 1420
  • Joined: 20-February 08
  • Gender:Male
  • Location:San Antonio, TX
  • Project:The Bancast, Lone Stars, LOVE
  • Wiki edits:30
Will this likely work on hardware? :O

#21 User is offline Vangar 

Posted 14 February 2012 - 07:05 AM

  • Posts: 3473
  • Joined: 08-January 04
  • Gender:Not Telling
  • Location:America
  • Wiki edits:2
I've tested the Nyan cat ISO on real hardware, and it works.

#22 User is offline Bgvanbur 

Posted 22 February 2012 - 09:12 PM

  • Posts: 128
  • Joined: 02-November 10
  • Gender:Male
  • Location:USA
  • Project:a disassembly, some small Sega CD projects
Of course it works on real hardware. I don't see the point of working on the Sega CD system without having it work on real hardware.

Previously, my Cinepak source only assembled on asmx, ASM68k, and SNASM68K. I have updated it to also assemble using AS (macro assembler) [it just requires making a incbin macro to convert the incbin directives to AS's binclude directives]. I have overwritten the previous version of CINEPAKSRC.ZIP with these updates.

#23 User is offline Andrew Rosa 

Posted 25 November 2014 - 03:42 PM

  • Posts: 3
  • Joined: 25-November 14
  • Gender:Male
  • Location:Erewhon, MD
  • Project:My Life with SEGA
How easy is it to convert a completed video project to SEGA CD? I only ask because I'm not very tech savvy, but I want to have my SEGA-themed short movies play on an actual SEGA CD.
This post has been edited by Andrew Rosa: 25 November 2014 - 03:42 PM

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users