So long, USA, it was a disappointment knowing you

November 6th, 2024

I’m going to publish this after the elections are over so no idiot can call me interfering in the elections, even if I don’t argue in favour of either candidate or political system reform. This post is simply summing up the frustrations about the mismatch of how the country views and positions itself against what it really is.

First of all, the title is about USA slipping out of relevance and not e.g. about me emigrating from the country (I’ve never been to it and it’s highly unlikely I’ll ever go there) nor about USA stopping to exist in the near future. My point of view is that while USA has done to undermine its own position, it has built enough inertia to keep going for a while—like large baobabs that can’t physically fall down and simply rot away standing.

The upcoming downfall does not make me happy as I realise how bad it will be for the whole civilised world (remember 2008? ever heard of Black Tuesday?). So consider it as an extremely late (a decade or two late) and useless warning. In theory some things still can be done to rectify the situation but does anybody believe anything substantial will be done?

Below I’ll try to present my thoughts in a logical form: what made USA great in the first place, what it did wrong in last decades (and why it hurts USA), and how it will likely to end.

What made USA a global superpower?

Let’s start with the foundation on which USian power was built. Without defining it it’s impossible to argue what actions undermine that foundation.

My short list would look like this:

  • having one of the largest pieces of land stolen from others (rivalled only by China and russia); and if you wonder why I haven’t included Canada to the list—with those countries land was not merely something seized from uncivilised tribes (which may be unthinkable now but was though more as a God-given right back then) but from other countries as well (ever heard of internationally recognised Hawaiian Kingdom and how it ended being a state of USA? do you want to visit United States (of Mexico) and tell them how Texas and California have always been a part of USA?);
  • that land being suitable for agriculture and being rich in natural resources (russia has been always complaining about the quality of its lands—even after large oil reserves were discovered; from what I heard China also complains about its territory being mostly mountains);
  • people willing to work and the state not hindering them (you won’t believe how many russian proverbs are there about the futility of working; also back in the day russia and Austro-Hungary were two empires stifling technical progress in fear of losing power—you can guess how it helped them during World War I);
  • being isolated by oceans from most other countries and not experiencing a full-scale war at its own territory in XX century—sure, USA was involved in wars but it was mostly sending troops overseas instead of, say, Japanese troops occupying half of Oregon or German bombers levelling down Bridgeport, Philadelphia and Jacksonville. If you manage to have your civil population safe, industry and economics mostly intact and working, not needing money for post-war reconstruction—that definitely gives you an edge against the countries devastated by war;
  • even more, you can help other countries in time of need tying them to you economically;
  • as the result you can play Switzerland and organise things to go by your rules that will benefit all the players involved (like free trade, technological co-operation, unified defence and so on);
  • and finally, you can build large and good equipped military force that helps keeping the rules.

And thus, by the end of XX century USA had:

  • a powerful economy;
  • the standard currency for international trade (surviving even de-pegging from the gold standard in 1971);
  • well-developed industry and financial sector;
  • being a leader in scientific research and hi-tech developments;
  • leading the most powerful military alliance, with its main antagonist temporarily withdrawing from the playing-field.

In theory every thing on that list should only ensure that other things keep getting better, so what went wrong?

Losing advantages

In one word—idiocy. In more words—greed, short-sightedness and idiocy. Almost every advantage USA had was lost either via uncontrollable greed, decisions that prioritised short-term gains over long-term consequences, and refusal to see something that does not fit your comfortable image of the world. Let’s see how each and every strong point got undermined.

A powerful economy. I’d point at 2008 financial crisis as the best demonstration of what went wrong. The financial market became so strong and successful that it managed to shatter the bonds of reality and as the result it could build something imaginary—a derivative paper on derivative paper that tries to hide a risk of suspicious credit (or mortgage of dubious value). And the total amount of CDSes issued was comparable to the whole world economy of the day (Wikipedia quotes the number of over $62 trillion of CDS amount by the end of 2007 and about $109 trillion for estimated size of world economy in 2024). You should be able to guess what reasons were at play here. I’d also add that dealing with it demonstrated short-sightedness as it seems nobody serious was punished (because they all are Too Big To Fail) which incentivises others to keeps such dangerous games—after all, you get your bonus now and the government will bail you out later if needed. And such hiccup in the economy lowered the trust in its robustness abroad.

