You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GF2int is a a global singleton and does not allow multiple RSCoder instances with different field generator polynomials.
import unireedsolomon as rs
def codeword_symbols(msg):
return [ord(c) for c in msg]
def find_generator(rscoder):
""" Returns the generator polynomial of an RSCoder class """
msg = [0]*(rscoder.k - 1) + [1]
degree = rscoder.n - rscoder.k
codeword = rscoder.encode(msg)
# look at the trailing elements of the codeword
return codeword_symbols(codeword[(-degree-1):])
rs4 = rs.RSCoder(15,11,generator=2,prim=0x13,fcr=0,c_exp=4)
print "g4(x) = %s" % find_generator(rs4)
encmsg15 = codeword_symbols(rs4.encode([1,2,3,4,5,6,7,8,9,10,11]))
print "RS(15,11) encoded example message from BBC WHP031:\n", encmsg15
rs8 = rs.RSCoder(255,239,generator=2,prim=0x11d,fcr=0,c_exp=8)
print "g8(x) = %s" % find_generator(rs8)
encmsg15 = codeword_symbols(rs4.encode([1,2,3,4,5,6,7,8,9,10,11]))
print "RS(15,11) encoded example message from BBC WHP031:\n", encmsg15
rs4 = rs.RSCoder(15,11,generator=2,prim=0x13,fcr=0,c_exp=4)
encmsg15 = codeword_symbols(rs4.encode([1,2,3,4,5,6,7,8,9,10,11]))
print "RS(15,11) encoded example message from BBC WHP031:\n", encmsg15
# Initialize the look-up tables for logarithm and anti-log
init_lut(generator=generator, prim=prim, c_exp=self.gf2_c_exp)
Bad.
jason-s
changed the title
Multiple RSCoder instances appear to share state somewhereGF2int is a a global singleton and does not allow multiple RSCoder instances with different field generator polynomials.
Jun 11, 2018
jason-s
changed the title
GF2int is a a global singleton and does not allow multiple RSCoder instances with different field generator polynomials.
GF2int is a a global singleton and does not allow multiple RSCoder instances with different field generator polynomials.
Jun 11, 2018
@jason-s Yes this is a leftover of the original implementation that I did not make. I can't remember exactly why I did not factor this directly into the RSCoder class, but I think I tried and it led to duplicated code and a performance drop...
Anyway, this library is mostly for educational usage, as I think the object-oriented approach is more intuitive to tackle error correction codes. If you want a library for practical use, with good enough (for a pure python) performances and the possibility to use multiple codecs at the same time, you can checkout this library that share the exact same features as unireedsolomon:
GF2int
is a a global singleton and does not allow multiple RSCoder instances with different field generator polynomials.results in:
The text was updated successfully, but these errors were encountered: