[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Chou cam 4912



Hello Matthias,

Actually I use the umb buffers in the same way test_itifg does. I use 
GET_UMBBUFSIZE to get the size and GET_UMBBUFADDR to get the offsets. I
don't think I am having an addressing problem. When I reference an
image, I use the address returned by mmap offsets by the amount
returned from the ioctl call GET_UMBBUFADDR.

  ioctl(fd, GIOC_GE_GET_UMBBUFFERS, &n_buf);
  ioctl(fd, GIOC_GE_GET_UMBWIDTH, &image_width);
  ioctl(fd, GIOC_GE_GET_UMBHEIGHT, &image_height);
  ioctl(fd, GIOC_GE_GET_UMBBUFSIZE, &image_size);

  ioctl(fd, GIOC_GE_GET_UMBMAPSIZE, &size);
  addr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);

  for(n = 0; n < n_buf; n++) {
    ioctl(fd, GIOC_GE_SET_UMBBUF, &n);
    ioctl(fd, GIOC_GE_GET_UMBBUFADDR, &offset);
    image_address[n] = addr + offset;
  }   

   I guess this way of addressing an image is the same as
   image_address[n] = addr + n*image_size;

Still, the frame grabbed in the first available umb buffer is clear
while  the frames grabbed to other consecutive buffers are some how
blurred.

I have now solved the problem using signals and only the first of the
available umb buffers and I am happy enough. 
Still, I would like to figure out the problem for future applications.


Thank you,

      Enzo

M.Stein writes:
> 
> Hello Enzo!
> 
> On Tue, 9 Jan 2001, Enzo Pascale wrote:
> 
> > Hi Matthias,
> > 
> > Thanks a lot for the configuration file. Now it works.
> > 
> > I have now one more problem using UMB buffers.
> > 
> > When I snap a frame to a single UMB buffer it works well, but I need
> > to snap different frames to different buffers. 
> > So I tried to snap several frames, to consecutive buffers
> > and something weird happened.
> > 
> > The first frame in the first buffer was ok, but the frames stored in
> > the second, third, ... buffer were slightly corrupted. Like if few
> > pixels were placed in a wrong position.
> > 
> > Then I went to check umb buffers and what I found out is that the
> > image dimensions are right while the size  was not what I would
> > expect:
> > 
> > GIOC_GE_GET_UMBWIDTH and  GIOC_GE_GET_UMBBUFSIZE return the right
> > value 512X480 but 
> > GIOC_GE_GET_UMBBUFSIZE returns 249856 bytes like if the frame was
> > 512X488. (each pixel is 8 bit deep).
> > 
> > I did the same check without using UMB and now 
> > GIOC_GE_GET_MEMWIDTH, GIOC_GE_GET_MEMHEIGHT, GIOC_GE_GET_MEMBUFSIZE
> > all return the right value: 512, 480 and 245760. And the frame was clear.
> > 
> > Do you have any idea of what is going on?
> > 
> > Thanks again,
> > 
> >        Enzo.
> > 
> 
> After each frame a structure called iti_info_t (see itifgExt.h) was
> appendend. This holds mainly the image time stamp and some statistics.
> After appending this structure, the size was rounded up to the PAGE_SIZE
> size of the system, to make the things a little bit easier (mmap and
> stuff).
> So if you are working with umb-buffers, please use UMBBUFSIZE to calculate
> the offset to the second image (not width * height * depth)!
> 
> Remark: There is also a ioctl GET_UMBBUFADDR to get the offset address of
>         the buffer specified with SET_UMBBUF.
>  
> 						matthias
> 
> -------------------------------------------------------------------------------
> GOM mbH                                                 Tel.: ++49 531/3804-330
> Gesellschaft fuer optische Messtechnik                  Fax.: ++49 531/3804-333
> Rebenring 33                                            Mail: M.Stein@gom.com
> 38106 Braunschweig GERMANY                              http://www.gom.com
> -------------------------------------------------------------------------------
> 
>