Search in sources :

Example 16 with DogArray_I16

use of org.ddogleg.struct.DogArray_I16 in project BoofCV by lessthanoptimal.

the class TestReedSolomonCodes_U16 method findErrorEvaluator.

private void findErrorEvaluator(DogArray_I16 syndromes, DogArray_I16 errorLocator, DogArray_I16 expected) {
    DogArray_I16 found = new DogArray_I16();
    var alg = new ReedSolomonCodes_U16(8, primitive8, 0);
    alg.findErrorEvaluator(syndromes, errorLocator, found);
    assertEquals(found.size, expected.size);
    for (int j = 0; j < found.size; j++) {
        assertEquals(found.get(j), expected.get(j));
    }
}
Also used : DogArray_I16(org.ddogleg.struct.DogArray_I16)

Example 17 with DogArray_I16

use of org.ddogleg.struct.DogArray_I16 in project BoofCV by lessthanoptimal.

the class TestReedSolomonCodes_U16 method findErrorLocatorPolynomialBM.

/**
 * Computed using a reference implementation found at [1].
 */
@Test
void findErrorLocatorPolynomialBM() {
    DogArray_I16 message = DogArray_I16.parseHex("[ 0x40, 0xd2, 0x75, 0x47, 0x76, 0x17, 0x32, 0x06, 0x27, 0x26, 0x96, 0xc6, 0xc6, 0x96, 0x70, 0xec ]");
    var ecc = new DogArray_I16();
    int nsyn = 10;
    DogArray_I16 syndromes = DogArray_I16.zeros(nsyn);
    var alg = new ReedSolomonCodes_U16(8, primitive8, 0);
    alg.generator(nsyn);
    alg.computeECC(message, ecc);
    message.data[0] = 0;
    alg.computeSyndromes(message, ecc, syndromes);
    DogArray_I16 errorLocator = new DogArray_I16();
    alg.findErrorLocatorPolynomialBM(syndromes, errorLocator);
    assertEquals(2, errorLocator.size);
    assertEquals(3, errorLocator.get(0));
    assertEquals(1, errorLocator.get(1));
    message.data[6] = 10;
    alg.computeSyndromes(message, ecc, syndromes);
    alg.findErrorLocatorPolynomialBM(syndromes, errorLocator);
    assertEquals(3, errorLocator.size);
    assertEquals(238, errorLocator.get(0) & 0xFF);
    assertEquals(89, errorLocator.get(1));
    assertEquals(1, errorLocator.get(2));
}
Also used : DogArray_I16(org.ddogleg.struct.DogArray_I16) Test(org.junit.jupiter.api.Test)

Aggregations

DogArray_I16 (org.ddogleg.struct.DogArray_I16)17 Test (org.junit.jupiter.api.Test)13 DogArray_I32 (org.ddogleg.struct.DogArray_I32)3