Archive for the ‘Useless Rants’ Category

A bit of class theory

Saturday, March 15th, 2025

There is a Ukrainian word “жлоб” (zhlob) with unknown origin, but probably coming from Polish żłób via Yiddish (and likely donating that meaning back, since in Ukrainian it means only a person while in Polish it’s not a main meaning and does not connect to it).

It is hard to give a proper translation for that word. It may mean a man large as ox, strong as ox, and with comparable intellect too. One dictionary claims it’s a synonym for a wealthy peasant who employs others. More often though it means a vulgar person with very limited intellectual needs and a miser. Kinda like an average person but without positive traits and with deficiencies magnified. I’m pretty sure that you can recognise such characters even without a strict definition.

And there’s Ukrainian living classic Les’ Poderv’iansky, often known simply as The Artist (he started his career as a painter but got much more famous as a writer and poet; he has given us many catchphrases, the best-formulated version of Ukrainian national idea and I’ve heard people quote his adaptation of Hamlet in full—people who would not normally read classics or memorise poetry).

Once he formulated the main reason why Karl Marx was wrong: people differ not by classes but rather by mindset. So poor zhlob shares interests with the rich zhlob and they can understand each other better (despite being a worker and factory-owner) than, say, a teacher.

Here’s an excerpt from his essay (published in the essay collection “Жлобологія” pp. 245-250 in 2013 if you care):

It would be nice to turn things around so zhlobs can’t get power. Unfortunately that’s utopia.

Sensible people, who are sadly too few, don’t have any influence, so zhlob ideology prospers. The prevalent class is zhlob, who is preserving his values. If this continues, this country will be completely fucked.

That’s because zhlobs are not fit for anything good but like awards nevertheless. […] They require proofs of own importance. They like various tchotchkes, posts and titles. Their hidden dream is to become counts and dukes.

Of course it had been written in Ukraine back in the day before people revolted and threw away one certain zhlob that other zhlobs voted for president, but the principles remain the same and can be applied to other countries. So if you ever wondered why rednecks vote for a hereditary billionaire believing him to be “our guy”, while hating another candidate despite her being “closer” to them—now you know the answer.

NihAV: hardware-accelerated playback revisited

Monday, March 10th, 2025

Recently I’ve made a mistake of upgrading one of my laptops to systemd 24.04. I can talk about various quality of life improvements there (like brightness control not working any longer so I have to evoke xrandr instead) but it’s so useless rant that it does not deserve to be written. What is worth talking about is hardware acceleration. Previously my player on that laptop had rather unreliable playback with VA-API decoding (i.e. it worked but some videos made it too laggy); now the situation has improved—it’s reliably unusable. Additionally it seems to consume only slightly less CPU than with software decoding. So I finally looked at the way to speed it up (spoiler alert: and failed).

Conceptually it’s simple: after you decode VA-API picture you need to obtain its internal parameters with vaExportSurfaceHandle(), create an EGL picture using eglCreateImage() (or eglCreateImageKHR()), blit it onto OpenGL texture with glEGLImageTargetTexture2DOES() and you’re done. It was not so simple in practice though.

Exporting descriptors is easy, I just modified my fork of VA-API wrapper to do that and it even seemed to produce correct output. The problems started with OpenGL integration. My player uses SDL2 so I spent a lot of time trying to make it work. First of all, it’s not clear how to obtain a proper OpenGL context for the calls, then there’s this problem of it being finicky and not liking multi-threaded execution. And of course you have to load all those functions mentioned above manually (because SDL2 offers only a small subset of all possible OpenGL functions—not surprising, considering how many of those are optionally supported extensions or missing in certain profiles).

Anyway, I threw away most of my player functionality, leaving just loading an input file, decoding it and trying to display only the first frame. It ended with a segfault.

It is probably because of (poorly documented) SDL2 wrapper doing, but it can’t provide a sane OpenGL context probably. So a call to eglGetCurrentDisplay() returns either NULL or a pointer that looks like a small negative value; the same happens with eglCreateImage() (fun thing that eglGetError() returns the same value, -424 if somebody is curious); at glEGLImageTargetTexture2DOES() call it finally segfaults.

