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.

2D to 2D block transfer from image with EDMA3

 

 I m new to DM6467. and  I m just writting simple code for 8x8 block tranasfer from one image to another. i write down the below code

 

elem.LineLength = obj->frameWidth;

elem.NumLines = obj->frameHeight;

elem.srcLineOffset = obj->frameWidth;

elem.dstLineOffset = obj->frameWidth;

 

elem_uv.LineLength = obj->frameWidth;

elem_uv.NumLines = obj->frameHeight/2;

elem_uv.srcLineOffset = obj->frameWidth;

elem_uv.dstLineOffset = obj->frameWidth;

 

 

 

// block by block copy

 

#pragma 

 

 

DATA_ALIGN(ipDataPtr,128)

 

 

 

 

 

/* aligned on cache boundary */

 

#pragma 

 

DATA_ALIGN(opDataPtr,128)

 

/* aligned on cache boundary */

 

#pragma

 

DATA_ALIGN(tin,128)

 

/* aligned on cache boundary */

 

#pragma

 

DATA_ALIGN(tout,128)

 

/* aligned on cache boundary */

 

#pragma

 

DATA_ALIGN(inBufs->descs[0].buf,128)

 

/* aligned on cache boundary */

 

#pragma

 

DATA_ALIGN(outBufs->descs[0].buf,128)

 

/* aligned on cache boundary */

 

 

 

 

// Copy the input image Y data /

ipWdthStp = elem.LineLength;

 

 

 

//ipImgPtr->widthStep;

opWdthStp = elem.LineLength;

 

 

 

//opImgPtr->widthStep;

 

ipDataPtr = (

 

unsigned char

 

*) inBufs->descs[0].buf;

opDataPtr = (

unsigned char

*) outBufs->descs[0].buf;

blockWidth = 8;

 

 

for

( i=0; i<elem.NumLines ; i += blockWidth) {

 

 

//ipDataPtr = i*ipWdthStp; opDataPtr = i*opWdthStp;

 

 

 

for

 

( j=0; j<elem.L ineLength ; j+=blockWidth ) {

tin = ipDataPtr + (i*ipWdthStp + j); tout = opDataPtr + (i*opWdthStp + j);

// memcpy( tout, tin, blockWidth );

VCA_ALGORITHMS_MT_doCopy2D2DBlock(obj->dmaHandle2D[0], tin , tout, &elem, blockWidth);

// ipDataPtr += blockWidth; opDataPtr += blockWidth;

}

// opDataPtr += opWdthStp; ipDataPtr += ipWdthStp;

}

 

 

Void VCA_ALGORITHMS_MT_doCopy2D2DBlock(IDMA3_Handle dmaHandle, Void *in, Void *out, ElemStruct *elem,

 

int

blockWidth)

{

 

ACPY3_Params params;

 

 

/*

* Activate Channel scratch DMA channels.

*/

 

 

 

 

// ACPY3_activate(dmaHandle);

 

 

 

 

 

/* Configure the logical channel */

 

params.transferType = ACPY3_2D2D;

params.srcAddr = (

 

void

 

*)in;

params.dstAddr = (

 

void

*)out;

params.elementSize = blockWidth;

params.numElements = blockWidth;

params.numFrames = 1;

 

//(elem->LineLength)*(elem->NumLines)/(blockWidth*blockWidth);

params.srcElementIndex = elem->srcLineOffset ;

params.dstElementIndex = elem->dstLineOffset ;

params.srcFrameIndex = 0;

params.dstFrameIndex = 0;

 

 

 

 

/* Configure logical dma channel */

ACPY3_configure(dmaHandle, &params, 0);

 

 

 

 

 

/* Use DMA to fcpy input buffer into working buffer */

ACPY3_start(dmaHandle);

 

 

 

 

/* Check that dma transfer has completed before finishing "processing" */

 

 

 

while

 

(!ACPY3_complete(dmaHandle)) {

;

};

 

 

/*

* DeActivate Channel scratch DMA channels.

*/

 

 

 

 

// ACPY3_deactivate(dmaHandle);

}

 

 

 

but surprisingly this code is working fine with 32 and 16 byte block transfer but its not working with 8x8 and 4x4 block.

i cant understand hows it happen.

 

"working fine with 32 and 16 byte block transfer" - Exactly what does this mean? Are you doing these with the 1D1D transfer function above?

No, it is 2D2D transfer and working fine means code is running well. I can see the vidoe frame on vlc. I m copying video frame from input buffer to output buffer by using EDMA. It is a test code for EDMA. when I copying 16x16 and 32x32 its working. but when my blockwidth is 8 or 4 its not working. 

"not working with 8x8 and 4x4 block" - What is not working? Does nothing get transferred? Not enough? To the wrong destination? From the wrong source?

I thnik code is stuck anywhere. I didnt get video on my vlc display. 

May I assume the image array is single byte objects?

yes image is single byte object and its a 704x576.

What is in the elem struct?

 

 

 

ipWdthStp = elem.LineLength;

 

 

//ipImgPtr->widthStep;

opWdthStp = elem.LineLength;

 

 

 

 

If you set a breakpoint at the call to ACPY3_start(dmaHandle);, can you look at the PARAM for the QDMA channel to see what it looks like?

No I cant put the breakpoint over there. I m using OS to test this code.

How to resolve this issue? 

regards,

Naresh

elem.LineLength = obj->frameWidth;// 704

elem.NumLines = obj->frameHeight;//576

elem.srcLineOffset = obj->frameWidth;

elem.dstLineOffset = obj->frameWidth;