Reed-Solomon Decode
Pull clean bytes out of corrupted data
- data
- decoded_msg
- msg_with_code
- errata_pos_list
ReedSolomonDecode is the recovery half of the pack's error-correction pair. Where ReedSolomonEncode appends redundancy to your bytes, this node takes data that has been mangled - symbols flipped by a noisy channel, a lossy embedding, a damaged image region - and reconstructs the original message, if enough of the code survived. It's the node that makes the "hide a message in an image, extract it, still have it intact" workflow actually work.
It's a thin wrapper around reedsolo's RSCodec.decode(), so the heavy lifting is a well-tested library, not hand-rolled crypto-adjacent code. Here's the deal on how much damage it can fix: with n error-correction symbols, the decoder recovers from up to n/2 corrupted symbols when it doesn't know where the errors are. But if you do know where the damage is - a specific list of positions - each known position ("erasure") only costs one symbol, so the same n handles up to n erasures. That's the whole game with Reed-Solomon: knowing where the errors are doubles your budget.
Inputs:
- data - the possibly-corrupted bytes (BYTESLIKE).
- ecc_symbols - the number of error-correction symbols the data was encoded with. This must match the encode side exactly; too low and decoding fails, too high and it fails differently.
- erase_pos (optional) - a comma-separated list of positions where you know the errors are, if you have that information. It's free power when you can provide it.
Outputs are three, which is where this node earns its keep:
- decoded_msg - the recovered original message bytes. This is the one you care about.
- msg_with_code - the corrected message plus its code symbols, i.e. the data after repair.
- errata_pos_list - the positions that were corrected. The pack returns this as BYTESLIKE, which is a quirk of how it's wired (it's really a list of integers being carried as bytes) - don't try to read it as text. Its real use is introspection: you can see exactly where damage happened.
Install: ComfyUI Manager → "ComfyUI ARG Toolkit" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI; it's under ARG Toolkit/Utilities/Error Correction. No model downloads; reedsolo comes with the pack.
The two failure modes to know. If ecc_symbols doesn't match what was encoded, decode raises a Reed-Solomon error rather than quietly producing garbage - which is actually the friendly behavior, it tells you something's off. And if corruption exceeds the n/2 budget and you didn't supply erasures, it also fails; that's the signal to go back and increase ecc_symbols on the encode side, or figure out the error positions and feed them to erase_pos.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| data | BYTESLIKE | The data to run through the error-correction algorithm. | |
| ecc_symbols | INT | The amount of error-correction symbols to insert into the data. | |
| erase_posopt | STRING | If you know the exact positions of the errors, type them here in a comma-separated list. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| decoded_msg | BYTESLIKE | — |
| msg_with_code | BYTESLIKE | — |
| errata_pos_list | BYTESLIKE | — |