Cinepak: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
(adjusted the information as the situation changes)
(refreshed info, added a technical note)
Line 5: Line 5:
* Windows binary codec: [http://www.probo.com/cinepak.htm http://www.probo.com/cinepak.htm]
* Windows binary codec: [http://www.probo.com/cinepak.htm http://www.probo.com/cinepak.htm]


The Cinepak coding method is a vector quantization scheme with interframe update optimization. It is known to operate most commonly using a modified YUV 4:2:0 colorspace but also supports 256-grayscale mode. A modified variant of this format is used for full motion video on many Sega Saturn games (in [[Sega FILM]] files often bearing the .cpk extension). It is not known if this format has anything in common with the [[Cinepak For Sega]] format used in many Sega CD games.
The Cinepak coding method is a vector quantization scheme with interframe update optimization. It is known to operate most commonly using a modified YUV 4:2:0 colorspace but also supports 256-grayscale and palettized mode. A modified variant of this format is used for full motion video on many Sega Saturn games (in [[Sega FILM]] files often bearing the .cpk extension). It is not known if this format has anything in common with the [[Cinepak For Sega]] format used in many Sega CD games.
 
ffmpeg contains an almost compliant decoder (using YUV420 instead of the Cinepak colorspace, which distorts colors somewhat - should be easy to fix).


There are several versions of a binary proprietary encoder/decoder as a windows dll, among others ftp://ftp.probo.com/pub/cinepak/cvid32.zip
There are several versions of a binary proprietary encoder/decoder as a windows dll, among others ftp://ftp.probo.com/pub/cinepak/cvid32.zip
Line 14: Line 12:
http://titan.codemill.se/~tomhar/cinepakenc.patch
http://titan.codemill.se/~tomhar/cinepakenc.patch


Unfortunately the open source decoder present in ffmpeg is using the non-compliant YUV420 colorspace instead of the native Cinepak one (for the fix see below).
The encoder mentioned above was adapted for the current (December 2012) ffmpeg, bugfixed and improved for better rate/distortion performance by Rl. The compression speed is barely optimized (it is slow), a choice made for keeping simplicity and r/d. A snapshot 2013-02-18 is at
 
The encoder mentioned above was adapted for the current (December 2012) ffmpeg, bugfixed and improved for better rate/distortion performance by Rl. The compression speed is barely optimized (it is slow), for simplicity and better r/d. A snapshot 2013-02-12 is at
http://www.aetey.se/dl/cinepak-encoder-ffmpeg.patch
http://www.aetey.se/dl/cinepak-encoder-ffmpeg.patch


There is also a patch introducing the correct colorspace for the open source decoder
ffmpeg used to contain an almost compliant decoder (using YUV420 instead of the Cinepak colorspace, which distorts colors), a colorspace fix has been submitted (as of 2013-02-18) by Rl, also improving decoding speed with 15-60% and stream format compliance.This patch is also available at
http://www.aetey.se/dl/cinepak-decoder-colorspace.patch
http://www.aetey.se/dl/cinepak-decoder-colorspace.patch


The encoder was never submitted for inclusion in ffmpeg, feel free to push it upstream.
The encoder was never submitted for inclusion in ffmpeg, feel free to push it upstream.
----
A technical note: x1, x2 and y1, y2 strip coordinates are absolute, unless y1==0 and the strip is not the first one on the frame - then y1 is assumed to coincide with y2 from the previous strip and the read y2 contains the strip height, i.e. ''if(read_y1==0){ y1 = previous_y2; y2 = previous_y2 + read_y2; }''
----


[[Category:Video Codecs]]
[[Category:Video Codecs]]

Revision as of 02:00, 19 February 2013

The Cinepak coding method is a vector quantization scheme with interframe update optimization. It is known to operate most commonly using a modified YUV 4:2:0 colorspace but also supports 256-grayscale and palettized mode. A modified variant of this format is used for full motion video on many Sega Saturn games (in Sega FILM files often bearing the .cpk extension). It is not known if this format has anything in common with the Cinepak For Sega format used in many Sega CD games.

There are several versions of a binary proprietary encoder/decoder as a windows dll, among others ftp://ftp.probo.com/pub/cinepak/cvid32.zip

There is also a simple and straightforward open source encoder as a ffmpeg patch, written in 2011 by Tomas Härdin and available at http://titan.codemill.se/~tomhar/cinepakenc.patch

The encoder mentioned above was adapted for the current (December 2012) ffmpeg, bugfixed and improved for better rate/distortion performance by Rl. The compression speed is barely optimized (it is slow), a choice made for keeping simplicity and r/d. A snapshot 2013-02-18 is at http://www.aetey.se/dl/cinepak-encoder-ffmpeg.patch

ffmpeg used to contain an almost compliant decoder (using YUV420 instead of the Cinepak colorspace, which distorts colors), a colorspace fix has been submitted (as of 2013-02-18) by Rl, also improving decoding speed with 15-60% and stream format compliance.This patch is also available at http://www.aetey.se/dl/cinepak-decoder-colorspace.patch

The encoder was never submitted for inclusion in ffmpeg, feel free to push it upstream.


A technical note: x1, x2 and y1, y2 strip coordinates are absolute, unless y1==0 and the strip is not the first one on the frame - then y1 is assumed to coincide with y2 from the previous strip and the read y2 contains the strip height, i.e. if(read_y1==0){ y1 = previous_y2; y2 = previous_y2 + read_y2; }