The standard currency. While US dollar is still the main international trade currency, both the behaviour of US government and the way it imposed sanctions made other countries search a way to avoid relying on it too much. Terrorist states (like russia) do it to ensure they can function even under sanctions cutting off access to the international banking and payment processing, states supporting terrorism (like China) take preventive measures against possible sanctions, and even the EU wants to ensure it’ll manage to function no matter what ham-fisted decisions US government will make (in recent news there was a bit about EU startup backed by a lot of large European banks trying to provide an independent payment system).

Well-developed industry. (no reason to discuss financial sector again) Guess what is losing its reputation rather fast. For example, I still remember the days when Boeing was a company producing quality air planes, Intel making cutting-edge CPUs and Google search returning relevant results. Nowadays Boeing is known for its faulty planes, Intel for failing to keep with the progress and the overall state of Internet search has degraded. Why? I’d blame two main things: having duopoly (or monopoly) which makes you care less about the innovations (after all, what alternatives do your customers have?) and the usual prioritisation of showing current growth over long-term improvements (Intel is the most apparent case of not trying to invest money into semiconductor fabrication research and losing, in other cases it’s more like small cuts that result in a company not caring about the quality of its products). I’d argue this is also a consequence of companies becoming too large and divorced from reality (especially when managed by those with MBS degree instead of people who at least have an idea what the company should make and how). After all, investors mostly care about the current price of their stocks. And offloading production to China also lowers perception of USian goods being high-quality—after all, most of them are not made in the USA (and quite often, not even designed there either).

Scientific research and hi-tech developments. Those seem to have suffered in two ways: first, from the companies spending less on the research (because not all companies do production themselves anymore and thus don’t care about improving e.g. production processes—they can simply move to the lowest bidder in China instead); second, the unhealthy atmosphere in academia. I’m not going to claim knowledge what exactly is wrong with it, but from an outsider point of view there are two main problems: degree inflation (so that everybody and their dog tries to get a degree even if it’s mostly good for whining about a student debt later let alone the pressure succinctly put in formula “publish or perish” resulting in a large amount of low-quality papers) and abusing ethical and moral principles in the best Soviet traditions (I’m not going to discuss if there’s anything wrong with those principles, I would simply like to point out that there are people abusing those principles either to get rid of successful competition or merely secure a place for themselves so you can’t kick them out as it would be treated as an offence even if there’s no merit to keep them at that position in the first place). And in both those aspects you can’t compete with China which has larger population and thus can engage more students producing ideologically correct papers.

Leading the most powerful military alliance. The recent events demonstrated the lack of leadership there. In the first days of 24 February there was a joke that if russia would invade Poland, Poland would be kicked out from NATO. Now it seems more like Poland would be kept in NATO but it would be forbidden for it to retaliate—after all russian invasion would pose no threat to the alliance and retaliating means escalation of the conflict. The current war (essentially resulting from the Budapest Memorandum that USA pressured Ukraine to sign—with no guarantees in return) demonstrated that USA is unreliable partner. Even worse, recent events show that USA has OSCE-grade of blindness. I need to elaborate this a bit.

