E-mail address changed

April 27th, 2022

Some time ago Baidu sent me a warning that they’re going to force two-factor authentication on my account at the end of May. This was rather expected from them since they’ve announced those plans earlier and I had some time to prepare for that, but another thing was rather unexpected.

My Internet access was switched from one provider to another (no idea why) and after the switch fetchmail was banned from accessing my Baidu account. Since I do not want to change the ways I work with email (which is fetchmail+mutt+msmtp combination), I’ve finally bought some simple hosting and switched email on various accounts around the Web (surprisingly enough only one webshop did not allow to change it).

Now the mail link in the right column will lead to a picture of my new e-mail address (this should annoy bots and people with taste). Feel free to ignore it as you did with my previous address.

P.S. I’ll try to check my Baidumail account while it’s possible (i.e. for a month) a couple of times but after that it’s as good as dead for me.

P.P.S. Considering that their mail was the only service I logged into and the only other service I use is BaidUTube (usually with yt-dlp) you can consider me degoogled—and it happened mostly because of their push to keep people logged in all the time. After they introduced those unskippable “I agree” windows I’ve finally switched to On2On2Go for search (in case you didn’t know duck.com used to belong to On2 back in the day) and OpenStreetMap for maps. At least they made it gradual so there was enough time to switch.

Russia, Ukraine and 1939v2

April 5th, 2022

I’m trying not to express my political views publicly because who cares about them, but this is an occasion when I have to write something because I cannot abstain from that.

I was born in Kharkiv in Ukraine, I spent two thirds of my life there and I had a chance to travel throughout it, from visiting my grandparents in Lysychans’k in the East to seeing Lviv and Uzhhorod in the West, from Chernihiv in the North to Odessa and Crimea in the South (back when it was just some Russian military bases there and not the full-scale occupation of course). For you it may be just random places on the map, for me it’s very real places, in some cases places where my relatives live. So call me biased.

Anyway, the only way I can characterise the current situation is 1939 repeating again though this time you have one country to represent both National-Socialistic Germany and International-Socialistic Soviet Union (yes, IMO the main difference between them is what people they regarded as lower races—all but their own or simply all).

The reason for the current war is the same as in 1939: a power-mad dictator convinced himself that he and his country were denied the Lebensraum they believe should belong to them and that it’s the foreign threat that made them start the war.

And since Russian Reichspropaganda (in July 2014 putin said that Goebbels was a talented man—at the meeting with Jewish diaspora representatives—so I guess they see him as their teacher indeed) claims that Ukraine is not a real country and never has existed let’s start with a very condensed history of Ukraine.

History of Ukraine

The origin of Ukraine lies in the times when Scandinavians discovered they can organise a trade route to the East Roman Empire (the famous route from the Varangians to the Greeks) and built some outposts to control it with Kyiv becoming the main one. Time passed, the rulers (called knyaz which roughly corresponds to prince, duke or (war)lord) started to develop territory and thus Kievan Rus’ was created. It became a European country by accepting Christianity as the state religion (it was before East-West Schism so Volodymyr I is the saint both in Orthodox and Catholic branches of Christianity) and strengthening ties with the East Roman Empire while having ties with the Western Europe as well (Yaroslav the Wise had a daughter of Swedish king for wife, he helped one of his sons-in-law to become a Norwegian king, his other daughters were married to the kings as well and one of them even was a French regent for a while).

It’s worth noting that there was another trade centre in the North—Novgorod—which was a member of Hanseatic League and a democracy akin to Venetian one. Yet it played the second role to Kyiv and was eventually squashed by Moscow czar Ivan IV.

The main problem of Kievan Rus’ was the power struggle and very complicated inheritance rules so it was essentially lots of duchies competing for a throne in Kyiv. On the outskirts of Kievan Rus’ there was so-called Украина Залесская which translates to Beyond-forests Mark or Transylvanian Ukraine. Yes, word “ukraine” initially meant a borderland territory (but Ukrainians made it sound proud nevertheless). And yes, it’s bloodsuckers from wrong Transylvania who got all the fame. Anyway, on this territory there was a duchy of Suzdal and its ruler, Yuriy Dolgorukiy, founded a settlement called Moscow. And yet he wanted to be a ruler of Kyiv instead (and he was kicked out from there the first time out).

