-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverse engineering the MQA decoder #4
Comments
Από ότι ξέρω, Roon comes with a built-in MQA decoder. If Roon is written in .NET (I think, it might be), it'd launch the RoonInstaller64.exe via Sandboxie to grab all the files from it—or I would even try just unzipping it with a tool like 7Zip. I would then use a tool like ILSpy to decompile the .NET libraries into C# and look around... |
Yes roon is in .NET. I have decompiled it with dotPeek and didn't found something. Although my C# knowledge stops when the # starts so there might be more there. I would guess maybe in some of the Roon.Audio.***.dll. There is also Audirvana - it's a UWP application. |
MQA (the company) should at least make some parts open source... |
I don't find a good reason why they would :P |
At least the way of identifying an MQA from an MQA |
Even giants like Microsoft started embracing open-source one way or the other; being completely closed-source is a dead-end as history shown us... Still, YMMV. |
To be clear, I'm a huge fan of MQA.— (Τελεία και παύλα.) But I believe MQA (the company) should release the base codec as open-source, while keep the MQA Studio™ one internal to be used only in authorized mastering studios. They way they set it up right now, makes it impossible for an open-source community of developers and enthusiasts to evolve... |
@moodmosaic Please stay on topic. The issue here is to reverse engineer the mqa soft decoder, not a forum to discuss what MQA has to do. |
EDIT: Removed after reading RoonLabs' ToS 😛 |
from: https://patentimages.storage.googleapis.com/70/18/e6/c2b80f8d65bebf/WO2013186561A2.pdf FIG 7.B seems to be MQA decoders path The noise shaped joiner is described at |
It seems, MQA format is very similar it's predecessor MLP (Meridian Lossless Packing) and Dolby TRUE-HD. So libffmpeg possibly has done some work for us. For example, sample rate identification, seems to be very similar indeed. static inline int mlp_samplerate(int in) {
if (in == 0xF)
return 0;
return (in & 8 ? 44100 : 48000) << (in & 7) ;
} MQA (pour-me implementation): uint32_t OriginalSampleRateDecoder(unsigned c) {
const uint32_t base = (c & 1u) ? 48000 : 44100;
const uint32_t multiplier = 1u << (((c >> 3u) & 1u) | (((c >> 2u) & 1u) << 1u) | (((c >> 1u) & 1u) << 2u));
return base * multiplier; |
Could that be the reason why there are articles around like this one? (Although this one uses sox instead.) |
I don't think so. Probably the mqa dithering helps the resampling a bit. From what I read on the above paper there is no upsampling at all, the lower bits produce a higher frequency content of (17.5bits) and then they are interleaved together. But he is right Auralic probably does. Probably chi-fi marketing |
Sync header for MLP: XORing gives you the header (like MQA 😏) Probably have to rethink MQA sync word size. I don't like the 36bits EDIT: MQA like TRUE-HD doesn't have 2 substreams - so safe to assume those blocks are gone (#sad #prayforsubstream1) |
I just realised the tidal app ships with the debug .pbd file, lol thank you electorn. |
I'm trying to find if there there is a given length for each subframe of the stream. Does seem to. Track 1 (2L-048_14_stereo.mqa.flac)Original FS: 96000
Samples where MQA subframe starts: [ 4 15905 73232 79335 137827 143779 203927 209378 269233 275177
334561 340281 399310 405649 464483 471042 529811 535667 595132 601211
660267 666444 725456 731087 791141 797541 857111 863396 922459 928899]
Differences
---- 15901
---- 57327
---- 6103
---- 58492
---- 5952
---- 60148
---- 5451
---- 59855
---- 5944
---- 59384
---- 5720
---- 59029
---- 6339
---- 58834
---- 6559
---- 58769
---- 5856
---- 59465
---- 6079
---- 59056
---- 6177
---- 59012
---- 5631
---- 60054
---- 6400
---- 59570
---- 6285
---- 59063
---- 6440 Track 2 (2L-125_04_stereo.mqa.flac)Original FS: 352800
[ 4 15878 72298 78183 138765 144072 203166 208797 269184 274366
334482 340218 399953 406001 465215 470758 529955 536196 595164 601340
660397 665867 726461 731934 791803 797558 857169 862727]
---- 15874
---- 56420
---- 5885
---- 60582
---- 5307
---- 59094
---- 5631
---- 60387
---- 5182
---- 60116
---- 5736
---- 59735
---- 6048
---- 59214
---- 5543
---- 59197
---- 6241
---- 58968
---- 6176
---- 59057
---- 5470
---- 60594
---- 5473
---- 59869
---- 5755
---- 59611
---- 5558 |
Seems there are some stuff there 😉. |
After cloning, you need to acquire the |
|
Yeah using shared libraries doesn't seem very legal 😬. I had mostly accuired what the above repo does, so I won't need to troubleshoot them I guess. I just need to write them in c++, 'cause I was using python for bootstrapping. @ValZapod 🙂. They put it inside a zip file, for safety. |
Any progress? |
I don't have much time to work on it :(. Although there is some progress :P |
btw: Should this ever be finished, or someone know some other opensource decoder for MQA, than it would be nice if note could be given to https://trac.ffmpeg.org/ticket/6158 . |
Can someone explain what "noise shaped joiner" means here? I'd like to help reverse this format but I'm not completely sure how this "folding" works quite yet. |
maybe run it in a docker with older glibc versions |
Don't know - just a suggestion |
As far as I know 44.1/48K sample rates are unfolded to 88.2 and 96K respectively |
OK guys, Newb here so please be cruel...... I haven't tried any of the decoding MQA programs yet but I am looking for a solution to what feels like and upcoming end to MQA altogether. Recent news has been popping up about MQA going into receivership, with either a buyout or IP being bought and sold into pieces.. I have used TIDAL exclusively for 5 years now and love it. This must be the FPGA/ARM7 whatever chip utilized, doing some form of Blackbox magic decoding. The mysterious further unfolds..... So I am trying to find a way to preserve my MQA experience for a long time in the case MQA brand goes bye-bye, Tidal stops supporting it or as many users have found, titles appear then disappear in Master Quality. So Capture is high on my list of priorities. Solution 1. Solution 2. Solution 3. Note: Yes I know I am suggesting Piracy and copyright infringements. But I don't want to lose one of the small pleasures I have. |
Firstly, this project is only for educational purposes. Please read GitHub Terms and conditions. |
Sorry I should have explained that my whole intention was to help in the reverse/engineering process. I have done a fair bit of research into DSP algorithms, though what MQA have done is something very clever, by separating the algorithm into two parts, one is the software through the player, the second is the DAC/FPGA. So as far as I have reached out the DAC/FPGA is only given out to licensed companies. I couldn't use the student studying DSP card to pull any strings. So I sort of gave up. The chips being used are well known and each company publicizes them (almost too much) so the consumer knows they are getting the newest/fastest/best DAC currently on the market. But in schematics I have seen prior to the DAC (or in some cases multiple DAC chips) there is another chip running hardware/software unfolds. I will leave the software parts to people better than me at that, though has anyone got any leads into the FPGA/hardware coding to use for testing/research/development. I am not looking at copyright infringements. |
Topic for Reverse engineering the MQA decoder and maybe a (virtual) renderer.
The text was updated successfully, but these errors were encountered: