Question

Binary grouping analysis

Asked by: gmk1212

I 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/indices.htm

Office 2003 Format (25MB)
http://www.mydatadump.com/indices.xls

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-01 at 20:25:20ID24700148
Tags

binary file analysis

Topics

Probability & Statistics

,

Algorithms

,

Math & Science

Participating Experts
1
Points
500
Comments
31

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. multi-threaded app slows down toward the end....
    Hi... I have a threaded app organized in this basic way: I split up my main Input file of data to process, into lots of small data 'packets' (let's say 500 for example). Then my app - which may be running about 20 or so identical worker threads - each go out and grab an ava...
  2. looking for a fool proof method of converting date to age
    looking for a fool proof method of converting date to age. BUT the input field must allow the user to either type the age or the date. in other words if they type an age do nothing just save if they type a date convert to age if they type something else fix their error

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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 ?

 

by: Infinity08Posted on 2009-09-01 at 23:20:21ID: 25238350

>> Do you know the file format ?

If not, where does the file come from ?

 

by: gmk1212Posted on 2009-09-01 at 23:32:57ID: 25238402

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/10000_-1090506039.data
http://www.mydatadump.com/10001_-1090506038.data
http://www.mydatadump.com/10002_-1090506037.data
http://www.mydatadump.com/10003_-1090506036.data
http://www.mydatadump.com/10004_-1090506035.data
http://www.mydatadump.com/10005_-1090506034.data
http://www.mydatadump.com/10006_-1090506033.data
http://www.mydatadump.com/10007_-1090506032.data
http://www.mydatadump.com/10008_-1090506031.data
http://www.mydatadump.com/10009_-1090506030.data

 

by: gmk1212Posted on 2009-09-01 at 23:34:22ID: 25238403

Those sample files are some of the individual data blocks. There's about 21,000 of them.

 

by: Infinity08Posted on 2009-09-01 at 23:50:27ID: 25238457

>> Those sample files are some of the individual data blocks.

And was there an original index file too ? Or do you only have the headers of each of the separate data files ?

 

by: gmk1212Posted on 2009-09-01 at 23:56:18ID: 25238484

The headers for the seperate data files are the .xls or .htm files

 

by: gmk1212Posted on 2009-09-02 at 00:01:06ID: 25238503

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.

 

by: gmk1212Posted on 2009-09-02 at 00:05:40ID: 25238527

"And was there an original index file too ? Or do you only have the headers of each of the separate data files ?"

Oh, I misread the second sentence. There is a index file too. It's currently compressed with zlib. I'll try to get that uploaded.

 

by: Infinity08Posted on 2009-09-02 at 03:11:39ID: 25239434

>> 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 ?

 

by: gmk1212Posted on 2009-09-03 at 12:03:22ID: 25253822

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.

 

by: Infinity08Posted on 2009-09-03 at 12:38:44ID: 25254184

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 :).

 

by: gmk1212Posted on 2009-09-07 at 09:39:29ID: 25276118

For the datablock names, I'm not really sure. I was combining a bunch of values to ensure name uniqueness.

 

by: Infinity08Posted on 2009-09-09 at 06:39:14ID: 25291088

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,214,215,216.
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) :