This internal struggle proved fatal when Mongolian hordes came. Disunited rulers could not unite even against the common threat and the land fell prey to the invaders. IMO that’s where the real story of Russia starts. While Ukraine struggled against the invaders, rulers from the Northern parts were happy to integrate with the khans, marry their daughters and competed for a permit to rule the whole region (which included collecting taxes and contribution to the Great Khan). Eventually a huge chunk was united under one rules who drove Mongols away by being a loyalist and supporting a different pretender to the post of the Great Khan (who later thanked them by coming and burning Moscow down). Ukraine meanwhile went a different route.

A lot of Ukrainian lands (and Belarusian lands as well) were taken by the Grand Duchy of Lithuania (even to this day Belarusians are calling themselves litvin because of that). In that time so-called Ruthenian language (a Slavic language that local population would understand) was used as one of the official languages. The problems started to arise after the union between Lithuania and Poland that created Rzeczpospolita—Lithuanians did not care about certain things like religion while Poland started to force Catholicism (which led to the creation of a rather unique Ukrainian Greek Catholic Church). And it was the time when cossacks started to play an important role. They were an independent group with democratic traditions (hetman, the highest military commander, was elected at the officers council, to give one example) but they also enjoyed being employed by Polish government. The tensions between them and the Polish government (let alone the oppression of Ukrainian people by Polish noble landowners) resulted in an uprising led by Bohdan Khmelnytsky that resulted in unfortunate casualties. Side note: in Russian history until XX century there were no uprisings by Russians against the government except when led by the pretenders claiming to be czars. In either case, Khmelnytsky had to seek an ally to help him against Poland and he chose Muscovia (it was renamed to Russia much later) for being culturally similar.

But this protectorate has not lasted well since czars demanded each new hetman to make a new treaty with fewer and fewer freedoms left until in late XVIII century all pretence was dropped and that part of Ukraine was annexed, cossacks expelled and serfdom introduced (if you don’t know what serfdom is, it’s not that different from slavery). Another part of Ukraine went along with Poland to Austro-Hungary.

Let’s skip to XX century. After the February revolution of 1917 Ukrainian people formed a congress and made declaration of independence—before the October revolution of 1917 (and it had started before Lenin decided to return to Russia). The same way like some Soviet republics declared independence before the formal dissolution of USSR (mostly Baltic states and Ukraine). And since bolsheviks refused to recognize election results in Ukraine (where they got a minority of votes), they created a Ukrainian Soviet Socialistic Republic and used the army (pretending to be a Ukrainian one) to conquer as much of Ukrainian territory as they could (Western Ukraine was left under Polish rule at that time). Then in 1939 World War II started and Ukraine was one of the bloodiest battlefields that was first fully occupied by the USSR, then by Germany and then by USSR again. During that was USSR fought mostly with troops from Ukraine and Belarus (with enormous losses because the commandment did not care) which was later used as a pretext to introduce both republics as founding members of the United Nations and allow Russians to claim that it was them who won the war (and who cares that USSR would not be able to fight without British supplies and American lend-lease program).

And here’s another small detail: after the war Crimea was devastated, its inhabitants deported to Middle Asia, so it was decided to “make a gift” to Ukraine which should provide it with the fresh water from the Dnieper and restore its agriculture, all while various distinguished Russians would get a piece of land at a scenic Southern Crimean Coast.

In the beginning of the XXI century Ukraine was slowly failing state (especially considering the corruption around natural gas but Europe turned out to be not that different in that aspect) that started to unite and get the national identity after several incidents all related to Russia: 2003 attempt to seize Tuzla island by building a dam to it (IIRC China has managed to get several islands from Russia in that way; this attempt has failed though), occupation of Tuzla island along with the rest of Crimea in 2014 and the war of 2022.

Now with that background let’s move to the common myths instigated by Russians.

