SMPTE / st299-1

ST 299-1:2009 - SMPTE Standard - 24-Bit Digital Audio Format for SMPTE 292 Bit-Serial Interface
Other
1 stars 0 forks source link

ST 299 - BCH polynomial #3

Open kierank opened 3 years ago

kierank commented 3 years ago

How on earth do you actually implement this from the equations? Clearly everyone has just gone and implemented the circuit diagram example. Is this even a mathematically correct BCH polynomial (probably not).

mrmxf commented 2 years ago

Software forms of BCH coding certainly exist. An internet search will show many examples, though not necessarily the specific code used in ST 299-1.

In regards to the validity of the equation, it appears valid, and to match the informative circuit diagram. However I have not implemented this specific code and we would need to consult with other experts to validate that the equation implements the code as described (a BCH(31,25) code). Given numerous ST 299-1 implementations over the years I would have relatively high confidence that it is valid and correct.

The use of the ST 299-1 ECC bits in real world products is another issue. My reading of the standard is that the ECC bits are required to be in the bitstream and set according to the equations but there is no requirement on receiving devices to use them. It is likely or at least possible there are receiving devices that ignore them, which makes it possible some generating devices do not set them, though I would read that as not compliant with the standard.

kierank commented 2 years ago

To avoid anyone else wasting time trying to implement the maths then giving up and reverse engineering the circuit diagram here is the C code we used.

    for (int i = 0; i < 48; i += 2) {
        const uint8_t in = ecc[0] ^ (dst[i] & 0xff);
        ecc[0] = ecc[1] ^ in;
        ecc[1] = ecc[2];
        ecc[2] = ecc[3] ^ in;
        ecc[3] = ecc[4] ^ in;
        ecc[4] = ecc[5] ^ in;
        ecc[5] = in;
    }

It is unclear whether this is a valid BCH polynomial that a software library can generate