offset count            id         (X, Y)         0 last byte
------ ---------------- ---------- -------------- - ---------------------------------------
0      1960 = 14*14*10  0x00000495 (0..13, 1..14) 0 13,14,15,113,114,115,116,214,215,216
1960   1176 = 14*14* 6  0x00000496 (0..13, 1..14) 0 58,59,60,157,158,159
3136   3072 = 16*16*12  0x00000497 (0..15, 1..16) 0 1,2,3,4,101,102,103,104,201,202,203,204
6208   2304 = 16*16* 9  0x00000498 (0..15, 1..16) 0 46,47,48,146,147,148,245,246,247
8512   1536 = 16*16* 6  0x00000499 (0..15, 1..16) 0 90,91,92,189,190,191
10048  2560 = 16*16*10  0x0000049A (0..15, 1..16) 0 33,34,35,133,134,135,136,233,234,235
12608  1792 = 16*16* 7  0x0000049B (0..15, 1..16) 0 77,78,79,177,178,179,180
14400  1792 = 16*16* 7  0x0000049C (0..15, 1..16) 0 21,22,23,121,122,123,124
16192  2048 = 16*16* 8  0x0000049E (0..15, 1..16) 0 114,115,116,117,214,215,216,217
18240     3 =  1* 1* 3  0x00000F42 (0..0 , 1..1)  0 65,66,67
18243   192 =  8* 8* 3  0x00000F69 (0..7 , 1..8)  0 81,82,83
18435   192 =  8* 8* 3  0x00000F6A (0..7 , 1..8)  0 25,26,27
18627   256 =  8* 8* 4  0x00000F6D (0..7 , 1..8)  0 57,58,59,60
18883   256 =  8* 8* 4  0x00000F71 (0..7 , 1..8)  0 34,35,36,37
19139  1024 = 16*16* 4  0x00000F90 (0..15, 1..16) 0 97,98,99,100
20163    27 =  3* 3* 3  0x00001005 (0..2 , 1..3)  0 145,146,147
20190     1 =  1* 1* 1  0x00D4A574 (0..0 , 1..1)  0 1
20191     9 =  3* 3* 1  0x00D4A63C (0..2 , 1..3)  0 1
20200   196 = 14*14* 1  0x00D4A7CC (0..13, 1..14) 0 1
20396    64 =  8* 8* 1  0x00D4A830 (0..7 , 1..8)  0 1
20460   196 = 14*14* 1  0x00D4AA88 (0..13, 1..14) 0 1
20656   256 = 16*16* 1  0x00D4AB50 (0..15, 1..16) 0 1
20912

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:

Select allOpen in new window

 

by: gmk1212Posted on 2009-09-09 at 09:55:47ID: 25293208

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/tajava.html

 

by: Infinity08Posted on 2009-09-10 at 02:32:46ID: 25298576

What algorithm did you use to compress the data ?
Could you use a standard compression tool, so it's easier for me to get the original data ?

 

by: gmk1212Posted on 2009-09-10 at 08:55:54ID: 25301481

It was already compressed via zlib.

 

by: gmk1212Posted on 2009-09-10 at 08:57:41ID: 25301497

I'll see if I can get it to a smaller size with something else though.

 

by: gmk1212Posted on 2009-09-10 at 09:04:06ID: 25301561

Of course, I would then have to upload it again. Unless you can work with zlib?

 

by: Infinity08Posted on 2009-09-10 at 09:27:08ID: 25301814

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.

 

by: gmk1212Posted on 2009-09-10 at 09:38:18ID: 25301929

The code is already written for extracting the data. I put it on that page - http://mydatadump.com/tajava.html

You should be able to just put the code together with something like eclipse.

 

by: gmk1212Posted on 2009-09-10 at 09:40:17ID: 25301948

The code is all in text files so that you can just copy and paste.

 

by: Infinity08Posted on 2009-09-10 at 09:52:04ID: 25302045

I understand that, but I don't have the time to mess around with Java just to extract some files ;) Maybe this weekend.

 

by: gmk1212Posted on 2009-09-10 at 09:55:21ID: 25302085

"I've got the file, so there's no need to doubly compress it ;)"

I meant the file was compressed with zlib before I got my hands on it :)

 

by: gmk1212Posted on 2009-09-10 at 09:56:08ID: 25302097

Ok, I'll see if I can get it uploaded with something else.

 

by: Infinity08Posted on 2009-09-10 at 10:00:46ID: 25302138

>> 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.

 

by: gmk1212Posted on 2009-09-12 at 09:02:41ID: 25316921

Sorry I haven't gotten back to you yet, but you may have already solved the problem anyway. So I'll figure that out first.

 

by: Infinity08Posted on 2009-09-14 at 02:10:43ID: 25323776

No, unfortunately I haven't had the time this weekend ...

 

by: gmk1212Posted on 2009-09-14 at 07:00:54ID: 25325487

I meant I might not need anymore help with this. I'll have to get back to it on Wednesday.

 

by: Infinity08Posted on 2009-09-14 at 07:30:09ID: 25325829

Understood.

 

by: gmk1212Posted on 2009-09-26 at 16:30:45ID: 25432031

Ok, you've been brilliant!

Hopefully I can ask you for help again :)

 

by: Infinity08Posted on 2009-09-27 at 00:45:24ID: 25433080

Sure ;) I'd be happy to help you out again if I can :)

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...