Since I can’t do anything about the world largest countries run by over 70-year old dictators, I try to find a distraction elsewhere. It usually works only until the next time I read next. Anyway, here’s something different for a change.
With all the work on na_game_tool
I’ve been mostly neglecting the original NihAV
(not that it makes much difference). So I’ve tried to improve it a bit and I have something to report.
First of all, I decided to make ARMovie support more complete (after discovering that e.g. the only thing that can play Eidos Escape 122 codec is their own DOS player). So I’ve added all three video codecs with known samples (Escape 122, 124 and 130) as well as their ADPCM codec. Sadly Escape 122 description in The Wiki is somewhat unclear, so I referred to the original DOS player for it. Similarly I looked at ADPCM decoding because what libavcodec
produces is not quite right (but I guess Paul can tell you more stories about all those IMA ADPCM flavours). So I guess now my project has the most complete ARMovie formats support out there. There’s only one other third-party format I’m aware of (The Complete Animation film, it may be stand-alone or encapsulated in RPL) and I might get to it eventually.
The other thing is TrueMotion S. When you think there’s nothing unknown left about it, it manages to surprise you anyway. So I was looking at Discmaster search results for potential candidates (“aviAudio” is a good format for that—sometimes it is really AVI with audio track only, sometimes it is AVI with unknown video codec) and found three .duk
files that were TM1 in AVI and which could not be decoded. It turned out to use codebook 0—which is not present in the open-sourced version of the decoder. Another thing is that it does not use so-called fat deltas (i.e. larger difference values), so code zero means eight zeroes instead of an escape value. Remarkably, this is demo of The Horde game by Toys For Bob, known to employ yet another exotic version of the codec in their 3DO version of Star Control II. It makes me wonder if they had the same relationship with Duck as JVC NWC with RAD (you know, the company which released a game with Bink-b videos not found anywhere else and bundling Bink-d decoder with one of their other games—all while others started with Bink-f or later).
Hopefully I’ll be able to do more in the future, but I wanted to share these stories while they’re still fresh.
for adpcm issue you mean usage of multiplications in expand nibble instead of jumps for 4bit cases?
if yes, I’m already aware of that issue, trying to find codecs that actually use multiplications.
the decoded errors/artifacts are not that easy detectable, on average error is bellow -40dB.
at least 2, 3, and 5 bits in adpcm ima wav variants are already fixed.
Yes and no.
Old implementations used bit-testing plus shifts since multiplication was too expensive—but it results in the same output.
Here it’s rather
(2 * delta + 1) * step >> 1
versusdelta * step
.And I was alluding to the fact that you’ve REd lots of variations of IMA ADPCM with various small differences.
Unfortunately it can not give same output, it should be same as qt expand nibble as in libavcodec’s adpcm decoder code.
In that particular case the formula was
step * diff >> 2
whilelibavcodec
uses((2 * diff + 1) * step) >> 6
.But as you could see for yourself, there are too many ways to do it and you have to refer to the (binary) specification when possible.
Yes, for rpl/escape variant multiplication is correct as you found out, but for ADPCM IMA WAV its not, and probably for others too.
Indeed, I’ve quickly looked into the original
imaadp32.acm
and it uses the same method as QT (adding shifted differences).In theory it should give the same result though…
How so? The order of shifts is reversed, no?
If you find faster incarnation with bit-exact output keep me in touch!
I tried to git checkout git://git.nihav.org/nihav.git and your other NihAV repos but they failed with ‘fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.’
Yes, this is a known issue. Apparently you can still download source snapshots via gitweb. Or the bundles as described in https://codecs.multimedia.cx/2024/11/technical-nihav-repository-snapshots-are-available-over-https/
Mind you, currently it’s not very suited for exporting exotic formats it can decode. I intend to work on that (eventually).