At that point I actually tried searching for some alternative crates that would allow me to create an OpenGL window and call those functions—and found none fitting the purpose. They all are either provide rather limited OpenGL subset which is enough for drawing a triangle with shaders (and probably expect you to locate and load the library with the additional functions by yourself) or even simply provide OpenGL bindings, leaving even window creation to you.

In other words, not my kind of fun. I’ll simply disable hardware acceleration for all cases there until I find a better alternative.

P.S. Vulkan is not really an option either. My hardware is too old for ANV driver (and for HASVK driver too).

A bit on USA

Sunday, February 2nd, 2025

As usual, I don’t have to say what has been put to words in much better way by somebody else already.

At the banquet, last winter, of that organization which calls itself the Ends of the Earth Club, the chairman, a retired regular army officer of high grade, proclaimed in a loud voice, and with fervency,

“We are of the Anglo-Saxon race, and when the Anglo-Saxon wants a thing he just takes it.”

That utterance was applauded to the echo. There were perhaps seventy-five civilians present and twenty-five military and naval men. It took those people nearly two minutes to work off their stormy admiration of that great sentiment; and meanwhile the inspired prophet who had discharged it—from his liver, or his intestines, or his esophagus, or wherever he had bred it—stood there glowing and beaming and smiling, and issuing rays of happiness from every pore—rays that were so intense that they were visible, and made him look like the old-time picture in the almanac of the man who stands discharging signs of the zodiac in every direction, and so absorbed in happiness, so steeped in happiness, that he smiles and smiles, and has plainly forgotten that he is painfully and dangerously ruptured and exposed amidships, and needs sewing up right away.

The soldier man’s great utterance, interpreted by the expression which he put into it, meant, in plain English—

“The English and the Americans are thieves, highwaymen, pirates, and we are proud to be of the combination.”

[…]

The initial welcome of that strange sentiment was not an unwary betrayal, to be repented of upon reflection; and this was shown by the fact that whenever, during the rest of the evening, a speaker found that he was becoming uninteresting and wearisome, he only needed to inject that great Anglo-Saxon moral into the midst of his platitudes to start up that glad storm again. After all, it was only the human race on exhibition. It has always been a peculiarity of the human race that it keeps two sets of morals in stock—the private and real, and the public and artificial.

And here’s a link to the full writing in case you haven’t read it already.

Professional metric benders

Tuesday, January 28th, 2025

Today on “things that Kostya cannot change so he rants about them instead” is something different from the usual political or open-source political rants.

There are several groups of people whose occupation is (in theory) to evaluate certain things. So (again, in theory) you can call them the metric for those things. In practice though they rather do the opposite and try to make things conform to the valuations they give, or at least to make public perceive those things in the way that would confirm the original claims (and truth be damned!).

Of course some would see nothing wrong with it, others would even try to tell you that they’re always right because they cannot be wrong and thus only their opinion is the true one. Well, I’ll present three examples and see for yourself.

Let’s start with the most prominent example, namely lawyers. In an ideal world, lawyers are a part of judicial process, making sure that the side they support is represented fairly—and that means that judging is done according to the laws, without glaring mistakes or prejudices. In practice though lawyers tend to get associated with paid justice, meaning that quite often the outcome of the trial or litigation depends on the pay-grades of the lawyers involved instead of actual known facts (or even laws). Which sometimes leads to the fun systems as the British one with two mandatory kinds of lawyers (barristers and solicitors) and USian one—resembling quantum dynamics—where you can call lawyers elementary particles responsible for any interactions between entities (except that quantum dynamics is easier to comprehend).

