Hi,
To convert YUV420 with pixfc, the three planes (Y, U and V) must be contiguous. What this means is that you must have a single buffer of size (width * height * 3 / 2), the Y plane must be at the start of the buffer, followed by the U plane (at offset width * height), followed by the V plane (at offset width * height + width * height / 4). Translated into C, this gives:
struct pixFcSSE* pixfc;
uint32_t width = 1920, height = 1080;
unsigned char *y, *u, *v;
unsigned char *yuv420p_pixfc_buffer;
unsigned char *rgb24_pixfc_buffer;
posix_memalign(yuv420p_pixfc_buffer, 16, width * height * 3 / 2);
// check return value to make sure it succeeded.
posix_memalign(rgb24_pixfc_buffer, 16, width * height * 3);
// check return value to make sure it succeeded.
// Copy the three separate Y, U, V planes into one single buffer
memcpy(yuv420p_pixfc_buffer, y, width * height);
memcpy((yuv420p_pixfc_buffer + width * height), u, (width * height / 4));
memcpy((yuv420p_pixfc_buffer + width * height + width * height / 4), v, (width * height));
create_pixfc(&pixfc, PixFcYUV420P, PixFcRGB24, width, height, PixFcFlag_Default);
// check return value to make sure it succeeded
pixfc->convert(pixfc, yuv420p_pixfc_buffer, rgb24_pixfc_buffer);
//when finished:
destroy_pixfc(pixfc);
// Also free yuv420p_pixfc_buffer and rgb24_pixfc_buffer
The above approach will be slower because of the three memcpy's before the actual YUV to RGB conversion. You might also be able to optimise and get rid of the first memcpy if you can re-allocate the Y plane buffer and increase its size. but ultimately, you will get much better performance if you obtain your YUV420p data in one single contiguous buffer rather than in 3 separate buffers.
Frank