Hi
I have a RGB24 image which I am saved on file, I am using sws_scale to convert it to YUV420 and then I wanted to verify if the conversion was done correctly so I tried converting it back to RGB24 to view the results. And all I see is vertical white and black bars. What am I doint incorrect?
Any help would be greatly appreciated!
I have attached the code here
if (sws_ctx == NULL)
{
sws_ctx = sws_getContext(pFrameRGB->width, pFrameRGB->height,
AV_PIX_FMT_RGB24, pFrameRGB->width, pFrameRGB->height,
AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR, 0, 0, 0);
}
int inLinesize[1] = { 3*pFrameRGB->width }; sws_scale(sws_ctx, pFrameRGB->data, inLinesize, 0, pFrameRGB->height, frame2->data, frame2->linesize);
if ( final_sws_ctx == NULL )
{
final_sws_ctx = sws_getContext(pFrameRGB->width, pFrameRGB->height,
AV_PIX_FMT_YUV420P, pFrameRGB->width, pFrameRGB->height,
AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, 0, 0, 0);
}
sws_scale(sws_ctx, frame2->data, frame2->linesize, 0, frame2->height, finalRGB->data, finalRGB->linesize);