Hi,
I want to realize the 90-degree, 180-degree and 270-degree rotated used tiler.
I create the link as follow:
capture->dup->dei->framesout-> ...
At dupLink, I copy the non-tiler memory to tiler memory by edma transfer.
At deiLink, I translate the tiler-address and realize the tiler memory to non-tiler memory and rotation.
I modify the deiLink input frame as follow:
#define UTILS_TILER_CNT_8BIT_PITCH_XY_SWAP (8192)
#define UTILS_TILER_CNT_16BIT_PITCH_XY_SWAP (8192)
switch(rotationView)
{
case AVAL_ROTATION_90_DEGREE:
pInFrame->addr[0][0] = (Ptr)Utils_tilerGetOriAddr((UInt32)pInFrame->addr[0][0], UTILS_TILER_CNT_8BIT, 6, width, height);
pInFrame->addr[0][1] = (Ptr)Utils_tilerGetOriAddr((UInt32)pInFrame->addr[0][1], UTILS_TILER_CNT_16BIT, 6, width, height/2);
pInFrameInfo->rtChInfo.width = height;
pInFrameInfo->rtChInfo.height = width;
pInFrameInfo->rtChInfo.pitch[0] = UTILS_TILER_CNT_8BIT_PITCH_XY_SWAP;
pInFrameInfo->rtChInfo.pitch[1] = UTILS_TILER_CNT_16BIT_PITCH_XY_SWAP;
break;
case AVAL_ROTATION_180_DEGREE:
pInFrame->addr[0][0] = (Ptr)Utils_tilerGetOriAddr((UInt32)pInFrame->addr[0][0], UTILS_TILER_CNT_8BIT, 3, width, height);
pInFrame->addr[0][1] = (Ptr)Utils_tilerGetOriAddr((UInt32)pInFrame->addr[0][1], UTILS_TILER_CNT_16BIT, 3, width, height/2);
break;
case AVAL_ROTATION_270_DEGREE:
pInFrame->addr[0][0] = (Ptr)Utils_tilerGetOriAddr((UInt32)pInFrame->addr[0][0], UTILS_TILER_CNT_8BIT, 5, width, height);
pInFrame->addr[0][1] = (Ptr)Utils_tilerGetOriAddr((UInt32)pInFrame->addr[0][1], UTILS_TILER_CNT_16BIT, 5, width, height/2);
pInFrameInfo->rtChInfo.width = height;
pInFrameInfo->rtChInfo.height = width;
pInFrameInfo->rtChInfo.pitch[0] = UTILS_TILER_CNT_8BIT_PITCH_XY_SWAP;
pInFrameInfo->rtChInfo.pitch[1] = UTILS_TILER_CNT_16BIT_PITCH_XY_SWAP;
break;
default:
Vps_printf("DEI_DEBUG: %s, Line%d, don't support the rotation view!\n", __func__, __LINE__);
return -1;
}
And modify the function Utils_tilerGetOriAddr() as follow:
UInt32 Utils_tilerGetOriAddr(UInt32 tilerAddr, UInt32 cntMode,
UInt32 oriFlag, UInt32 width, UInt32 height)
{
UInt32 oriAddr;
UInt32 hOffset, vOffset;
UInt32 hStride, vStride;
/* Get the base address without orientation and container modes */
oriAddr = tilerAddr;
oriAddr &= ~(0x1Fu << 27u);
oriFlag &= (UTILS_TILER_ORI_X_FLIP |
UTILS_TILER_ORI_Y_FLIP | UTILS_TILER_ORI_XY_SWAP);
/* Figure out horizontal stride and max lines as per container mode */
if (UTILS_TILER_CNT_8BIT == cntMode)
{
hStride = VPSUTILS_TILER_CNT_8BIT_PITCH;
vStride = UTILS_TILER_CNT_8BIT_MAX_LINES;
}
else if (UTILS_TILER_CNT_16BIT == cntMode)
{
hStride = VPSUTILS_TILER_CNT_16BIT_PITCH;
vStride = UTILS_TILER_CNT_16BIT_MAX_LINES;
}
else
{
hStride = VPSUTILS_TILER_CNT_32BIT_PITCH;
vStride = UTILS_TILER_CNT_32BIT_MAX_LINES;
}
hOffset = oriAddr & (hStride - 1u);
vOffset = (oriAddr / hStride);
switch (oriFlag) {
case 5:
UTILS_assert((hStride > (hOffset + width)));
oriAddr = (hStride - (hOffset + width - 1)) * vStride;
oriAddr += vOffset;
break;
case 6:
oriAddr = hOffset * vStride;
UTILS_assert(vStride > (vOffset + height));
oriAddr += vStride - (vOffset + height);
break;
default:
break;
}
/* Set the orientation modes */
oriAddr &= ~UTILS_TILER_ORI_MODE_MASK;
oriAddr |= (oriFlag << UTILS_TILER_ORI_MODE_SHIFT);
/* Set the container mode */
oriAddr = UTILS_TILER_PUT_CNT_MODE(oriAddr, cntMode);
return (oriAddr);
}
The 180-degree rotation is succeed, however, the 90-degree and 270-degree rotation as follow:
270-degree rotation image as follow:
Could you give me some advices?
Regards,
Tianxing