Then there’s another often disliked group of people called philosophers. In theory philosophy is a way to explain the world or some of its aspects. So one would expect philosopher to be a thinker who studies the world (or part of it) and makes some conclusions about how it works and what implications that gives for the rest of the things. For instance, science may study human morals as a thing emerging in collectives and affecting interactions between members of those collectives, while philosophy may ponder how morality defines human itself and what should be considered the ideal moral. But the modern philosophers seem to work in the reverse: first they start with a conviction (quite often a small one and benefiting them directly) and work up from that to build a system that will provide an excuse for their beliefs. Of course this is unlikely a modern trend, but history preserved enough examples of real philosophers for any epoch and different countries as well—which is hard to say about the modern world.

And finally art critics. One would naïvely expect them to be people with certain tastes who appraise certain kinds of art (paintings, sculptures, books, movies, video games etc etc) and tell public their opinion about it. You may like them or not, agree with them or not, but in either case such reviews should not merely give an abstract score but also provide an explanation of what was done right, what could be improved, and what hidden qualities may make it even better than your first impression told you. There’s a reason why people still remember and quote Roger Ebert (of Chicago Sun-Times) or Scorpia (of Computer Gaming World). But the majority of the modern art critics seem to start from the premise of having to praise the reviewed product (often, apparently, out of fear for the salary and other benefits—disappointed owners of the badly-reviewed product may stop advertising in your media or provide early access to the next products they release and so on) and construct up the review leading to the goal without mentioning the actual reasons. What makes it worse is that often it’s accompanied not by the notion “if you love X and Y then this is definitely a thing for you, otherwise you may want to skip it” but rather “if you don’t like it you’re a dumb bad person”. Thanks, I still remember a bit of Soviet Union to reject it at a visceral level.

So there you have it. Of course this effect is nothing new but I felt that for some reason I need to say it, so here it is.

Call for a new container format!

Friday, January 17th, 2025

Sometimes I remember that Matroska exists and today I also remembered how it came to existence. Its author proudly admits mixing all the buzzwords of Web 2.0 era like XML, Semantic Web etc etc and coming up with that format. Since we’re in Web 3.0 era we should have something more modern.

That is why I’m calling for a modern multimedia container format to supplant the outdated formats of the old. It should encompass all the features that make the modern Web great:

  • binary JSON as the backbone of the format;
  • central repository for the downloadable descriptions of the parts of the format (but not codecs themselves! Think of it as of MXF specification if it helps);
  • blockchain (as well as clusterchain and framechain);
  • metaverse integration;
  • decentralised storage (so that the container may refer to some data in the cloud as well as on the local disk; even MOV could do something like this);
  • and of course AI!

Some of you may ask where AI can be applied in this scenario. The answer is obvious—transforming input data for better compression (let alone generating metadata or enabling better integration with other Web 3.0 products). A good model should be able to do the same savings like Matroska did by e.g. shaving off common headers bytes from each frame but without special mapping. An excellent model may generate the content by the embedded description instead of transmitting AV2 video. And of course the central repository will contain the description of models and parameters to be used (in addition to the descriptions of better representation of container parts layout). The possibilities are limitless!

Proposals should be sent to the Alliance for Open Media , I have worse things to deal with.

On the sorry state of opensource multimedia

Wednesday, December 25th, 2024

I’ve been wanting to write this post for a long time, with a focus on the difference between hobby project and product and about NihAV only. But a recent FFdrama made me re-think both the structure and the conclusions.

Apparently there’s another surge of developer’s discontent in jbmpeg for having mushroom treatment (not for the first time and probably not for the last one). IMO they need to realize the project is as free and democratic as Soviet Union and you need simply to agree to the things proposed by the General Secretary (definitely not the leader)—that would save time and nerves of everybody involved. As I wrote countless times before, I do not fear for the future of that project as it can keep such existence indefinitely long and here I’ll try to present my reasons why.

First of all, revolution a la libav won’t work—Michael has learned the lesson and he won’t be kicked out again (not that it really worked in 2011 but now there are no chances for that).

Second, if you split out and form an alternative, it has not so many chances to replace it. And if you decide to write anything from scratch your chances are next to zero. The rest of this post is dedicated to answering why.

