Update of /cvsroot/playerstage/code/player/server/drivers/camera/1394
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/server/drivers/camera/1394

Modified Files:
        .cvsignore camera1394.cc 
Log Message:
applied Toby's patch to replace fixed-size arrays

Index: .cvsignore
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/camera/1394/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** .cvsignore  17 Sep 2007 02:18:59 -0000      1.2
--- .cvsignore  1 Nov 2007 22:16:18 -0000       1.3
***************
*** 3,4 ****
--- 3,7 ----
  .deps
  *.la
+ .libs
+ *.loT
+ *.lo

Index: camera1394.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/camera/1394/camera1394.cc,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** camera1394.cc       24 Oct 2007 22:32:04 -0000      1.35
--- camera1394.cc       1 Nov 2007 22:16:18 -0000       1.36
***************
*** 646,649 ****
--- 646,650 ----
    this->num_dma_buffers = cf->ReadInt(section, "dma_buffers", 
NUM_DMA_BUFFERS);
  
+   this->data.compression = PLAYER_CAMERA_COMPRESS_RAW;
    
    return;
***************
*** 1156,1160 ****
    if (frameSize == 0)
      frameSize = frame_width * frame_height;
! 
    switch (this->mode)
    {
--- 1157,1163 ----
    if (frameSize == 0)
      frameSize = frame_width * frame_height;
!   
!   delete [] this->data.image;
!   this->data.image = NULL;
    switch (this->mode)
    {
***************
*** 1164,1170 ****
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
      this->data.width = frame_width;
      this->data.height = frame_height;
-     assert(this->data.image_count <= sizeof(this->data.image));
      uyvy2rgb((unsigned char *)capture_buffer, this->data.image, (frame_width) 
* (frame_height));
      break;
--- 1167,1173 ----
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
+     this->data.image = new unsigned char [this->data.image_count];
      this->data.width = frame_width;
      this->data.height = frame_height;
      uyvy2rgb((unsigned char *)capture_buffer, this->data.image, (frame_width) 
* (frame_height));
      break;
***************
*** 1176,1179 ****
--- 1179,1183 ----
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
+     this->data.image = new unsigned char [this->data.image_count];
      this->data.width = frame_width / 2;
      this->data.height = frame_height / 2;
***************
*** 1201,1207 ****
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
      this->data.width = 600;
      this->data.height = 450;
-     assert(this->data.image_count <= sizeof(this->data.image));
      uyvy2rgb((unsigned char *)capture_buffer, this->resized, (frame_width) * 
(frame_height));
      ptr1 = this->resized;
--- 1205,1211 ----
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
+     this->data.image = new unsigned char [this->data.image_count];
      this->data.width = 600;
      this->data.height = 450;
      uyvy2rgb((unsigned char *)capture_buffer, this->resized, (frame_width) * 
(frame_height));
      ptr1 = this->resized;
***************
*** 1228,1234 ****
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
      this->data.width = frame_width;
      this->data.height = frame_height;
-     assert(this->data.image_count <= sizeof(this->data.image));
      memcpy(this->data.image, (unsigned char *)capture_buffer, 
this->data.image_count);
      break;
--- 1232,1238 ----
      this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
      this->data.image_count = this->frameSize;
+     this->data.image = new unsigned char [this->data.image_count];
      this->data.width = frame_width;
      this->data.height = frame_height;
      memcpy(this->data.image, (unsigned char *)capture_buffer, 
this->data.image_count);
      break;
***************
*** 1243,1249 ****
        this->data.format = PLAYER_CAMERA_FORMAT_MONO8;
        this->data.image_count = this->frameSize;
        this->data.width = frame_width;
        this->data.height = frame_height;
-       assert(this->data.image_count <= sizeof(this->data.image));
        memcpy(this->data.image, (unsigned char *)capture_buffer, 
this->data.image_count);
      } 
--- 1247,1253 ----
        this->data.format = PLAYER_CAMERA_FORMAT_MONO8;
        this->data.image_count = this->frameSize;
+       this->data.image = new unsigned char [this->data.image_count];
        this->data.width = frame_width;
        this->data.height = frame_height;
        memcpy(this->data.image, (unsigned char *)capture_buffer, 
this->data.image_count);
      } 
***************
*** 1252,1265 ****
        this->data.bpp = 24;
        this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
!       if ((frame_width) > PLAYER_CAMERA_IMAGE_WIDTH)
!       {
!         if (resized == NULL)
!           resized = new unsigned char[this->frameSize * 3];
!         dst = this->resized;
!       }
!       else 
!       {
!         dst = this->data.image;
!       }
        switch (this->BayerMethod)
        {
--- 1256,1260 ----
        this->data.bpp = 24;
        this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
!       dst = this->data.image;
        switch (this->BayerMethod)
        {
***************
*** 1267,1271 ****
          // quarter of the image but 3 bytes per pixel
        this->data.image_count = this->frameSize/4*3;
-       assert(this->data.image_count <= sizeof(this->data.image));
        BayerDownsample((unsigned char *)capture_buffer, this->data.image,
                                        frame_width/2, frame_height/2,
--- 1262,1265 ----
***************
*** 1273,1287 ****
        break;
        case BAYER_DECODING_NEAREST:
!         if ((frame_width) > PLAYER_CAMERA_IMAGE_WIDTH) this->data.image_count 
= this->frameSize/4*3;
!       else this->data.image_count = this->frameSize * 3;
!       assert(this->data.image_count <= sizeof(this->data.image));
!       BayerNearestNeighbor((unsigned char *)capture_buffer, dst,
                                        frame_width, frame_height,
                                        (bayer_pattern_t)this->BayerPattern);
        break;
        case BAYER_DECODING_EDGE_SENSE:
!         if ((frame_width) > PLAYER_CAMERA_IMAGE_WIDTH) this->data.image_count 
= this->frameSize/4*3;
!         else this->data.image_count = this->frameSize * 3;
!       assert(this->data.image_count <= sizeof(this->data.image));
        BayerEdgeSense((unsigned char *)capture_buffer, dst,
                                        frame_width, frame_height,
--- 1267,1280 ----
        break;
        case BAYER_DECODING_NEAREST:
!         this->data.image_count = this->frameSize * 3;
!         BayerNearestNeighbor((unsigned char *)capture_buffer, dst,
                                        frame_width, frame_height,
                                        (bayer_pattern_t)this->BayerPattern);
        break;
        case BAYER_DECODING_EDGE_SENSE:
!         this->data.image_count = this->frameSize * 3;
!         delete [] this->data.image;
!         this->data.image = new unsigned char [this->data.image_count];
!         
        BayerEdgeSense((unsigned char *)capture_buffer, dst,
                                        frame_width, frame_height,
***************
*** 1294,1324 ****
        if (this->BayerMethod != BAYER_DECODING_DOWNSAMPLE)
        {
!         if ((frame_width) > PLAYER_CAMERA_IMAGE_WIDTH)
!       {
!         this->data.width = frame_width/2;
!         this->data.height = frame_height/2;
!           ptr1 = this->resized;
!           ptr2 = this->data.image;
!           for (f = 0; f < (this->data.height); f++)
!           {
!             for (c = 0; c < (this->data.width); c++)
!             {
!             ptr2[0] = ptr1[0];
!             ptr2[1] = ptr1[1];
!             ptr2[2] = ptr1[2];
!             ptr1 += (3 * 2);
!             ptr2 += 3;
!             }
!             ptr1 += ((frame_width) * 3);
!           }
!       } else
!       {
!         this->data.width = frame_width;
!         this->data.height = frame_height;
!       }
!       } else
        {    //image is half the size of grabbed frame
!       this->data.width = frame_width/2;
!       this->data.height = frame_height/2;
        }
      }
--- 1287,1297 ----
        if (this->BayerMethod != BAYER_DECODING_DOWNSAMPLE)
        {
!         this->data.width = frame_width;
!         this->data.height = frame_height;
!       } 
!       else
        {    //image is half the size of grabbed frame
!         this->data.width = frame_width/2;
!         this->data.height = frame_height/2;
        }
      }
***************
*** 1341,1360 ****
  void Camera1394::RefreshData()
  {
-   size_t size;
- 
-   // Work out the data size
-   size = sizeof(this->data) - sizeof(this->data.image) + 
this->data.image_count;
- 
-   // now we just do the byte-swapping
-   this->data.width = this->data.width;
-   this->data.height = this->data.height;
- 
-   this->data.compression = PLAYER_CAMERA_COMPRESS_RAW;
-   this->data.image_count = this->data.image_count;
- 
-   /* We should do this to be efficient */
    Publish(this->device_addr, 
            PLAYER_MSGTYPE_DATA, PLAYER_CAMERA_DATA_STATE,
!           reinterpret_cast<void*>(&this->data), size, NULL);  
    
    return;
--- 1314,1320 ----
  void Camera1394::RefreshData()
  {
    Publish(this->device_addr, 
            PLAYER_MSGTYPE_DATA, PLAYER_CAMERA_DATA_STATE,
!           reinterpret_cast<void*>(&this->data));  
    
    return;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to