MFGetStrideForBitmapInfoHeader function

Calculates the minimum surface stride for a video format.


HRESULT MFGetStrideForBitmapInfoHeader(
  _In_  DWORD format,
  _In_  DWORD dwWidth,
  _Out_ LONG  *pStride


format [in]

FOURCC code or D3DFORMAT value that specifies the video format. If you have a video subtype GUID, you can use the first DWORD of the subtype.

dwWidth [in]

Width of the image, in pixels.

pStride [out]

Receives the minimum surface stride, in pixels.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.


This function calculates the minimum stride needed to hold the image in memory. Use this function if you are allocating buffers in system memory. Surfaces allocated in video memory might require a larger stride, depending on the graphics card.

If you are working with a DirectX surface buffer, use the IMF2DBuffer::Lock2D method to find the surface stride.

For planar YUV formats, this function returns the stride for the Y plane. Depending on the format, the chroma planes might have a different stride.

Note  Prior to Windows 7, this function was exported from evr.dll. Starting in Windows 7, this function is exported from mfplat.dll, and evr.dll exports a stub function that calls into mfplat.dll. For more information, see Library Changes in Windows 7.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]







See also

Media Foundation Functions
Image Stride