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.

question about the rotation and tiler

Other Parts Discussed in Thread: DM385

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

  • Hi Tianxing,

    What is the device and what is the software release you are using?

    BR
    Pavel

  • Refer this patch which I shared with you previously http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/310774.aspx

    We have tested 90 and 270 rotate and there is no issue. Make sure you merge changes correctly.

    Also make sure you are restoring the address to natural address after rotation.

    Why are you hardcoding rotateMask to 6. First check  if only XY_SWAP works

  • Hi, Badri

    Thanks for your reply.

    I used the rdk4.0 on dm8168.

    I have referred to the manual of TILER Mirroring/Rotation using ISS on DM812x/DM385 and TMS320DM816x Davinci DSP Technical Reference Manual(sprugx8b).

    I thought if I want to realize the 90-degree rotation, the oriFlag would be 6, and the rotated tiler address would be calculated according to the following formula:

    tilerAddr: the natural tiler address

    oriAddr: 90-degree rotated tiler address

    the formula as follow:

    oriAddr = tilerAddr;

    oriAddr &= ~(0x1F << 27);

    oriAddr = hOffset * vStride;

    oriAddr += vStride - (vOffset + height);

    oriAddr |= (cntMode << 27);

    oriAddr |= (oriFlag << 29);

    If the cntMode is 8-bit, the hStride is 16384, vStride is 8192. If the cntMode is 16-bit, the hStride is 32768, vStride is 4096.

    What's the mean of natural address?

    I have modified the code as your patch, however, the 270-degree rotated would be have noise at left of image. In my system, the pitch of image greater than its width, if it would be affect the result of rotation.

    And I want to further study about the tiler, and the TMS320DM816x Davinci DSP Technical Reference Manual have no further reference, could you give some references about the principle of tiler. My email is houtianxing2003@163.com.

    Regards,

    Tianxing

  • The TI816x TRM has all required detail related to tiler rotation. Can you indicate what issue you are seeing with an image . Is 90 rotation working fine now with changes from the patch I shared. Is only 270 rotation having artifacts ?

    By natural view I mean the original tiler address. You should restore buffer address to original tiler address after the HDVPSS process call as shown in the swms patch I shared.

    If possible try examining the luma buffer separately if it is displaying correctly. If so it would be easier to debug the chroma corruption.