<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div><span style="white-space:pre-wrap"></span>>y_1strow +=
Width;<span style="white-space:pre-wrap"></span><br>
>y_2ndrow += Width;<br>
<br>
Check this to see if it is your problem.<br>
<br>
Appears you should be using the pitch for this and not the width.
Normally width is width of video and pitch is the number of bytes
per line and can be greater than width.<br>
</div>
<br>
<div class="moz-cite-prefix">On 7/27/2016 11:05 PM, Ankush Wadke
wrote:<br>
</div>
<blockquote
cite="mid:CANWBmeaPkBmOatM=cmZjViVa2ORJZz6qgkqTiba8YxrhhMJxJQ@mail.gmail.com"
type="cite">
<div dir="ltr">Thanks for the reply Harry.
<div>And yes it has something to do with the offset of U and V
planes but it works perfectly fine for a FHD stream i.e.
1920x1080 but dosent seem to for a 3840x2160 stream. Does
planer data require alignment to be considered?</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 27, 2016 at 7:51 PM, Harry
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:Harry@gps-laptimer.de" target="_blank">Harry@gps-laptimer.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto">
<div>Green borders are a wrong offset / starting address
for the UV planes.</div>
<div><br>
</div>
<div>Harry<br>
<br>
Sent from my smartphone</div>
<div>
<div class="h5">
<div><br>
On 27 Jul 2016, at 11:47, Ankush Wadke <<a
moz-do-not-send="true"
href="mailto:wadkes93@gmail.com" target="_blank">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 style="white-space:pre-wrap"> </span>uint8_t
*buffer_uyvy_1strow = opBuffer, </div>
<div> *buffer_uyvy_2ndrow =
opBuffer+(2*Width);</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>uint8_t<span style="white-space:pre-wrap"> </span>*y_1strow
= videoBuffer.data[0],</div>
<div><span style="white-space:pre-wrap"> </span>*y_2ndrow
= videoBuffer.data[0]+Width;</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>uint8_t
* u_ptr = videoBuffer.data[1];</div>
<div><span style="white-space:pre-wrap"> </span>uint8_t
* v_ptr = videoBuffer.data[2];</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>for
(unsigned int i_conv_ht =0;
i_conv_ht<Height;i_conv_ht+=2) {</div>
<div><span style="white-space:pre-wrap"> </span>for
(unsigned int i_conv_wt =0;
i_conv_wt<Width;i_conv_wt+=2) {</div>
<div><span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_1strow++
= *u_ptr;</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_1strow++
= *y_1strow++;</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_1strow++
= *v_ptr;</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_1strow++
= *y_1strow++;</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_2ndrow++
= *u_ptr;</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_2ndrow++
= *y_2ndrow++;</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_2ndrow++
= *v_ptr;</div>
<div><span style="white-space:pre-wrap"> </span>*buffer_uyvy_2ndrow++
= *y_2ndrow++;</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>++u_ptr;</div>
<div><span style="white-space:pre-wrap"> </span>++v_ptr;</div>
<div><span style="white-space:pre-wrap"> </span>}</div>
<div><span style="white-space:pre-wrap"> </span>y_1strow
+= Width;</div>
<div><span style="white-space:pre-wrap"> </span>y_2ndrow
+= Width;</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"> </span>buffer_uyvy_1strow
+= FFALIGN((2*Width),1);</div>
<div><span style="white-space:pre-wrap"> </span>buffer_uyvy_2ndrow
+= FFALIGN((2*Width),1);</div>
<div><span style="white-space:pre-wrap"> </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">
<li><br>
</li>
</dl>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
<blockquote type="cite">
<div><span>_______________________________________________</span><br>
<span>Libav-user mailing list</span><br>
<span><a moz-do-not-send="true"
href="mailto:Libav-user@ffmpeg.org"
target="_blank">Libav-user@ffmpeg.org</a></span><br>
<span><a moz-do-not-send="true"
href="http://ffmpeg.org/mailman/listinfo/libav-user"
target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a></span><br>
</div>
</blockquote>
</div>
<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a moz-do-not-send="true"
href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a moz-do-not-send="true"
href="http://ffmpeg.org/mailman/listinfo/libav-user"
rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div>
<div><span style="color:rgb(68,68,68)"><b>Ankush
Wadke<br>
<br>
</b></span></div>
<span style="color:rgb(102,102,102)">Mob: 9673898604<br>
</span></div>
<span style="color:rgb(68,68,68)"><span
style="color:rgb(102,102,102)">Email: <a
moz-do-not-send="true"
href="mailto:wadkes93@gmail.com" target="_blank">wadkes93@gmail.com</a></span></span>
<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">
<li><a moz-do-not-send="true"
href="http://in.linkedin.com/pub/ankush-wadke/36/868/981/"
style="font-family:inherit;font-style:inherit;font-variant:inherit;font-weight:inherit;line-height:1.2em"
target="_blank"><font size="2">in.linkedin.com/pub/ankush-wadke/36/868/981/</font></a><br>
</li>
</dl>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
This email has been checked for viruses by Avast antivirus software.
<br><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
</body>
</html>