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.

mfxFrameSurface1 Pitch size

bingol__evren
Novice
812 Views

How and where does pitch get set? I see that  

Encoder has a line 
MSDK_MEMCPY_VAR(m_pVppSurfaces.Info, &(m_mfxVppParams.mfx.FrameInfo), sizeof(mfxFrameInfo));

This line  sets the info struct of  mfxFrameSurface1
But where does the surface.data.pitch get set of mfxFrameSurface1
Does it automatically mults width by 8 bytes and since we alight the width with MSDK_ALIGN16 ?

Thanks

0 Kudos
5 Replies
Mark_L_Intel1
Moderator
812 Views

Hi Evren,

The macro is defined here, so it belongs to our sample code.

The usage can be found in sample_utils.cpp in common directory, so the real value will be filled when dealing with actual input/output video data, like function CSmplYUVReader::LoadNextFrame().

Let me know if this answers your question.

Mark

0 Kudos
bingol__evren
Novice
812 Views

Hi Mark.
That does not answer my question. My question is not the macro. 
My question is HOW and Where does the pData.Pitch get set in Load Next frame. 

How does the system calculate the PITCH value ? 
In the encoder example we never set the pitch, so it must be calculated somewhere. I  know how pitch is usually calculated and what it means but I can not see the code that sets that value in the example or commons sample code. 
thanks

0 Kudos
Mark_L_Intel1
Moderator
812 Views

Hi Evren,

Since different frame type might have different pitch, I think this could be implementation of the virtual frame allocation function, here may be one of them:

https://github.com/Intel-Media-SDK/MediaSDK/blob/238f5a2a6f2ec6044d3ac6035adccadd7aac7fd1/_studio/shared/src/libmfx_allocator.cpp#L150

Is this helpful?

Mark 

0 Kudos
bingol__evren
Novice
812 Views

I found that function myself before but that pitch is a local variable in that function (line 171) and it is used to allocate the surface size.
But It is never set to to the mfxFrameSurface1.data.pitch. 

UPDATE as i was looking at https://software.intel.com/en-us/node/628470 mfxFrameData struct I see that pitch is a union and I now understand because I see that PItchLow is set in the LockFrame. PitchLow is actually Pitch pretty much. 

Thanks you pointed me to the right file 

0 Kudos
Mark_L_Intel1
Moderator
812 Views

Good to know you have solve the problem and thanks for the feedback.

Mark

0 Kudos
Reply