<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-04-23 8:16 GMT+03:00 Sampsa Riikonen <span dir="ltr"><<a href="mailto:sampsa.riikonen@iki.fi" target="_blank">sampsa.riikonen@iki.fi</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear List,<br>
<br>
I am decoding H264 into YUV and using the YUV bitmaps in a custom application.<br>
<br>
For av pixel formats<br>
<br>
AV_PIX_FMT_YUV420P<br>
<br>
AV_PIX_FMT_YUVJ420P<br>
<br>
I calculate the number of bytes in each plane like this (av_frame is AVFrame*):<br>
<br>
y_size =(GLsizei)( (av_frame->height)*(av_frame-><wbr>linesize[0]) );<br>
u_size =(GLsizei)( (av_frame->height/2)*(av_frame<wbr>->linesize[1]) );<br>
v_size =(GLsizei)( (av_frame->height/2)*(av_frame<wbr>->linesize[2]) );<br>
<br>
Question 1: Is there a more "standard" way of doing this?  Here I am using "outside" information by assuming that "height/2".  Can I get the number of bytes in each plane (safely) somewhere from the AVCodecContext or AVFrame structures directly?<br>
<br>
Then, accessing the data itself:<br>
<br>
av_frame->data[0] has y_size bytes<br>
<br>
av_frame->data[1] has u_size bytes<br>
<br>
av_frame->data[2] has v_size bytes<br>
<br>
Question 2: Can I assume that data[0]..data[2] is a continuous block of memory?<br>
<br>
Regards,<br>
<br>
Sampsa<br>
<br>
<br>
______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/list<wbr>info/libav-user</a><br>
</blockquote></div><br></div><div class="gmail_extra">Take a look at av_image_fill_arrays and other imgutils.h functions.</div><div class="gmail_extra">Also av_pix_fmt_desc_get.</div></div>