Russian myths about Ukraine

Here’s a short list of what I can remember. Probably there are more but I’d feel queasy if I have to search for more.

  • Ukraine is not a real country. I hope from that condensed version of Ukrainian history you could see that Ukraine was a country, always wanted to be an independent country, and remains an independent country despite Russian best efforts;
  • Ukrainian language is not a real one (or even: Ukrainian language was invented at Austrian General Staff). I think that’s the case of projecting. Ukrainian language remains rather similar to Old Ukrainian language used in Kievan Rus’ and to Polish and Belarusian languages so you can more or less understand them if you know Ukrainian. Russian language is quite different, based on Old Ukrainian and Church Slavonic with some features not found in Ukrainian or Belarusian language like heavy stress (but you can find it in Mongolian language). Even funnier is that the first Russian grammar was made by a Ukrainian and later the language rules were mostly revised and updated by people of German origin;
  • Ukrainian culture does not exist. Despite the best efforts of Russians (just see for yourself what Ems Ukaz was and that it was not the first of its kind either), Ukrainian culture existed back then even if a lot of it was appropriated by Russians (I dare you to look what Yevhen Hrebinka is famous for). Or there’s another fun episode: in the beginning of XX century Hnat Hotkevych re-discovered some bandura players and revived the art of bandura playing. In 1930 most of the bandurists were dead (many believe they were gathered in one place under pretence of some conference and shot) and the monument to them installed in Kharkiv in 1997 gets vandalised rather regularly. So this myth is more of a wishful thinking plus covering up a theft (the same as they did with history);
  • Russia brought civilisation to Ukraine. As usual, it was the other way round. For the majority of time Ukrainians were more literate than Russians, centuries ago Ukraine supplied Russians with clergy and officials (and see the example with Russian language grammar above). And even in Soviet times a good deal of engineers were Ukrainians or had Ukrainian origin;
  • Ukrainian nationalists were Nazi collaborators and are very active up to this day. It is true that Ukrainian nationalists collaborated with Germany, but after they’ve declared Ukrainian republic in Lviv they were arrested and mostly killed. Some of the leaders were kept alive in the concentration camps in case they can be useful later. It’s mostly thanks to Soviet propaganda that demonised Stepan Bandera that many Ukrainians remember him, otherwise it would be “well, there was such historic figure but he’s no longer relevant”. And nationalistic parties have never gained much influence in the parliament after the independence. Similarly nobody was oppressing Russian-speaking people in Ukraine, not even in the Western part. Now the things might change but I guess people speaking German were not popular in Europe in 1950s either;
  • Russia liberated Ukraine from Nazis and it’s so ungrateful. As mentioned in the history section, it was Ukrainian forces that had to hold the defence and be waster during counter-offence. And people have not forgotten the other nice things like Holodomor and other famines of 1930s and 1940s, how Russians behaved in 1939 in “liberated” part of Ukraine, how lots of valuables from museums and factories were evacuated during the war and never returned or only a part of it was returned (just read the history of Uralvagonzavod), there are other cases that demonstrate that Russians have not earned gratitude;
  • Ukraine survived only because of Russian gas. And as usual it’s a mix of lies and covering up for the theft. In 1950s Moscow used natural gas from the West Ukraine (and they even had to disguise it as something else so that Ukrainian resistance wouldn’t blow it up). There are gas deposits in Kharkiv region as well (and some oil was pumped in Okhtyrka district in addition to the oil deposits in Western Ukraine). The situation around gas in 1990s-2000s was complicated and caused (IMO) by both countries profiting off cheap gas and the differences in gas prices for the population and for the industry. After the 2014 events Ukraine started to buy gas at European market and it was not much worse than before (except maybe for certain oligarchs);
  • Russians are the elder brethren of Ukrainians. First of all, Ukrainians as a nation are older. Second, your actions have shown what kind of people you are so you’re disowned relatives at best. Go after your warship!

So what do I think about it in general?

Final thoughts about Russia

Russia has been a prison at almost any period of its existence. Wikipedia quotes the state census of 1857 that out of 62.5 millions of total population 23 millions were private serfs and about the same number of people were state peasants who were not much different from private serfs either.

