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.

frame padding

Guru 20755 points

Hello,

I would like to pad a centered frame with blank data using the scaler.  No scaling is done for the original frame.
Can you please give some guidelines as to how it should be done ? I couldn't find a demonstration for that.

Thanks,

Ran

  • Ran,

    Could not understand, Do you require to shift the video frame, i.e. display couple of lines of blank at top and left of frame?

    Thanks,
    Sujith
  • Hi Sujith,

    Yes, I meant blank lines on top, right, left, and bottom, so that the frame is in center.

    Thanks, Ran

  • Hi Ran,

    One way would be 
    1. Start with a frame buffer that is filled with "blank data"
    2. Determine the offset of the frame buffer, where actual video would start. Specify this as the start address of the destination buffer for scalar. This will ensure the video is vertically centered. i.e. Top / bottom blank lines are retained.
    3. Pitch should be updated to include blank pixels on left + blank pixels on right. i.e. 
    1. Consider 200 X 200 video frame
    2. In which we would require to display 100 X 100 centered video frame
    3. considering YUV422 data type
    4. pitch = (100 * 1.5) + (50 * 1.5) + (50 * 1.5), i.e. actual width + margin on left + margin on right.
    I am not sure if we have an demo for this.

    Thanks,
    Sujith

  • Hi Sujith,

    Thank you very much for the detailed answer.

    As I understand, the offset in 2, and pitch in 3 is part of channel info. Both startX, and startY should be updated. The pitch is relevant only for rows numbers, right (i.e. top , bottom pad is not par of pitch) ? about 4. , Why did you multiply all the pixels of (actual width + margin on left + margin on right) with 1.5 ?

    typedef struct
    {
        UInt32              bufType; /**< see System_BufType */
        UInt32              codingformat; /**< Video coding format - IVIDEO_H264BP, IVIDEO_H264MP,...*/
        UInt32              dataFormat; /**< see System_VideoDataFormat */
        UInt32              memType; /**< see System_MemoryType - Tiled / non-tiled */
        UInt32              startX; /**< Start x position */
        UInt32              startY; /**< Start x position */
        UInt32              width; /**< channel resolution - width */
        UInt32              height; /**< channel resolution - height */
        UInt32              pitch[SYSTEM_MAX_PLANES]; /**< Pitch for various formats / planes  */
        UInt32              scanFormat; /**< see System_VideoScanFormat */
    } System_LinkChInfo;

    If you can please provide a demo for this feature it will be very much helpful.

    Thanks,

    Ran

  • Hi Ran,

    Yes you right the multiplier should have been 2 and not 1.5.
    If you do not include the <keft pad + right pad> in the pitch calculations, the first line of the video will be centered and rest would be left aligned.

    Please remember that you constructing this in a 2D memory. The start position will account for first line to start centered, since you will have to give the address of buffer at 0.0(to scalar output buffer pointer) the next line would 0, <top pad> + 1. Hence left aligning the rest of video line.

    I am not sure about the demo for this particular use case.

    Thanks,
    Sujith
  • Hi Sujith,

    Thank you very much,

    Any similar demo which demonstrate padding in general (not just this particular one) will be helpful.

    Thanks,

    Ran

  • Hi Sujith,

    Did you mean in the previous post that we should create a new Link ?
    Can padding & scaling parameters (startx,starty,pitch,scaling value) be changed dynamically ?
    Is there a demo for that ? it seems that SCLR_LINK_CMD_SET_OUTPUTRESOLUTION might partly achieve that.

    Thanks, Ran

  • Hi Ran,

    No you do not require to write a new link. You could customize existing link to do that.
    Yes, setoutput resolution will allow you to change the output image size. Since you would require to centerlize the video on the output frame, you will have to update the link to calculate / specify, start address of the output buffer as described above.

    Sorry, we do not have any demo for this.

    Thanks,
    Sujith
  • Hi Sujith,

    >You could customize existing link to do that

    Is the idea you suggested before(start with blank frame, etc.) is to customize scaler Link  (or to use the existing scaler) ? 
    Isn't pitch, startX,startY already supported in scaler ? What is not supported in scaler with regards to padding of the centered scaled frame ?
    Is pitch affect how the image is stored in memory, or how the image is displayed ?

    Thanks, Ran

  • Hi Ran,

    The proposal was to modify the existing scalar link. In the current RDK, there is no support for this.

    The "start X & start Y," is used always used by links for the incoming frames. This is required as decoded frame could have meta data on top left of the frame.

    The output frame is always aligned on top left. If we require to center-lize the output video. We will have to update the output buffers start address.

    Thanks,
    Sujith
  • Hi Sujith,

    I think that for supporting aspect ration capability in DM8168, as done in other MPEG encoders, it is important maybe to add padding support feature in the future. I don't see this capability in codec itself, so the HDVPSS is where such pre-processing for supporting aspect ratio change should be done.

    Thanks,

    Ran