NV12转换为I420





int nv12Toi420(int nWidth,int nHeight,int nPitch,CUdeviceptr* Src_NV12,unsigned char *Dst_i420)
{
	if(m_pTempBufSize < nPitch * nHeight * 3 / 2)
	{
		m_pTempBufSize = nPitch * nHeight * 3 / 2;
		if(m_pBuf)
		{
			free(m_pBuf);
			m_pBuf = (unsigned char* )malloc(m_pTempBufSize);
		}
		else
			m_pBuf = (unsigned char* )malloc(m_pTempBufSize);
	}
	
	memcpy(m_pBuf, Src_NV12, nPitch * nHeight * 3 / 2);
	int dst_pos = 0;
	int src_pos = 0;

	for (int i = 0;i


你可能感兴趣的:(有用源码,视频编解码)