In Soviet times after the initial period of freedom they’ve decided to re-introduce internal passports and the system of propiska which restricted internal migration (and going abroad for a trip let alone emigrating was extremely hard). Additionally the country in Stalin’s times was characterised as a bus—one man driving, half of people sitting (in the camps) and the other half of people shaking (or watching over the first half in other variant of the joke). It was a mass system of forced labour and rather ineffective at that. To give one example, Salekhard-Igarka railway was built by camp prisoners with an effective rate of one dead prisoner per one sleeper tie laid—and the best part is that this railway turned out to be rather useless. So thanks to such wonderful state system being a prisoner was not shameful.

Then in 1990s it was a turmoil and the economics was not functioning properly. Those who could sold leftovers of the Soviet legacy or natural resources, those who could not in many cases became bandits and since they had money it was seemed as an attractive occupation. Many of the bands were formed by ex-military, ex-policemen or ex-KGB people (and thanks to Andropov there were too many KGB agents for any meaningful job). And one ex-KGB agent from one of those gangs later became a dictator and brought both his cronies and ways of dealing with others to the state level.

It’s hard to believe but criminal way of living has been romanticised there (even if 2000s were rather good and wealthy years for Russia) to the point that most Russians may not recite any poem of their classic poets but know prison jargon quite well and the answer to a riddle about two chairs that’s supposedly asked to an each new prisoner by older inmates. Their police works like legalised criminal gang, their army is not that different from the prison either, their political system resembles prison hierarchy as well.

And then comes the ideology…

The claim that Moscow is the third Rome is about as old as Russia itself (while in Kievan Rus’ knyaz could have a daughter of Byzantine emperor for a wife, they were proud to be who they were and not somebody else). Considering what other countries made claims to be a successor of Roman Empire it puts Russia into a nice company already.

Then you have a schizophrenic chauvinism, where they both claim to be the greatest nation of the world and having no regard for their own people (one writer explained it by Russian community being large but too vague to define so the definition of “own people” changes depending on purpose).

Then you have imperialistic ambitions for more and more territory—instead of developing already enormous chunk of landmass they have. In Russian empire times they tried to conquer more and more land but were afraid to have external colonies in fear they go independent (that’s why they were eager to sell Alaska and Fort Ross colony for a rather small sum of money). In Soviet times they tried to bring back countries lost after 1917 (did not work with Finland thankfully) and tried to get more countries into Socialistic (concentration) camp. Now they’re trying to restore Soviet glory (which makes it the third empire or the third Reich more precisely).

Then you have a fascistic ideology based on worshipping World War II (or rather the part of it that does not paint USSR in a bad light) with random outbursts against other nations (like Poles, Czechs or Estonians) in the best traditions of Orwell’s two minutes hate. This is partly because it was the apex moment of Soviet glory (good reputations, a lot of influence and large territories conquered from the neighbours) partly because (as it turned out) they wanted to repeat a war in the same fashion.

Then you have a mindset of a typical criminal, believing that you can say any lie no matter how easily disprovable it is and if you’re caught you can simply say another lie and another. The same mindset gives the following fine strategy as well: at first you demand proofs and if those are delivered you simply say “so what?” and keep doing what you were doing while your opponent is shocked by your chutzpah.

And finally you have both yearning for the great past and dissatisfaction with the reality resulting in a willingness to revise the reality by starting a war. 1930s Germany was in the same situation but it was caused by losing the previous war and bad economic situation because of that, now it’s caused by a bad economic situation from the mismanagement (if you’re a gang extracting rent from natural resources while your underlings extract rent by extorting private businesses you have an ideal case of trickle-down economy that works good only so long as gas/oil price is high enough).

As the result you get war done in the best traditions of both the Red Army trying to conquer Finland (with equal incompetence and losses) and the SS troops (they got infamous not for their military prowess either).

