Hi,
I have used the following code to convert yuv422 to yuv420 images.
void ConvertUyvyToYuv420P(uint8_t* destFrame,
uint8_t* srcFrame,
int width,
int height)
{
uint8_t* pyFrame = destFrame;
uint8_t* puFrame = pyFrame + width*height;
uint8_t* pvFrame = puFrame + width*height/4;
int uvOffset = width * 4 * sizeof(uint8_t);
int i,j;
for(i=0; i<height-2; i++)
{
for(j=0;j<width;j+=2)
{
uint16_t calc;
if ((i&1) == 0)
{
calc = *srcFrame;
calc += *(srcFrame + uvOffset);
calc /= 2;
*puFrame++ = (uint8_t) calc;
}
srcFrame++;
*pyFrame++ = *srcFrame++;
if ((i&1) == 0)
{
calc = *srcFrame;
calc += *(srcFrame + uvOffset);
calc /= 2;
*pvFrame++ = (uint8_t) calc;
}
srcFrame++;
*pyFrame++ = *srcFrame++;
}
}
}
When I used this on 1080p input at 30 frames per second I am able to convert only at 15 frames per second, is there any way to improve the above snippets speed or is there a better algorithm for conversion.
Any help would be great!!
Thanks
I am also trying to modify the code based on ur space tradeoff suggestion in para 3, ll let u know how things improve up.
Thanks again.
Regards
Shiv