There was a joke in Ukrainian emigrant magazine of 1948—”USA will send $100 million relief funds to European countries, one half immediately, for the second half they’ll have to wait too.” This applies to the way USA provided its military help as well. And it not only delayed its own help, it sabotaged attempts of other countries by e.g. not giving a permission to train Ukrainian pilots on F-16 planes in other countries. And of course that help was so limited that it reminds me somebody taking an antibiotic to combat the disease in such half-hearted way that it mostly helps breeding antibiotic-resistant bacteria than actually curing a patient. If you don’t see a similarity—thanks to the weapons being limited in at least two senses (range and amount) russia has learned how to deal with them (same with economic sanctions). And as a cherry on top, you should remember USian officials asking Ukraine not to hit russian refineries—because they value oil prices as a more important thing than safety. And unless you’re a USian official you should know that at least one common feature among China, Iran, North Korea and russia is that they all regard USA as their number one enemy and would gladly hit it if the occasion presents itself. Another fun fact: while Ukraine managed to damage or destroy several russian strategic objects used in their nuclear defence without any retaliation (despite russian doctrine claiming that such actions would cause an immediate nuclear strike on the offender), USA is still afraid of that paper bear.

Speaking of which, you might’ve wondered what “OSCE-grade blindness” expression means. You can read more about the organisation in Wikipedia but suffice to say that after the russian invasion in Ukraine in 2014 it proved itself to be worse than useless—it completely ignored russian war crimes and, as Ukrainian soldiers wrote, after OSCE inspector visits they had to relocate the forces because russian shells would start hitting the place they visited. And now we have USA reacting to the reality of one terrorist state sending military help to the other terrorist state:

  1. Those are just the rumours.
  2. Okay, maybe not the rumours but still there’s no reason to do anything yet.
  3. We’ll consider our actions when it comes to the direct engagement.
  4. Ukraine has the right to defend itself against Koreans (why, thank you very much!).
  5. We’ll go as far as not forbidding Ukraine to use our weapons against them.

I believe this post was not far from the truth (translated for those who don’t understand Ukrainian):

Bloomberg writes that potential NATO answers to the DPRK actions are limited, yet they may include:

  • concern
  • deep concern
  • playing dumb
  • making a busy appearance
  • shaking head in disbelief
  • saying “tsk-tsk” with a sad expression
  • giving russians some Patriot systems to protect their oil refineries

And while various experts and “experts” say it’s a desperate step for russia, they forget to mention that desperate buyer pays any price—and Iran and DPRK both would gladly wrestle some technologies from it so they can nuke USA (or at least Israel) later. Of course USA sees no threat in that.

As the result, other NATO members (as well as other countries currently depending on USian help) see this inaction and finally prepare to be able to defend themselves even without USA. The claims of one candidate about leaving NATO (as well as hindering the trade with other countries) if he wins—which he may or may not follow—do not help with trusting USA either.

Overall, it seems like the advantages USA had were so successful that they went out of control and started to hurt themselves. To give an example, in ancient times stock prices were determined a lot by dividends they paid, nowadays dividends are treated as something archaic and it’s presumed that stock owners should get wealth from the increase of stock prices—which are determined by a metric “how much a lot of suckers would agree to pay” (and not some silly things as assets and profits). Similarly the companies are run by professional managers that care mostly about their bonuses—which usually means implementing short-term measures like sacking fifth of staff right before the financial report, so savings can be shown as profits, growth (and bonus for the successful manager). And if somebody is not like this—where to find enough people with a similar mindset to run a large corporation? Hubris and monopoly may make you think that it’ll last forever—but then the conditions change and your position is not so sure anymore (you might’ve heard about gas guzzlers and Detroit being the industrial heart of USA—before oil prices soared and USians started to buy Japanese cars instead).

There were many attempts to undermine Pax Americana but this time it seems USA is helping in doing that itself.

What’s next?

Nobody knows. IMO the most realistic scenario is that USA will wither while pretending that everything is nice and Enron-y—and it may work for them until the reality hits.

There are countries that attempted to concentrate on ideological issues instead of more practical ones, usually building communism (socialism, or Islam revolution). This ended badly for the population of those countries even if they must feel happy living in such moral place (or face consequences of wanting more bread instead of high moral ground).

