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.

32-byte alignment for HEVC

AaronL
Beginner
610 Views

As described in the "How to run Media SDK samples on Skylake" post, at https://software.intel.com/en-us/forums/intel-media-sdk/topic/593838 , it is necessary to use 32-byte alignment for both the width and height when encoding using HEVC.  Is there an expectation that this requirement will be relaxed in the future?  This is a bit of a pain, since if we consider 720p, a frequently used progressive video format, a 720p video frame can be used unaltered with H.264 but the height must be aligned to 736 with HEVC, requiring the creation of an additional buffer.

Also, related to this, the following code in pipeline_encode.cpp pertains to HEVC:

    // In case of HEVC when height and/or width divided with 8 but not divided with 16
    // add extended parameter to increase performance
    if ( ( !((m_mfxEncParams.mfx.FrameInfo.CropW & 15 ) ^ 8 ) ||
           !((m_mfxEncParams.mfx.FrameInfo.CropH & 15 ) ^ 8 ) ) &&
             (m_mfxEncParams.mfx.CodecId == MFX_CODEC_HEVC) )
    {
        m_ExtHEVCParam.PicWidthInLumaSamples = m_mfxEncParams.mfx.FrameInfo.CropW;
        m_ExtHEVCParam.PicHeightInLumaSamples = m_mfxEncParams.mfx.FrameInfo.CropH;
        m_EncExtParams.push_back((mfxExtBuffer*)&m_ExtHEVCParam);
    }

This code, however, preexisted the change described in the "How to run Media SDK samples on Skylake" post.  Is this code snippet still relevant for Skylake HW HEVC encoding?

0 Kudos
5 Replies
Surbhi_M_Intel
Employee
610 Views

Hi Aaron, 

I understand the concern here, I checked with the MSDK architect today and there is plan to have height and width alignment to be 16 for HEVC HW encode in future API support. But atleast in API 1.17, we might have to live with 32 pixel alignment.  
Up till Media SDK sample version 6.0.0.68, HEVC code is applicable to SW implementation and doesn't have HEVC HW encode and decode requirements. This will be addressed in the next sample release which will be out in few weeks. 

Thanks,
Surbhi

0 Kudos
AaronL
Beginner
610 Views

Regarding the height and width alignment being 16 in a future version of the Media SDK, will the height alignment still be 32-byte for interlaced video?  For H.264, the height needs to be 32-byte aligned for interlaced video.

0 Kudos
Surbhi_M_Intel
Employee
610 Views

Yes for interlaced it will continue to be 32 bit aligned like for H264 codec.

-Surbhi 

0 Kudos
AaronL
Beginner
610 Views

It would be nice to see the alignment requirements formally documented in the Media SDK manual.  These requirements have only really been "documented" in the form of sample code and forum posts.  This also applies to the 32-bit alignment requirement for the frame allocation when using system memory, which is sort of documented in the manual on page 28 in the form of pseudo-code.  I guess this is a general criticism of the documentation, and the need to rely upon sample code in order to understand how to use the Media SDK applies to more than just alignment.

Also, since proper alignment is a requirement in order to use the Media SDK, it would be nice to see the MSDK_ALIGN16 and MSDK_ALIGN32 defines moved out of sample code and into a standard Media SDK header.

0 Kudos
Sravanthi_K_Intel
610 Views

Hi Aaron - We are capturing HEVC limitations and requirements in the documentation which will be released soon. We recognize the documentation gaps for many features (not just HEVC) - we are working to fix them gradually. This is not a generic statement - there are indeed efforts to improve our documentation and you should see the updates rolling in gradually moving forward.

0 Kudos
Reply