Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6689 Discussions

Bug? Reed-Solomon ippsRSEncode works in IPP version 6 but not in version 7


I have tried to use your Reed-Solomon functions. This has not been easy (and I may have it wrong) because there are no examples or detailed descriptions of how to form the Galois field, etc. -- so please excuse my ignorance.

I got the code to work and successfully encode messages in 64-byte chunks with a code length of 69 bytes under IPP version6. The same functions (with no modifications) fail under version7. The offending line is:

"stat = ippsRSEncodeInit_8u(codelen, msgChunkLen, pGF, root, rseSpec);"

where codelen = 69, and msgChunkLen=64. Under version6, this function would return "stat = ippStsNoErr", but under version 7, it returns "ippStsRangeErr". I looked up this error for the ippsRSEncodeInit_8u function and the error should not occur as long as "codelen" and "msgChunkLen" obey the inequalities: 2 codelen < orderof(GF); 0 < msgChunkLen < codelen. These criteria are met, so I do not understand why the message. I have also tried this functionwith a wide variety of values for "codelen" and "msgChunkLen", and I always get "stat = ippStsRangeErr". Could you please enlighten me?

I have included the relevant function code below:

char eSpec[1024];
char eBuf[2048];
IppsRSEncodeSpec_8u *rseSpec = (IppsRSEncodeSpec_8u *)eSpec;
Ipp8u *rseBuffer = (Ipp8u *)eBuf;

IppStatus ippRSEncode(char *codeAndMsg, char *msg, int chunksize, int codeBytes, int msglen, int *totalCodeLen) {
int contextSize;
int gfSize;
int feBitSize = 8;
Ipp8u root = 1;

IppStatus stat = ippsGFGetSize_8u(feBitSize, &gfSize);
if (stat!=ippStsNoErr) return stat;

Ipp8u pPoly[] = { 1, 0, 1, 1, 1, 0, 0, 0, 1 };

IppsGFSpec_8u* pGF = (IppsGFSpec_8u *) malloc(gfSize); // Ptr to finite field context to be initialized.
stat = ippsGFInit_8u(feBitSize, pPoly, pGF);
if (stat!=ippStsNoErr) return stat;

int bufSize;
int remMsgLen = msglen;
int msgChunkLen = min(chunksize, remMsgLen);
int codelen = msgChunkLen + codeBytes;
*totalCodeLen = msglen + (msglen/chunksize)*codeBytes;

if (remMsgLen >= chunksize) {
stat = ippsRSEncodeInit_8u(codelen, msgChunkLen, pGF, root, rseSpec);
if (stat!=ippStsNoErr) return stat;

while (remMsgLen >= chunksize) {
stat = ippsRSEncode_8u((Ipp8u *)msg, (Ipp8u *)codeAndMsg, rseSpec, rseBuffer);
msg += chunksize;
codeAndMsg += codelen;
remMsgLen -= chunksize;

if (remMsgLen > 0) {
codelen = remMsgLen + codeBytes;
stat = ippsRSEncodeInit_8u(codelen, remMsgLen, pGF, root, rseSpec);
if (stat!=ippStsNoErr) return stat;
stat = ippsRSEncode_8u((Ipp8u *)msg, (Ipp8u *)codeAndMsg, rseSpec, rseBuffer);
*totalCodeLen += codeBytes;

return stat;

0 Kudos
0 Replies