Pitch of a YUV frame

Pitch of a YUV frame


I am trying to rewrite the function in common_utils.cpp:

mfxStatus ReadPlaneData(mfxU16 w, mfxU16 h, mfxU8 *buf, mfxU8 *ptr, mfxU16 pitch, mfxU16 offset, FILE* fSource)


How can a YUV frame have a pitch to it, defined as the distance between two consecutive rows in a frame when Y is 4 times bigger than U or V?


Is it the distance between the Y and U or U and V?  I appears to be U and V but I can't completely tell.

Thank you,


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Matthew,

The raw input surface read from disk does not have any pitch but the destination memory surface often has a pitch (different from the content frame dimensions) due to memory allocation alignment requirements. Take a look at for instance the Media SDK Tutorial (which I'm guessing you are basing your code on?) "simple_encode.cpp" code, at the stage in the code where "mfxEncParams.mfx.FrameInfo.Width" and "mfxEncParams.mfx.FrameInfo.Height" is set. Here you can see how the actual size of the allocated surface gets determined; which does impact surface pitch.


Leave a Comment

Please sign in to add a comment. Not a member? Join today