RV6: a blast from the past

November 8th, 2022

So while various terrorist states try to prove they have better industry than russia, here’s yet another fun distraction.

It turned out that Peter Ross for some unfathomable reason decided to take a look at RealVideo 6. RealPlayer™ has RV11 support (which is FFmpeg with wrappers for calling their proprietary encoder and decoder for RV11), he played a bit with it. And since there’s one opensource decoder for RV6 (should be obvious which one), he contacted me with a list of changes to make it work fine not just on the only sample I had. Many thanks for that!

Beside various small mistakes there are several things that are rather curious:

  • RMVB container version 2 supports 64-bit offsets. Now all is left is to find a person willing to create RMVB files over 4GB in size;
  • chroma motion compensation case (¾,¾) is the same as (¾,½);
  • loop filtering formula was changed from |p0-q0|*lim1 < 512 to ((|p0-q0|*lim1) & ~0x7F) <= 384. They should be equivalent (even if I can't bother to prove it) but the change is still baffling;
  • and it turns out that delta quantisers are once per CU instead once per one row. More about it below.

So what's the deal with delta quantisers? When I REd the code, the binary specification had all debug information left inside. So when you see a function named Decoder::parseBitStream_CUOneCULine() that calls decodeCUQPOffset() once before calling decodeAndReconstructCBTree() in a loop you'd presume it reads DQP once per one row of CUs yet it turned out to be one DQP per CU (also reasonable but not what you expect from the function name). The thread management code that sets various parameters for slice decoding and calls the function is too messy to figure out parameters from it (I tried and got a number of 4 CUs per call unless it's at the end of row—which is obviously wrong).

It's nice to see that RealVideo 6 keeps up the traditions of previous RealVideo versions.

Denazification, or the story my divorce from russian culture

November 4th, 2022

This is another story that I simply had to write. It may be fun to seek parallels between this and free services of a certain privacy-invading company but the only common points there are that I stopped using them out of disgust and the company helped to make the process easier. So far no matter what it did it hasn’t done even a minuscule amount of harm russia did (and does) to Ukraine and the rest of the world.

So I’m finally writing about russian culture not in general but applied to me. Short summary: I grew up in both russian and Ukrainian cultures and I didn’t hate either, yet there were always some things in russian works that rubbed me the wrong way and I had been slowly drifting from it even before russia demonstrated what a loaded deal it is.

A bit about Kharkiv

Let’s start from my birthplace. I was born and spent two thirds of my life in Kharkiv, the large cultural centre of the East Ukraine. It was founded about four hundred years ago in a territory of border Cossack forces called Slobozhanshchyna (the word comes from the word “freedom” BTW). Kharkiv grew up a large trade and industrial city. First private bank in russian empire was founded there and the best known Soviet tank (along with several others) were designed and produced there, to give just two random examples. It was equally powerful scientific and cultural centre as well—all three Ukrainian Nobel laureates studied at Kharkiv University (which is over two centuries old), and a plethora of people who made great contributions to the Ukrainian culture, from from Kvitka-Osnovianenko to the group known as Executed Renaissance to the modern ones like Serhiy Zhadan (I have actually seen him once at our Literary Museum). There were people living in Kharkiv who later moved elsewhere to make great contributions to russian culture as well (actors, singers and even the scriptwriters of the best Soviet comedies).

As you can see, my home city had a lot to offer. And I sampled a lot of it like visiting a six dozen of different theatres (half of them repeatedly) but more about it later. The main negative property of Kharkiv is being located in less than 50 kilometres from the russian border (and it shows).

My early years and language

Anyway, let’s move to my childhood. I was born in a russian-speaking family, everybody was speaking russian and we had just one topic in school taught in Ukrainian (which is, not surprisingly, was Ukrainian language itself). Side note: during that time the Ukrainian grammar was reformed to make it closer to the actual Ukrainian language instead of russian, for example the letter “ґ” was reintroduced back into Ukrainian language (it’s called “Wallachian g” and used mainly in loanwords that have a sound different from real Ukrainian ‘g’). Yet despite all that people had nothing against Ukrainian language, I used to listen to the radio station “Промінь” that had various kinds of music in Ukrainian (and some retro music in russian as well), I read children magazines in russian or Ukrainian depending on in which language an issue was available (you can guess why Ukrainian periodicals often had versions in two languages; the same applies to books). It was the same in my university years: mostly people spoke russian and we had only two subjects taught in Ukrainian (Ukrainian history and Ukrainian language for business letters). So I could observe it myself that most of the time people spoke russian but nobody was against Ukrainian language (only complaining about not mastering it). The only time I heard somebody saying that she hates Ukrainian language was in Luhansk region…

I had relatives in Luhansk region, my grandparents were from Borivske village and they lived in Lysychansk. Of course I stayed with them in summer and heard different stories about the region. For example, during German occupation in 1940s German soldiers had better attitude to the locals than collaborators (my grandmother remembered how one of them commented it in broken language—”a russian beats brother, what idiot”). My grandpa was involved in building Sieverodonetsk Azot (the large producer of nitrogen-based compounds that became infamous this spring). He said that it started as a German chemical plant that was dismantled and rebuilt in two several sites, namely Sieverodonetsk and somewhere in east russia (maybe Kemerovo but I can’t be sure). Later it was expanded using an equipment bought abroad, so my grandpa worked with prisoners who were laying bricks for the future production sites and with Japanese experts overseeing other construction works. It seems to be a common story when russian or Soviet industry is built by foreigners and prisoners (sometimes they’re the same people). And it demonstrates the problem planted by USSR: since all those large construction works in Donbas area were performed mostly by prisoners, those prisoners had to be brought from somewhere (which means russia) and they were left there afterwards, creating an alien element. That is why this region had the population that refused to speak anything but russian and well-developed criminal culture culminating in yanukovych, the fourth president of Ukraine who still had manners and jargon of an ex-con, and his cronies from Donbas who helped him to rob the country—and a bang in 2014 when Ukrainians got finally tired of this and russia showed its true colours by occupying Crimea and sending people to start an uprising in Donbas. And yes, the pretext was oppression of russian-speaking population (which is probably was a need for them to learn even a bit of Ukrainian). Mind you, that person who said that she hated Ukrainian language was not speaking the perfect russian either. This reminds me also of French language attitude but I’ll leave comparisons of France/French and russia/russians to another time.

The slow move from different kinds of russian culture

That was all mostly about the language itself, what about the other aspects of culture: books, music, plays, mass-media? I’ve written already about radio station I’ve listened to but what about the rest?

Television

As for TV, I watched mostly humour shows (in russian, Ukrainian and even surzhyk which is a mix of both). One of my favourite shows was КВН (“a club of witty and clever ones” which grew out of student sketch shows and competitions where people asked random questions and others tried to answer with a witty response), which had a lot of Ukrainian teams as strong competitors and they even were winning tournaments more than once (two of those teams had a guy who became a famous and comedian, you might’ve heard about Volodymyr Zelensky). In the mid-2000s though the show degraded as it was no longer possible to joke about politics and everything in the show now essentially belongs to the host and his family (not just a trademark, broadcasting rights and the building where the shows are performed, teams wanting to perform in the show have to sign a contract making them virtually slaves)—and considering that this guy is over 80, tries to pretend to be young and shows no desire to leave, it feels like a history of modern russia in a nutshell.

Back in the day Ukrainian TV features a lot of russian soap operas (half of them being the local version of telenovelas and another half being about cops or criminals) and a good deal of them was shot in Ukraine because it was cheaper (in the same way as iconic American movies were shot in England). Once I’ve caught a bit of it while switching channels and acting was so bad that it made me want to puke. So I haven’t missed anything good by not watching them either.

Anyway, I’ve stopped watching TV completely around 2005 out of disgust. Advertisements may be annoying but when the same programme is interrupted with advertisements in five minutes after the first time, it’s too much. So I turned TV set off and haven’t regretted that since. I suppose I should thank certain Ukrainian TV channel for that.

Music

As for the music, I prefer instrumental music that is couple of centuries old (German baroque music played on harpsichord or organ is the best). I heard enough russian composers but I didn’t like their music (except for Glinka for some reason). Ukrainian traditional music, played on bandura, kobza and dulcimer, somehow resonates with my soul though (it was performed sometimes at our philharmonic). And out of many theatres I’ve visited, the russian drama theatre was the one I liked the least (not the repertoire though but the attitude to the watchers). So I’m mostly into classics yet there’s one Ukrainian song from my home city that I know by heart (and it sounds equally good both in russian and Ukrainian).

See, I haven’t had to stop listening to russian music because I haven’t listened much to it in the first place.

Literature

It’s not that I like reading, it’s more that I can’t live without it. We had all kinds of books at home, from russian classics (including two or three complete sets of works by Pushkin) to modern science fiction (including both books by Strugatsky brothers, works by foreign authors and even some science fiction in Ukrainian by local authors). Later I learned other languages and I’ve read a couple of books in each language I know (and probably couple of hundred books in English). I value content and ideas over the presentation so I can forgive some problems to a book if it’s an interesting reading (and not written by a completely illiterate person). Books in russian are plenty and easy to get access to in electronic form for free (and not even via means of piracy) so no wonder I mostly read those. The problem is that many of those books have issues with quality and they get worse every year.

One of the main problems is declining literacy: while the books are still being written, they’re written used poor language (limited vocabulary, primitive sentences, words used at random, lack of punctuation) and the topics are not good either. And it’s increasingly hard to find decent books among the thousands of mediocre and outright bad ones (yeah, like with the information in Internet).

Here’s a short review of the most popular russian genres of fiction (the ones I’ve heard of, most of them I’d rather never touch but reading comments on such works was sometimes entertaining):

  • “ironic detectives” (it’s ironic to call them detectives)—pulp fiction oriented at women and produced in bulk (I still remember when you could rent such books for a nickel per day at some stalls). Considering that the best known author (allegedly) wrote over 250 books in two decades, you can guess how good they are. Pass;
  • “female fantasy” (again, a genre of its own). Comes in three flavours: a young woman gets to study at some magical school where she marries a dean or a prince; a woman in fantasy world gets what she wants (often marrying a prince) by chutzpah; a woman is a wealthy heiress or possess special qualities which makes several powerful males (not necessarily humans or elves, dragons are popular too) compete for her hand. Pass;
  • action—often features weapon porn (where a good deal of book is dedicated to the weapon specifications and what accessories are attached). The stories are usually primitive as it’s more about the amount of enemies killed and women courted with. Pass;
  • popadanets genre (or isekai if you prefer it)—stories about somebody from one world transported/teleported/reincarnated into another (or the same but in different time). By itself it’s a good tool to show a conflict of traditions and beliefs for somebody put into an alien environment. A Connecticut Yankee in King Arthur’s Court is still being read today and Futurama is still fun to watch. The problem is that in russia it degraded into two template stories: a Marty Stu with extraordinary abilities grows riches and harem or somebody gets into the past and does whatever needed to prevent russian empire from collapsing/taking losses in World War II/USSR dissolution. There’s even a saying that every popadanets should warn Stalin about German attack, invent intermediate cartridge and two-hatch version T-34 tank, and sing Vysotsky songs (yes, it’s that formulaic). There were some interesting books there but it’s very hard to find them among the rest;
  • alternative history. The same notion as above: something in russian history does not happen (or happens differently) which leads to russia (in either form) to grow even stronger and larger and to take revenge on real and imaginary enemies. Pass;
  • fantasy in boyar-anime stylistics. This is very alternative history with a setting involving russia staying in feudalism with boyar clans keeping power by having large magical talents (like shooting lightnings or sending storms on their opponents). You can guess from the name where they got some of the ideas. Pass;
  • various “historical” “research” books trying to convince the reader that Stalin did not plan to wage a war and the fact that Soviet Union had very large forces concentrated near its (newly created) borders in June 1941 is just a coincidence. Yuck;
  • the literary RPG genre of (sciency) fiction. The settings are usually either virtual reality MMORPGs where characters spend most of their lives (or even serve their prison sentences) or even “real-world RPGs” where something (nanomachines, son!) re-creates the system with RPG characteristics, levels and skills in the real world. Few adequate books are buried under the tons of usual Marty Stu fantasies and books mostly full of main character game logs and stat sheets printed after each update;
  • there were also series based on a predefined setting of two games, namely S.T.A.L.K.E.R. and Metro 2033 but it’s best to be left to the equivalent of Star Wars Expanded Universe fans.

I’ve missed something for sure (like books in more traditional genres) and there are exceptions but here are the reoccurring themes that turn me off even in more reasonable books:

  • jabs at other nations, sometimes not merely chauvinistic but gratuitous too—it’s one thing when a brave russian protagonist uncovers a plot by evil Britain against his country and another thing when a brave russian protagonist encounters some Ukrainians without any reason and they start insulting him, still without any reason, and when this episode ends it gives absolutely nothing to the story;
  • normalised prison traditions. I’ve written before that it seems to be the only natural part of russian culture (and the rest was invented to bind the empire together), a lot of people in russia believe that you’re not a Real Man™ unless you’ve been to prison, so of course it gets reflected in the literature. It’s not that uncommon to see protagonists enjoying speaking prison argot, to give one example;
  • resentment and revanchist feeling (just look at how many books are about fixing something with the russian past);
  • and finally, the attitude to plagiarism. For example, protagonist has some knowledge (technical or art), passes it as his (or her) own inventions/writings without having any regrets. Bonus points for having such protagonist offended when somebody else does the same with his (or her) stuff. I dropped reading one of the books in disgust after the author copied a well-known humoristic piece verbatim without giving credit.

Again, previously I could write these deficiencies off to the skewed views of individual authors. Now russia demonstrated to the whole world that chauvinism, resentment and thievery are the main virtues there. So why should I even attempt to read new russian books that cause only revulsion and disgust? Why should I read older russian books if they’re either the same or about the topics I have no interest about (i.e. russia and russians). And considering that most of the russian classics were imperialists and chauvinists why should I read them too? Fun fact: back in 1930s during Ukrainisation movement (started by Soviets to make their rule accepted by local population and cut off when it was no longer required) those classics were against their works being translated into Ukrainian (probably culminating in intelligentsia from Leningrad protesting against “traditionally russian” operas being performed in Ukrainian, including Aida). As for the foreign books translated into russian, considering the usual poor quality of the translation it’s better to find and read the originals.

Books were my main connection to russian culture, and this connection is being cut mostly without any efforts on my side. At least there’s enough good literature to replace it. If this makes you think about Nord Stream pipelines, it’s only because there might be something in common here.

Movies

russian movies suffer from the same problems as russian literature. Additionally since shooting a movie is not cheap (in general), one of the important parts of the process is securing funding and finding distributors. Because of certain peculiarities of russian political and economical system it essentially devolved into a system where a cabal formed from large studio owners (that may also act as directors and producers) “help” russian ministry of culture decide which movie to sponsor (usually one of their own). And they use their connections to advertise those movies in prime time on state media channels (or in some cases convincing that the movie should be mandatory to be watched by e.g. children from elementary schools and the orders are made at the ministry of education). The rest of the movies are usually something targeting lowbrow audience to be commercially viable.

As somebody put it, Hollywood movies are for making profit and all about the box office and russian movies are all about securing funding. Unlike Hollywood accounting where the idea is to make movie bring profit without paying taxes, here it’s like in The Producers—make a flop so nobody questions where money for production really went to. That’s why pitching the movie, actors lying how fun it was to shoot and exaggerated advertisement claims are usually the best part of those movies.

Are there exceptions? Yes, but most of those movies are either about criminals or depressing life, sometimes both. And the remaining couple of movies that are clever satire on russian reality I’m not going to re-watch because it’s still about russian reality.

Video games

I don’t play games much and when I find time for them it’s usually adventure games. I’ve made a short review of the games I’m aware of (or played myself). Some of them were actually decent (as they were made before the time when they started make and publish any garbage) but I’ve not played them for a long time and it won’t be hard not to play any them at all.

Internet media

Here the situation is rather simple: most of the sites I visit are in English and at the start of the war a lot of russian sites I visited closed in protest (some may have reopened since but I’ve learned to live without them). The main loss is a webcomic called Depth of Delusion (a deep passionate parody on popular movie franchises with toucans on top). Its author was from Chernihiv so in the best case he simply lost any desire to write it on a russian site (as he said in his last post) and in the worst case he lost his live during the initial state of the 2022 invasion.

As for the videos, I had no interest on what their bloggers can tell me about the russian lifestyle. I watch mostly the videos with humorous reviews of the movies or TV series (so I both be entertained and keep informed about what’s going on). Due to sanctions some of them went to greener pastures (i.e. video hostings that still pay money in russia), others disappeared entirely, yet another one made claims that made me stop watching them out of disgust (those claims may be either outright nationalistic or weaselly shifting the blame from russia). So the amount of channels I’m willing to watch is shrinking steadily and will reach zero eventually. Another thing is that considering the current situation I’m not eager to learn about new russian movies and how awful they are (I’ve explained above why they are) and I can find out stuff about foreign movies from native reviewers.

Meanwhile there’s a vast amount of channels in English offering content good enough for me. And there’s this catalogue for Ukrainian channels which helped me a lot.

Conclusion

There’s a phrase from Soviet times: I’ve not read Pasternak but I condemn him. My situation is opposite: I grew up in a multicultural place with a strong dominance of russian culture and have learned a lot about it. Nevertheless, I had alternatives to choose from and since I have some tastes (I’m not going to claim they’re all good, but they’re there) I don’t mindlessly consume everything but rather pick what I find interesting or entertaining and while I try something new in order to escape filter bubble, there are some things that would make me reject them immediately. And russian culture is one of the things the more you know about the more revolting it is.

As I wrote before, russian culture is an artificial thing created to bind the empire (be it called empire or USSR, doesn’t matter). Initially it was enforced by power (by both suppressing local cultures, including Ukrainian, and leaving the opportunities to work only at russian narratives), later by money (Ukraine has lower reserves of oil, so a lot of Ukrainians moved to russia to get significantly larger payments for their work as actors, singers, writers or even producers). It would be understandable but the imperialist agenda never left it (even in Soviet times they dreamed about uniting the whole world under the wise rule of The Party and praised the leading role of Soviet Russia). So it turned into a mental poison that tries to convince the whole world that Ukraine, Ukrainian language and culture do not exist.

Previously I could ignore those narratives and pick up the better bits, but in 2022 russia demonstrated that those idiocies about defending oppressed russian culture are actually their guidelines and if you do not purge it from your country there may be russian tanks and missiles coming next to “defend” it (again, it’s russian-speaking part of Ukraine that suffered and suffers the most from russian invasion). Taking all this into account, consuming russian culture is like drinking from a spring in Makiivka (this source of potable water at occupied Ukrainian territory got viral a couple of months ago after somebody took a dump into it; considering that this is a thing a russian soldier would do, it’s a very appropriate symbol indeed). Maybe I’m not so smart to cut all possible ties earlier but I can take a hint.

Visiting multimedia grave

October 31st, 2022

When people ask why I call the search division of Alphabet Inc Baidu, I answer that I do it in spite to muddle their search index and mostly because they remind me of a Chinese totalitarian company. And recent news only reaffirm such views.

As you should remember, Baidu is famous for its graveyard for the killed projects—it even has a separate alley for the messenger apps. And looks like it prepares a plot under a concrete duck for burying some multimedia formats (which makes it interesting to me).

The history of multimedia formats at Baidu essentially started with the purchase of On2 and releasing VP8 in WebMKV format. Then VP8 was mostly buried since VP9 was created (some of it remains hidden inside WebP format), VP9’s turn is near since VP10 is here to succeed it (under the name of AV1).

In the recent news though it turns out that Chrome is deprecating its support for JPEG XL, a format developed mostly at Baidu and the only one properly standardised. But as we all know, Chrome currently controls the Web and removing support for it means that the format will remain obscure. Kinda like in a Soviet joke where a foreign tourist asks in a shop why there’s no caviar and hears that there’s no demand for it—and as he observed for a whole day nobody asked for it indeed (in case it’s not obvious people in the USSR didn’t ask for caviar at the shops because they knew it would not be sold there; see also Baidu Stadia).

And because it was not enough, people spotted that WebP2 has changed its status to experimental, meaning that it won’t be supported either.

So we have, VP9 buried in favour of AV1, JPEG XL being buried in favour of AV1F, WebP2 being buried in favour of AV1F (which is AV1 still frames in MP4) and the original WebP is likely to follow the suit. Now consider that AV1 is recommended to be distributed inside MP4 instead of WebMKV and you’ll fear about the future of that container as well.

I guess now all is left for them to do is to adopt Baidu Lyra as non-experimental codec to purge Vorbis and Opus not created by them and then bury it in favour of AV1-based audio compression. That would make a nice collective grave of formats killed by Baidu to make space for AV1.

So, do you know when AV2 should arrive?

A final look at SIFF

October 29th, 2022

This is a resource format (as one could guess from its name) used by Beam Software for various resources in its games. The first time I had to deal with it was when some anonymous contributor contacted me with a REd decoder for videos in Lost Vikings 2. I adapted for FFmpeg (wow, it’s been fifteen years ago) and added sound support as well.

Recently I decided to revisit it (previously I tried to adapt decoder for 15-bit video but could not make it exactly right for some reason). So I looked at it, it turned out to be exactly the same algorithm but depending on whether palette is present in the frame (yes, 256-colour palette with RGB555 entries) pixel data is read either as byte palette indices or raw 16-bit values. I also looked at The Dame was Loaded game and its FCP format turned out to use exactly the same compression but with a different frame format (16-bit sizes, different audio/palette/video order and so on). And the game audio uses packed 12-bit PCM (two samples without low nibble are stored in three bytes) which is not something you often see.

And with that I’m done with game formats for a long time. Probably I should write a toy encoder or two now.

Looking at Talisman animations

October 27th, 2022

While the situation in Ukraine is stable bad so I keep looking at game formats instead of playing those games instead.

Apparently there’s a German adventure game from mid-1990s called Talisman and that’s about all I can tell about it. Yet it seems to have rather interesting animation format that’s worth talking about.

It turned out to be codebook-based compression with a codebook shared by a group of frames (typically 20-30) and actual codebook being created from a transmitted codebook data mixed with the static codebook (an interesting fact: unlike many other game formats, this one not merely allows seeking inside, there’s a special chunk preceding group of frames with the same codebook that contains an offset of the next such chunk). Tile operations are either copying 2×2 tile from another part of the frame (optionally updating one pixel in it) or reading it raw.

While it’s not the most complex format ever it turned out to be interesting enough. And with that I’ve probably exhausted the game video formats to look at. I’ll probably revisit SIFF but that’s about it.

A quick look at PDQ2

October 21st, 2022

So there’s this new service discmaster.textfiles.com for searching for files from some old disks and discs at archive.org and out of curiosity I took a look at what it offers.

While it’s physically impossible to check all hundreds of millions of files it indexes (even just videos), I took a look at one rather curious category called aviAudio. There are about six hundred files of such type found so I decided to check them to see what kind of beast that is.

Some files turned out to exactly AVI audio files—AVI files with single stream that turns out to be audio (I don’t know why but this happens). The rest of the files were AVIs with unrecognized video track (just what I was hoping for!). One set of the samples come from some game with IPMA codec, other sources mostly feature Motion Pixels video (which is horrible both to RE and to support so I’d rather not touch it), one sample was special “codec” for some russian erotic game (which means complete garbage even by russian game standards) that is really just obfuscated Indeo 5. And finally there was a single PDQ2 sample (from some Incredible Hulk game demo from 1997).

An interesting thing is that it’s a DOS game with built-in AVI demuxing and decoding of this codec. The codec turned out to be a lot like various lossless codecs (so its FOURCC probably stands for something like “pretty damn quick codec, version 2”). It splits video into 4×4 tiles and emits up to three streams stored one after another: tile opcode (copy previous tile, copy previous data with an arbitrary offset, skip tile, raw tile), variable offsets and tile pixels. Additionally frame data may be packed further with LZ77-based scheme. As I said, a rather familiar scheme for lossless video codecs and it makes me wonder whether it’s a codec developed specifically for the game(s) or it was borrowed from somewhere else.

Another bunch of interesting game codecs

October 17th, 2022

While Iran wages a proxy war with Ukraine (and I can easily believe they’re not against doing it to the last russian), I’m still trying to distract myself by looking at various video formats in games I have no intention to play.

Finding games with unknown formats gets harder and harder (or at least more tedious). So here are two games with an interesting approach to video compression.

Dark Earth packs frames as separate planes with 5-bit components and each plane is compressed using a peculiar modification of LZ77 scheme: depending on a bit set, it either codes a run or a forward reference in either the same or previous buffer. Additionally it codes it using non-bytealigned stream (run mode is coded in 13 bits and copy mode takes 25 bits).

There’s also Defcon 5 game (the one from the mid-1990s, do not confuse it with a game with the same name but from a previous decade). This one employs a different method I don’t remember seeing anywhere else: painting squares. Of course you’re used to various codecs splitting tiles in blocks and filling them (from older codecs using quadtrees to H.26x and its rip-offs). This one does it differently though: there is a fixed set of tile sizes selected for each video (I’ve seen only 32, 16, 8, 4, 2 set though) and frame data is essentially a list of commands telling at which offsets to paint a tile of this size with a given colour (those offsets may be completely arbitrary). It may be not the most efficient compression algorithm but it’s quite interesting. Also the container specifies palette as fixed and changing colours—first part is stored in the header and the second part is transmitted with each frame. Again, it’s not something extremely effective but I can’t easily remember any other format doing it that way.

I’ll probably try to do something different next time but I consider time spent on looking at these formats well-wasted.

Looking at yet another game format

October 15th, 2022

Since I have nothing better to do and I don’t feel a desire to write a lengthy rant about what’s wrong with this world (beside the fact that russia still exists of course), I keep looking at various games I can find in order to see if they have some interesting format. Last time I’ve managed to locate an elusive Indeo IVF sample, now it’s rather curious FMV format.

So there’s an unpublished PC game called Highlander: The Last of the MacLeods which is apparently some kind of 3D action game based on the animated series (one of those, the franchise seems to have a lot in it beside the one good movie). And it turns out that it has a three dozen of FMV clips in proprietary format (stored inside mov.dat but extracting them is trivial).

From technical point of view the format is rather simple but video compression is rather peculiar: each frame in coded independently by painting each 4×4 block with 1-16 pixels using a certain pattern. That’s common but this data is packed with a simple history-based method: depending on a flag a value is rather read raw or reused from a history buffer depending on two previously decoded values. And now there’s a twist—this compression is applied twice.

Overall, it was fun to look at the format even if I don’t care about the game itself and the video quality is rather poor (probably thanks to the rather low bitrate and fixed palette all those FMVs share despite half of them being digitised animation clips and half of them being recorded in-game 3D animation). Still, now I can play the files with NihAV if I ever get such desire.

Looking at true IVF

October 13th, 2022

So while russia demonstrates once again what a hysterical führer and his similarly minded generals would do, I’m trying to do something to distract myself from the thoughts about the losses Ukraine suffered in last couple of days (and previous couple hundreds of days too).

Accidentally I’ve managed to find a sample in IVF format—the original streaming format for Indeo codecs. Despite the expectations it was not a renamed AVI file which made it even more interesting. So I took Ghidra and binary specification and started implementing it.

The format by itself is rather simple and the only interesting thing is that it transmits video data in passes: first it’s just bare minimum keyframes and all other frames as drop frames, then some inter frames are sent, then more data is sent and more. Unfortunately there’s no obvious field to tell where each part starts so I simply assemble frames in memory (which is not effective but still better than the original creating temporary files for assembling fragments).

Then there was a problem with decoding them: my existing decoder expected a frame with sequential structure while in this case fragments are transmitted out of order. Normally you’d get all four bands for luma plane and then a band for each chroma planes but in this case it may be one or two bands for luma plane, then chroma plane bands, then some zero padding and then the rest of the bands for luma (if they were transmitted at all). In the reference implementation the demuxer seems to parse and re-assemble the frame while I ended up writing a slightly different decoder for this scalable mode. It seems to work fine so now NihAV support for Indeo family of formats is even more complete than ever.

P.S. The Wiki had only the entry for Duck test samples format (that has the same extension) so somebody had to correct that. Which also makes me think about things like Duck AVC, AVS being an FMV game format or Chinese non-Duck AVC rip-off, IEEE AAC and so on. This confusion deserves to be written about but don’t expect me to do that.

Model of man and social/economic systems

October 6th, 2022

Here’s some random thoughts about how some subjects should’ve been explained at school to make understanding it easier. Or maybe they were and I was unlucky.
Read the rest of this entry »