# Help: need Reed-Solomon C++ code for RS(4, 2) and RS(24, 20) on 6 bit symbols

Started by August 20, 2004
```You may guess i'm trying to correct CD subcodes R-W in software.
Symbols are 6 bits each.

I've seen the code here: http://www.eccpage.com/rs.c
and a lovely explaination here:
http://www.4i2i.com/reed_solomon_codes.htm

my problem is, with s=6 (mm in the aforementioned code) that means my
data n is 63 symbols long.  but it's not, it's explicitly 4 symbols
long, with 2 parity symbols (t = 1, k = 2).

the other solution i need deals with 24 symbols with t=2 (4 symbols of
parity, 20 of data)

I heard something about just rounding up to the next table size and
throwing out the unneded extras.  Is that the way to go?  What am I
missing?  how can you have n=4 when N must be 2**s-1 which always
yields an odd number?

Confused in CD+G land
david

my real email is quote me at davecotter dot com unquote
```
```"Lazarus I. Long" <me@lazilong.com> wrote in message

> my problem is, with s=6 (mm in the aforementioned code) that means my
> data n is 63 symbols long.  but it's not, it's explicitly 4 symbols
> long, with 2 parity symbols (t = 1, k = 2).
>
> the other solution i need deals with 24 symbols with t=2 (4 symbols of
> parity, 20 of data)
>
> I heard something about just rounding up to the next table size and
> throwing out the unneded extras.  Is that the way to go?  What am I
> missing?  how can you have n=4 when N must be 2**s-1 which always
> yields an odd number?

You are dealing with *shortened* codes.  A (4,2) RS with 6-bit symbols
is just a (63, 61) RS code in which the first 59 data symbols are set to 0
(that is, each of these 59 six-bit symbols is 000000).  If you have a
program
to encode/decode the (63, 61) code, it will encode/decode the (4,2) code as
well if you set the first 59 data/received symbols to 0.  If you delve into
the
details of the software, you will find that the program spins its wheels
while
it is processing the first 59 zeroes.  In  short, some re-programming
(having
some for-loops run for 4 instead of 61 iterations) will save a lot of time.

Hope this helps.

```