I've found the source codes for HDCD "on-the-fly" decoder for foobar2000 in the net.
The VC++ project home is there:
https://gitlab.kode54.net/kode54/foo_hdcd/tree/master
(Copyright (C) 2007 Christopher Key, 2010 Chris Moeller, 2012 Gumboot).
The "hdcd_decode.c" sorce code contains a plain C implementation of HDCD decode process (so it can be compiled/ported to Linux),
while the rest sources implements wrapping it into (Windows) Foobar's plugin API interface.
So please, reuse this code for RuneAudio audio stream proccessing, i.e. transparent detection/reconstruction of 20bit(24bit) output PCM stream from 16bit hdcd-encoded PCM stream,
As we (audiophiles) need every hidden bit to be unvelied

You should not even reverse engineering something (it's done by Christopher Key), just learn the source code and reuse it