<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Green borders are a wrong offset / starting address for the UV planes.</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature">Harry<br><br>Sent from my smartphone</div><div><br>On 27 Jul 2016, at 11:47, Ankush Wadke <<a href="mailto:wadkes93@gmail.com">wadkes93@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi everybody,<div> I am stuck with a problem to which I am not able to figure out what exactly is wrong.</div><div> 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. </div><div> It would be really helpful if someone would point me to something tat would help.</div><div><br></div><div>hers the code i am using for conversion,</div><div><br></div><div><div>void Convert_yuv420_to_yuv422(const AVFrame &videoBuffer, uint8_t * opBuffer, const int const &Width, const int const &Height)</div><div>{</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>uint8_t *buffer_uyvy_1strow = opBuffer, </div><div> *buffer_uyvy_2ndrow = opBuffer+(2*Width);</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>uint8_t<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*y_1strow = videoBuffer.data[0],</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*y_2ndrow = videoBuffer.data[0]+Width;</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>uint8_t * u_ptr = videoBuffer.data[1];</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>uint8_t * v_ptr = videoBuffer.data[2];</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>for (unsigned int i_conv_ht =0; i_conv_ht<Height;i_conv_ht+=2) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>for (unsigned int i_conv_wt =0; i_conv_wt<Width;i_conv_wt+=2) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_1strow++ = *u_ptr;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_1strow++ = *y_1strow++;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_1strow++ = *v_ptr;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_1strow++ = *y_1strow++;</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_2ndrow++ = *u_ptr;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_2ndrow++ = *y_2ndrow++;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_2ndrow++ = *v_ptr;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>*buffer_uyvy_2ndrow++ = *y_2ndrow++;</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>++u_ptr;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>++v_ptr;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>y_1strow += Width;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>y_2ndrow += Width;</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>buffer_uyvy_1strow += FFALIGN((2*Width),1);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>buffer_uyvy_2ndrow += FFALIGN((2*Width),1);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>}</div><div>}</div><div><br></div>Regards,</div><div>Ankush<div><div dir="ltr"><div dir="ltr"><div dir="ltr"><ul style="margin:0px;padding:0px 0px 8px;border:0px;font-size:12px;font-family:arial,sans-serif;vertical-align:baseline;list-style:none;line-height:17px;display:table-cell;width:504px;color:rgb(51,51,51)"><li style="margin:0px;padding:8px 12px 2px 0px;border:0px;font-weight:inherit;font-style:inherit;font-size:11px;font-family:inherit;vertical-align:baseline;font-variant:inherit;line-height:1.2em"><dl style="margin:0px;padding:0px;border:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline;font-variant:inherit;line-height:inherit;word-wrap:break-word"><ul style="margin:0px;padding:0px 0px 8px;border:0px;font-size:12px;vertical-align:baseline;list-style:none;line-height:17px;display:table-cell;width:504px"></ul><li><br></li></dl></li></ul></div></div></div></div>
</div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Libav-user mailing list</span><br><span><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a></span><br><span><a href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a></span><br></div></blockquote></body></html>