The data would need to be interpreted in row-major order to match my comment above instead of column-major as you have. But here's an example with your particular tag.
For CH0 counts:
gain(0, 1) = 30/740 = 0.04
gain(1, 1) = 740/740 = 1.00 (by definition, a band has gain 1 wrt. itself)
gain(2, 1) = 12363/740 = 16.70
gain(3, 1) is unknown, as the data is saturated for a 10-bit sensor represented on 16-bit values (count at
(2**10-1)*2**6 ). Also note the choice of
reference_gain is arbitrary as long as you keep the same reference everywhere.
The same computations would need to be performed for every band (Green, Red, Red edge, NIR) and channel (here I omitted CH1 counts for simplicity)