This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM368 + IPNC: How to improve the code for DDR2 random access?

After the capture thread, I need to reorder the pixel of the image with a LUT (look up table), but a cycle of 1Mpix done by Arm or Imcop is too slow ... sorry :-) I'm not able to write a fast code to done this :-(

With (8bit version):
      XDAS_UInt8 *ldwS = (XDAS_UInt8 *)inBufs->bufDesc[0].buf;
      XDAS_UInt8 *ldwD = (XDAS_UInt8 *)outBufs->bufs[0];
      XDAS_UInt32 *pI = in_mtrx;
      XDAS_UInt32 i;
      for(i=0; i<numInBytes; i++)
        *ldwD++ = ((XDAS_UInt32)*(ldwS+*pI++)); // 2.62 fps
In the Arm or inside the IMCOP I have same result : 2.62 fps

With (32bit version):
      XDAS_UInt8 *ldwS = (XDAS_UInt8 *)inBufs->bufDesc[0].buf;
      XDAS_UInt32 *ldwD = (XDAS_UInt32 *)outBufs->bufs[0];
      XDAS_UInt32 *pI = in_mtrx;
      XDAS_UInt32 i, numInDWord = (numInBytes)>>2;
      for(i=0; i<numInDWord; i++) {
        *ldwD++ = ((XDAS_UInt32)*(ldwS+*pI)) | ((XDAS_UInt32)*(ldwS+*(pI+1))<<8) | ((XDAS_UInt32)*(ldwS+*(pI+2))<<16) | ((XDAS_UInt32)*(ldwS+*(pI+3))<<24); // 2.62 fps
        pI += 4;
      }
In the Arm or inside the IMCOP I have same result : 2.62 fps

I have try to allocate the src and dst image with
   prm.flags = CMEM_NONCACHED;
or
   prm.flags = CMEM_CACHED;
But don't change

With (internal buffer):
      XDAS_UInt8 *ldwS = (XDAS_UInt8 *)inBufs->bufDesc[0].buf;
      XDAS_UInt8 *ldwD = (XDAS_UInt8 *)outBufs->bufs[0];
      XDAS_UInt32 *ldwM = in_mtrx;
      XDAS_UInt32 i, j, numInDWord = numInBytes;
      int pix = videncObj->workBuf1_size;
      for(i=0; i<numInBytes; i+=pix) {
        unsigned int *pI = videncObj->workBuf2;
        char *pD = videncObj->workBuf1;
        memcpy(videncObj->workBuf2, ldwM, pix*sizeof(XDAS_UInt32));
        ldwM += pix;
        for(j=0; j<pix; j++)
          *pD++ = *(ldwS + *pI++); // 2.42 fps
          //*pD++ = *ldwS++; // 3.5 fps
          //*pD++ = *pI++; // 9.25 fps
        memcpy(ldwD, videncObj->workBuf1, pix);
        ldwD += pix;
      }
Inside the IMCOP, and with the two buffer allocate in internal memory:
    /* Request memory for working buffer 1 */
    memTab[WORKBUF1].size = (params->maxWidth) * 4 * sizeof (Char);
    memTab[WORKBUF1].alignment = ALIGN_FOR_CACHE;
    memTab[WORKBUF1].space = IALG_DARAM0;
    memTab[WORKBUF1].attrs = IALG_SCRATCH;

    /* Request memory for working buffer 2 */
    memTab[WORKBUF2].size = (params->maxWidth) * 4 * sizeof (Int32);
    memTab[WORKBUF2].alignment = ALIGN_FOR_CACHE;
    memTab[WORKBUF2].space = IALG_DARAM1;
    memTab[WORKBUF2].attrs = IALG_SCRATCH;
I get the same slow result

I think this system is designed to work with sequential stream and not random access to the externl RAM, but I'm new with this architecture so I hope some one can tell me where I fail.

Is impossible for me, move the LUT to little pieces of memcpy, because one circle in the source image is a row in the destination

Thanks in advance
Manzo