Difference between revisions of "PSX/TIM format"

From Final Fantasy Inside
< PSX
Jump to navigation Jump to search
my_wiki>Qhimm
m (Header)
my_wiki>Qhimm
m (File layout)
Line 3: Line 3:
  
 
== File layout ==
 
== File layout ==
A TIM file is made up of three conceptual blocks; the header, the color lookup table (CLUT) and the image data. The CLUT block and the image data block have the same basic layout and are also treated the same way when loading a TIM file into the PlayStation frame buffer. Also, the CLUT block is optional and technically does not need to be present, even when the image data consists of color indices. Such image data is assumed to refer to ''some'' color lookup table, but not necessarily one stored in the same TIM file -- on the PlayStation, the actual CLUT used for a set of image data is referred to only by its frame buffer coordinates, not by the file it comes from. In almost all cases though, the CLUT is included in the same TIM file as the image data using it and can thus be assumed to be applicable.
+
A TIM file is made up of three conceptual blocks; the header, the color lookup table (CLUT) and the image data. The CLUT block and the image data block have the same basic layout and are also treated the same way when loading a TIM file into the PlayStation frame buffer. Also, the CLUT block is optional and technically does not need to be present, even when the image data consists of color indices. Such image data is assumed to refer to ''some'' color lookup table, but not necessarily one stored in the same TIM file. In almost all cases though, the CLUT is included in the same TIM file as the image data using it and can thus be assumed to be applicable.
 
<br/><center>[[Image:PSX_TIM_file_layout.png]]</center><br/>
 
<br/><center>[[Image:PSX_TIM_file_layout.png]]</center><br/>
  

Revision as of 21:16, 3 March 2005

Introduction

A TIM file is a standard image file format for the Sony PlayStation. The file structure closely mimics the way textures are managed in the frame buffer by the GPU. TIM files are little endian-based.

File layout

A TIM file is made up of three conceptual blocks; the header, the color lookup table (CLUT) and the image data. The CLUT block and the image data block have the same basic layout and are also treated the same way when loading a TIM file into the PlayStation frame buffer. Also, the CLUT block is optional and technically does not need to be present, even when the image data consists of color indices. Such image data is assumed to refer to some color lookup table, but not necessarily one stored in the same TIM file. In almost all cases though, the CLUT is included in the same TIM file as the image data using it and can thus be assumed to be applicable.


PSX TIM file layout.png


Header

The header starts with a 'tag' byte; this value is constant for all TIM files and must be 0x10. The immediately following byte denotes the version of the file format. At present, only version '0' TIM files are known to exist.

The next 32-bit word contains specific flags denoting the basic properties of the TIM file. The BPP (Bits Per Pixel) value denotes the bit depth of the image data, according to the following values:

00  4-bit (color indices)
01  8-bit (color indices)
10  16-bit (actual colors)
11  24-bit (actual colors)

The CLP (Color Lookup table Present) flag simply denotes if the CLUT block is present in the TIM file. This flag is typically set when BPP is 00 or 01, and cleared otherwise.

CLUT (color lookup table)

Image data