YUYV format DOES NOT be supported...

YUYV format DOES NOT be supported...

admin's picture

Hi,

I read all the manuals in 'doc' folder and found that Intel Media SDK supports planar YUV format( ex.NV12 ) but not packed YUV format( ex. YUYV ).

Therefore I use the converter function as below whosefirst parameter is YUYV format and the Second is NV12.

Ioptimizedthe functionin my own way but it needs many CPU operation in line 17-30. In multi-decoder environment, it's terrible.

Has Intel any plan to support YUYV format? ... as decoder output.
Or give me any information abouthow todiscard many pixel-by-pixel copys( shown in line 17-30 ).

WriteFrame( BYTE *pDec, mfxFrameSurface1 *pSurface )
{
	if ( !pSurface || !pSurface->Data.Y || !pSurface->Data.UV )
		return FALSE;

	BYTE *Y		= pSurface->Data.Y;
	BYTE *UV	= pSurface->Data.UV;
	int i, j, k, h, w, w_pitch, h_Y, h_UV;
	h = pSurface->Info.CropH;
	w = pSurface->Info.CropW;	
	w_pitch = pSurface->Data.Pitch;		
	i = h;
	k = w * h * 2 - 1;
	h_Y = (h - 1) * w_pitch;
	h_UV = ( (h - 1) >> 1 ) * w_pitch;

	while ( i-- )
	{
		j = w;
		while ( j-- )
		{	
			pDec[ k-- ] = UV[ h_UV + j ];
			pDec[ k-- ] = Y[ h_Y + j-- ];
			pDec[ k-- ] = UV[ h_UV + j ];
			pDec[ k-- ] = Y[ h_Y + j ];
		}
		h_Y -= w_pitch;
		if ( i & 0x1 )
			h_UV -= w_pitch;
	}

	return TRUE;
}

Regards,
kmjlove130

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Vassili Yakovlev's picture

Hi,

Optionally you can use DirectX surfaces to do convert job.

admin's picture

Hi kmjlove130,

There are no plans to natively support any other color formats than NV12 in Media SDK.
However, the Media SDK VPP component supports a set of color conversion operations (From NV12 to RBG32, YV12 or YUY2).

As far as I know YUYV should be the same format as YUY2, so you should be able to use VPP to perform the conversion.http://www.fourcc.org/yuv.php#YUYV

If you are looking for the reverse operation such as NV12 to YUY2, then I'm sorry to say that Media SDK does not support this operation. For an optimized implementation of such an algorithm you may explore the Intel Integrated Performance Primitives (IPP).

Also, as Vassili suggested, if you keep your surfaces in D3D mem, you may also explore using DirectX to do the color conversion. Regards, Petter

Hari K.'s picture

Hi all does the intel ipp support the conversion of yuyv to yuv422 ,if suppted please let me know how to do that . Please reply .

Thank you very much .

Regards,

Harikrishna

Jeffrey Mcallister (Intel)'s picture

IPP has many color conversions.  It doesn't cover every permutation, but the selection is pretty wide.

I haven't verified the solution, but you may find a match in IPP with the 'YCbCr422' functions. In this case, C2  indicates the "packed" version of the format.  In the header it's sometimes referred to as YUYV or YUY2.  'P3' indicates 3 separate planes for Y, U, and V values.

The function to convert YUYV to YUV422 should be something like ippiYCbCr422_8u_C2P3R.  As you can see from the header or docs the packed image is treated as a single contiguous buffer, but you'll need to prepare a 3-element array for the planar version.

It looks like you could also try YUYV to NV12 with ippiYCbCr422ToYCbCr420_8u_C2P2R.  I'd guess this might be faster but you'll have to check to make sure.

 

Hari K.'s picture

Dear Jeffrey Mcallister thank you very much for the reply.

Login to leave a comment.