func ExtractDibits(bits []byte) ([]int8, error) {
	if len(bits) != dmr.InfoBits {
		return nil, fmt.Errorf("trellis: expected %d bits, got %d", dmr.InfoBits, len(bits))
	}
	var dibits = make([]int8, 98)
	for i := 0; i < 196; i += 2 {
		o := i / 2
		switch {
		case bits[i] == 0 && bits[i+1] == 1:
			dibits[o] = 3
			break
		case bits[i] == 0 && bits[i+1] == 0:
			dibits[o] = 1
			break
		case bits[i] == 1 && bits[i+1] == 0:
			dibits[o] = -1
			break
		case bits[i] == 1 && bits[i+1] == 1:
			dibits[o] = -3
			break
		}
	}
	return dibits, nil
}
ExtractDibits extracts dibits from bits.
package trellis
import (
	"errors"
	"fmt"
	"github.com/pd0mz/go-dmr"
)
var (
	interleaveMatrix = []uint8{
		0, 1, 8, 9, 16, 17, 24, 25, 32, 33, 40, 41, 48, 49, 56, 57, 64, 65, 72, 73, 80, 81, 88, 89, 96, 97,
		2, 3, 10, 11, 18, 19, 26, 27, 34, 35, 42, 43, 50, 51, 58, 59, 66, 67, 74, 75, 82, 83, 90, 91,
		4, 5, 12, 13, 20, 21, 28, 29, 36, 37, 44, 45, 52, 53, 60, 61, 68, 69, 76, 77, 84, 85, 92, 93,
		6, 7, 14, 15, 22, 23, 30, 31, 38, 39, 46, 47, 54, 55, 62, 63, 70, 71, 78, 79, 86, 87, 94, 95,
	}
	encoderStateTransition = []uint8{
		0, 8, 4, 12, 2, 10, 6, 14,
		4, 12, 2, 10, 6, 14, 0, 8,
		1, 9, 5, 13, 3, 11, 7, 15,
		5, 13, 3, 11, 7, 15, 1, 9,
		3, 11, 7, 15, 1, 9, 5, 13,
		7, 15, 1, 9, 5, 13, 3, 11,
		2, 10, 6, 14, 0, 8, 4, 12,
		6, 14, 0, 8, 4, 12, 2, 10,
	}
)
func Decode(bits []byte, bytes []byte) error {
	if bytes == nil {
		return errors.New("trellis: bytes can't be nil")
	}
	if len(bytes) < 18 {
		return fmt.Errorf("trellis: need buffer of at least 18 bytes, got %d", len(bytes))
	}
	dibits, err := ExtractDibits(bits)
	if err != nil {
		return err
	}
	deinterleaved, err := Deinterleave(dibits)
	if err != nil {
		return err
	}
	points, err := ConstellationPoints(deinterleaved)
	if err != nil {
		return err
	}
	tribits, err := ExtractTribits(points)
	if err != nil {
		return err
	}
	binary, err := ExtractBinary(tribits)
	if err != nil {
		return err
	}
	copy(bytes, dmr.BitsToBytes(binary))
	return nil
}