There are two countries known for going into isolation and having extremely limited trade with the outside world—China and Japan. In case of Japan most countries politely avoided interacting with it until some rude USians came uninvited on their black warships and said “let’s trade!” In case of China it ended with a period they proudly call “century of humiliation”. You know, when the country that was proud to have most population and the most advanced industry (for some time) lost couple of wars to small groups of foreign barbarians, having to open trade, paying tribute and ceding territories. I guess that’s the future some want for USA.

If somebody thinks that voting for a right candidate will solve everything, I advise you to watch South Park episode about choosing a school mascot. I’d compare the current alternatives as Boeing and The-Company-Formerly-Known-as-Twitter: in one case you have a respectable outlook that hides degradation of the things—until the planes start to crash or self-disassemble in the air; in another case you have a company managed by a chaotic personality that manages to lose half of the users and advertisers while severing ties with the other half itself. IMO the main problem comes from most people being functionally idiots i.e. having a working brain but refusing to use it (thinking is hard after all—and there are too many helpful people around offering to think for you).

I don’t have much hope in other countries either—many things I’ve written above apply to the EU as well (but I’d argue it’s more about bureaucracy and having too many parties to come to unanimous decisions). Even China while being effectively a dictatorship (and thus lacking several of the problems) seems to experience problems (because dictators don’t always make good decisions and there’s nobody to stop them) and it is not clear if it will survive the downfall of USA (though it would welcome such event regardless).

Welcome to the shitty world, finding new ways to get worse since 2020. Enjoy it while there’s still something left to enjoy.

Another annoying game video format

October 31st, 2024

Since I had nothing better to do and remembered about one mostly finished format, I decided to add its support to na_game_tool. The game in question is called either Cydonia: Mars – The First Manned Mission or Lightbringer (with two variations of sub-title).

The main problem is that there may be different audio and video formats inside but you cannot easily detect them. The header contains only the dimensions (which can be any as long at it’s 640×320 as the game uses hard-coded dimensions in the decoder), number of video frames (also rather pointless as it does not really affect anything) and audio present flag (the only useful information there).

First annoyance is audio format detection. The simplest solution I could devise is looking at the first audio block size and depending on its size setting the format (22050 bytes means 11kHz mono, 44100 bytes are for 22kHz mono and 88200 bytes are for 22kHz stereo). As long as you don’t encounter those extra-short files with a single audio block of different size you should be fine.

Then, video. Game demo (and maybe some versions of the full game) uses paletted video while the full game (at least the version I could find) uses 16-bit video instead. So if you discover palette chunk before video it must be a paletted format. At least the compression schemes remain the same.

And what do you know, video compression is also annoying. Both compression methods employ LZ77-based algorithm with some variations. Method 3 always decodes 640*320 bytes (or twice as much for 16-bit video) and employs an additional code for leaving data unchanged from the previous frame. Method 2 uses the same coding method (minus the “keep previous data” code) to code inter frame data of variable length (without an end code apparently). Essentially if the next 24-bit code is a valid offset (which is coded as x+y*632) then copy a block from the previous frame at the given position, otherwise decode block data (64 or 128 bytes depending on bit-depth). As I mentioned before, you don’t know compressed data size beforehand and you don’t have end-of-stream marker so you have to decode the needed amount of data as you paint the frame.

Overall, this is rather interesting video compression scheme but Paco also serves as an example of how not to design a container format. This reminds me of RoQ hack where the game engine used slightly different decoding mode if the filename was in a special list. And Nova Logic KDV but there it were different flavours in different games at least.

Ratvideo: done and not done

October 21st, 2024

I’ve written a decoder for Ratvideo (and documented it as well). So why it’s not done? Because apparently it’s VIDPAK (from the creator of DIGPAK John W. Ratcliff—hmm, I wonder if his name has anything to do with the format name) so it’s a different thing that had been done. And since the format was created by an EA programmer for use in EA games it’s definitely Peter Ross’s fault for not REing it.

