Showing results for 
Search instead for 
Did you mean: 

Using ippsRSEncode_8u

I try learn IPP data integrity area...

i wrote some code in C++:

void main()
IppStatus status;
int feBitSize = 3; // Size of the field element (in bits).

int pGFSize; // Size of the buffer to be allocated by the application and used in
// future as the context of the finite field GF(2feBitzise)

status = ippsGFGetSize_8u(feBitSize, &pGFSize); // Gets the size of the IppsGFSpec_8u context in bytes.
printf("%s\\n", ippGetStatusString(status));

IppsGFSpec_8u* pGF = (IppsGFSpec_8u *) malloc(pGFSize); // Pointer to the finite field context to be initialized.
const Ipp8u pPolynomial[5] = {1,1,0,1,1}; // Pointer to the polynomial generating the finite field.
status = ippsGFInit_8u(feBitSize, pPolynomial, pGF); // Initializes user-supplied memory as IppsGFSpec_8u context for future use.
printf("%s\\n", ippGetStatusString(status));

int codeLength = 7; // The desired codeword length.
int dataLength = 5; // The desired data length.
int pSize = 0; // Pointer to the size of the context (in bytes).
status = ippsRSEncodeGetSize_8u(codeLength, dataLength, &pSize); // Gets the size of the ippsRSEncodeSpec_8u context in bytes.
printf("%s\\n", ippGetStatusString(status));

Ipp8u root = 1; // The root of the (first) minimal polynomial over GF.
IppsRSEncodeSpec_8u* pRS = (IppsRSEncodeSpec_8u *) malloc(pSize); // Pointer to the user-supplied buffer to be initialized as the IppsRSEncodeSpec_8u context.
status = ippsRSEncodeInit_8u(codeLength, dataLength, pGF, root, pRS); // Initializes user-supplied memory as the IppsRSEncodeSpec_8u context for future use.
printf("%s\\n", ippGetStatusString(status));

int pBufferSize = 0; // Pointer to the size of the work buffer (in bytes).
status = ippsRSEncodeGetBufferSize_8u(pRS, &pSize); // Gets the size of a work buffer for the encoding operation.
printf("%s\\n", ippGetStatusString(status));

now how i use the ippsRSEncode_8u function???

0 Kudos
1 Reply

Hello Efim,

If you have every parameterrequired by ippsRSEncode ready, you may have just go ahead to call it.

for example,

status=ippsGFGetSize_8u(feBitSize, &pGFSize);
printf("%s\n", ippGetStatusString(status));
pGF = (IppsGFSpec_8u *) malloc(pGFSize);
status=ippsGFInit_8u(feBitSize, pPolynomial,pGF);
printf("%s\n", ippGetStatusString(status));

status=ippsRSEncodeGetSize_8u(codeLength, dataLength, &pSize);
printf("%s\n", ippGetStatusString(status));
IppsRSEncodeSpec_8u* pRS = (IppsRSEncodeSpec_8u *) malloc(pSize);

status=ippsRSEncodeInit_8u(codeLength, dataLength, pGF, root, pRS);
printf("%s\n", ippGetStatusString(status));
status=ippsRSEncodeGetBufferSize_8u(pRS, &pBufferSize);
printf("%s\n", ippGetStatusString(status));
Ipp8u* pBuffer=(Ipp8u *)malloc(pBufferSize);
status=ippsRSEncode_8u(pMsg, pCodeWord, pRS, pBuffer);
printf("%s\n", ippGetStatusString(status));

weprepared forsome easy application based on ippDI internally. I will attach them by privacy thread.
(For who are intetresting in the codec too, pleasefollow the thread)