<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 9, 2016 at 11:53 AM, Peter Steinbach <span dir="ltr"><<a href="mailto:steinbach@scionics.de" target="_blank">steinbach@scionics.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Hi Jepser,<br>
<br>
I am not an expert on this (@all please correct what I err upon),
but AFAIK the data is padded per line! that's why you also have a
linesize data member of AVFrame:<br>
<a href="https://ffmpeg.org/doxygen/3.0/structAVFrame.html" target="_blank">https://ffmpeg.org/doxygen/3.0/structAVFrame.html</a><br>
So in other words, say you have a 6x6 frame in GRAY8, this would
mean that AVFrame->data[0] would show for the first 2 lines of
the frame:<br>
item0 item1 item2 item3 item4 item5 unused0 unused1 <br>
item6 item7 item8 item9 item10 item11 unused2 unused3<br>
...<br>
assuming that AVFrame->linesize[0] = 8!<br>
<br>
Also, a frame in AV_PIX_FMT_BGR24 encoding would map to <br>
AVFrame->data[0] being the B channel<br>
AVFrame->data[1] being the G channel<br>
AVFrame->data[2] being the R channel<br>
<br>
Translating this to your code example, this would give:<br>
<br>
uint64_t src_i = (xx+(yy*src_camera_width))*3;<br>
r =
f->pAVFrame->data[2][yy*f->pAVFrame->linesize[2]+xx];<br>
g =
f->pAVFrame->data[1][yy*f->pAVFrame->linesize[1]+xx];<br>
b =
f->pAVFrame->data[0][yy*f->pAVFrame->linesize[0]+xx];<br>
<br>
assuming that you f->pAVFrame was already filled by some other
function.<br>
Crossing fingers that I got everything right.<br>
<br>
Best,<br>
P<div><div class="h5"><br></div></div></div></div></blockquote><div><br></div><div>Wonder why his frame didn't look all garbled, using only B data and feeding it to other planes data (assuming those r,g,,b variables are put back into AVFrame->data) would've messed up the color values so much that would render into a gardbled frame.<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div><div><div class="h5">
<br>
On 09.06.2016 20:32, Jesper Taxbøl wrote:<br>
</div></div></div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div class="gmail_extra">
<div data-smartmail="gmail_signature">Sorry
about the toppost . Im afraid my phone and me had a slight
accident.</div>
<div data-smartmail="gmail_signature"><br>
</div>
<div data-smartmail="gmail_signature">What
I was trying to add was how I index the the source pixels,
hoping it can shed light on the offset error im
experiencing.</div>
<div data-smartmail="gmail_signature"><br>
</div>
<table>
<tbody>
<tr>
<td style="padding:0px 10px;vertical-align:top;overflow:visible;word-wrap:normal">
uint64_t src_i = (xx+(yy*src_camera_width))*3;<br>
r = f->pAVFrame->data[0][src_i+0];<br>
g = f->pAVFrame->data[0][src_i+1];<br>
b = f->pAVFrame->data[0][src_i+2];<br>
<br>
Kind regards<br>
<br>
Jesper</td>
</tr>
</tbody>
</table>
<div data-smartmail="gmail_signature"><br>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
Libav-user mailing list
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a 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></div></div>