So the runtime-generated table turned out to be code for masked update and inter-coding mode proved out to be a fixed-size mask telling which pixels to update plus the values to update it with. Mentioned in the previous post mode with duplicating lines turned out to be an alternative coding mode where each next line uses a previous one as the reference, so that previous line is copied and updated depending on the mask. That’s another case where you need to look at the disassembly instead of what decompiler provides (if it manages to produce something in the first place) but the code is almost trivial.

I’m not going to look at any more game formats in the near future (unless some come to my attention), so it’s just boring stuff for me for now.

A quick look at Ratvideo

October 18th, 2024

While I saw this format mentioned in dexvert unsupported formats, I ignored it for confusing with RatDVD. And apparently it’s not me who should’ve paid attention—since it’s a format used in some of EA games (like SSN-21 Seawolf or Kasparov’s Gambit) it is Peter Ross who should’ve looked and REd it by now.

While the format is rather simple, it is still rather curious. Audio data seems to be coded using a mix of RLE and ADPCM (i.e. it allows coding a run of the same sample value or deltas that are scaled depending on the previous delta code value). Video can be coded as simple frame (raw or RLE) or split into two parts (each may be raw or RLE as well) and assembled back somehow. From what I see it uses one buffer as a source of pixels and another one as opcodes stream and invokes a runtime-generated code for those opcodes. So I’ll need to find out what gets generated first and then translate it to more conventional operations. Though I expect it to be something rather simple like telling how many pixels to skip. There’s another mode which seems to use flags to tell which lines of the previous frame to duplicate but could misunderstand it (after all, the standalone player code supports additional features like scaling during playback).

Of course I intend to document it and add this format support to na_game_tool eventually.

MPEG-4 ASP: done for now

October 15th, 2024

In my last post I mentioned I need to deal with MP3 in AVI and multi-threaded decoding. The former turned out to be a simple bug (I should’ve not trusted AVI header reporting 12-bit audio), and I gave up on the latter.

The main reason for that is what seems to be the main contribution of MPEG to the world of video coding, namely B-frames. While the idea behind them is reasonable (to code scene transitions or smooth movements as an interpolation between two keyframes), practical implementation brings headaches because those frames are coded in an order different from the display order (after all, you can’t interpolate between two frames if you haven’t decoded both of them). And of course it got worse in H.264 and later codecs where B-frames can reference other B-frames so you need to code information about the frame structure (references and how to update them).

And the problem with MPEG-4 ASP is that while it can have B-frames, its popularity it tied more to AVI container which lacks means to signal frame reordering (fun fact: the MPEG-4 ASP video files in MOV that I have would be perfect candidates for B-frames but lack them entirely). Of course later there other containers gaining popularity like Matroska or OGM (or even MP4 occasionally) but the gilded age seems to be tied to AVI. And of course that created difficulties.

If you have I- and P-frames only, there’s nothing to care about—but multi-threading won’t be that effective either. Newer implementations (Xvid 1.3.7 is rather fresh BTW) output B-frames as is so good luck knowing that in advance and performing reorder. In this case I see if the coded timebase is the same as the one reported by the container and simply re-assign timestamps from the bitstream (and if this does not work—well, tough luck). But there was a funnier intermediate solution with one frame containing data for both P- and B-frame and the following frame being a skip frame, so a decoder could replace it with an appropriate frame. This reminds of Indeo 4 which performed the same trick. And making that a multi-threaded decoding would be a mess requiring either saving frame data and scheduling it for later decoding or scheduling both frames and then trying to tie it to the upcoming frame decoding request. And playing back typical video takes about 20% of CPU load…

Thus I’ve committed what I find to be good enough for my needs and I shall forget about it—at least until some decoding artefact will annoy me enough. There’s more boring and unremarkable stuff I want to do on NihAV, working on this decoder reminded me that it can always be worse (or uglier).

P.S. For some reason repository cloning or updating from git.nihav.org still does not work (but the web interface is fine). I’ve reported the problem and hopefully it will be resolved soon. I suspect that the provider blocked it because of too many synchronisation requests from other sites trying to mirror the repositories. In either case I’m still grateful for the hosting.

