I am trying to read BAM files but I'm having some issues.
I parse the BAM header according to the IESDP doc, and get generally good results:
[signature] => BAM [version] => V1 [nbFrames] => 135 [nbCycles] => 9 [transparentIndex] => 0 [offsetFrameEntries] => 24 [offsetPalette] => 1680 [offsetFrameLut] => 2704
That's for DBAM1A1.bam. This one works fine!
But now some other BAM files, like DBAM1G1.bam, are arranged in a different order:
[signature] => BAM [version] => V1 [nbFrames] => 846 [nbCycles] => 99 [transparentIndex] => 0 [offsetFrameEntries] => 45728 [offsetPalette] => 24 [offsetFrameLut] => 1048
Here I have the palette, the frame lookup table then the frame entries (and, I guess, the cycle entries). That's problematic because I rely on the cycle entries to know how large the frame lookup table is! As per the IESDP:
To find the number of entries in this lookup table, find the largest value of start+count in the cycle entries table.
So I am stuck, I tried computing the lookup table size from (offsetFrameEntries - offsetFrameLut) but this doesn't work. Actually, parsing frames from the offsetFrameLut position doesn't even work!
Any idea? Am I missing something?
Edit: fixed file names