Densely packed decimal (DPD) to decimal For nandgame fans: Please try out DPD to decimal in logic gates too!


Background

Densely packed decimal (DPD) is a way to efficiently store decimal digits in binary. It stores three decimal digits (000 to 999) in 10 bits, which is much more efficient than naive BCD (which stores one digit in 4 bits).

Notations


The lowercase letters a to i are the bits that are copied to the decimal representation.
0 and 1 are the exact bits in the input or output bit patterns.
x bits are ignored in the conversion.


Conversion table

The following is the conversion table from 10 bits of DPD to three decimal digits. Each decimal digit is represented as 4-bit binary (BCD). Both sides are written left to right from the most significant digit to the least.

Bits                 =&gt;  Decimal         (Digit range)
a b c d e f 0 g h i  =&gt;  0abc 0def 0ghi  (0-7) (0-7) (0-7)
a b c d e f 1 0 0 i  =&gt;  0abc 0def 100i  (0–7) (0–7) (8–9)
a b c g h f 1 0 1 i  =&gt;  0abc 100f 0ghi  (0–7) (8–9) (0–7)
g h c d e f 1 1 0 i  =&gt;  100c 0def 0ghi  (8–9) (0–7) (0–7)
g h c 0 0 f 1 1 1 i  =&gt;  100c 100f 0ghi  (8–9) (8–9) (0–7)
d e c 0 1 f 1 1 1 i  =&gt;  100c 0def 100i  (8–9) (0–7) (8–9)
a b c 1 0 f 1 1 1 i  =&gt;  0abc 100f 100i  (0–7) (8–9) (8–9)
x x c 1 1 f 1 1 1 i  =&gt;  100c 100f 100i  (8–9) (8–9) (8–9)


Task

Convert 10 bits of DPD to 3 digits of decimal.

Test cases

DPD           Decimal
0000000101    005
0001100011    063
0001111001    079
0000011010    090
0001011110    098
1010111010    592
0011001101    941
1100111111    879
1110001110    986
0011111111    999
1111111111    999  * Output is same regardless of the `x` bits


Input

The default input format is a list of 10 bits. The bits should follow the exact order above, or the reverse of it. You may choose to use an equivalent string or integer representation instead. Unlike my other challenges, reordering or using nested structures is not allowed.

For the input [1, 1, 0, 0, 0, 1, 0, 1, 0, 0], the following formats are allowed:


List of bits: [1, 1, 0, 0, 0, 1, 0, 1, 0, 0]
String: "1100010100"
Binary integer: 788 or 0b1100010100
Decimal integer: 1100010100
Reversed: [0, 0, 1, 0, 1, 0, 0, 0, 1, 1] and reversed in any other formats above


The following formats are NOT allowed:


Arbitrary reordering of bits: [0, 0, 0, 0, 0, 1, 1, 1, 0, 1]
Nested structures: [[1, 1, 0], [0, 0, 1], [0, 1, 0, 0]] or [0b110, 0b001, 0b0100]


Output

The default output format is a list of 3 decimal digits. Each digit should be represented as 0 to 9, either an integer or a character. As in input, you can choose string or integer representation. If you choose integer representation, leading zeroes can be omitted.

Scoring &amp; winning criterion

Standard code-golf rules apply. The shortest program or function in bytes for each language wins.
JavaScript (ES6), 112 bytes
All credit for this shorter version goes to @nwellnhof.
Takes input as an integer. Returns an array of three decimal digits.
n=&gt;[(x=n&gt;&gt;4,y=x&gt;&gt;3,q=n/2&amp;55,p=q%8)&gt;5&amp;&amp;q-39?8|y&amp;1:y,(p&amp;5^5?x&amp;6:q-23?8:y&amp;6)|x&amp;1,(p&lt;5?p*2:p&lt;6?x&amp;6:p%q&lt;7?y&amp;6:8)|n&amp;1]

Try it online!

