>> Do you know the file format ?
If not, where does the file come from ?
Main Topics
Browse All TopicsI have a file that contains a bunch of Datablocks that are raw image files. The images can be put together to form a larger image. I need to figure out the positional information for the individual Datablocks so that I can create a program to automatically put them together.
In the Datablock Header, there is information for X and Y size, as well as IDs and groups, or something. What I am looking for is grouping information as well as individual ID information. The most I have assertained thus far is that they are grouped in multiples of 14* or 16*. aka (14*14=196, 16*16=256), however I have not found a fool proof way of grouping them. Even my above observations fall apart towards the middle/end of the list.
I have compiled these Datablock Headers into an HTML file and MS Excel file and have done basic analysis on them. I converted 2 byte blocks to Shorts and 4 byte blocks to integers. I then performed a MIN, MAX, and UNIQUEness calc on them all.
Here is the data:
----------
HTML Format (20MB)
http://www.mydatadump.com/
Office 2003 Format (25MB)
http://www.mydatadump.com/
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm 99% sure the file format is a proprietary raw image. You can rename the data files as a .raw and load them into Photoshop CS4 as a 128x128 with a 26 byte header. This is probably a terrain height map or alpha splat texture.
The 'header' information I posted earlier (in .xls and .htm formats) are the context information from the blocks.
Here are some sample files:
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
http://www.mydatadump.com/
The larger file contained a main Header and an Index. I parsed out the individual segments based on the Index. These individual segments *were* compressed via zlib. The segments I have posted above are raw data blocks.
The index file consists of:
1 File Header Section(16bytes)
1 Index Section (variable bytes)
1 Data Section (variable bytes)
The index section consists of individual Index Elements. Each Index Element is formatted:
1 Unknown 4byte value
1 ID (4 bytes)
1 offset to Data in file (4 bytes)
1 uncompressed size (4 bytes)
1 compressed size (4 bytes)
All this is working fine. When I read out the compressed data at the offset pointed to by the index element, I run it in the inflater and have the data block.
>> 1 Unknown 4byte value
I assume this has something to do with it ...
>> 1 ID (4 bytes)
Anything peculiar about this ID ?
>> Those sample files are some of the individual data blocks. There's about 21,000 of them.
The 10 you posted all have the same header. Is that true for all of the 21000 data blocks (do they all have the same header ?) ?
The first two 32bit values seem to be the pixel width and height of the image (128x128).
The next two 32bit values are both 1 - that could mean anything ...
Then there are 6 more bytes, the last two of which are 1 - that could mean anything ... (possibly one of those is a type - maybe grayscale, and the other is the amount of bytes used for one pixel)
The last 32bit value seems to be the size of the data (16348 = 128*128) that follows after the header.
>> The 'header' information I posted earlier (in .xls and .htm formats) are the context information from the blocks.
You listed 12 bytes for each data block. Where do these 12 bytes come from ?
For the 10 sample data blocks you posted, which lines in the html file do they correspond with ? Do I use the first value in the data block file name (10000 - 10009) as the line number in the html file ?
Sorry for not getting back to you sooner. I couldn't get some of the information until now.
The whole cache file is broken down into small chunks. Each of this chunks is referenced to by an indices table in the header of the file.
Each chunk is formatted like this:
Unknown 1 (4 bytes)
Unknown 2 (4 bytes)
OffsetToData (4 bytes)
UncompressedSize (4 bytes)
CompressedSize (4 bytes)
Data (variable)
Now the data files I have posted above are the Data blocks from the chunks, already uncompressed.
The 12 bytes I am referring to are the Unknown 1 and Unknown 2 in the chunk's header. And now I see that it is only the first 8 bytes I am worried about, not 12. These are the bytes that I built my spreadsheets around.
The 10 you posted all have the same header. Is that true for all of the 21000 data blocks (do they all have the same header ?) ?
No, I don't think so. I would try to upload them all, but they come out at about 400 megs. I could give you a link to the compressed file (already uploaded), and give you the java code that is used for decompressing it.
No need to upload them all ;) If anything, just the headers should be more than enough. But I don't think it matters much. The information you're looking for is likely not in the data blocks, but rather in the index data as you suspect.
Just one other thing I'm curious about. Where do the values from the data block file names come from ? The first one seems to just be the index (1 to 21000), but what's the second value ?
I'm leaving for a short weekend holiday, so I won't be able to work on this in the next few days, but as soon as I get back, I plan to give it a go ... That'll be tuesday though, so you or someone else might have already figured it out by then :).
Ok, here's how far I got with my analysis of those 8 bytes of header data :
4 bytes : id of some kind (?)
2 bytes : X/Y coordinates (?), following the formula ((X * 1000) + Y) (or with X and Y switched around)
1 byte : always 0
1 byte : some pattern appears, but I'm not sure how to interprete it
For each id, all the (X, Y) pairs in the range are present N times, where N is the amount of different values for the last byte (for that id)
For example, for id 0x00000495, a 14x14 grid of (X, Y) pairs is repeated 10 times, once for each of the 10 different values of the last byte : 13,14,15,113,114,115,116,2
Notice the strange pattern that emerges if these 10 values are arranged like this :
13, 14, 15,
113,114,115,116,
214,215,216
Similar patterns are present for the other id's.
Is it possible that there are gaps in the data (missing data files maybe) ?
The interpretation of the (X,Y) pairs could easily be verified by laying out the image data on a grid, and seeing if it matches like that. But for that I'd need all of the data, and that's a lot of data heh :)
I've included a table summarizing the results I got (based on your table) :
Nice work, thanks.
"The interpretation of the (X,Y) pairs could easily be verified by laying out the image data on a grid."
I was thinking that might be the case.
I could send you the java code and the link for the compressed file. It's only 116 mb compressed. I had already prepared a page for it, actually.
http://mydatadump.com/taja
I've got the file, so there's no need to doubly compress it ;)
I just wanted to know the compression algorithm used, so I can retrieve the original files heh.
So, zlib ... I'm afraid I currently don't have the time to write code for extracting the data. It would be easier if you'd use a standard compression tool like gzip to compress the original data.
The code is already written for extracting the data. I put it on that page - http://mydatadump.com/taja
You should be able to just put the code together with something like eclipse.
>> I meant the file was compressed with zlib before I got my hands on it :)
Ah, I see :)
>> Ok, I'll see if I can get it uploaded with something else.
Thanks. I'm sorry, but I'm quite busy at work at the moment heh, so other than a few quick posts I can't spend a lot of time on this. And the day is not finished yet lol.
Business Accounts
Answer for Membership
by: Infinity08Posted on 2009-09-01 at 23:20:00ID: 25238348
If you could upload the original file, that would probably be of a lot more help to us ...
Do you know the file format ?