Giter Site home page Giter Site logo

Comments (8)

tomerfiliba avatar tomerfiliba commented on May 20, 2024

as i explained in the readme, i don't understand enough math to patch this myself. if you can send a working patch, i'll happily incorporate it in, but i can't do it (nor do i have the time) on my own.

in order to submit a patch, click "fork" on github repo, which will create a separate repo on which you can work. when you're done, create a pull request and send me the patch. it's very easy to do on github. see https://help.github.com/articles/using-pull-requests

from reedsolomon.

shuffle2 avatar shuffle2 commented on May 20, 2024

I have also noticed that reedsolo library is not working correctly. Codewords of size 9 (5 data+4 parity) and 62 (30 data+32 parity) seem to work ok. But for size 248 (216 data+32 parity), it fails. According to the readme this should still work, as it's under 255, no?
You can compare results with another library I've found to work on the large codeword size, if interested: http://rscode.sourceforge.net/ (requires NPAR=32 for the 216+32 configuration).

For me, I can just use rscode C library. But I thought I'd document the issue here.

edit:
for example, here is a log of codeword being decoded/corrected by rscode: http://pastie.org/9397876
reedsolo will just except with "Could not locate error" for this input data.

from reedsolomon.

morefigs avatar morefigs commented on May 20, 2024

Where exactly is it failing for you shuffle2? In my experience I could only encode 7-bit strings but could encode 8-bit (i.e. up to 255) byte arrays. Eg:

str_with_8_bit_chars = 'å˜ýþ'
RSCodec.encode(str_with_8_bit_chars)    # fails

str_as_bytearray = bytearray(str_with_8_bit_chars)
RSCodec.encode(str_as_bytearray)    # works

This is because the library attempts to convert any string into a 7-bit bytearray, but ignores it if it is already a bytearray.

Hope that helps with your issue.

from reedsolomon.

shuffle2 avatar shuffle2 commented on May 20, 2024

This is the same input codeword as previous pastie:

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from reedsolo import *
>>> codeword=open('codeword_248.bin','rb').read()
>>> import binascii
>>> binascii.hexlify(codeword)
b'430949cd403e238bc48ac5906474c30be37479a516ad5b2fc8867a18d3d2c689e1c9b76175f745fc23d8f5f1ab2d732ee226527f9cb7335596311a7c3e8d61e28565fb32fb77aceb2062
47c8710ba154a36e1f31c4953abd4ec1bea560c8254d9c7d9e82709cd8cf5a830b2fbff21e60dc619e4aff7f0ad40948dc5a2478c378d37868c78704fec69cb4007bb8dcc3b8d44b680691
2de45cc221435c1eea73588758302b6753a9f6d82f5cc774312f28803e67cd421c17bf721bbd231f8584ec6c9e32748de78104c78996cd56a08a390e73e75ad4ab902f6d7eeb8858a8e7c4
d215a52687c3c4c5e04aeb8f997bdd8a284b82aa31b49618'
>>> RSCodec(32).decode(codeword)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python34\lib\site-packages\reedsolo.py", line 251, in decode
    dec.extend(rs_correct_msg(chunk, self.nsym))
  File "c:\Python34\lib\site-packages\reedsolo.py", line 213, in rs_correct_msg
    raise ReedSolomonError("Could not locate error")
reedsolo.ReedSolomonError: Could not locate error
>>> RSCodec(32).decode(bytearray(codeword))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python34\lib\site-packages\reedsolo.py", line 251, in decode
    dec.extend(rs_correct_msg(chunk, self.nsym))
  File "c:\Python34\lib\site-packages\reedsolo.py", line 213, in rs_correct_msg
    raise ReedSolomonError("Could not locate error")
reedsolo.ReedSolomonError: Could not locate error
>>> binascii.hexlify(RSCodec(32).encode(codeword[:216]))
b'430949cd403e238bc48ac5906474c30be37479a516ad5b2fc8867a18d3d2c689e1c9b76175f745fc23d8f5f1ab2d732ee226527f9cb7335596311a7c3e8d61e28565fb32fb77aceb2062
47c8710ba154a36e1f31c4953abd4ec1bea560c8254d9c7d9e82709cd8cf5a830b2fbff21e60dc619e4aff7f0ad40948dc5a2478c378d37868c78704fec69cb4007bb8dcc3b8d44b680691
2de45cc221435c1eea73588758302b6753a9f6d82f5cc774312f28803e67cd421c17bf721bbd231f8584ec6c9e32748de78104c78996cd56a08a390e73e75ad4ab902f81dae140d009d66f
4fd563d944b519db601a89bf52f73a8a55505331b41e4381'
>>> binascii.hexlify(RSCodec(32).encode(codeword[:216])[216:])
b'81dae140d009d66f4fd563d944b519db601a89bf52f73a8a55505331b41e4381'
>>> binascii.hexlify(codeword[216:])
b'6d7eeb8858a8e7c4d215a52687c3c4c5e04aeb8f997bdd8a284b82aa31b49618'

It should decode correctly with errors in one byte and no erasures.

from reedsolomon.

shuffle2 avatar shuffle2 commented on May 20, 2024

At this point, I'm seeing strange behavior with rscode as well :(
If I decode the codeword, it will correct one byte and indicate success. If I try to decode this "corrected" value, it will fail. If I take the "corrected" bytes and re-encode, a different parity buffer is generated (also differs from the one generated by reedsolo).

Nothing makes sense! :(

from reedsolomon.

morefigs avatar morefigs commented on May 20, 2024

Shit, another programmer lost to reed solomon madness...

from reedsolomon.

shuffle2 avatar shuffle2 commented on May 20, 2024

mmmph, my comments here can be ignored. Turns out I was generating some data incorrectly, and the codewords with higher parity:data ratio could of course correct my bad data, while the larger codewords had too much bad data (and I wasn't using erasures).
Works now :)
Related: I do wish using erasures with this library were more obvious though - didn't realize it was supported until I started inserting debug print()s in the code.

from reedsolomon.

lrq3000 avatar lrq3000 commented on May 20, 2024

If you still experience an issue, please try the new release, it has been thoroughly unit tested, or else if it's ok now, please close this thread :)

from reedsolomon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.