Woes of implementing MPEG-4 ASP decoder

October 11th, 2024

So, for a last month or even more (it feels like an eternity anyway) I was mostly trying to force myself to write a MPEG-4 ASP decoder. Why? Because I still have some content around that I’d like to play with my own player. Of course I have not implemented a lot of the features (nor am I going to do that) but even what I had to deal with made me write this rant.
Read the rest of this entry »

Another bunch of formats I’m not looking at

October 5th, 2024

I regularly look at the dexvert list of unsupported video formats to see if something curious comes up. About half of that list are formats supported by na_game_tool, maybe a third are animation systems (i.e. more like a script language telling how to compose and change external or internal resources), but the rest are formats that pique my curiosity. I’ve written about some of them (like Amiga formats I blogged about half a year ago or rather recent TealMovie) and today I’m going to mention some more.

First of all, AVS. That’s the third AVS format I’m hearing about. First there was AVS used in Creature Shock game, then there’s this Chinese MPEG-四 AVS (followed by AVS2 aka HEVS and AVS3 aka “VP9VVC by any other name…”). Apparently there’s another one, from early PC era. It seems to have been used by some ActionMedia cards with Indeo video compression formats (DVI PLV and DVI RTV, also PIC and JPEG are mentioned in the convertor) and audio (8-bit PCM or DVI ADPCM). There’s a special tool for converting AVS to AVI but good luck finding samples (I’ve found one, yulelog.avs, used in a demo). The format seems to be documented (as DVI format) but the codecs are not (beside RTV 2.0 aka Indeo 2). Maybe I’ll take another look at it one day…

Then, there’s a game called Music Chase. I found it by accident looking for Toon Boom Studio samples (which is an animation system, so not so interesting to look at). So what’s interesting about this game?

It looks like the game assets are divided into rooms, each having its own set of resources—usually some TBP files, some TMV files and a MID file or two. The first format is the standard BMP with compression method 21 (which is not). TMV files are ciuQmiTke MOV (i.e QuickTime format but with all values being little-endian now) and custom track handlers so while you can recognize audio track, video track is not so easy. Additionally the helper DLL is 16-bit code that makes Ghidra decompiler give up on almost every function. So maybe I’ll return to it when I’m seriously bored but not today.

Still, it’s nice to encounter such formats time from time.

Looking at Winamp codebase

October 4th, 2024

Breaking news from the Slowpoke News Channel™: a source code base for Winamp has been released (just last month). So it’s a good occasion to talk about it and what interesting (for me) things can be found in the third-party libraries.

I think I used the software a bit back in the day when MP3 was still rage (and there were CDs sold proudly featuring MP3 at 256kbps) and I still was using Windows (so around 1998-1999). I even briefly tried K-Jofol player (does anybody remember that?) but I didn’t see much point in that. About at that time I finally switched to Linux as my main OS and started using XMMS and XMMS2 (I actually met one of its developers at FOSDEM once—and saw a llama or two when I visited a zoo but that’s beside the point). Also there was a plugin for XMMS2 that added VQF support (again, nowadays hardly anybody remembers the format but it was an interesting alternative; luckily Vitor Sessak reverse engineered it eventually). But with the time I switched to MPlayer for playing music and nowadays I use my own player with my own decoders for the formats I care about (including MP3).

But I wanted to talk about the code, not about how little I care about the program.

First fun thing is that the source code release looks like somebody was lazy and thinking something similar to “let’s just drop what we have around and tell not to do much with it—it’ll create some hype for us”.

Second fun thing is that it fails to live up to the name. As it should be obvious, the name comes from AMP—one of the earliest practical MP3 decoders (the alternatives I can remember from those times were dist10 or the rather slow Fraunh*fer decoder). And of course WinAMP uses mpg123 for decoding instead (I vaguely remember that they switched the decoding engine to the disappointment of some users but I had no reason to care even back then).

