Update of /cvsroot/playerstage/code/player/server/drivers/camera/compress
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20569
Modified Files:
Tag: release-2-0-patches
cameracompress.cc
Log Message:
applied patch 1795574
Index: cameracompress.cc
===================================================================
RCS file:
/cvsroot/playerstage/code/player/server/drivers/camera/compress/cameracompress.cc,v
retrieving revision 1.12.2.3
retrieving revision 1.12.2.4
diff -C2 -d -r1.12.2.3 -r1.12.2.4
*** cameracompress.cc 10 Feb 2007 17:47:15 -0000 1.12.2.3
--- cameracompress.cc 18 Oct 2007 22:39:16 -0000 1.12.2.4
***************
*** 128,131 ****
--- 128,132 ----
// Output (compressed) camera data
private: player_camera_data_t data;
+ private: int valid;
// Image quality for JPEG compression
***************
*** 165,168 ****
--- 166,170 ----
this->save = cf->ReadInt(section,"save",0);
this->quality = cf->ReadFloat(section, "image_quality", 0.8);
+ this->valid = 0;
// camera settings
***************
*** 230,235 ****
--- 232,239 ----
this->NewCamData=true;
Unlock();
+ /*
if (this->camera_data.compression != PLAYER_CAMERA_COMPRESS_RAW)
PLAYER_WARN("compressing already compressed camera images (not good)");
+ */
return 0;
***************
*** 260,306 ****
if (NewCamData)
{
! switch (this->camera_data.bpp)
{
! case 8:
! l = (this->camera_data.width) * (this->camera_data.height);
! ptr = this->converted; ptr1 = (char *)(this->camera_data.image);
! for (i = 0; i < l; i++)
! {
! ptr[0] = *ptr1;
! ptr[1] = *ptr1;
! ptr[2] = *ptr1;
! ptr += 3; ptr1++;
! }
! ptr = this->converted;
! break;
! case 24:
! ptr = (char *)(this->camera_data.image);
! break;
! case 32:
! l = (this->camera_data.width) * (this->camera_data.height);
! ptr = this->converted; ptr1 = (char *)(this->camera_data.image);
! for (i = 0; i < l; i++)
! {
! ptr[0] = ptr1[0];
! ptr[1] = ptr1[1];
! ptr[2] = ptr1[2];
! ptr += 3; ptr1 += 4;
}
! ptr = this->converted;
! break;
! default:
! PLAYER_WARN("unsupported image depth (not good)");
! return;
}
- this->data.image_count = jpeg_compress( (char*)this->data.image,
- ptr,
- this->camera_data.width,
- this->camera_data.height,
- PLAYER_CAMERA_IMAGE_SIZE,
- (int)(this->quality*100));
-
if (this->save)
{
! snprintf(filename, sizeof(filename),
"click-%04d.ppm",this->frameno++);
FILE *fp = fopen(filename, "w+");
fwrite (this->data.image, 1, this->data.image_count, fp);
--- 264,327 ----
if (NewCamData)
{
! if (this->camera_data.compression == PLAYER_CAMERA_COMPRESS_RAW)
{
! switch (this->camera_data.bpp)
! {
! case 8:
! l = (this->camera_data.width) * (this->camera_data.height);
! ptr = this->converted; ptr1 = (char *)(this->camera_data.image);
! for (i = 0; i < l; i++)
! {
! ptr[0] = *ptr1;
! ptr[1] = *ptr1;
! ptr[2] = *ptr1;
! ptr += 3; ptr1++;
! }
! ptr = this->converted;
! break;
! case 24:
! ptr = (char *)(this->camera_data.image);
! break;
! case 32:
! l = (this->camera_data.width) * (this->camera_data.height);
! ptr = this->converted; ptr1 = (char *)(this->camera_data.image);
! for (i = 0; i < l; i++)
! {
! ptr[0] = ptr1[0];
! ptr[1] = ptr1[1];
! ptr[2] = ptr1[2];
! ptr += 3; ptr1 += 4;
! }
! ptr = this->converted;
! break;
! default:
! PLAYER_WARN("unsupported image depth (not good)");
! return;
}
! this->data.image_count = jpeg_compress( (char*)this->data.image,
! ptr,
! this->camera_data.width,
! this->camera_data.height,
! PLAYER_CAMERA_IMAGE_SIZE,
! (int)(this->quality*100));
! this->data.width = (this->camera_data.width);
! this->data.height = (this->camera_data.height);
! this->data.bpp = 24;
! this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
! this->data.compression = PLAYER_CAMERA_COMPRESS_JPEG;
! this->data.image_count = (this->data.image_count);
! } else
! {
! this->data.width = (this->camera_data.width);
! this->data.height = (this->camera_data.height);
! this->data.bpp = (this->camera_data.bpp);
! this->data.format = (this->camera_data.format);
! this->data.compression = (this->camera_data.compression);
! this->data.image_count = (this->camera_data.image_count);
! memcpy(this->data.image, this->camera_data.image,
this->data.image_count);
}
if (this->save)
{
! snprintf(filename, sizeof(filename),
"click-%04d.jpeg",this->frameno++);
FILE *fp = fopen(filename, "w+");
fwrite (this->data.image, 1, this->data.image_count, fp);
***************
*** 310,320 ****
size = sizeof(this->data) - sizeof(this->data.image) +
this->data.image_count;
- this->data.width = (this->camera_data.width);
- this->data.height = (this->camera_data.height);
- this->data.bpp = 24;
- this->data.format = PLAYER_CAMERA_FORMAT_RGB888;
- this->data.compression = PLAYER_CAMERA_COMPRESS_JPEG;
- this->data.image_count = (this->data.image_count);
-
Publish(device_addr, NULL, PLAYER_MSGTYPE_DATA,
PLAYER_CAMERA_DATA_STATE, (void*) &this->data, size, &this->camera_time);
}
--- 331,334 ----
-------------------------------------------------------------------------
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