Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AaronL
Beginner
83 Views

32-byte alignment for HEVC

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
83 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

AaronL
Beginner
83 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.

Surbhi_M_Intel
Employee
83 Views

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

-Surbhi 

AaronL
Beginner
83 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.

83 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.

Reply