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.

Converter YUY2 to NV12

IDZ_A_Intel
Employee
1,148 Views
Hello,
I have two question.
*1
I want to converter YUY2 to NV12 with directshow filter, but I can not find out any third party filter.
I found an artical write aboutbelow to converter from YUY2 to NV12.

for ( row = 0; row < Height; ++ row )
{
for ( col = 0; col < Width; ++ col )
{
NV12->Y[ index1 ++ ] = YUY2->Data[ index ++ ];
NV12->U[ index2 ++ ] = YUY2->Data[ index ++ ];
NV12->V[ index3 ++ ] = YUY2->Data[ index ++ ];
NV12->Y[ index1 ++ ] = YUY2->Data[ index ++ ];
}
index += (Stride - Width);

}

But I don't knowthe meaning of index1,index2,index3 and how to caluate Stride.

I write my code as below

//================================
ULONG inLen=0,outLen=0;

HRESULT hr = pSource->GetPointer(&pSourceBuffer );

if ( FAILED( hr ) )

return hr;

else

inLen = pSource->GetSize();

hr = pDest->GetPointer(&pDestBuffer );

if ( FAILED( hr ) )

return hr;

else

outLen = pDest->GetSize();

AM_MEDIA_TYPE* pType = &m_pInput->CurrentMediaType();

VIDEOINFOHEADER *pvi = (VIDEOINFOHEADER *) pType->pbFormat;

ASSERT(pvi);

int cWidthImage = pvi->bmiHeader.biWidth;

int cHeightImage = pvi->bmiHeader.biHeight;

int numPixels = cWidthImage * cHeightImage;

int row=0,col=0;

int index=0,indexOut=0,index2=2,index3=3;

//int InTotal=numPixels*2;

int Offset=numPixels;

for(int index=0;index

{

BYTE U0=pDestBuffer[ indexOut++ ] = pSourceBuffer[index++];

BYTE Y0=pDestBuffer[ Offset++] = pSourceBuffer[index++];

BYTE V0=pDestBuffer[ Offset++ ] = pSourceBuffer[index++];

BYTE Y1=pDestBuffer[ indexOut++ ] = pSourceBuffer[index++];

}

//================================================
It doesn't work. Could anyone tell me where the problem is.



*2
Can I copy evr.dll to xp OS, then I can use Enhanced Video Render in XP system?
I do this,but I can't connect the output pin of Intel Media SDK h.264 decoder to Enhanced Vdeo Render in XP system.

Thanks
0 Kudos
3 Replies
IDZ_A_Intel
Employee
1,148 Views
Hi,

1. Regarding converting from YUY2 to NV12.
In the case of Intel Media SDK we do support YUY2, YV12 and RGB32 conversion to NV12 via the use of Intel Media SDK VPP component. Unfortunately the current Direct Show encoder filter sample that comes part of Intel Media SDK package (2.0) does not include YUY2 to NV12 conversion. However, we plan to add support for this as part of the encoder filter in the next release of the Intel Media SDK 3.0 beta that will be publicly available in a couple of weeks.

Of course, you can always develop your own algorithm to convert between color spaces, but using Intel Media SDK VPP will allow you to take advantage of HW acceleration if your platform supports it.

I'm not familiar with the algorithm you present but I suggest checking out "http://www.fourcc.org/" for details on the most common color formats. This may help in case you try to develop your own conversion routine.


2. Intel Media SDK does not support Windows XP therefore wedo not validate Intel Media SDK or samples on that OS, so the behavior is unknown.
Not sure if EVR can be used on XP, I suggest exploring further in Microsoft knowledge base


I hope this helps in your efforts.

Regards,
Petter
0 Kudos
gthomaz
Beginner
1,148 Views
Hi kkbee!


Like Peter sad, Media SDK don't support WinXP. They only validated it on Win7.
But, I was using Media SDK on XP and it was ok for me...

About H264 decoder output pin, I suggest to you use ffdshow raw filter if you want to do a simple test.
For example, using GraphEdit:
File Source Async (test.mp4) -> Intel Media SDK H264 Splitter -> Intel Media SDK h264 Decoder -> ffdshow raw Filter-> Video Renderer

It works (I tested on XP and on seven). It's a good way to you understand how these filters works and test it running on your windows environment.
0 Kudos
IDZ_A_Intel
Employee
1,148 Views
Thanks for Petter's and Guilherme's help.
But I use ffdshow raw filter on XP and the color of image after decoding is a little strange.
0 Kudos
Reply