ASTC Partitions

ASTC (Adaptive Scalable Texture Compression) is a very cool and flexible texture compression format but also very complicated. Where the old BC-formats only give you a choice between 4 or 8 bits-per-pixel, you get a wide range of choices with ASTC by varying the block-size:

Screen Shot 2017-12-29 at 21.00.19

Partitions in ASTC are a lot more complicated compared to BC7. First of all 1,2,3 or 4 subsets are supported and instead of 128 patterns you have 3072! Also, you have 14 different block sizes instead of just 4×4.

So, 14 * (1024 * 3) = 43008 different patterns! (not counting the patterns used for 3D textures). With that many patterns, storing them in ROM is not feasible so they are instead generated using an algorithm. That algorithm is not perfect and it generates a fair amount of duplicates, and also generates patterns that although not identical are equivalent to others. Like this:

astc_equivalent

Another problem is that the patterns generated will not always produce a pattern with the requested number of partitions – in that case you should always use the pattern made for the fewer partitions since that has more bits for endpoints etc. You could argue that you should never use these patterns, but maybe that pattern is a perfect fit for the image-block you are trying to encode…

So, if we remove only exact duplicates how many patterns should an encoder look at?

Screen Shot 2017-12-29 at 20.33.00

Screen Shot 2017-12-29 at 20.18.44

..and when removing duplicates/equivalents including across sets:

Screen Shot 2017-12-29 at 20.38.35

Screen Shot 2017-12-29 at 20.20.46

A naive encoder would have to look at 3072 patterns for each block. Still, compared to BC7’s 128 patterns this is pretty insane.

Since I was curious about what the generated patterns looked like, I made this visualizer.

Here are some examples:

4x4_2p

4×4, 2-partitions, duplicates removed

astc_8x5_3p

8×5, 3-partitions, duplicates removed

Posted in code | Leave a comment

BC7 Partitions / Subsets

I was working on some BC7 texture compression at work and got curious about the partitioning patterns – so I decided to visualize them.

BC7 Partitions

Posted in software | Leave a comment

Back again again!

So, I finally managed to get my site back online. Turned out to be a more hassle than I had hoped. I only had an old raw SQL-dump of the (now pretty old) WordPress database and not a fancy WXR file..

I used MAMP to set up a dummy local site with the WordPress version I used when I made my latest backup. I tried just importing my SQL file but that only sort of worked. I ended up with semi functional site.

Instead I imported the old SQL into a temporary MySQL database. Then I exported everything from the old database except the wp_options table into a new temporary SQL file. Then I deleted everything but the wp_options table in the new database and imported the temporary SQL file!

Then I could export the local site as WXR and import into the site here at WordPress.com. Then the site just needed some image and link fix-ups.

Posted in Uncategorized | Leave a comment

SPU Tips and tricks

This is a collection of SPU constant loading, odd/even balancing and other tips and tricks of varying usefulness 🙂

Continue reading

Posted in code, software, spu | 2 Comments

SPU analyzer released!

I made this spusim clone called Sputnik. Useful if you are into low-level SPU optimization. Check it out here

Posted in code, software, spu | Leave a comment

SPU Constant Building Tricks

Neil Henning (@sheredom) asked this on Twitter:

“SPU gurus of twitter unite, want a vector unsigned int with {1, 2, 3, 4} in each slot, without putting it in as elf constant, any ideas?”

The SPU instructions that exist for constant loading usually put the same value in all slots of a quadword, so this was a fun challenge. After some thinking I came up with this:

il zero,0
fsmbi magic,0x137f
andbi magic,magic,1
sumb dest,zero,magic

Sometimes you have a zero-register around already for other stuff so most of the time this idea will only use 3 instructions.

Continue reading

Posted in code, spu | Leave a comment

Dreamcast GD-ROM Replacement Project, part 2

The project is not dead! 🙂

We managed to figure out the make and model of the connectors used! The connector on the DC motherboard has a very small number on it and with that number and some googling it turns out that it is a Molex part. Trying to buy them turned out difficult though – most places will only sell them in lots of a 1000! That’s a bit much for this hobby-project!

The search went on for some time until we suddenly saw that you could buy them at any quantity at DigiKey! I’m positive that we checked that site before and couldn’t find the parts! A bit weird but the important thing is that we now have the connectors and we can move forward with the project.

Apparently the parts numbers have been known for some time as pointed out by inacete in the original posting. I guess my Google skills are not what they used to be.. 🙂

The two connectors on the right are basically the same but the taller one is a little easier to work with I guess. The left one is the one on the DC motherboard. The one to the right is the one used on the GD-ROM board.

IMG_6164

Molex Connectors

 

I’ve also bought a FPGA prototyping board and started at learning VHDL. There is still a lot of stuff to do and learn but I do think it is doable.

Posted in hardware | 9 Comments

New Zealand Helicopter Ride

I’m going through my back-catalogue of movie clips from previous vacations and trying to make some small movies out of it. The first one is from our awesome helicopter ride in New Zealand around the Franz Josef glacier.

The music is “like it” from sapiens fx.

 

New Zealand Helicopter Ride! from Jon Rocatis on Vimeo.

Posted in photography, travel | Leave a comment

Time Lapse Video

Just got back from a nice vacation in Vancouver/British Columbia/Seattle! This was my first vacation since I got CHDK installed on my pocket camera so it was time to experiment with some time lapse photography!

I got quite a lot of footage from various places and since I turned down the jpeg quality to the absolute minimum to get more shots on my 2GB SD card I even had the battery die before the card was full some times. I need to look into making some kind of external battery hack.

Anyway, just finished editing the best sequences in Final Cut Express and uploaded it to Vimeo.

The sound is garbled in a couple of places – quite weird. It is not on the source material but it seems that it happens in FCE when it converts from mp3. Must investigate.. Update: I tried converting the mp3 to wav using VLC (QuickTime will do as well) and then using that in FCE. That solved it! Maybe FCE doesn’t like VBR mp3’s or something.

The music is by HiFi Hustlers btw.

Posted in photography, travel | Leave a comment

Visual guide for SPU instructions

A picture is worth a 1000 words – that also goes for CPU instruction descriptions! So I started doing this for the SPUs in the Cell processor. For the most part it makes it easier for me to see what is going on and helps me remember what an instruction does. Not all instructions needs a diagram and some were really not that easy to visualize but I included them all for completeness.

Also I put instruction timings and whether they execute in the odd or even pipe right there with the instructions – all this info is taken from the “SPU Cheat Sheet” document by Insomniac Games. Thanks for those!

I hope you will find it useful. It really was more work than I anticipated and “Pages” which I used for this is not really suited for this kind of work and it slowed to a crawl. Rather painful actually. It handles PDF import very nicely though. I used OmniGraffle for the diagrams and I found it pretty much perfect!

Anyway, enjoy!

Download it here

June 19 2012 – Fixed pipe for “orx”. Thanks Daniel! 🙂

Posted in code, spu | 4 Comments