Recently I re-read The Mythical Man-Month which tells not only about the author’s experience designing RedHat OS/360 but also presents more general observations and ideas. And right in the beginning he talks about the difference between a program, a programming product, and a programming systems product. Essentially, a program something a programmer writes and that it works for him on his system; a programming product is a program with documentation and support; and a programming system product is that works as a component in a larger system. And moving from one stage to another requires an effort several times larger than the previous one (I’m simplifying a lot and probably misremember something—so you’d better read the original book, it’s a worthy reading anyway).

Here we have a similar situation: writing a tool just to do things for you is straightforward, even I have managed to do it with NihAV; making it into a product requires offering much wider support for different platform configurations (for example, my videoplayer has VA-API hardware decoding enabled by default while it’s not available, say, on Windows and you need to switch that feature off there in order to build it) and different features (e.g. nihav-encoder works for testing encoding per se, but lacks ability to encode input into a good intermediate format supported by other players and encoders). And it gets even worse if you try to make it into a library ready to be used by others—beside the usual things like documentation you’re expected to guarantee some API stability and a certain level of quality. So while I may not care that my app panics/crashes in certain circumstances, it’s significantly less forgivable for a library. And of course achieving such quality level requires a lot of unexciting work on small details. Debugging is even worse.

Suppose you decided to create a fork and work from that. Then you still have a much worse position—you may have the same codebase but there are no killer features you can offer and you don’t have recognition. libav managed to succeed for a while since it was supported by some distribution maintainers—and even then users complained because the de facto brand name was replaced with some unknown thing. And I guesstimate 40% of current jbmpeg developers contribute to it in order to upstream the changes they make while using it in their employer’s product or pipeline. So how can you convince those companies to use your fork instead? And that’s not taking patent situation into account which makes a substantial support from any large company for your project rather improbable.

Good thing I’ve never intended NihAV to be a competition, but what about other projects? rust-av died because of lack of interest (Luca claims that he started it mostly to learn Rust and see how performant it can get—mission accomplished, no further development required). librempeg fares better but I doubt that Paul wants to deal with all the demands that other parties make for the honour of your stuff being included into their distribution (or being used without even a credit).

Another thing that needs to mentioned is that multimedia is no longer an attractive field. Back when I started to dabble in the field, it was rather exciting: there were many different formats around—in active use as well, and people wanted to play them not only with the proprietary players. There were libraries and players supporting only a specific subset of different formats, like avifile or libquicktime or DVD-only player. Nowadays it’s usually a combination of H.26x+AAC in MP4 or VP9/AV1+Opus in WebMKV, all formats having specifications (unless you lack Swiss Francs to pay for the ones from ISO) and new formats are not introduced that often either. Of course, we might have H.267 standardised soon but who uses even H.266? When was the last time you heard AV2 development news? The codec was supposed to be released a couple of years ago, did I miss it along with AV3? Do you remember Ghost audio codec from Xiph? Of course Fraunhofer will keep extending AAC patent lifetime by inventing new formats and naming them like OMGWTFBBQ-AAC but who really cares?

That is why I believe that no matter how dysfunctional jbmpeg is, it will keep existing in this undead state indefinitely long as it’s good enough for the most users and there’s no compelling reason (e.g. new popular formats or radically different ways to process data) to switch to anything else. The only winning move is not to play.

To NIH or not to NIH

Sunday, December 22nd, 2024

Paul of librempeg fame informs me about his achievements occasionally (and in my turn I try to remind the world time from time that this project exists and may provide you functionality hardly found elsewhere, like various filters or console formats support). And his recent work was implementing inflate routine specifically for the multimedia needs. This made me think if it makes sense to have a custom implementation for deflate decompressor and packer in multimedia project when zlib exists and I think it makes perfect sense. Of course in NihAV I NIHed it because the project concept demands it and it was a nice exercise, but in more serious projects it makes sense too and below I’ll try to explain the reasons.

