<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">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 class="moz-txt-link-freetext" href="https://ffmpeg.org/doxygen/3.0/structAVFrame.html">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<br>
<br>
On 09.06.2016 20:32, Jesper Taxbøl wrote:<br>
</div>
<blockquote
cite="mid:CAHQA3mTW7ciaU8S-WUqQXMgyW1DxN0tRhdU9qCkQGcNhWfvBfg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_signature" data-smartmail="gmail_signature">Sorry
about the toppost . Im afraid my phone and me had a slight
accident.</div>
<div class="gmail_signature" data-smartmail="gmail_signature"><br>
</div>
<div class="gmail_signature" 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 class="gmail_signature" data-smartmail="gmail_signature"><br>
</div>
<table class=""
style="border-spacing:0px;border-collapse:collapse;color:rgb(51,51,51);font-family:Helvetica,arial,nimbussansl,liberationsans,freesans,clean,sans-serif,"Apple
Color Emoji","Segoe UI Emoji","Segoe UI
Symbol";font-size:13px;line-height:18.2px">
<tbody style="">
<tr style="">
<td id="LC167" class="" 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 class="gmail_signature" data-smartmail="gmail_signature"><br>
</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>
</body>
</html>