But the main thing is that they’ve managed to do what Baidu failed to do—they’ve made VP5 decoder and VP6 codec open-source. Of course it may be removed later but for now the repository contains the library with the traditional Truemotion structure that has VP5 decoder as well as VP6 decoder and VP6 encoder. So those who wanted an open-source VP6 encoder—grab it while it’s still there (and I still have my own implementations for either of those things).

Out of curiosity I looked at the encoder and I was not impressed. It has more features (like two-pass encoding) and more refined rate control but it does not look that much better. I wonder what Peter Ross could say about it, being a developer of a popular and well-respected encoder for a codec with rather similar structure.

Overall, the code base looks like a mess with no clear structure, with most libraries shoved into one directory without any further attempt to separate them by purpose. But it does not matter as it was not intended for the large collaborative efforts and two or three programmers could live with it.

Still, let’s see if something good comes from this source release.

Update from October 17th: looks like the original owners had enough fun and removed the repository. So those who’re still willing to study the code need to locate one of countless copies of it first.

A quick look at Death Rally HAF

September 27th, 2024

I tried to look at it before but since the game uses that special 32-bit DOS extender (PMODE/W if anybody’s curious), I gave up. As I mentioned in one of previous posts, I need either to find a way to dump unpacked and properly loaded executable reliably or write such decompressor from the binary specification—and I’m not eager to do either of those things.

Luckily somebody bothered to decompile the engine in order to make game work on modern OSes without DOS emulation. I use the term “decompile” because a lot of the parts are slightly prettified direct translations of the assembly. Anyway, this can be improved and it probably work good enough already to make game fans rejoice.

Here’s the decompiled cutscene player and what follows is my understanding of the code given there.

So, HAF files start with 16-bit number of the frames followed by two tables, one byte per entry each. First table contains sound effects that should be played starting at that frame (or zero), second table gives frame duration at 70fps. Then actual frame data follows: 16-bit frame size, 768-byte palette and then LZW-compressed image. And looks like they lifted LZW compression from GIF as it’s not only the basic parameters of LZW compression being the same (dictionary size limited to 4096, having restart code and arbitrary initial number of bits) but also LZW data is packed into chunks prefixed with its size. I can’t outright remember any other format doing that—or having a need to do that when total data size is known beforehand.

Maybe I’ll add support for this format to na_game_tool eventually but I’ll find something else to do for now.

A cursory glance at TealMovie

September 23rd, 2024

Apparently there’s such format for Palm so one could play videos on such devices as well (PocketPC devices got so powerful that they could even play 320×240 MPEG-4 ASP videos—provided you used some good opensource player like TCPMP and not something like VLC). Since there’s a Win32 player for it, I decided to look at the format and was slightly disappointed.

I expected it to be more akin to GBA formats that use vector quantisation (I looked at them in this post; e.g. Palm Treo should have comparable or better performance) but instead I got something reminding me of SMUSH of all things.

The format turned out to use palette and transmit frames either in raw form or split into 8×8 blocks and using various opcodes to code them. Most of the opcodes are used to signal that image should be copied from a previous frame with a fixed offset (there are 225 offsets for motion vectors in (-16,-16)..(13,13) range), fill block with single colour (either an arbitrary one or one of four provided in the frame header), skip block, fill with two colours using one of 256 predefined patterns, or split into smaller sub-blocks (and again down to 2×2 sub-sub-blocks) and update all/some of them. And there’s an opcode to code a run of repeated opcodes. If you don’t immediately think about SMUSH codec 47 then I don’t know what it reminds you of.

And of course it supported audio, which followed video part and was either 8-bit PCM or IMA ADPCM.

Overall, I believe it was enough to provide full-screen 160×160 video experience at 15 FPS using the handheld’s over 8000kHZ DragonBall CPU; I still wonder if having a direct 15-bit RGB format would make more sense.