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.

About the the using of DRV_dmaCopy2D()



Hi all,
            Using IPNC 2.0, I have meet a problem of DRV_dmaCopy2D(). BTY, the data is YUV420.

.

        I want use DRV_dmaCopy2D() to do the copy of data. just like this:


Uint8 *srcPhysAddr, *dstPhysAddr; DRV_DmaCopy2D copy2D;
srcPhysAddr = (Uint8*)DRV_dmaGetPhysAddr((unsigned long)srcVirtAddr);
dstPhysAddr = (Uint8*)DRV_dmaGetPhysAddr((unsigned long)dstVirtAddr);

if(srcPhysAddr==NULL||dstPhysAddr==NULL)
return -1;

 copy2D.srcPhysAddr = (unsigned long)srcPhysAddr +(2432-1920);
copy2D.dstPhysAddr = (unsigned long)dstPhysAddr;

 copy2D.copyWidth = 1920;
 copy2D.copyHeight = 1080 * 3 /2;

 copy2D.srcOffsetH = 2048 - 1080;
copy2D.dstOffsetH =
2048 - 1080 ;

copy2D.skipH = 0;

DRV_dmaCopy2D(&dmaHndl, &copy2D, 1);

 

 Using the above code, the result is not correct. Anybody can help me?

And if I want to copy  any AOI of src, how to do? Thanks a lot!

 

 

  • Format you are referring to is yuv420 or yuv420 semi(NV12)?

  • Thanks, YUV420

    YYYYYYYYYYYYYYYYYYYYY........  UVUVUVUV....

     

  • Anybody have good idea!

  • since have no 2D EDMA copy way, I write a function to relize this function using memcpy.

    /*YUV420  AOI copy
      @src image source, YUV420 format 
      @imgw image source width
      @imgh image source height       
      @dest  dest image source, YUV420 format
      @aoix start x position       
      @aoiy start y position
      @aoiw copy image width     
      @aoih copy image height
     
      @attention the size of image source is imgw * imgh * 3 / 2
    */
    int YUV420_AOI_Copy(char *src, int  imgw, int imgh,
                char *dest, int aoix, int aoiy, int aoiw, int aoih )
    {
            int k = 0;
            if((aoix + aoiw > imgw) || (aoiy + aoih) > imgh)
                    return -1;
            char *ptrsrc = src + (imgw * aoiy) + aoix;
            for(k = 0; k < aoih; k++)        //copy Y data
            {
                    memcpy(dest + k * aoiw, ptrsrc + k * imgw, aoiw);
            }

            ptrsrc = src + imgw * imgh + (imgw * aoiy / 2) + aoix/2*2; //local to UV data
            char *ptrdest = dest + aoiw * aoih;
            for(k = 0; k < aoih/2; k++)
            {
                    memcpy(ptrdest + k * aoiw, ptrsrc + k * imgw, aoiw);
            }     
    }

    It is maybe help for you!