<br><br><div class="gmail_quote">On Fri, Oct 15, 2010 at 9:33 PM, Gwenole Beauchesne <span dir="ltr">&lt;<a href="mailto:gbeauchesne@splitted-desktop.com">gbeauchesne@splitted-desktop.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi,<div class="im"><br>
<br>
On Thu, 14 Oct 2010, Varun Dua wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I am decoding a H.264 video using Nvidia&#39;s Graphics Card and Vaapi Library on Ubuntu 10.04. I am able to decode an entire video<br>
and display it using vaPutSurface, no problems at all. Now I need the data in RGBA format so I get the data in BRGA format which<br>
is supported in my implementation (I can convert it into RGBA).<br>
</blockquote>
<br></div>
Note that retrieving the decoded pixels can be a slow operation. Also note that only the vdpau-video driver supports BGRA read-back. In particular, only the NVIDIA implementation. i.e. I would not rely on that.<div class="im">

<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
VAImage vaimage;<br>
unsigned char *imagedata = NULL;<br>
FILE *fp1;<br>
char file[100];<br>
printf(&quot;%x\n&quot;,myimgfmt.fourcc);<br>
vastatus = pfn_vaCreateImage(vaapi-&gt;display,&amp;myimgfmt,avcc-&gt;width,avcc-&gt;height,&amp;vaimage);<br>
checkVaStatus();<br>
pfn_vaGetImage (vaapi-&gt;display,va_surface_ids[current_surface],0,0,avcc-&gt;width,avcc-&gt;height,vaimage.image_id);<br>
checkVaStatus();<br>
imagedata = (char *)malloc(vaimage.data_size*sizeof(char));<br>
pfn_vaMapBuffer(vaapi-&gt;display,vaimage.buf,(void *)&amp;imagedata);<br>
</blockquote>
<br></div>
vaMapBuffer() returns the mapped region in imagedata. i.e. you must not allocate, neither free that pointer;<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
sprintf(file,&quot;brga/frame%d.raw&quot;,framenumber++);<br>
fp1 = fopen(file,&quot;wb&quot;);<br>
fwrite(imagedata,vaimage.data_size*sizeof(unsigned char),1,fp1);<br>
fclose(fp1);<br>
free(imagedata);<br>
imagedata = NULL;<br>
vastatus = pfn_vaUnmapBuffer(vaapi-&gt;display,vaimage.buf);<br>
checkVaStatus();<br>
vastatus = vaDestroyImage(vaapi-&gt;display,vaimage.image_id);<br>
<br>
Everthing is working fine except that I am getting Segmentaion fault at vaDestroyImage. I am unable to correct this error. Can<br>
anybody help me with that ?<br>
</blockquote>
<br></div>
Drop the imagedata = ...; and free(imagedata); lines.<br>
<br>
Regards,<br><font color="#888888">
Gwenole.<br>
</font></blockquote></div><br>Thanks a lot.<br><br>Varun Dua<br>