[Libav-user] 4k video decoding planner data

Ankush Wadke wadkes93 at gmail.com
Wed Jul 27 13:47:41 EEST 2016

Hi everybody,
    I am stuck with a problem to which I am not able to figure out what
exactly is wrong.
    I am decoding a 4k video which gives me a YUV420P output frame. In
order to convert it to UYVY I wrote a piece of code. which works fine for
first frame, then second frame has a small green line and the third frame
has the colors totally displaced. I am getting the correct frames sometimes
but i am not able to figure out what is wrong with the other frames.
    It would be really helpful if someone would point me to something tat
would help.

hers the code i am using for conversion,

void Convert_yuv420_to_yuv422(const AVFrame &videoBuffer, uint8_t *
opBuffer, const int const &Width,  const int const &Height)
uint8_t  *buffer_uyvy_1strow = opBuffer,
                    *buffer_uyvy_2ndrow = opBuffer+(2*Width);

uint8_t *y_1strow = videoBuffer.data[0],
*y_2ndrow = videoBuffer.data[0]+Width;

uint8_t * u_ptr = videoBuffer.data[1];
uint8_t * v_ptr = videoBuffer.data[2];

for (unsigned int i_conv_ht =0; i_conv_ht<Height;i_conv_ht+=2) {
for (unsigned int i_conv_wt =0; i_conv_wt<Width;i_conv_wt+=2) {
*buffer_uyvy_1strow++ = *u_ptr;
*buffer_uyvy_1strow++ = *y_1strow++;
*buffer_uyvy_1strow++ = *v_ptr;
*buffer_uyvy_1strow++ = *y_1strow++;

*buffer_uyvy_2ndrow++ = *u_ptr;
*buffer_uyvy_2ndrow++ = *y_2ndrow++;
*buffer_uyvy_2ndrow++ = *v_ptr;
*buffer_uyvy_2ndrow++ = *y_2ndrow++;

y_1strow += Width;
y_2ndrow += Width;

buffer_uyvy_1strow += FFALIGN((2*Width),1);
buffer_uyvy_2ndrow += FFALIGN((2*Width),1);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160727/44350211/attachment.html>

More information about the Libav-user mailing list