Skip to content

PFF format description

Ophir LOJKINE edited this page Mar 13, 2015 · 21 revisions

Constants

CHUNKSIZE = 256
HEADEROVERHEAD = 0x424

File format description

A pff file is composed of four parts :

  • A header, containing general information about the file. Its size is 0x424.
  • A table of JFIF image headers. One of this header has to be appended to the each tile to form a valid JPEG file.
  • A table of pointers to the tiles contents.
  • The tile contents.

Header

Data Offset in file (in bytes) Size (in bytes)
Version 0x8 4
Size of the JFIF image headers table 0x74 4
Number of tiles 0x7c 4
width 0x41c 4
height 0x420 4

The size of the header is fixed (0x424 bytes). It seems to be composed of three parts of size 904, 136, and 20.

I don't understand all the bytes in this header. There are many zeros.

JFIF image headers table

Data Offset in file (in bytes) Size (in bytes)
Number of elements in the table 0x424 4
Size of the first element 0x428 4
First element contents 0x42C See previous line
Size of the 2nd element 0x42C + (size of the first element) 4
Second element contents ... ...

Table of pointers

Data Offset in file (in bytes) Size (in bytes)
Offset in the file of tile number n 0x424 + (size of the JFIF table) + n * 8 8

Remark: the pointers are not aligned. They are all eight bytes long, but they may start at an offset that is not a multiple of 8.

Tiles data

This is just a region of the memory that contains the tiles data, glued together (no alignment). So the data of tile number n ends where the data of tile n+1 starts.

Algorithm

Each tile has an index. The first metadata can be retrieved with a call to the servlet with the peremeter "requestType=1"