Zeroth of all, a quick reminder about flexibility. RFC 1951 merely specifies the format, so the implementations can output varying bitstreams that will correctly decompress the data. Back in the day when I worked on it I mentioned how you can compress data in different ways, dedicating more time to achieve better compression. And there are more tricks not mentioned there like parallel compression.

Now, the first reason why to have your own implementation is that you can adapt it to your custom needs. As Paul demonstrated, inflating data into a custom format might be beneficial. If all you need in 99% cases is unpacking data from one buffer into another or to a frame buffer (which has padding so you have to output, say, 27 bytes, then skip 5 bytes, output 27 bytes and so on) you can do without all additional functions and not bother with a sequence of calls to partially inflate data.

Then, there’s a question of consistency. You cannot be sure that a new version of zlib will produce the same output as its previous version (I vaguely remember that there was a small scandal when GitHub releases were re-generated using different deflate implementation and resulted in a lot of headache because of old archive hashes being no longer valid; or there’s a story of some Linux distros replacing zlib with zlib-ng resulting in failed tests; and even “no compression” format may change apparently). The case with liblzma is probably a good demonstration of other reasons why it’s not always wise to rely on third-party components.

And finally, you can not merely adapt interface to your needs, you can tune it to handle your data better too. There’s a reason why there exist compressors targeting e.g. genome data. So when you compress image data, it may be beneficial to search for matches around the position right above the current line first, and the presets for the compression levels may be tuned to the different sets of trade-offs. After all, deflate is often used in screen capture codecs where real-time performance is more important than the compression ratio. But who can imagine people tinkering with the encoder trying to improve its performance in a multimedia project?

I hope this helped to convince you that there are circumstances where NIHing something may prove worthy. As a rule of thumb, if it’s easier to implement yourself than to re-use an existing library then maybe you should do so. That it the right way, and the other way lies left-pad.

Some words about Alien Isolation CDA2

Wednesday, December 11th, 2024

Some of you might’ve heard about a Finnish adventure game called Alien Incident. Apparently it had a CD release with intro and final cutscenes re-done as an animation format. Of course that’s enough to draw my attention.

It turned out that it has several features making it one of the most advanced game formats: multiple soft subtitles and checksums for each frame. The file header is followed by the text block with subtitles in several languages that are rendered by the player over the video (and the font itself is RLE-compressed). Then there’s a table of 32-bit checksums for each frame, and only after that there’s frame size table followed by actual frame data.

Video is coded in 32×40 tiles with one of several coding modes: read full tile, update marked pixels in the tile, update 2×2 blocks in the tile, or update 4×4 blocks in the tile. That data is further compressed with slightly modified LZSS. Additionally frames carry audio data and some additional commands such as fading or setting frame duration. By default player operates on 70 or 75Hz clock and each frame is displayed for several ticks (usually 5-8). So a special command in the frame data tells player to display each frame for N ticks until further notice.

And now it is time for a rant. There is an issue uncovered by decoding these files. Both files are long (finale is over 11 minutes at 18.75 fps) and have lots of palette changes (because of both scene changes and fading)—and those two things helped uncover a problem with FFmpeg. Its AVI demuxer is the problem: it scans index, finds palette change chunks (which I explicitly mark with AVIIF_NO_TIME flag), adds them to the video stream statistics (despite the flag), concludes that video stream has significantly more frames than audio stream and switches to non-interleaved mode; in that mode it disregards actual index contents and treats palette change chunks as video data. Personally I don’t care because I have my own set of tools for decoding, transcoding or playing videos that does not have this problem, but considering that virtually every other piece of software uses libavformat for handling input data, that may pose a problem for everybody else (I can afford to not care but somebody else would have to change perfectly valid output just to work around third-party bug). This is a fun case demonstrating that monopoly is evil, even if it’s a monopoly of open-source software.

P.S. Probably it’s a good occasion to remind that librempeg exists and probably both it and you can benefit from your attention to it.

So long, USA, it was a disappointment knowing you

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

Woes of implementing MPEG-4 ASP decoder

Friday, 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.
(more…)