Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Possible MPEG4 conversion issue

sionice
Beginner
365 Views
Hey There,

I'm pretty new to working with this IPP stuff, though am running into one final problem. I'm actually correctly converting to MPEG4, though have one final problem. My Hue is off in the finally converted video, and most people/things appear in a shade of blue, and I can't seem to figure out quite why.

I'm having to jump color formats from RGB32 to YV12, and that's one potential area that my problem lies. I'm doing that with the final code.

[cpp]pYV12Buffer = (BYTE*)malloc(InBufLength);

long lSrcPitch0 = m_iImageWidth * 4;
long lSrcPitch1 = 0;
long lSrcPitch2 = 0;

BYTE *pSrcBuffer0 = pInBuf;
BYTE *pSrcBuffer1 = NULL;
BYTE *pSrcBuffer2 = NULL;

long lDestPitch0 = m_iImageWidth;
long lDestPitch1 = m_iImageWidth/2;
long lDestPitch2 = m_iImageWidth/2;

BYTE *pDestBuffer0 = pYV12Buffer;
BYTE *pDestBuffer1 = pDestBuffer0 + (lDestPitch0 * abs(m_iImageHeight));
BYTE *pDestBuffer2 = pDestBuffer1 + ((lDestPitch1 * abs(m_iImageHeight))/2);

IppStatus status = ippStsNoErr;
....
else if (IsEqualGUID(m_InMT.subtype, MEDIASUBTYPE_RGB32))
{
	Ipp8u* pSrc[3] = {pSrcBuffer0, pSrcBuffer1, pSrcBuffer2};
	Ipp8u* pDest[3] = {pDestBuffer0, pDestBuffer1, pDestBuffer2};
	int destStep[3] = {lDestPitch0, lDestPitch1, lDestPitch2};
	IppiSize roiSize = { m_iImageWidth, abs(m_iImageHeight) };
	status = ippiBGRToYCrCb420_8u_AC4P3R(pSrcBuffer0, lSrcPitch0, pDest, destStep, roiSize);
}[/cpp]

I'm thinking it either has to do with this conversion or the setup of my EncoderFilter. But I'm kinda lost. Any help would be appreciated. If you need a little bit more code from a different area, please ask and I'd be happy to help. I've updated the IPP libraries to be using the latest as well, 6.1 I believe, and that didn't help either.

Thanks in advance,
- Greg

0 Kudos
1 Solution
oxydius
New Contributor I
365 Views
If people appear as blue and you're using a BGRToYCrCb function, that means you have blue and red swapped. You can still use the BGR function to convert RGB data, but just swap the 1st and 3rd input channels.

Ipp8u* pSrc[3] = {pSrcBuffer2, pSrcBuffer1, pSrcBuffer0};

View solution in original post

0 Kudos
3 Replies
Chao_Y_Intel
Moderator
365 Views
Hi Greg,

If you dump out the YUV420 data ( the output of ippiBGRToYCrCb420_8u_AC4P3R), and display it with some YUV player, can you find if the YUV data is corrected?

Thanks,
Chao


0 Kudos
oxydius
New Contributor I
366 Views
If people appear as blue and you're using a BGRToYCrCb function, that means you have blue and red swapped. You can still use the BGR function to convert RGB data, but just swap the 1st and 3rd input channels.

Ipp8u* pSrc[3] = {pSrcBuffer2, pSrcBuffer1, pSrcBuffer0};
0 Kudos
sionice
Beginner
365 Views
Quoting - oxydius
If people appear as blue and you're using a BGRToYCrCb function, that means you have blue and red swapped. You can still use the BGR function to convert RGB data, but just swap the 1st and 3rd input channels.

Ipp8u* pSrc[3] = {pSrcBuffer2, pSrcBuffer1, pSrcBuffer0};

Thank you both for your help...We had originally been using IPP v.4.X.X, and did not have the availability of the RGB functions. Upon switching to 6.1.1, I simply changed the function header to RGB instead of BGR and it worked flawlessly.

I was able to figure this out thanks to the comment above which was dead on. Appreciate the help. =)
0 Kudos
Reply