summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-08-14 01:35:46 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-08-14 01:35:46 +0200
commit22cc3140070957fb1dc6b5efd68442d6d2105d5b (patch)
tree44847fbb9d9d33066979086aa6903dfa9aa64431
parentad52865aefeef7c87506a45bf2515413c8092a09 (diff)
downloadipecamera-22cc3140070957fb1dc6b5efd68442d6d2105d5b.tar.gz
ipecamera-22cc3140070957fb1dc6b5efd68442d6d2105d5b.tar.bz2
ipecamera-22cc3140070957fb1dc6b5efd68442d6d2105d5b.tar.xz
ipecamera-22cc3140070957fb1dc6b5efd68442d6d2105d5b.zip
Adjust buffer sizes to reduce memory consumption with CMOSIS20 camera
-rw-r--r--base.c4
-rw-r--r--private.h7
2 files changed, 6 insertions, 5 deletions
diff --git a/base.c b/base.c
index 1adc185..20183b0 100644
--- a/base.c
+++ b/base.c
@@ -111,9 +111,8 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) {
return NULL;
}
- ctx->buffer_size = IPECAMERA_DEFAULT_BUFFER_SIZE;
-
ctx->dim.bpp = sizeof(ipecamera_pixel_t) * 8;
+ ctx->buffer_size = IPECAMERA_DEFAULT_BUFFER_SIZE;
FIND_REG(status_reg, "fpga", "status");
FIND_REG(control_reg, "fpga", "control");
@@ -136,6 +135,7 @@ pcilib_context_t *ipecamera_init(pcilib_t *pcilib) {
break;
case IPECAMERA_FIRMWARE_CMOSIS20:
ctx->firmware = value;
+ ctx->buffer_size = IPECAMERA_DEFAULT_CMOSIS20_BUFFER_SIZE;
err = pcilib_add_registers(pcilib, 0, cmosis20000_registers);
break;
default:
diff --git a/private.h b/private.h
index 18138e7..0e16044 100644
--- a/private.h
+++ b/private.h
@@ -25,10 +25,11 @@
//#define IPECAMERA_BUG_INCOMPLETE_PACKETS //**< Support incomplete packets, i.e. check for frame magic even if full frame size is not reached yet (slow) */
//#define IPECAMERA_ANNOUNCE_READY //**< Announce new event only after the reconstruction is done */
//#define IPECAMERA_CLEAN_ON_START //**< Read all the data from DMA before starting of recording */
-#define IPECAMERA_ADJUST_BUFFER_SIZE //**< Adjust default buffer size based on the hardware capabilities */
+//#define IPECAMERA_ADJUST_BUFFER_SIZE //**< Adjust default buffer size based on the hardware capabilities (number of frames stored in the FPGA memory) */
-#define IPECAMERA_DEFAULT_BUFFER_SIZE 256 //**< should be power of 2 */
-#define IPECAMERA_RESERVE_BUFFERS 2 //**< Return Frame is Lost error, if requested frame will be overwritten after specified number of frames
+#define IPECAMERA_DEFAULT_BUFFER_SIZE 256 //**< number of buffers in a ring buffer, should be power of 2 */
+#define IPECAMERA_DEFAULT_CMOSIS20_BUFFER_SIZE 64 //*< overrides number of buffers for CMOSIS20 sensor to reduce memory consumption */
+#define IPECAMERA_RESERVE_BUFFERS 4 //**< Return Frame is Lost error, if requested frame will be overwritten after specified number of frames
#define IPECAMERA_DMA_TIMEOUT 50000 //**< Default DMA timeout */
#define IPECAMERA_TRIGGER_TIMEOUT 200000 //**< In trigger call allow specified timeout for camera to get out of busy state. Set 0 to fail immideatly */