And one last final thing I want to mention that is related to the current topic: how Russians are keeping words, contracts or treaties. European countries operate on reputation and keeping your word no matter now matter what. In Russia it seems to be the opposite: you’re more respected if you’ve managed to swindle somebody with your contract. On the one side they think they can denounce any treaties at any time their conditions are not good enough for them, on the other side when they provide something they behave worse than any copyright holder. That was the case with Crimea when they decided that it’s been long enough a part of Ukraine and should be taken back (because it was theirs by some treaty with Turkey in XVIII century), this is the case with UN where they recognize its activity only when it either favours them or they can veto it. That was the case with their natural gas and the peculiar “take it or pay regardless” scheme where you were supposed to pay for a fixed amount of natural gas no matter if you’ve used it in full or just part of it or none at all—and you were forbidden to re-sell the leftovers. After 2014 when Ukraine stopped buying gas from Russia and started to buy (the same) gas on European market they wanted to forbid other countries to sell it to Ukraine. Sounds like a licensing scheme instead of commodity sell, doesn’t it?

Despite all that I don’t hate Russia or Russians, I’m merely deeply disgusted by them. But I’d have nothing about them living in whatever way they like in their own country without trying to threaten let alone invade any other country. It would be nice if they’re taught that what they’re doing is wrong (like Germans were about seventy years ago) but it’s too unrealistic.

P.S. I’ve never asked for money (because I’d started earning myself before I had this blog) but in this situation I ask to help Ukrainian Armed Forces by sending some money (here is the official page of the National Bank of Ukraine). There are enough kind people willing to help Ukrainian refugees and Ukrainians suffering from Russian attacks but somebody has to fight so those people will have a place to return to and live in safety. I’ve transferred over 30k€ and keep sending more, maybe you can help too?

Looking at Voyeur II videos

March 26th, 2022

Here’s a result of another attempt to distract myself from the thoughts whether Ukraine will kick out the invaders in a steady manner or if the führer will resort to chemical or nuclear weapons.

So I decided to take a look at random FMV game and Voyeur II came to my attention. From what I know the first instalment uses RL2 videos and is supported by ScummVM. The second game, however, uses a completely different format and packs most of the data into few volumes (80% of the data on CD is in single diskN.vol and the rest of the data is mostly in endings.vol and slides.vol).

Those volume files turned out to be archives as expected, and the content of those archives turned out to be kinda archives too.

The data stored in volume files is bits of video usually one or two seconds long but the way they’re stored is somewhat peculiar. The header defines (always?) four streams, two of which are dummy ones and the other two are audio and video correspondingly (and they can turn up in any order). The rest of the file is a collection of blocks with 8-byte header defining block size and to which stream it belongs to—and yes, blocks for different streams may be interleaved. Audio stream seems to be plain PCM and video stream is a sequence of frames (thankfully, 14-byte frame header contains packed frame size).

So, what about video compression? It’s RLE with a small twist: there are intra- and inter-frame RLE variants and they can use double-pixel mode (i.e. where you skip or fill the doubled amount of pixels and for raw pixel data each pixel is repeated twice on output). Inter-frame RLE compression has skip codes (i.e. at first you read how many pixels you need to skip, then you read either raw pixels to update the frame with or RLE data depending on opcode, and then you read next skip code and repeat it until the end of frame). Additionally it seems the video is always 320×160 and only video height is stored in the files.

All in all, the most interesting part there turned out to be the logical organisation of data and not the RLE compression or actual videos (I checked random couple of dozens of samples from over two thousands total videos and nothing piqued my interest). Maybe I’ll find something more interesting next time.

Revisiting legendary video format

March 22nd, 2022

So Ukraine is still holding against self-proclaimed second army of the world (though by this time it has earned the title of the most atrocious and hateful military force in the world, the title that had to be taken from the SS troops). And while I can’t stop worrying about my relatives, home city and home country in general, I still need something to distract me at least for a while.

While watching some video about video games, I spotted something surprising in it: a cutscene in Callahan’s Crosstime Saloon. While I worked on supporting Q video format in Legend Entertainment games I remember seeing just one video from that game (the animated title). So I tracked a full CD version of the game and discovered some surprising things about it.

