.CSO

From Wikipedia, the free encyclopedia
Compressed ISO
Filename extension
.cso
Internet media type
application/x-compressed-iso
Magic number'CISO'
Developed byBooster
Type of formatDisk image
Container forISO images

.CSO is a compression method for the ISO image format. It is used to compress dumped PlayStation Portable UMD games, and is an alternative to the compression method. It is also sometimes called "CISO".

It was the first compression method for ISO. It was created so that more memory space can be saved. Booster created the first code; it was later optimized for better compression. Other formats tried to replace it by fixing up certain issues such as lag in games, such as .DAX and .JSO. However at the time, the popular application homebrew "DevHook" used CSO. .DAX needed another loader, and .JSO was basically unused.

CSO uses Deflate compression with nine levels of presets, usually with 2 KiB blocks handled individually (they could be uncompressed). While the highest levels of compression can introduce slowdown and lengthy load-times in software which relies heavily on disc streaming, even the lower levels are capable of substantial compression.[1] This is partially due to the data layout of a UMD, though more frequently due to the use of as both an anti-piracy tool and a means to more optimally lay the data out physically on the disc.

In addition to being used for compressing PlayStation Portable UMD games, the PSP port of PicoDrive supports compressed Sega Mega-CD disc images in the CSO format.[2]

Other formats[]

CSO are known to have received later extensions in the form of CSO "v2" and ZSO ("ZISO"), using LZ4 compression for faster decompression. CSO "v2" is backwards compatible with CSO "v1" when using Deflate, while ZSO only supports LZ4.

DAX is a competing format, it uses 8 KiB blocks which aims to increase the data compression ratio, and it also allows uncompressed areas just like CSO. JSO ("JISO") was another now unpopular competing format that was overall similar to CSO, with the difference of added option for LZO compression and a block size tweakable in the official compressor. While CSO allows a tweakable block size, the official compressor does not allow changing it.

File structure[]

The file format consists of a 24-byte header, an index table, and data blocks. Little-endian is assumed for fields larger than a byte, following the architecture endianness of PlayStation Portable.

Header[]

Offset (bytes) Name Size (bytes) Purpose
0x0 Magic 4 Always CISO, or 0x4F534943 when read as a 32-bit integer. This field is used to identify a CSO file. Note that this field can be different for the other derivatives of CSO, for example ZSO used the magic code ZISO.
0x4 Header size 4 For the original CSO "v1" file format, this field is ignored and therefore not required to be accurate. However, the "v2" and ZSO format require this field to always be 0x18 (24 bytes).
0x8 Uncompressed size 8 The size of the original uncompressed ISO in bytes.
0x10 Block size 4 The size of each data block in bytes before compression. Usually 2048 bytes, same as the size of each ISO 9660 sector.
0x14 Version 1 The version of the file format in use. For the "v1" format, the value can be either 0 or 1. For the "v2" format, this must be 2. Additionally, the ZSO format requires this to be 1.
0x15 Index alignment 1 The alignment of each index entry, specified in bits.
0x16 Reserved 2 This field is unused. In the "v1" format, this field is ignored and may contain arbitrary values. In the "v2" format, this field must be zero.

Index table[]

The index table consists of multiple 4-byte entries, which indicate the position of each data block within the file. There is an additional, last entry which points to the end of file. The number of entries in the table can be calculated using the formula: .

The content of each entry is as follows:

Bit Length Mask Name Purpose
0 31 0x7FFFFFFF Position This field, when shifted left by the index alignment given in the header, gives off the position where the data block starts.
31 1 0x80000000 Compression type In CSO "v1" format, the meaning of the field is as follows:
Value Compression method
0 Deflate is used.
1 The block is uncompressed.

The ZSO format has similar semantics, only that 0 represents LZ4 instead of Deflate.

In the "v2" format, the meaning of the field is as follows:

Value Compression method
0 Deflate is used.
1 LZ4 is used.

The block is implicitly considered to be uncompressed if the block size is equal to or larger than the block size specified in the file header.

Data blocks[]

Each data block contains uncompressed or compressed data. The actual size of each block is calculated by taking its position, and then subtracting it from the position of the following block. If the index alignment is greater than zero, it is possible that the block size is larger than the data it holds, necessitating the use of padding.

References[]

  1. ^ "CSO compression". Archived from the original on 23 February 2008. Retrieved 2008-02-28.
  2. ^ "PicoDrive for PSP v1.35b - bugfixes and major feature added". Archived from the original on 2007-12-12. Retrieved 2007-12-11.

External links[]

Retrieved from ""