JavaScript (ES6), 118 117 bytes
Takes input as an integer. Returns an array of three decimal digits.
n=&gt;[(x=n&gt;&gt;4&amp;7,y=n&gt;&gt;7,p=n/2&amp;7)&gt;5&amp;&amp;p&lt;7|x/2^2?8|y&amp;1:y,(p&lt;7?p-5?x:8:x/2^1?8:y&amp;6)|x&amp;1,(p&lt;5?p*2:p&lt;6?x&amp;6:p&lt;7|x&lt;2?y&amp;6:8)|n&amp;1]

Try it online!
How?
Instead of trying to apply the 'official' algorithm, this code is based on some kind of reverse-engineering of the patterns that can be found in the expected results.
Given the input integer \$n\$, we compute:
$$\begin{align}&amp;x=\left\lfloor\frac{n}{16}\right\rfloor \bmod 8\\
&amp;y=\left\lfloor\frac{n}{128}\right\rfloor\\
&amp;p=\left\lfloor\frac{n}{2}\right\rfloor \bmod 8\end{align}
$$
Example: first digit (hundreds)
x     | 0                | 1                | 2                | 3               
n &amp; 1 | 0101010101010101 | 0101010101010101 | 0101010101010101 | 0101010101010101
p     | 0011223344556677 | 0011223344556677 | 0011223344556677 | 0011223344556677
------+------------------+------------------+------------------+-----------------
y = 0 | 0000000000008888 | 0000000000008888 | 0000000000008888 | 0000000000008888
y = 1 | 1111111111119999 | 1111111111119999 | 1111111111119999 | 1111111111119999
y = 2 | 2222222222228888 | 2222222222228888 | 2222222222228888 | 2222222222228888
y = 3 | 3333333333339999 | 3333333333339999 | 3333333333339999 | 3333333333339999
y = 4 | 4444444444448888 | 4444444444448888 | 4444444444448888 | 4444444444448888
y = 5 | 5555555555559999 | 5555555555559999 | 5555555555559999 | 5555555555559999
y = 6 | 6666666666668888 | 6666666666668888 | 6666666666668888 | 6666666666668888
y = 7 | 7777777777779999 | 7777777777779999 | 7777777777779999 | 7777777777779999

x     | 4                | 5                | 6                | 7               
n &amp; 1 | 0101010101010101 | 0101010101010101 | 0101010101010101 | 0101010101010101
p     | 0011223344556677 | 0011223344556677 | 0011223344556677 | 0011223344556677
------+------------------+------------------+------------------+-----------------
y = 0 | 0000000000008800 | 0000000000008800 | 0000000000008888 | 0000000000008888
y = 1 | 1111111111119911 | 1111111111119911 | 1111111111119999 | 1111111111119999
y = 2 | 2222222222228822 | 2222222222228822 | 2222222222228888 | 2222222222228888
y = 3 | 3333333333339933 | 3333333333339933 | 3333333333339999 | 3333333333339999
y = 4 | 4444444444448844 | 4444444444448844 | 4444444444448888 | 4444444444448888
y = 5 | 5555555555559955 | 5555555555559955 | 5555555555559999 | 5555555555559999
y = 6 | 6666666666668866 | 6666666666668866 | 6666666666668888 | 6666666666668888
y = 7 | 7777777777779977 | 7777777777779977 | 7777777777779999 | 7777777777779999

Algorithm:

If \$p&lt;6\$, we have \$d=y\$
If \$p=6\$, we have \$d=8+(y\bmod2)\$
If \$p=7\text{ AND }(x&lt;4\text{ OR }x&gt;5)\$, we have \$d=8+(y\bmod2)\$
If \$p=7\text{ AND }(x=4\text{ OR }x=5)\$, we have \$d=y\$

As JS code:
p &gt; 5 &amp;&amp; p &lt; 7 | x / 2 ^ 2 ? 8 | y &amp; 1 : y