First of all, it turned out to be version 7 of the format (and I’ve seen only versions 3-5 before). Second, it turned out to be mostly the same as version 5 but with F8 opcode in use. This opcode turned out to be used for compact representation of the colours where a code either introduces a cache of up to 15 colours or reuses some previous table and then tile colours are stored in a nibble. Third, beside cutscenes there are a couple of videos of some lady with a small child that look like a home video sneaked in by some developer.

There’s still a lot of work to be done to support it properly (because of the various quirks of the format) but I’ve managed to decode all of the videos from the game already, some of them even without artefacts. This is a pointless but fun distraction after all.

vp6enc: slightly faster encoding mode

March 12th, 2022

As I mentioned before, I wanted to try to apply the macroblock selection approach from VP7 encoder in VP6 encoder. Well, it was easy to implement: instead of preparing all macroblock modes and then trying which is the best one now it tries macroblock modes (starting with inter mode now) and stops when the result is good enough. In this mode encoding seems to go couple percent faster and the resulting size at the same quantiser can differ somewhat in both directions. You can try it yourself by using fast encoder option.

The encoder is still a failure though.

VP7 encoder release

March 3rd, 2022

While a certain country cosplays the Third Reich and conducts talvisota simultaneously—and tries to bomb my home city to debris, I still need some distraction…

borrowed from vp7.de

Since I’m rather bored with VP7 encoder I’ve decided to release it and move to something else. It should work about the same as VP6 encoder (i.e. poorly and nobody should care about it) but if you want to know what knobs you can turn just invoke nihav-encoder --query-encoder-options vp7 (but I guess the only useful options are to set bitrate/quantiser and keyframe interval).

Have fun!

Update from March 4: encoding with low quantisers should now work as well.

VP7 encoder: various bits

February 27th, 2022

As the world tries to avert attention from an insane dictator re-enacting 1939 (it gets funnier since I observe it from Germany), I should also do something to take my mind off constant worrying about my parents and other relatives in one of the Ukrainian cities under attack. Hence this significantly less unpleasant thing.

Now my encoder is conceptually done, all that is left to do is to fix a leftover bug or two, improve a thing of two, clean the code up and integrate it nicely with the rest of nihav-duck crate by splitting off common parts with VP6 encoder. Meanwhile I can talk about some things implemented since the last time and what wasn’t.
Read the rest of this entry »

The Prayer

February 24th, 2022

I do not like to state my political views publicly but sadly this is the right occasion.

I’m not a religious man so I know only just one prayer, the main Ukrainian prayer:

Дякую тобі, Боже, що я не москаль.

(translation: “thank you, God, that I’m not a Russian”). We live in a sad world where I’m really grateful for that.

The problem with opensource encoders

February 20th, 2022

Disclaimer: this post is about the general situation with existing (and even more, with non-existing) opensource encoders (for both audio and video) and not about the flaws in those encoders.

When I was developing my toy(ish) VP6 encoder, I got questions about it and general encoding technologies from many people (as in “one, two, many” but still it’s above the expected amount of zero). And then I remembered the reasons why there was no opensource VP6 encoder before I wrote one.

The main problem with opensource encoders is the shortage of talented people and the lack of environment to grow more of them. As the result, those who know how to write or tune encoders keep doing that or move to some other stuff (nowadays most of them who are remaining active seem to be sucked into rav1e and those who don’t know how to write encoders have very hard time learning how it should be done.
Read the rest of this entry »

Basic VP7 encoder: cutting corners

February 17th, 2022

I’ve more or less completed a basic failure of VP7 encoder. Now it can encode inter-frames using various size of motion compensation (and the resulting file can be decoded too!). There’s still a lot of work to be done (rate control, MB features and multiple frame analysis) but there are some things that I can talk about as well.

As I wrote in the previous post, there are too many coding parameters to try so if you want to have a reasonable encoding done in reasonable time you need to cut corners (or “employ heuristics” if you want to sound more scientific) in various ways. So here I want to present what has been done in my decoder to make it run fast.
Read the rest of this entry »