[maemo-developers] No subject
From:Date: Thu Dec 30 00:36:54 EET 2010
- Previous message: No subject
- Next message: No subject
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
gdigicam-managers private data). I am not sure if the buffer on the pipeline has the right size at all. This is the application I wrote: http://talk.maemo.org/showthread.php?t=70870 I use the gdigicam api because it seems that Nokias camera-ui uses this as well. As I found the above mentioned send_raw_frame function, I thought this would be a great addition. > > But sadly not the full image data is copied. Here are my observations: > > > > The cameradriver somewhere decides(I couldn't find out where or how) the > > biggest > > image resolution would be 2576x1960 pixels with 2 bytes per pixel, so the > > image data would > > be 10097920 bytes. > > probably you've not set the caps (e.g. resolution, frame rate, color > space, etc.) on the v4l2camsrc sink pad. > I don't set these properties, it is handled by gdigicam. And the settings from gdigcam are mostly reasonable. The main question are: - why does the camera driver capture at 2576x1960? If you change the image resolution (with the caps (I said I user gdgicam to handle this but for testing purpose I can even manipulate this)), the driver still captures at this resolution but crops and scales the image to the new resolution. - the buffer filled by the v4l2 device driver actually uses 2592x1968 pixel resolution. Even though the camera driver (from gstv4l2camsrc) thinks the capture resolution is 2576x1960 the buffer is filled with 2592x1968 pixel data! Nicolai > > Regards > > > In the method: > > gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *buf) > > are two GstBuffer, > > the argument of this method "buf" which holds the image data from the > camera > > driver > > and the new copy of this buffer "raw_buffer". > > > > buf buffer is copied with: > > raw_buffer = gst_buffer_copy (buf); > > > > The amount of bytes copied are based on the size of the source buffer > > (10097920 bytes). > > Now the raw_buffer size attribute is changed based on the raw_caps from > the > > camera driver: > > /* calculate raw_size from raw_caps */ > > raw_s = gst_caps_get_structure (raw_caps, 0); > > gst_structure_get_int (raw_s, "width", &raw_width); > > gst_structure_get_int (raw_s, "height", &raw_height); > > raw_size = raw_width * raw_height * 2; > > > > But the raw_buffer size isn't 10097920, the actual size is computed based > > on the bayer-raw BA10 format with a 2952x1968 resolution with 2 bytes per > > pixel. > > > > That means the buffer copy send over GstBus has the size 10202112, but > the > > last > > 104192 are mostly garbage because the call > > raw_buffer = gst_buffer_copy (buf); > > only wrote bytes of "buf" data (10097920). > > > > Of course, I could change my application to store only a raw-image of > > 2576x1960. > > But what bothers me is, the source buffer (buf) actually has the full > > 2592x1968x2 data! > > I made a quick and dirty change to the above mentioned method to write > out > > the > > full buffer, and it indeed contains valid image data. > > > > So, my questions are, is it a bug, that the source buffer thinks its size > is > > 10097920, > > whereas it actually holds 10202112 bytes of image data? > > And where is this 2576x1960 resolution setting? When I request the > supported > > resolutions (v4l2camsrc->formats) I don't get 2576x1960 but 2592x1968 > > instead. > > > > regards > > Nicolai > > > --0016368340cc1d50da049e963fd2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">2011/3/16 Marco Ballesio <span dir=3D"lt= r"><<a href=3D"mailto:gibrovacco at gmail.com">gibrovacco at gmail.com</a>>= </span><br><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0= .8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"> Hi Nicolai,<br> <br> have you tried using the camerabin element? It provides much more<br> facilities (e.g. AWB) than v4lcamsrc (and it ultimately uses the<br> latter as a source). Btw, some comments below..<br></blockquote><div><br>Hi= Marco and thank you for your response.<br>Actually I use the gdigicam api = which in turn uses the gstcamerabin.<br>=A0</div><blockquote class=3D"gmail= _quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204,= 204, 204); padding-left: 1ex;"> <div class=3D"im"><br> On 3/9/11, Nicolai Hess <<a href=3D"mailto:nicolaihess at web.de">nicolaihe= ss at web.de</a>> wrote:<br> > Hi,<br> > I hope someone can help me or points me to someone else how knows<br> > something about the gstv4l2camsrc.<br> ><br> > I have got a question regarding raw-image buffers in gstv4l2camsrc.c<b= r> > (in gstreamer0.10-plugins-camera-<br> > 0.79 for Fremantle).<br> ><br> > I am interested in this method:<br> > gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *b= uf).<br> > I know the method can copy the raw-image buffer end send this over the= <br> > GstBus.<br> > This would be a good way to make raw-images with the N900 camera.<br> ><br> <br> </div>A simpler way is to just use the buffer pushed through the pipeline.<= br> It's possible, for instance, to write exactly one frame to a file by<br= > connecting the v4l2camsrc to a filesink. Maybe I can give you more<br> hints if you explain what you're exactly trying to do.<br></blockquote>= <div><br>From the gdigicam api the pipeline isn't accessible (it is hid= den in gdigicam-managers<br>private data). I am not sure if the buffer on t= he pipeline has the right size at all.<br> <br>This is the application I wrote: <a href=3D"http://talk.maemo.org/showt= hread.php?t=3D70870">http://talk.maemo.org/showthread.php?t=3D70870</a><br>= I use the gdigicam api because it seems that Nokias camera-ui uses this as = well.<br> As I found the above mentioned send_raw_frame function, I thought this woul= d<br>be a great addition.<br><br></div><blockquote class=3D"gmail_quote" st= yle=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204)= ; padding-left: 1ex;"> <div class=3D"im"><br> > But sadly not the full image data is copied. Here are my observations:= <br> ><br> > The cameradriver somewhere decides(I couldn't find out where or ho= w) the<br> > biggest<br> > image resolution would be 2576x1960 pixels with 2 bytes per pixel, so = the<br> > image data would<br> > be =A010097920 bytes.<br> <br> </div>probably you've not set the caps (e.g. resolution, frame rate, co= lor<br> space, etc.) on the v4l2camsrc sink pad.<br></blockquote><div><br>I don'= ;t set these properties, it is handled by gdigicam. And the settings<br>fro= m gdigcam are mostly reasonable.<br><br>The main question are:<br>- why doe= s the camera driver capture at 2576x1960?<br> <br>If you change the image resolution (with the caps (I said I user gdgica= m to<br>handle this but for testing purpose I can even manipulate this)), t= he driver<br>still captures at this resolution but crops and scales the ima= ge to the new<br> resolution. <br><br>- the buffer filled by the v4l2 device driver actually = uses 2592x1968 pixel resolution.<br>Even though the camera driver (from gst= v4l2camsrc) thinks the capture resolution is<br>2576x1960 the buffer is fil= led with 2592x1968 pixel data!<br> <br>Nicolai<br>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: = 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left:= 1ex;"> <br> Regards<br> <div><div></div><div class=3D"h5"><br> > In the method:<br> > gst_v4l2camsrc_send_raw_frame (GstV4l2CamSrc *v4l2camsrc, GstBuffer *b= uf)<br> > are two GstBuffer,<br> > the argument of this method "buf" which holds the image data= from the camera<br> > driver<br> > and the new copy of this buffer "raw_buffer".<br> ><br> > buf buffer is copied with:<br> > =A0 raw_buffer =3D gst_buffer_copy (buf);<br> ><br> > The amount of bytes copied are based on the size of the source buffer<= br> > (10097920 bytes).<br> > Now the raw_buffer size attribute is changed based on the raw_caps fro= m the<br> > camera driver:<br> > =A0 /* calculate raw_size from raw_caps */<br> > =A0 raw_s =3D gst_caps_get_structure (raw_caps, 0);<br> > =A0 gst_structure_get_int (raw_s, "width", &raw_width);<= br> > =A0 gst_structure_get_int (raw_s, "height", &raw_height)= ;<br> > =A0 raw_size =3D raw_width * raw_height * 2;<br> ><br> > But the raw_buffer size isn't 10097920, the actual size is compute= d based<br> > on the bayer-raw BA10 format with a 2952x1968 resolution with 2 bytes = per<br> > pixel.<br> ><br> > That means the buffer copy send over GstBus has the size 10202112, but= the<br> > last<br> > 104192 are mostly garbage because the call<br> > =A0 raw_buffer =3D gst_buffer_copy (buf);<br> > only wrote bytes of "buf" data (10097920).<br> ><br> > Of course, I could change my application to store only a raw-image of<= br> > 2576x1960.<br> > But what bothers me is, the source buffer (buf) actually has the full<= br> > 2592x1968x2 data!<br> > I made a quick and dirty change to the above mentioned method to write= out<br> > the<br> > full buffer, and it indeed contains valid image data.<br> ><br> > So, my questions are, is it a bug, that the source buffer thinks its s= ize is<br> > 10097920,<br> > whereas it actually holds 10202112 bytes of image data?<br> > And where is this 2576x1960 resolution setting? When I request the sup= ported<br> > resolutions (v4l2camsrc->formats) I don't get 2576x1960 but 259= 2x1968<br> > instead.<br> ><br> > regards<br> > Nicolai<br> ><br> </div></div></blockquote></div><br> --0016368340cc1d50da049e963fd2--
- Previous message: No subject
- Next message: No subject
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]