DM36x Interlace Encoding FAQs

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Contents


Does the DM36x H264 Encoder support interlace encoding?

Yes.


What all different interlace content encoding is supported?

Following different types of interlace encoding is supported.

Dm36x InterlaceEncoding ARF.png

Dm36x InterlaceEncoding SPF.png

Dm36x InterlaceEncoding MRCF.png


How to enable interlace encoding and interlace encoding type in application?

Following interface parameter needs to be set appropriately to enable interlace encoding

InterlacedVideo         = 0    # 0 => Progressive, 1 => Interlaced
 
interlaceRefMode        = 0    # 0 => ARF (default mode),1 = SPF,2 = MRCF

What all feature set of encoder is disabled when interlace encoding is enabled?

Following are the limitations of the encoder:


Do we need to have two separate process call for 2 fields (top and bottom) of a frame?

Yes, in case of interlaced content, process call has to be invoked for each field separately.


Does the encoder expect the i/p to be interleaved or field separated ?

No, we support both through capture width. For interlaced sequence, encoder expects the start pointer of top or bottom field be given to it during the process call of the top or bottom fields, respectively. The pitch to move to the next line of the field is conveyed using captureWidth of DynamicParams. Refer below example for details.

/*This example tells how to set address of input buffer for 720x480 resolution.*/
/*Let us say complete frame is stored from the address: 0x81000000.*/
 
frameWidth  = 720;    /*0x2D0*/
frameHeight = 480;    /*0x1E0*/
 
/*If the input frame is stored in the frame format.*/
 
      captureWidth = frameWidth << 1;
      captureWidth = 1440  /*0x5A0*/
 
      /*For even field process call.*/
      inobj.bufDesc[0].buf = 0x81000000;
      inobj.bufDesc[1].buf = 0x81000000 + (frameWidth * frameheight * 1.5);
 
      inobj.bufDesc[0].buf = 0x81000000;
      inobj.bufDesc[1].buf = 0x81054600;
 
      /*For odd field process call.*/
      inobj.bufDesc[0].buf = 0x81000000 + frameWidth;
      inobj.bufDesc[1].buf = 0x81000000 + (frameWidth * frameheight * 1.5) + frameWidth;
 
      inobj.bufDesc[0].buf += 0x810002D0;
      inobj.bufDesc[1].buf += 0x810548A0;
 
 
/*If the input frame is stored in the field separated format.*/
 
      captureWidth = frameWidth;
      captureWidth = 720;    /*0x2D0*/
 
      /*For even field process call.*/
      inobj.bufDesc[0].buf = 0x81000000;
      inobj.bufDesc[1].buf = 0x81000000 + (frameWidth * (frameheight >> 1));
 
      inobj.bufDesc[0].buf = 0x81000000;
      inobj.bufDesc[1].buf = 0x8102A300;
 
      /*For odd field process call.*/
      inobj.bufDesc[0].buf = 0x81000000 + (frameWidth * (frameheight >> 1) * 1.5);
      inobj.bufDesc[1].buf = 0x81000000 + (frameWidth * (frameheight >> 1) * 1.5) + (frameWidth * (frameHeight >> 1));
 
      inobj.bufDesc[0].buf = 0x8103F480;
      inobj.bufDesc[1].buf = 0x8113FC80;

What all encoder parameters are affected and needs to be taken care in interlace encoding?

Following parameters needs to be taken care appropriately during interlace encoding:

Parameter Type Input/Output Description
inputContentType XDAS_Int32 Input Input content type.

IVIDEO_PROGRESSIVE = Progressive video content;
IVIDEO_INTERLACED = Interlaced video content;
Default value = IVIDEO_PROGRESSIVE

interlaceRefMode XDAS_Int32 Input Flag to control the reference picture selection(for inter prediction) in case of interlaced encoding

0: Automatic (Adaptive Reference field selection).
1: Same parity field chosen for reference
2: Most recent field chosen for reference
Default Value = 0

frameHeight XDAS_Int32 Input Height of the video frame.
Note:
Progressive: It will be same as inputHeight for height multiple of 16.For inputHeight non-multiple of 16, application will set this field to next multiple of 16.
Interlaced: It will be same as inputHeight for height multiple of 32.For inputHeight non-multiple of 32, application will set this field to next multiple of 32.
inputHeight XDAS_Int32 Input For Interlaced: When the input height is a non-multiple of 32, the encoder expects the application to pad the input frame to the nearest multiple of 32 at the bottom of the frame. In this case, the application should set input height to actual height but should provide the padded input YUV data buffer to encoder. The encoder then sets the difference of the actual height and padded height as crop information in the bit-stream.
captureWidth XDAS_Int32 Input Capture width parameter enables the application to provide input buffers with different line width (pitch) alignment than input width.
For progressive content, if the parameter is set to:
  • 0 - Encoded input width is used as pitch.
  • >= encoded input width - capture width is used as pitch.
    For interlaced content, captureWidth should be equal to the pitch/stride value needed to move to the next row of pixel in the same field.
    Default value = 0
topFieldFirstFlag XDAS_Int32 IVIDENC1_InArgs Flag to indicate the field order in interlaced content.
Valid values are XDAS_TRUE and XDAS_FALSE.
This field is only applicable to the input image buffer. This field is only applicable for interlaced content and not progressive. Currently, supported value is XDAS_TRUE.

How does buffer requirement changes when interlace encoding is enabled?

In following cases memory footprint changes with interlace encoding:

captureWidth = frameWidth << 1;
 
frameHeight = inputHeight  >> 1;
 
inputBuffSizeY = (frameHeight * captureWidth);
 
inputBuffSizeUV = (frameHeight * captureWidth)>>1;

Dm36x InterlaceEncoding InBuff FrameRead.png

  • If frame is captured in field mode and captureWidth is set to the frameWidth, size of input buffer would be
captureWidth = frameWidth;
 
frameHeight = inputHeight  >> 1;
 
inputBuffSizeY = (frameHeight * captureWidth);
 
inputBuffSizeUV = (frameHeight * captureWidth)>>1;

Dm36x InterlaceEncoding InBuff FieldRead.png


captureWidth = frameWidth ;
 
frameHeight = captureHeight  >> 1
 
outputBuffSize = ((frameHeight * captureWidth)*3)>>1;

There is no restriction on output buffer size except that it should be enough to store one frame of encoded data. The output buffer size returned by the XDM_GETBUFINFO command assumes that the worst case output buffer size is (frameHeight*frameWidth)/2.

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox