Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Buffer Alignment Requirement For Video Preprocessor (VPP)

Prashanth_D_
Beginner
689 Views

Hi,

While working on H264 transcode use case using Intel Media SDK, we noticed that the Video Preprocessor component (Hardware implementation) of the SDK was causing a memory corruption at the output surface, specifically when the output resolution is 426x240. According to the Media SDK documentation, the width of the video frame must be a multiple of 16 and height must be a multiple of 16 (for progressive) or 32 (for interlaced). As we are currently dealing with only progressive video, we have used 16 byte alignment for both the height and the width. Also, the width and height of the surface buffers have the same alignment, i.e, 16 byte alignment. If done so, we see that the Video Preprocessor component writes more than the allocated surface buffer, thus causing memory corruption. To check if there was a problem with the configuration of VPP, we used the “MFXVideoVPP_Query” call, which did not return any errors.

On the other side, the sample “tutorial” applications that come bundled with the SDK have implementations wherein a 32 byte alignment (for both width and height) is used for the input and output surfaces, for both progressive and interlaced video. Doing this however does not corrupt memory outside the surface buffer as a larger than required value of buffer is used. The issue is reproducible if we change the surface buffer alignment to 16 byte in the sample tutorials as well. Please note that we are using hardware acceleration with system memory I/O.

Thus, we wanted to understand the necessity of  32 byte surface buffer alignment (for height) at the output side of the Video Preprocessor. Also, we would like to understand the buffer alignment requirements for other Intel Media SDK components like H264 decoder/H264 encoder for different implementations (hardware/software) and for different IO patterns (system/video/opaque). Currently the documentation is not very clear in this regard.

Kindly let us know your views on the same.

Additional information:

  1. VPP configuration parameters:

Input-

    FourCC = MFX_FOURCC_NV12;

    ChromaFormat = MFX_CHROMAFORMAT_YUV420;

    CropX = 0;

    CropY = 0;

    CropW = 854;

    CropH = 480;

    PicStruct = MFX_PICSTRUCT_PROGRESSIVE;

    FrameRateExtN = 30;

    FrameRateExtD = 1;

    Width = 864;

    Height = 480;

                    Surface buffer width : 864

                    Surface buffer height: 480

Output-

    FourCC = MFX_FOURCC_NV12;

    ChromaFormat = MFX_CHROMAFORMAT_YUV420;

    CropX = 0;

    CropY = 0;

    CropW = 426;

    CropH = 240;

    PicStruct = MFX_PICSTRUCT_PROGRESSIVE;

    FrameRateExtN = 30;

    FrameRateExtD = 1;

    Width = 432;

    Height =  240;

                    Surface buffer width : 432

                    Surface buffer height: 240

IO Pattern-

    IOPattern =

        MFX_IOPATTERN_IN_SYSTEM_MEMORY | MFX_IOPATTERN_OUT_SYSTEM_MEMORY;

  1. System configuration

SDK version        : MediaServerStudioEssentials2015R6

OS                          : Centos 7.1

Kernel version  : 3.10.0-229.1.2.39163.MSSr4.el7.centos.x86_64

Processor            : Intel(R) Core(TM) i7-4770R

Thank you,

0 Kudos
5 Replies
Bjoern_B_Intel
Employee
689 Views

Hi Prashanth,

Thanks for your question here. Let me take the AR here and figure out if we have a comprehensive summary of this.

Best,

Bjoern

0 Kudos
Bjoern_B_Intel
Employee
689 Views

Hi Prashanth,

We did fix this issue so it should be gone in next release but I will test upfront.

Best,

Bjoern

0 Kudos
Prashanth_D_
Beginner
689 Views

Hi Bjoern,

Thanks for the update. Good to know that the issue is fixed.

Could you please let me know when is the next media sdk release planned for CentOS with this bug fix?

Till then I believe we should continue to use 32 byte alignment for VPP, could you please confirm on this?

Also, could you please let me know the buffer alignment requirements for other components like H.264 decoder and H.264 encoder for different run time configurations? Can we continue to have 16 byte alignment for those components for both system memory and video memory?

Thanks again!

Regards,

Prashanth Dixit

0 Kudos
Bjoern_B_Intel
Employee
689 Views

Hi Prashanth,

We released new Intel® Media Server Studio Version 2016 for Windows and Linux. You might want to try as we did lots of fixes plus some performance improvements as well.

Best,

Bjoern

0 Kudos
Bjoern_B_Intel
Employee
689 Views

I am closing this thread here.

Best,
Bjoern

0 Kudos
Reply